From 57db8a40d25853027750f18a54e4a6801993acba Mon Sep 17 00:00:00 2001 From: Vikas Pandey Date: Tue, 15 Jan 2019 19:58:14 +0100 Subject: [PATCH 001/320] update dotnet documentation path Apparently, this page is also moved and now not maintained "https://hyperledger.github.io/indy-sdk/wrappers/dotnet/docs/index.html". However, I located the documentation link in within the repository and hence updated it here. Please verify and approve/replace with the new link. Thank you. Signed-off-by: Vikas Pandey --- wrappers/dotnet/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wrappers/dotnet/README.md b/wrappers/dotnet/README.md index 9e9335ef45..f3e739fe5f 100644 --- a/wrappers/dotnet/README.md +++ b/wrappers/dotnet/README.md @@ -9,7 +9,7 @@ Pull requests welcome! ### Documentation -Documentation for the .NET wrapper is available [here](http://hyperledger.github.io/indy-sdk/wrappers/dotnet/docs/index.html). +Documentation for the .NET wrapper is available [here](https://github.com/hyperledger/indy-sdk/blob/master/wrappers/dotnet/docs/index.html). ### How to build @@ -33,4 +33,4 @@ the SDK for your specific platform in the [Building Indy SDK](../../README.md#bu For a sample project that contains executable demo code showing various usages of the .NET SDK wrapper see the [.NET Sample](../../samples/dotnet/README.md). #### Troubleshooting -Use environment variable `RUST_LOG={info|debug|trace}` to output logs of Libindy. \ No newline at end of file +Use environment variable `RUST_LOG={info|debug|trace}` to output logs of Libindy. From 2b5b3b94c1a3c5a1a6e2f332531b22dea0239e60 Mon Sep 17 00:00:00 2001 From: Axel Nennker Date: Sat, 11 May 2019 09:07:23 +0200 Subject: [PATCH 002/320] new version of libsodium 1.0.17 Signed-off-by: Axel Nennker --- docs/build-guides/rhel-build.md | 6 +++--- docs/build-guides/ubuntu-build.md | 10 +++++----- docs/build-guides/windows-build.md | 2 +- libindy/ci/amazon.dockerfile | 6 +++--- libindy/ci/ubuntu.dockerfile | 26 +++++++++++++++++++++----- 5 files changed, 33 insertions(+), 17 deletions(-) diff --git a/docs/build-guides/rhel-build.md b/docs/build-guides/rhel-build.md index 1ae8bf8a34..29ce55b27b 100644 --- a/docs/build-guides/rhel-build.md +++ b/docs/build-guides/rhel-build.md @@ -42,12 +42,12 @@ dnf install -y \ For Amazon Linux 2017.03 or other distributions without `libsodium` available in system repositories: ``` cd /tmp -curl https://download.libsodium.org/libsodium/releases/old/libsodium-1.0.14.tar.gz | tar -xz -cd /tmp/libsodium-1.0.14 +curl https://download.libsodium.org/libsodium/releases/libsodium-1.0.17.tar.gz | tar -xz +cd /tmp/libsodium-1.0.17 ./configure make make install -rm -rf /tmp/libsodium-1.0.14 +rm -rf /tmp/libsodium-1.0.17 export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib diff --git a/docs/build-guides/ubuntu-build.md b/docs/build-guides/ubuntu-build.md index 3ad424ff42..a3afc34d81 100644 --- a/docs/build-guides/ubuntu-build.md +++ b/docs/build-guides/ubuntu-build.md @@ -15,16 +15,16 @@ libncursesw5-dev ``` -1. `libindy` requires the modern `1.0.14` version of `libsodium` but Ubuntu 16.04 does not support installation it's from `apt` repository. +1. `libindy` requires the modern `1.0.17` version of `libsodium` but Ubuntu 16.04 does not support installation it's from `apt` repository. Because of this, it requires to build and install `libsodium` from source: ``` cd /tmp && \ - curl https://download.libsodium.org/libsodium/releases/old/libsodium-1.0.14.tar.gz | tar -xz && \ - cd /tmp/libsodium-1.0.14 && \ - ./configure --disable-shared && \ + curl https://download.libsodium.org/libsodium/releases/libsodium-1.0.17.tar.gz | tar -xz && \ + cd /tmp/libsodium-1.0.17 && \ + ./configure && \ make && \ make install && \ - rm -rf /tmp/libsodium-1.0.14 + rm -rf /tmp/libsodium-1.0.17 ``` 1. Build `libindy` diff --git a/docs/build-guides/windows-build.md b/docs/build-guides/windows-build.md index f9b00e43f8..3d32da1225 100644 --- a/docs/build-guides/windows-build.md +++ b/docs/build-guides/windows-build.md @@ -43,7 +43,7 @@ git clone https://github.com/hyperledger/indy-sdk.git ### Binary deps - https://www.npcglib.org/~stathis/downloads/openssl-1.0.2k-vs2017.7z -- https://download.libsodium.org/libsodium/releases/old/libsodium-1.0.14-msvc.zip +- https://download.libsodium.org/libsodium/releases/libsodium-1.0.17-msvc.zip ### Source deps diff --git a/libindy/ci/amazon.dockerfile b/libindy/ci/amazon.dockerfile index 72c6464574..33dca04cc7 100755 --- a/libindy/ci/amazon.dockerfile +++ b/libindy/ci/amazon.dockerfile @@ -22,12 +22,12 @@ RUN curl --silent --location https://rpm.nodesource.com/setup_8.x | bash - RUN yum -y install nodejs RUN cd /tmp && \ - curl https://download.libsodium.org/libsodium/releases/old/libsodium-1.0.14.tar.gz | tar -xz && \ - cd /tmp/libsodium-1.0.14 && \ + curl https://download.libsodium.org/libsodium/releases/libsodium-1.0.17.tar.gz | tar -xz && \ + cd /tmp/libsodium-1.0.17 && \ ./configure && \ make && \ make install && \ - rm -rf /tmp/libsodium-1.0.14 + rm -rf /tmp/libsodium-1.0.17 ENV PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib diff --git a/libindy/ci/ubuntu.dockerfile b/libindy/ci/ubuntu.dockerfile index a69723353e..c41b55bd73 100755 --- a/libindy/ci/ubuntu.dockerfile +++ b/libindy/ci/ubuntu.dockerfile @@ -9,6 +9,9 @@ RUN apt-get update && \ libgmp3-dev \ curl \ build-essential \ + autoconf \ + automake \ + libtool \ libsqlite3-dev \ cmake \ git \ @@ -21,7 +24,6 @@ RUN apt-get update && \ wget \ devscripts \ libncursesw5-dev \ - libzmq3-dev \ zip \ unzip \ jq @@ -38,13 +40,27 @@ RUN pip3 install -U \ plumbum \ deb-pkg-tools +ARG LIBSODIUM_VERSION=1.0.17 + +RUN cd /tmp && \ + curl https://download.libsodium.org/libsodium/releases/libsodium-$LIBSODIUM_VERSION.tar.gz | tar -xz && \ + cd /tmp/libsodium-$LIBSODIUM_VERSION && \ + ./configure && \ + make && \ + make install && \ + rm -rf /tmp/libsodium-$LIBSODIUM_VERSION && \ + ldconfig -n /usr/local/lib + +ARG LIBZEROMQ_VERSION=4.3.1 + RUN cd /tmp && \ - curl https://download.libsodium.org/libsodium/releases/old/libsodium-1.0.14.tar.gz | tar -xz && \ - cd /tmp/libsodium-1.0.14 && \ - ./configure --disable-shared && \ + curl https://codeload.github.com/zeromq/libzmq/tar.gz/v$LIBZEROMQ_VERSION | tar -xz && \ + cd /tmp/libzmq-$LIBZEROMQ_VERSION && \ + ./autogen.sh && ./configure && \ make && \ make install && \ - rm -rf /tmp/libsodium-1.0.14 + rm -rf /tmp/libzmq-$LIBZEROMQ_VERSION && \ + ldconfig -n /usr/local/lib RUN apt-get update && apt-get install openjdk-8-jdk -y ENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-amd64 From 93e17c2675d8a27ff681bcc9555e0a0a702e6f13 Mon Sep 17 00:00:00 2001 From: Ian Costanzo Date: Sat, 29 Jun 2019 10:01:46 -0700 Subject: [PATCH 003/320] Start re-factor of postgres wallet storage strategy w.i.p. Signed-off-by: Ian Costanzo --- ci/indy-pool.dockerfile | 2 +- .../plugins/postgres_storage/Cargo.lock | 2 +- .../plugins/postgres_storage/Cargo.toml | 2 +- .../plugins/postgres_storage/src/lib.rs | 52 +++++++++++++++---- .../postgres_storage/src/postgres_storage.rs | 11 +++- .../postgres_storage/src/wallet_strategy.rs | 17 ++++++ 6 files changed, 70 insertions(+), 16 deletions(-) create mode 100644 experimental/plugins/postgres_storage/src/wallet_strategy.rs diff --git a/ci/indy-pool.dockerfile b/ci/indy-pool.dockerfile index 43826012af..41e132a7a5 100644 --- a/ci/indy-pool.dockerfile +++ b/ci/indy-pool.dockerfile @@ -29,7 +29,7 @@ ARG indy_node_ver=1.9.0~dev987 ARG python3_indy_crypto_ver=0.4.5 ARG indy_crypto_ver=0.4.5 -RUN apt-get update -y && apt-get install -y \ +RUN apt-get update -y && apt-get install -y --allow-unauthenticated \ indy-plenum=${indy_plenum_ver} \ indy-node=${indy_node_ver} \ python3-indy-crypto=${python3_indy_crypto_ver} \ diff --git a/experimental/plugins/postgres_storage/Cargo.lock b/experimental/plugins/postgres_storage/Cargo.lock index 6b60e69902..95c46cc3b6 100644 --- a/experimental/plugins/postgres_storage/Cargo.lock +++ b/experimental/plugins/postgres_storage/Cargo.lock @@ -905,7 +905,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "storage-postgres" -version = "1.6.0" +version = "1.7.0" dependencies = [ "base64 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/experimental/plugins/postgres_storage/Cargo.toml b/experimental/plugins/postgres_storage/Cargo.toml index 529946d4e9..43e6c457c6 100644 --- a/experimental/plugins/postgres_storage/Cargo.toml +++ b/experimental/plugins/postgres_storage/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "storage-postgres" -version = "1.6.0" +version = "1.7.0" authors = [ "Ian Costanzo " ] diff --git a/experimental/plugins/postgres_storage/src/lib.rs b/experimental/plugins/postgres_storage/src/lib.rs index 7a5973eaa5..1fa2094331 100644 --- a/experimental/plugins/postgres_storage/src/lib.rs +++ b/experimental/plugins/postgres_storage/src/lib.rs @@ -55,10 +55,6 @@ pub static POSTGRES_STORAGE_NAME: &str = "postgres_storage"; #[no_mangle] pub extern fn postgresstorage_init() -> libindy::ErrorCode { - //if let Err(err) = utils::logger::LibnullpayLogger::init() { - // return err; - //} - let postgres_storage_name = CString::new(POSTGRES_STORAGE_NAME).unwrap(); libindy::wallet::register_wallet_storage( @@ -140,16 +136,37 @@ pub struct PostgresWallet {} impl PostgresWallet { + /// This needs to be called once at the beginning to create the database + pub extern fn init(config: *const c_char, credentials: *const c_char) -> ErrorCode { + check_useful_c_str!(config, ErrorCode::CommonInvalidState); + check_useful_c_str!(credentials, ErrorCode::CommonInvalidState); + + // create Postgres database, and create schema + let storage_type = ::postgres_storage::PostgresStorageType::new(); + let res = storage_type.init_storage(Some(&config), Some(&credentials)); + + match res { + Ok(_) => ErrorCode::Success, + Err(err) => { + match err { + WalletStorageError::AlreadyExists => ErrorCode::WalletAlreadyExistsError, + _ => ErrorCode::WalletStorageError + } + } + } + } + pub extern fn create(id: *const c_char, config: *const c_char, credentials: *const c_char, metadata: *const c_char) -> ErrorCode { - check_useful_c_str!(id, ErrorCode::CommonInvalidState); - check_useful_c_str!(config, ErrorCode::CommonInvalidState); - check_useful_c_str!(credentials, ErrorCode::CommonInvalidState); - check_useful_c_str!(metadata, ErrorCode::CommonInvalidState); + check_useful_c_str!(id, ErrorCode::CommonInvalidParam1); + check_useful_c_str!(config, ErrorCode::CommonInvalidParam2); + check_useful_c_str!(credentials, ErrorCode::CommonInvalidParam3); + check_useful_c_str!(metadata, ErrorCode::CommonInvalidParam4); // create Postgres database, create schema, and insert metadata + // ... or ... insert metadata let storage_type = ::postgres_storage::PostgresStorageType::new(); let res = storage_type.create_storage(&id, Some(&config), Some(&credentials), &metadata.as_bytes()[..]); @@ -169,9 +186,9 @@ impl PostgresWallet { config: *const c_char, credentials: *const c_char, handle: *mut i32) -> ErrorCode { - check_useful_c_str!(id, ErrorCode::CommonInvalidState); - check_useful_c_str!(config, ErrorCode::CommonInvalidState); - check_useful_c_str!(credentials, ErrorCode::CommonInvalidState); + check_useful_c_str!(id, ErrorCode::CommonInvalidParam1); + check_useful_c_str!(config, ErrorCode::CommonInvalidParam2); + check_useful_c_str!(credentials, ErrorCode::CommonInvalidParam3); // open wallet and return handle // PostgresStorageType::open_storage(), returns a PostgresStorage that goes into the handle @@ -996,6 +1013,19 @@ mod tests { use std::{slice, ptr}; use wql::storage::ENCRYPTED_KEY_LEN; + // TODO We need init() to be the first test run in order to create the wallets database + #[test] + fn postgres_storage_type_init_works() { + _cleanup(); + + let config = _wallet_config(); + let credentials = _wallet_credentials(); + + let err = PostgresWallet::init(config.as_ref().map_or(ptr::null(), |x| x.as_ptr()), + credentials.as_ref().map_or(ptr::null(), |x| x.as_ptr())); + assert_eq!(err, ErrorCode::Success); + } + #[test] fn postgres_wallet_crud_works() { _cleanup(); diff --git a/experimental/plugins/postgres_storage/src/postgres_storage.rs b/experimental/plugins/postgres_storage/src/postgres_storage.rs index 33ab8f89bf..78f15ea6de 100644 --- a/experimental/plugins/postgres_storage/src/postgres_storage.rs +++ b/experimental/plugins/postgres_storage/src/postgres_storage.rs @@ -109,6 +109,7 @@ impl Default for SearchOptions { const _POSTGRES_DB: &str = "postgres"; +const _WALLETS_DB: &str = "wallets"; const _PLAIN_TAGS_QUERY: &str = "SELECT name, value from tags_plaintext where item_id = $1"; const _ENCRYPTED_TAGS_QUERY: &str = "SELECT name, value from tags_encrypted where item_id = $1"; const _CREATE_WALLET_DATABASE: &str = "CREATE DATABASE $1"; @@ -294,11 +295,11 @@ impl StorageIterator for PostgresStorageIterator { #[derive(Deserialize, Debug)] pub struct PostgresConfig { url: String, - // TODO add additional configuration options - tls: Option, // default off + tls: Option, // default off max_connections: Option, // default 5 min_idle_time: Option, // default 0 connection_timeout: Option, // default 5 + wallet_scheme: Option, // default DatabasePerWallet } impl PostgresConfig { @@ -344,6 +345,12 @@ impl PostgresConfig { None => 5 } } + fn wallet_scheme(&self) -> WalletScheme { + match &self.wallet_scheme { + Some(scheme) => *scheme, + None => WalletScheme::DatabasePerWallet + } + } } #[derive(Deserialize, Debug)] diff --git a/experimental/plugins/postgres_storage/src/wallet_strategy.rs b/experimental/plugins/postgres_storage/src/wallet_strategy.rs new file mode 100644 index 0000000000..2d8cd67fa0 --- /dev/null +++ b/experimental/plugins/postgres_storage/src/wallet_strategy.rs @@ -0,0 +1,17 @@ + +#[derive(Deserialize, Debug)] +#[derive(Copy, Clone)] +enum WalletScheme { + DatabasePerWallet, + MultiWalletSingleTable, + MultiWalletMultiTable +} + +trait WalletStrategy { + // initialize storage based on wallet storage strategy + fn init_storage(&self, config: &PostgresConfig, credentials: &PostgresCredentials) -> Result<(), WalletStorageError>; + // determine phyisical table name based on wallet strategy + fn table_name(&self, config: &PostgresConfig, base_name: &str) -> str; + // determine additional query parameters based on wallet strategy + fn query_qualifier(&self, config: &PostgresConfig) -> str; +} From bf5825fb2c7e1b860daf2e858fcf2a2ae88b378c Mon Sep 17 00:00:00 2001 From: Ian Costanzo Date: Tue, 2 Jul 2019 14:34:17 -0700 Subject: [PATCH 004/320] Wallet updated w.i.p. Signed-off-by: Ian Costanzo --- .../postgres_storage/src/wallet_strategy.rs | 59 +++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/experimental/plugins/postgres_storage/src/wallet_strategy.rs b/experimental/plugins/postgres_storage/src/wallet_strategy.rs index 2d8cd67fa0..84baf2c82d 100644 --- a/experimental/plugins/postgres_storage/src/wallet_strategy.rs +++ b/experimental/plugins/postgres_storage/src/wallet_strategy.rs @@ -10,8 +10,67 @@ enum WalletScheme { trait WalletStrategy { // initialize storage based on wallet storage strategy fn init_storage(&self, config: &PostgresConfig, credentials: &PostgresCredentials) -> Result<(), WalletStorageError>; + // initialize a single wallet based on wallet storage strategy + fn init_wallet(&self, config: &PostgresConfig, credentials: &PostgresCredentials) -> Result<(), WalletStorageError>; // determine phyisical table name based on wallet strategy fn table_name(&self, config: &PostgresConfig, base_name: &str) -> str; // determine additional query parameters based on wallet strategy fn query_qualifier(&self, config: &PostgresConfig) -> str; } + +pub struct DatabasePerWalletStrategy {} +pub struct MultiWalletSingleTableStrategy {} +pub struct MultiWalletMultiTableStrategy {} + +impl WalletStrategy for DatabasePerWalletStrategy { + // initialize storage based on wallet storage strategy + fn init_storage(&self, config: &PostgresConfig, credentials: &PostgresCredentials) -> Result<(), WalletStorageError> { + // no-op + Ok(()) + } + // initialize a single wallet based on wallet storage strategy + fn init_wallet(&self, config: &PostgresConfig, credentials: &PostgresCredentials) -> Result<(), WalletStorageError> { + // create database for wallet + } + // determine phyisical table name based on wallet strategy + fn table_name(&self, config: &PostgresConfig, base_name: &str) -> str { + } + // determine additional query parameters based on wallet strategy + fn query_qualifier(&self, config: &PostgresConfig) -> str { + } +} + +impl WalletStrategy for MultiWalletSingleTableStrategy { + // initialize storage based on wallet storage strategy + fn init_storage(&self, config: &PostgresConfig, credentials: &PostgresCredentials) -> Result<(), WalletStorageError> { + // create database and tables for storage + } + // initialize a single wallet based on wallet storage strategy + fn init_wallet(&self, config: &PostgresConfig, credentials: &PostgresCredentials) -> Result<(), WalletStorageError> { + // no-op + Ok(()) + } + // determine phyisical table name based on wallet strategy + fn table_name(&self, config: &PostgresConfig, base_name: &str) -> str { + } + // determine additional query parameters based on wallet strategy + fn query_qualifier(&self, config: &PostgresConfig) -> str { + } +} + +impl WalletStrategy for MultiWalletMultiTableStrategy { + // initialize storage based on wallet storage strategy + fn init_storage(&self, config: &PostgresConfig, credentials: &PostgresCredentials) -> Result<(), WalletStorageError> { + // create database for storage + } + // initialize a single wallet based on wallet storage strategy + fn init_wallet(&self, config: &PostgresConfig, credentials: &PostgresCredentials) -> Result<(), WalletStorageError> { + // create tables for wallet storage + } + // determine phyisical table name based on wallet strategy + fn table_name(&self, config: &PostgresConfig, base_name: &str) -> str { + } + // determine additional query parameters based on wallet strategy + fn query_qualifier(&self, config: &PostgresConfig) -> str { + } +} From 9dd81546280b8fb6db58b144401f2d01b47d6515 Mon Sep 17 00:00:00 2001 From: Ian Costanzo Date: Wed, 3 Jul 2019 08:12:40 -0700 Subject: [PATCH 005/320] Multi-wallet database w.i.p. Signed-off-by: Ian Costanzo --- .../postgres_storage/src/postgres_storage.rs | 189 ++++++++++++++++++ .../postgres_storage/src/wallet_strategy.rs | 76 ------- 2 files changed, 189 insertions(+), 76 deletions(-) delete mode 100644 experimental/plugins/postgres_storage/src/wallet_strategy.rs diff --git a/experimental/plugins/postgres_storage/src/postgres_storage.rs b/experimental/plugins/postgres_storage/src/postgres_storage.rs index 78f15ea6de..e1f97a20c7 100644 --- a/experimental/plugins/postgres_storage/src/postgres_storage.rs +++ b/experimental/plugins/postgres_storage/src/postgres_storage.rs @@ -113,6 +113,7 @@ const _WALLETS_DB: &str = "wallets"; const _PLAIN_TAGS_QUERY: &str = "SELECT name, value from tags_plaintext where item_id = $1"; const _ENCRYPTED_TAGS_QUERY: &str = "SELECT name, value from tags_encrypted where item_id = $1"; const _CREATE_WALLET_DATABASE: &str = "CREATE DATABASE $1"; +const _CREATE_WALLETS_DATABASE: &str = "CREATE DATABASE wallets"; const _CREATE_SCHEMA: [&str; 12] = [ "CREATE TABLE IF NOT EXISTS metadata ( id BIGSERIAL PRIMARY KEY, @@ -367,13 +368,142 @@ pub struct PostgresStorage { } pub trait WalletStorageType { + fn init_storage(&self, config: Option<&str>, credentials: Option<&str>) -> Result<(), WalletStorageError>; fn create_storage(&self, id: &str, config: Option<&str>, credentials: Option<&str>, metadata: &[u8]) -> Result<(), WalletStorageError>; fn open_storage(&self, id: &str, config: Option<&str>, credentials: Option<&str>) -> Result, WalletStorageError>; fn delete_storage(&self, id: &str, config: Option<&str>, credentials: Option<&str>) -> Result<(), WalletStorageError>; } +#[derive(Deserialize, Debug)] +#[derive(Copy, Clone)] +pub enum WalletScheme { + DatabasePerWallet, + MultiWalletSingleTable, + MultiWalletMultiTable +} + +pub trait WalletStrategy { + // initialize storage based on wallet storage strategy + fn init_storage(&self, config: &PostgresConfig, credentials: &PostgresCredentials) -> Result<(), WalletStorageError>; + // initialize a single wallet based on wallet storage strategy + fn init_wallet(&self, config: &PostgresConfig, credentials: &PostgresCredentials) -> Result<(), WalletStorageError>; + // determine phyisical table name based on wallet strategy + fn table_name(&self, config: &PostgresConfig, base_name: &str) -> String; + // determine additional query parameters based on wallet strategy + fn query_qualifier(&self, config: &PostgresConfig) -> String; +} + pub struct PostgresStorageType {} +pub struct DatabasePerWalletStrategy {} +pub struct MultiWalletSingleTableStrategy {} +pub struct MultiWalletMultiTableStrategy {} + +impl WalletStrategy for DatabasePerWalletStrategy { + // initialize storage based on wallet storage strategy + fn init_storage(&self, config: &PostgresConfig, credentials: &PostgresCredentials) -> Result<(), WalletStorageError> { + // no-op + Ok(()) + } + // initialize a single wallet based on wallet storage strategy + fn init_wallet(&self, config: &PostgresConfig, credentials: &PostgresCredentials) -> Result<(), WalletStorageError> { + // create database for wallet + // TODO + Ok(()) + } + // determine phyisical table name based on wallet strategy + fn table_name(&self, config: &PostgresConfig, base_name: &str) -> String { + // TODO + base_name.to_owned() + } + // determine additional query parameters based on wallet strategy + fn query_qualifier(&self, config: &PostgresConfig) -> String { + // TODO + "".to_owned() + } +} + +impl WalletStrategy for MultiWalletSingleTableStrategy { + // initialize storage based on wallet storage strategy + fn init_storage(&self, config: &PostgresConfig, credentials: &PostgresCredentials) -> Result<(), WalletStorageError> { + // create database and tables for storage + // if admin user and password aren't provided then bail + if credentials.admin_account == None || credentials.admin_password == None { + return Ok(()) + } + + let url_base = PostgresStorageType::_admin_postgres_url(&config, &credentials); + let url = PostgresStorageType::_postgres_url(_WALLETS_DB, &config, &credentials); + + let conn = postgres::Connection::connect(&url_base[..], postgres::TlsMode::None)?; + + if let Err(error) = conn.execute(&_CREATE_WALLETS_DATABASE, &[]) { + if error.code() != Some(&postgres::error::DUPLICATE_DATABASE) { + conn.finish()?; + return Err(WalletStorageError::IOError(format!("Error occurred while creating the database: {}", error))) + } + } + conn.finish()?; + + let conn = match postgres::Connection::connect(&url[..], postgres::TlsMode::None) { + Ok(conn) => conn, + Err(error) => { + return Err(WalletStorageError::IOError(format!("Error occurred while connecting to wallet schema: {}", error))); + } + }; + + for sql in &_CREATE_SCHEMA { + if let Err(error) = conn.execute(sql, &[]) { + conn.finish()?; + return Err(WalletStorageError::IOError(format!("Error occurred while creating wallet schema: {}", error))); + } + } + conn.finish()?; + Ok(()) + } + // initialize a single wallet based on wallet storage strategy + fn init_wallet(&self, config: &PostgresConfig, credentials: &PostgresCredentials) -> Result<(), WalletStorageError> { + // no-op + Ok(()) + } + // determine phyisical table name based on wallet strategy + fn table_name(&self, config: &PostgresConfig, base_name: &str) -> String { + // TODO + base_name.to_owned() + } + // determine additional query parameters based on wallet strategy + fn query_qualifier(&self, config: &PostgresConfig) -> String { + // TODO + "".to_owned() + } +} + +impl WalletStrategy for MultiWalletMultiTableStrategy { + // initialize storage based on wallet storage strategy + fn init_storage(&self, config: &PostgresConfig, credentials: &PostgresCredentials) -> Result<(), WalletStorageError> { + // create database for storage + // TODO + Ok(()) + } + // initialize a single wallet based on wallet storage strategy + fn init_wallet(&self, config: &PostgresConfig, credentials: &PostgresCredentials) -> Result<(), WalletStorageError> { + // create tables for wallet storage + // TODO + Ok(()) + } + // determine phyisical table name based on wallet strategy + fn table_name(&self, config: &PostgresConfig, base_name: &str) -> String { + // TODO + base_name.to_owned() + } + // determine additional query parameters based on wallet strategy + fn query_qualifier(&self, config: &PostgresConfig) -> String { + // TODO + "".to_owned() + } +} + +pub static mut selected_strategy: &WalletStrategy = &DatabasePerWalletStrategy{}; impl PostgresStorageType { pub fn new() -> PostgresStorageType { @@ -908,6 +1038,65 @@ impl PostgresStorage { impl WalletStorageType for PostgresStorageType { + /// + /// Initializes the wallets database and creates the necessary tables for all wallets + /// This needs to be called once at the very beginning, I'm not entirely sure the best way to enforce it + /// + /// # Arguments + /// + /// * `storage_config` - config containing the location of Postgres DB files + /// * `storage_credentials` - DB credentials + /// + /// # Returns + /// + /// Result that can be either: + /// + /// * `()` + /// * `WalletStorageError` + /// + /// # Errors + /// + /// Any of the following `WalletStorageError` type_ of errors can be throw by this method: + /// + /// * `WalletStorageError::NotFound` - File with the provided id not found + /// * `IOError(..)` - Deletion of the file form the file-system failed + /// + fn init_storage(&self, config: Option<&str>, credentials: Option<&str>) -> Result<(), WalletStorageError> { + let config = config + .map(serde_json::from_str::) + .map_or(Ok(None), |v| v.map(Some)) + .map_err(|err| CommonError::InvalidStructure(format!("Cannot deserialize config: {:?}", err)))?; + let credentials = credentials + .map(serde_json::from_str::) + .map_or(Ok(None), |v| v.map(Some)) + .map_err(|err| CommonError::InvalidStructure(format!("Cannot deserialize credentials: {:?}", err)))?; + + let config = match config { + Some(config) => config, + None => return Err(WalletStorageError::ConfigError) + }; + let credentials = match credentials { + Some(credentials) => credentials, + None => return Err(WalletStorageError::ConfigError) + }; + + unsafe { + match config.wallet_scheme { + Some(scheme) => match scheme { + WalletScheme::DatabasePerWallet => selected_strategy = &DatabasePerWalletStrategy{}, + WalletScheme::MultiWalletSingleTable => selected_strategy = &MultiWalletSingleTableStrategy{}, + WalletScheme::MultiWalletMultiTable => selected_strategy = &MultiWalletMultiTableStrategy{} + }, + None => () + }; + } + + // initialize using the global selected_strategy object + unsafe { + return selected_strategy.init_storage(&config, &credentials); + } + } + /// /// Deletes the SQLite database file with the provided id from the path specified in the /// config file. diff --git a/experimental/plugins/postgres_storage/src/wallet_strategy.rs b/experimental/plugins/postgres_storage/src/wallet_strategy.rs deleted file mode 100644 index 84baf2c82d..0000000000 --- a/experimental/plugins/postgres_storage/src/wallet_strategy.rs +++ /dev/null @@ -1,76 +0,0 @@ - -#[derive(Deserialize, Debug)] -#[derive(Copy, Clone)] -enum WalletScheme { - DatabasePerWallet, - MultiWalletSingleTable, - MultiWalletMultiTable -} - -trait WalletStrategy { - // initialize storage based on wallet storage strategy - fn init_storage(&self, config: &PostgresConfig, credentials: &PostgresCredentials) -> Result<(), WalletStorageError>; - // initialize a single wallet based on wallet storage strategy - fn init_wallet(&self, config: &PostgresConfig, credentials: &PostgresCredentials) -> Result<(), WalletStorageError>; - // determine phyisical table name based on wallet strategy - fn table_name(&self, config: &PostgresConfig, base_name: &str) -> str; - // determine additional query parameters based on wallet strategy - fn query_qualifier(&self, config: &PostgresConfig) -> str; -} - -pub struct DatabasePerWalletStrategy {} -pub struct MultiWalletSingleTableStrategy {} -pub struct MultiWalletMultiTableStrategy {} - -impl WalletStrategy for DatabasePerWalletStrategy { - // initialize storage based on wallet storage strategy - fn init_storage(&self, config: &PostgresConfig, credentials: &PostgresCredentials) -> Result<(), WalletStorageError> { - // no-op - Ok(()) - } - // initialize a single wallet based on wallet storage strategy - fn init_wallet(&self, config: &PostgresConfig, credentials: &PostgresCredentials) -> Result<(), WalletStorageError> { - // create database for wallet - } - // determine phyisical table name based on wallet strategy - fn table_name(&self, config: &PostgresConfig, base_name: &str) -> str { - } - // determine additional query parameters based on wallet strategy - fn query_qualifier(&self, config: &PostgresConfig) -> str { - } -} - -impl WalletStrategy for MultiWalletSingleTableStrategy { - // initialize storage based on wallet storage strategy - fn init_storage(&self, config: &PostgresConfig, credentials: &PostgresCredentials) -> Result<(), WalletStorageError> { - // create database and tables for storage - } - // initialize a single wallet based on wallet storage strategy - fn init_wallet(&self, config: &PostgresConfig, credentials: &PostgresCredentials) -> Result<(), WalletStorageError> { - // no-op - Ok(()) - } - // determine phyisical table name based on wallet strategy - fn table_name(&self, config: &PostgresConfig, base_name: &str) -> str { - } - // determine additional query parameters based on wallet strategy - fn query_qualifier(&self, config: &PostgresConfig) -> str { - } -} - -impl WalletStrategy for MultiWalletMultiTableStrategy { - // initialize storage based on wallet storage strategy - fn init_storage(&self, config: &PostgresConfig, credentials: &PostgresCredentials) -> Result<(), WalletStorageError> { - // create database for storage - } - // initialize a single wallet based on wallet storage strategy - fn init_wallet(&self, config: &PostgresConfig, credentials: &PostgresCredentials) -> Result<(), WalletStorageError> { - // create tables for wallet storage - } - // determine phyisical table name based on wallet strategy - fn table_name(&self, config: &PostgresConfig, base_name: &str) -> str { - } - // determine additional query parameters based on wallet strategy - fn query_qualifier(&self, config: &PostgresConfig) -> str { - } -} From 04c7dfe8ad39b3829777661a6505df4edcdb9bc8 Mon Sep 17 00:00:00 2001 From: Ian Costanzo Date: Wed, 3 Jul 2019 19:58:06 -0700 Subject: [PATCH 006/320] Added init, create and delete methods for 2 wallet strategies Signed-off-by: Ian Costanzo --- .../postgres_storage/src/postgres_storage.rs | 360 ++++++++++++------ 1 file changed, 238 insertions(+), 122 deletions(-) diff --git a/experimental/plugins/postgres_storage/src/postgres_storage.rs b/experimental/plugins/postgres_storage/src/postgres_storage.rs index e1f97a20c7..d47c425aab 100644 --- a/experimental/plugins/postgres_storage/src/postgres_storage.rs +++ b/experimental/plugins/postgres_storage/src/postgres_storage.rs @@ -114,6 +114,7 @@ const _PLAIN_TAGS_QUERY: &str = "SELECT name, value from tags_plaintext where it const _ENCRYPTED_TAGS_QUERY: &str = "SELECT name, value from tags_encrypted where item_id = $1"; const _CREATE_WALLET_DATABASE: &str = "CREATE DATABASE $1"; const _CREATE_WALLETS_DATABASE: &str = "CREATE DATABASE wallets"; +// Note: wallet id length was constrained before by postgres database name length to 64 characters, keeping the same restrictions const _CREATE_SCHEMA: [&str; 12] = [ "CREATE TABLE IF NOT EXISTS metadata ( id BIGSERIAL PRIMARY KEY, @@ -155,6 +156,55 @@ const _CREATE_SCHEMA: [&str; 12] = [ "CREATE INDEX IF NOT EXISTS ix_tags_plaintext_value ON tags_plaintext(value)", "CREATE INDEX IF NOT EXISTS ix_tags_plaintext_item_id ON tags_plaintext(item_id)" ]; +const _CREATE_SCHEMA_MULTI: [&str; 14] = [ + "CREATE TABLE IF NOT EXISTS metadata ( + wallet_id VARCHAR(64) NOT NULL, + id BIGSERIAL NOT NULL, + value BYTEA NOT NULL, + PRIMARY KEY(wallet_id, id) + )", + "CREATE UNIQUE INDEX IF NOT EXISTS ux_metadata_wallet_id_id ON metadata(wallet_id, id)", + "CREATE UNIQUE INDEX IF NOT EXISTS ux_metadata_values ON metadata(wallet_id, value)", + "CREATE TABLE IF NOT EXISTS items( + wallet_id VARCHAR(64) NOT NULL, + id BIGSERIAL NOT NULL, + type BYTEA NOT NULL, + name BYTEA NOT NULL, + value BYTEA NOT NULL, + key BYTEA NOT NULL, + PRIMARY KEY(wallet_id, id) + )", + "CREATE UNIQUE INDEX IF NOT EXISTS ux_items_wallet_id_id ON items(wallet_id, id)", + "CREATE UNIQUE INDEX IF NOT EXISTS ux_items_type_name ON items(wallet_id, type, name)", + "CREATE TABLE IF NOT EXISTS tags_encrypted( + wallet_id VARCHAR(64) NOT NULL, + name BYTEA NOT NULL, + value BYTEA NOT NULL, + item_id BIGINT NOT NULL, + PRIMARY KEY(wallet_id, name, item_id), + FOREIGN KEY(wallet_id, item_id) + REFERENCES items(wallet_id, id) + ON DELETE CASCADE + ON UPDATE CASCADE + )", + "CREATE INDEX IF NOT EXISTS ix_tags_encrypted_name ON tags_encrypted(wallet_id, name)", + "CREATE INDEX IF NOT EXISTS ix_tags_encrypted_value ON tags_encrypted(wallet_id, value)", + "CREATE INDEX IF NOT EXISTS ix_tags_encrypted_wallet_id_item_id ON tags_encrypted(wallet_id, item_id)", + "CREATE TABLE IF NOT EXISTS tags_plaintext( + wallet_id VARCHAR(64) NOT NULL, + name BYTEA NOT NULL, + value TEXT NOT NULL, + item_id BIGINT NOT NULL, + PRIMARY KEY(wallet_id, name, item_id), + FOREIGN KEY(wallet_id, item_id) + REFERENCES items(wallet_id, id) + ON DELETE CASCADE + ON UPDATE CASCADE + )", + "CREATE INDEX IF NOT EXISTS ix_tags_plaintext_name ON tags_plaintext(wallet_id, name)", + "CREATE INDEX IF NOT EXISTS ix_tags_plaintext_value ON tags_plaintext(wallet_id, value)", + "CREATE INDEX IF NOT EXISTS ix_tags_plaintext_wallet_id_item_id ON tags_plaintext(wallet_id, item_id)" + ]; const _DROP_WALLET_DATABASE: &str = "DROP DATABASE $1"; const _DROP_SCHEMA: [&str; 4] = [ "DROP TABLE tags_plaintext", @@ -162,6 +212,12 @@ const _DROP_SCHEMA: [&str; 4] = [ "DROP TABLE items", "DROP TABLE metadata" ]; +const _DELETE_WALLET_MULTI: [&str; 4] = [ + "DELETE FROM tags_plaintext WHERE wallet_id = $1", + "DELETE FROM tags_encrypted WHERE wallet_id = $1", + "DELETE FROM items WHERE wallet_id = $1", + "DELETE FROM metadata WHERE wallet_id = $1" + ]; #[derive(Debug)] @@ -346,12 +402,6 @@ impl PostgresConfig { None => 5 } } - fn wallet_scheme(&self) -> WalletScheme { - match &self.wallet_scheme { - Some(scheme) => *scheme, - None => WalletScheme::DatabasePerWallet - } - } } #[derive(Deserialize, Debug)] @@ -365,6 +415,7 @@ pub struct PostgresCredentials { #[derive(Debug)] pub struct PostgresStorage { pool: r2d2::Pool, + wallet_id: String } pub trait WalletStorageType { @@ -376,48 +427,134 @@ pub trait WalletStorageType { #[derive(Deserialize, Debug)] #[derive(Copy, Clone)] -pub enum WalletScheme { +enum WalletScheme { DatabasePerWallet, MultiWalletSingleTable, MultiWalletMultiTable } -pub trait WalletStrategy { +trait WalletStrategy { // initialize storage based on wallet storage strategy fn init_storage(&self, config: &PostgresConfig, credentials: &PostgresCredentials) -> Result<(), WalletStorageError>; // initialize a single wallet based on wallet storage strategy - fn init_wallet(&self, config: &PostgresConfig, credentials: &PostgresCredentials) -> Result<(), WalletStorageError>; + fn create_wallet(&self, id: &str, config: &PostgresConfig, credentials: &PostgresCredentials, metadata: &[u8]) -> Result<(), WalletStorageError>; + // delete a single wallet based on wallet storage strategy + fn delete_wallet(&self, id: &str, config: &PostgresConfig, credentials: &PostgresCredentials) -> Result<(), WalletStorageError>; // determine phyisical table name based on wallet strategy - fn table_name(&self, config: &PostgresConfig, base_name: &str) -> String; + fn table_name(&self, id: &str, base_name: &str) -> String; // determine additional query parameters based on wallet strategy - fn query_qualifier(&self, config: &PostgresConfig) -> String; + fn query_qualifier(&self, id: &str) -> String; } pub struct PostgresStorageType {} -pub struct DatabasePerWalletStrategy {} -pub struct MultiWalletSingleTableStrategy {} -pub struct MultiWalletMultiTableStrategy {} +struct DatabasePerWalletStrategy {} +struct MultiWalletSingleTableStrategy {} +struct MultiWalletMultiTableStrategy {} impl WalletStrategy for DatabasePerWalletStrategy { // initialize storage based on wallet storage strategy - fn init_storage(&self, config: &PostgresConfig, credentials: &PostgresCredentials) -> Result<(), WalletStorageError> { + fn init_storage(&self, _config: &PostgresConfig, _credentials: &PostgresCredentials) -> Result<(), WalletStorageError> { // no-op Ok(()) } // initialize a single wallet based on wallet storage strategy - fn init_wallet(&self, config: &PostgresConfig, credentials: &PostgresCredentials) -> Result<(), WalletStorageError> { + fn create_wallet(&self, id: &str, config: &PostgresConfig, credentials: &PostgresCredentials, metadata: &[u8]) -> Result<(), WalletStorageError> { // create database for wallet - // TODO - Ok(()) + // if admin user and password aren't provided then bail + if credentials.admin_account == None || credentials.admin_password == None { + return Ok(()) + } + + let url_base = PostgresStorageType::_admin_postgres_url(&config, &credentials); + let url = PostgresStorageType::_postgres_url(id, &config, &credentials); + + let conn = postgres::Connection::connect(&url_base[..], config.tls())?; + + let create_db_sql = str::replace(_CREATE_WALLET_DATABASE, "$1", id); + let mut schema_result = match conn.execute(&create_db_sql, &[]) { + Ok(_) => Ok(()), + Err(_error) => { + Err(WalletStorageError::AlreadyExists) + } + }; + conn.finish()?; + + let conn = match postgres::Connection::connect(&url[..], config.tls()) { + Ok(conn) => conn, + Err(error) => { + return Err(WalletStorageError::IOError(format!("Error occurred while connecting to wallet schema: {}", error))); + } + }; + + for sql in &_CREATE_SCHEMA { + match schema_result { + Ok(_) => schema_result = match conn.execute(sql, &[]) { + Ok(_) => Ok(()), + Err(error) => { + Err(WalletStorageError::IOError(format!("Error occurred while creating wallet schema: {}", error))) + } + }, + _ => () + } + }; + let ret = match schema_result { + Ok(_) => { + match conn.execute("INSERT INTO metadata(value) VALUES($1) + ON CONFLICT (value) DO UPDATE SET value = excluded.value", + &[&metadata]) { + Ok(_) => Ok(()), + Err(error) => { + //std::fs::remove_file(db_path)?; + Err(WalletStorageError::IOError(format!("Error occurred while inserting the keys: {}", error))) + } + } + }, + Err(error) => Err(error) + }; + conn.finish()?; + ret + } + // delete a single wallet based on wallet storage strategy + fn delete_wallet(&self, id: &str, config: &PostgresConfig, credentials: &PostgresCredentials) -> Result<(), WalletStorageError> { + // if admin user and password aren't provided then bail + if credentials.admin_account == None || credentials.admin_password == None { + return Ok(()) + } + + let url_base = PostgresStorageType::_admin_postgres_url(&config, &credentials); + let url = PostgresStorageType::_postgres_url(id, &config, &credentials); + + match postgres::Connection::connect(&url[..], config.tls()) { + Ok(conn) => { + for sql in &_DROP_SCHEMA { + match conn.execute(sql, &[]) { + Ok(_) => (), + Err(_) => () + }; + } + let _ret = conn.finish(); + () + }, + Err(_) => return Err(WalletStorageError::NotFound) + }; + + let conn = postgres::Connection::connect(url_base, config.tls())?; + let drop_db_sql = str::replace(_DROP_WALLET_DATABASE, "$1", id); + let ret = match conn.execute(&drop_db_sql, &[]) { + Ok(_) => Ok(()), + Err(_) => Ok(()) + }; + conn.finish()?; + ret } // determine phyisical table name based on wallet strategy - fn table_name(&self, config: &PostgresConfig, base_name: &str) -> String { + fn table_name(&self, _id: &str, base_name: &str) -> String { // TODO base_name.to_owned() } // determine additional query parameters based on wallet strategy - fn query_qualifier(&self, config: &PostgresConfig) -> String { + fn query_qualifier(&self, _id: &str) -> String { // TODO "".to_owned() } @@ -452,7 +589,7 @@ impl WalletStrategy for MultiWalletSingleTableStrategy { } }; - for sql in &_CREATE_SCHEMA { + for sql in &_CREATE_SCHEMA_MULTI { if let Err(error) = conn.execute(sql, &[]) { conn.finish()?; return Err(WalletStorageError::IOError(format!("Error occurred while creating wallet schema: {}", error))); @@ -462,17 +599,67 @@ impl WalletStrategy for MultiWalletSingleTableStrategy { Ok(()) } // initialize a single wallet based on wallet storage strategy - fn init_wallet(&self, config: &PostgresConfig, credentials: &PostgresCredentials) -> Result<(), WalletStorageError> { - // no-op - Ok(()) + fn create_wallet(&self, id: &str, config: &PostgresConfig, credentials: &PostgresCredentials, metadata: &[u8]) -> Result<(), WalletStorageError> { + // insert metadata + let url = PostgresStorageType::_postgres_url(_WALLETS_DB, &config, &credentials); + + let conn = match postgres::Connection::connect(&url[..], postgres::TlsMode::None) { + Ok(conn) => conn, + Err(error) => { + return Err(WalletStorageError::IOError(format!("Error occurred while connecting to wallet schema: {}", error))); + } + }; + + // We allow error on conflict since this indicates AlreadyExists error + let ret = match conn.execute("INSERT INTO metadata(wallet_id, value) VALUES($1, $2)", &[&id, &metadata]) { + Ok(_) => Ok(()), + Err(error) => { + if error.code() == Some(&postgres::error::UNIQUE_VIOLATION) { + Err(WalletStorageError::AlreadyExists) + } else { + Err(WalletStorageError::IOError(format!("Error occurred while inserting into metadata: {}", error))) + } + } + }; + conn.finish()?; + ret + } + // delete a single wallet based on wallet storage strategy + fn delete_wallet(&self, id: &str, config: &PostgresConfig, credentials: &PostgresCredentials) -> Result<(), WalletStorageError> { + let url = PostgresStorageType::_postgres_url(&_WALLETS_DB, &config, &credentials); + + let conn = match postgres::Connection::connect(&url[..], postgres::TlsMode::None) { + Ok(conn) => conn, + Err(error) => { + return Err(WalletStorageError::IOError(format!("Error occurred while connecting to wallet schema: {}", error))); + } + }; + + let mut ret = Ok(()); + for sql in &_DELETE_WALLET_MULTI { + ret = match conn.execute(sql, &[&id]) { + Ok(row_count) => { + if row_count == 0 { + Err(WalletStorageError::NotFound) + } else { + Ok(()) + } + }, + Err(error) => { + Err(WalletStorageError::IOError(format!("Error occurred while deleting wallet: {}", error))) + } + } + }; + conn.finish()?; + return ret } // determine phyisical table name based on wallet strategy - fn table_name(&self, config: &PostgresConfig, base_name: &str) -> String { + fn table_name(&self, _id: &str, base_name: &str) -> String { // TODO base_name.to_owned() } // determine additional query parameters based on wallet strategy - fn query_qualifier(&self, config: &PostgresConfig) -> String { + fn query_qualifier(&self, _id: &str) -> String { // TODO "".to_owned() } @@ -480,30 +667,34 @@ impl WalletStrategy for MultiWalletSingleTableStrategy { impl WalletStrategy for MultiWalletMultiTableStrategy { // initialize storage based on wallet storage strategy - fn init_storage(&self, config: &PostgresConfig, credentials: &PostgresCredentials) -> Result<(), WalletStorageError> { + fn init_storage(&self, _config: &PostgresConfig, _credentials: &PostgresCredentials) -> Result<(), WalletStorageError> { // create database for storage // TODO Ok(()) } // initialize a single wallet based on wallet storage strategy - fn init_wallet(&self, config: &PostgresConfig, credentials: &PostgresCredentials) -> Result<(), WalletStorageError> { + fn create_wallet(&self, _id: &str, _config: &PostgresConfig, _credentials: &PostgresCredentials, _metadata: &[u8]) -> Result<(), WalletStorageError> { // create tables for wallet storage // TODO Ok(()) } + // delete a single wallet based on wallet storage strategy + fn delete_wallet(&self, _id: &str, _config: &PostgresConfig, _credentials: &PostgresCredentials) -> Result<(), WalletStorageError> { + Ok(()) + } // determine phyisical table name based on wallet strategy - fn table_name(&self, config: &PostgresConfig, base_name: &str) -> String { + fn table_name(&self, _id: &str, base_name: &str) -> String { // TODO base_name.to_owned() } // determine additional query parameters based on wallet strategy - fn query_qualifier(&self, config: &PostgresConfig) -> String { + fn query_qualifier(&self, _id: &str) -> String { // TODO "".to_owned() } } -pub static mut selected_strategy: &WalletStrategy = &DatabasePerWalletStrategy{}; +static mut SELECTED_STRATEGY: &WalletStrategy = &DatabasePerWalletStrategy{}; impl PostgresStorageType { pub fn new() -> PostgresStorageType { @@ -742,7 +933,7 @@ impl WalletStorage for PostgresStorage { match res { Ok(1) => Ok(()), Ok(0) => Err(WalletStorageError::ItemNotFound), - Ok(count) => Err(WalletStorageError::CommonError(CommonError::InvalidState(format!("SQLite returned update row count: {}", count)))), + Ok(count) => Err(WalletStorageError::CommonError(CommonError::InvalidState(format!("Postgres returned update row count: {}", count)))), Err(err) => Err(WalletStorageError::from(err)), } } @@ -1083,28 +1274,28 @@ impl WalletStorageType for PostgresStorageType { unsafe { match config.wallet_scheme { Some(scheme) => match scheme { - WalletScheme::DatabasePerWallet => selected_strategy = &DatabasePerWalletStrategy{}, - WalletScheme::MultiWalletSingleTable => selected_strategy = &MultiWalletSingleTableStrategy{}, - WalletScheme::MultiWalletMultiTable => selected_strategy = &MultiWalletMultiTableStrategy{} + WalletScheme::DatabasePerWallet => SELECTED_STRATEGY = &DatabasePerWalletStrategy{}, + WalletScheme::MultiWalletSingleTable => SELECTED_STRATEGY = &MultiWalletSingleTableStrategy{}, + WalletScheme::MultiWalletMultiTable => SELECTED_STRATEGY = &MultiWalletMultiTableStrategy{} }, None => () }; } - // initialize using the global selected_strategy object + // initialize using the global SELECTED_STRATEGY object unsafe { - return selected_strategy.init_storage(&config, &credentials); + return SELECTED_STRATEGY.init_storage(&config, &credentials); } } /// - /// Deletes the SQLite database file with the provided id from the path specified in the + /// Deletes the Postgres database file with the provided id from the path specified in the /// config file. /// /// # Arguments /// - /// * `id` - id of the SQLite DB file - /// * `storage_config` - config containing the location of SQLite DB files + /// * `id` - the wallet id + /// * `storage_config` - Postgres DB connection config /// * `storage_credentials` - DB credentials /// /// # Returns @@ -1140,36 +1331,9 @@ impl WalletStorageType for PostgresStorageType { None => return Err(WalletStorageError::ConfigError) }; - // if admin user and password aren't provided then bail - if credentials.admin_account == None || credentials.admin_password == None { - return Ok(()) + unsafe { + return SELECTED_STRATEGY.delete_wallet(id, &config, &credentials); } - - let url_base = PostgresStorageType::_admin_postgres_url(&config, &credentials); - let url = PostgresStorageType::_postgres_url(id, &config, &credentials); - - match postgres::Connection::connect(&url[..], config.tls()) { - Ok(conn) => { - for sql in &_DROP_SCHEMA { - match conn.execute(sql, &[]) { - Ok(_) => (), - Err(_) => () - }; - } - let _ret = conn.finish(); - () - }, - Err(_) => return Err(WalletStorageError::NotFound) - }; - - let conn = postgres::Connection::connect(url_base, config.tls())?; - let drop_db_sql = str::replace(_DROP_WALLET_DATABASE, "$1", id); - let ret = match conn.execute(&drop_db_sql, &[]) { - Ok(_) => Ok(()), - Err(_) => Ok(()) - }; - conn.finish()?; - ret } /// @@ -1219,59 +1383,10 @@ impl WalletStorageType for PostgresStorageType { None => return Err(WalletStorageError::ConfigError) }; - // if admin user and password aren't provided then bail - if credentials.admin_account == None || credentials.admin_password == None { - return Ok(()) + // initialize using the global selected_strategy object + unsafe { + return SELECTED_STRATEGY.create_wallet(id, &config, &credentials, metadata); } - - let url_base = PostgresStorageType::_admin_postgres_url(&config, &credentials); - let url = PostgresStorageType::_postgres_url(id, &config, &credentials); - - let conn = postgres::Connection::connect(&url_base[..], config.tls())?; - - let create_db_sql = str::replace(_CREATE_WALLET_DATABASE, "$1", id); - let mut schema_result = match conn.execute(&create_db_sql, &[]) { - Ok(_) => Ok(()), - Err(_error) => { - Err(WalletStorageError::AlreadyExists) - } - }; - conn.finish()?; - - let conn = match postgres::Connection::connect(&url[..], config.tls()) { - Ok(conn) => conn, - Err(error) => { - return Err(WalletStorageError::IOError(format!("Error occurred while connecting to wallet schema: {}", error))); - } - }; - - for sql in &_CREATE_SCHEMA { - match schema_result { - Ok(_) => schema_result = match conn.execute(sql, &[]) { - Ok(_) => Ok(()), - Err(error) => { - Err(WalletStorageError::IOError(format!("Error occurred while creating wallet schema: {}", error))) - } - }, - _ => () - } - }; - let ret = match schema_result { - Ok(_) => { - match conn.execute("INSERT INTO metadata(value) VALUES($1) - ON CONFLICT (value) DO UPDATE SET value = excluded.value", - &[&metadata]) { - Ok(_) => Ok(()), - Err(error) => { - //std::fs::remove_file(db_path)?; - Err(WalletStorageError::IOError(format!("Error occurred while inserting the keys: {}", error))) - } - } - }, - Err(error) => Err(error) - }; - conn.finish()?; - ret } /// @@ -1339,7 +1454,8 @@ impl WalletStorageType for PostgresStorageType { }; Ok(Box::new(PostgresStorage { - pool: pool + pool: pool, + wallet_id: id.to_string() })) } } From e6137323acac6a60b9f15ff33cf46396e359b438 Mon Sep 17 00:00:00 2001 From: Ian Costanzo Date: Fri, 5 Jul 2019 08:26:51 -0700 Subject: [PATCH 007/320] Update queries for multi-wallet DB w.i.p. Signed-off-by: Ian Costanzo --- .../postgres_storage/src/postgres_storage.rs | 320 ++++++++++++++---- 1 file changed, 252 insertions(+), 68 deletions(-) diff --git a/experimental/plugins/postgres_storage/src/postgres_storage.rs b/experimental/plugins/postgres_storage/src/postgres_storage.rs index d47c425aab..595c45ae53 100644 --- a/experimental/plugins/postgres_storage/src/postgres_storage.rs +++ b/experimental/plugins/postgres_storage/src/postgres_storage.rs @@ -443,7 +443,7 @@ trait WalletStrategy { // determine phyisical table name based on wallet strategy fn table_name(&self, id: &str, base_name: &str) -> String; // determine additional query parameters based on wallet strategy - fn query_qualifier(&self, id: &str) -> String; + fn query_qualifier(&self) -> Option; } pub struct PostgresStorageType {} @@ -554,9 +554,9 @@ impl WalletStrategy for DatabasePerWalletStrategy { base_name.to_owned() } // determine additional query parameters based on wallet strategy - fn query_qualifier(&self, _id: &str) -> String { + fn query_qualifier(&self) -> Option { // TODO - "".to_owned() + None } } @@ -659,9 +659,9 @@ impl WalletStrategy for MultiWalletSingleTableStrategy { base_name.to_owned() } // determine additional query parameters based on wallet strategy - fn query_qualifier(&self, _id: &str) -> String { + fn query_qualifier(&self) -> Option { // TODO - "".to_owned() + Some("AND wallet_id = $$".to_owned()) } } @@ -688,9 +688,9 @@ impl WalletStrategy for MultiWalletMultiTableStrategy { base_name.to_owned() } // determine additional query parameters based on wallet strategy - fn query_qualifier(&self, _id: &str) -> String { + fn query_qualifier(&self) -> Option { // TODO - "".to_owned() + None } } @@ -773,10 +773,18 @@ impl WalletStorage for PostgresStorage { }; let pool = self.pool.clone(); let conn = pool.get().unwrap(); + let query_qualifier = unsafe { + SELECTED_STRATEGY.query_qualifier() + }; let res: Result<(i64, Vec, Vec), WalletStorageError> = { - let mut rows = conn.query( - "SELECT id, value, key FROM items where type = $1 AND name = $2", - &[&type_.to_vec(), &id.to_vec()]); + let mut rows = match query_qualifier { + Some(_) => conn.query( + "SELECT id, value, key FROM items where type = $1 AND name = $2 AND wallet_id = $3", + &[&type_.to_vec(), &id.to_vec(), &self.wallet_id]), + None => conn.query( + "SELECT id, value, key FROM items where type = $1 AND name = $2", + &[&type_.to_vec(), &id.to_vec()]) + }; match rows.as_mut().unwrap().iter().next() { Some(row) => Ok((row.get(0), row.get(1), row.get(2))), None => Err(WalletStorageError::ItemNotFound) @@ -794,8 +802,16 @@ impl WalletStorage for PostgresStorage { let mut tags = Vec::new(); // get all encrypted. - let mut stmt = conn.prepare_cached("SELECT name, value FROM tags_encrypted WHERE item_id = $1")?; - let mut rows = stmt.query(&[&item.0])?; + let mut rows = match query_qualifier { + Some(_) => { + let mut stmt = conn.prepare_cached("SELECT name, value FROM tags_encrypted WHERE item_id = $1 AND wallet_id = $2")?; + stmt.query(&[&item.0, &self.wallet_id])? + }, + None => { + let mut stmt = conn.prepare_cached("SELECT name, value FROM tags_encrypted WHERE item_id = $1")?; + stmt.query(&[&item.0])? + } + }; let mut iter = rows.iter(); while let Some(res) = iter.next() { @@ -806,8 +822,16 @@ impl WalletStorage for PostgresStorage { } // get all plain - let mut stmt = conn.prepare_cached("SELECT name, value FROM tags_plaintext WHERE item_id = $1")?; - let mut rows = stmt.query(&[&item.0])?; + let mut rows = match query_qualifier { + Some(_) => { + let mut stmt = conn.prepare_cached("SELECT name, value FROM tags_plaintext WHERE item_id = $1 AND wallet_id = $2")?; + stmt.query(&[&item.0, &self.wallet_id])? + }, + None => { + let mut stmt = conn.prepare_cached("SELECT name, value FROM tags_plaintext WHERE item_id = $1")?; + stmt.query(&[&item.0])? + } + }; let mut iter = rows.iter(); while let Some(res) = iter.next() { @@ -854,9 +878,16 @@ impl WalletStorage for PostgresStorage { fn add(&self, type_: &[u8], id: &[u8], value: &EncryptedValue, tags: &[Tag]) -> Result<(), WalletStorageError> { let pool = self.pool.clone(); let conn = pool.get().unwrap(); + let query_qualifier = unsafe { + SELECTED_STRATEGY.query_qualifier() + }; let tx: transaction::Transaction = transaction::Transaction::new(&conn)?; - let res = tx.prepare_cached("INSERT INTO items (type, name, value, key) VALUES ($1, $2, $3, $4) RETURNING id")? - .query(&[&type_.to_vec(), &id.to_vec(), &value.data, &value.key]); + let res = match query_qualifier { + Some(_) => tx.prepare_cached("INSERT INTO items (type, name, value, key, wallet_id) VALUES ($1, $2, $3, $4, $5) RETURNING id")? + .query(&[&type_.to_vec(), &id.to_vec(), &value.data, &value.key, &self.wallet_id]), + None => tx.prepare_cached("INSERT INTO items (type, name, value, key) VALUES ($1, $2, $3, $4) RETURNING id")? + .query(&[&type_.to_vec(), &id.to_vec(), &value.data, &value.key]) + }; let item_id = match res { Ok(rows) => { @@ -884,13 +915,23 @@ impl WalletStorage for PostgresStorage { let item_id = item_id as i64; if !tags.is_empty() { - let stmt_e = tx.prepare_cached("INSERT INTO tags_encrypted (item_id, name, value) VALUES ($1, $2, $3)")?; - let stmt_p = tx.prepare_cached("INSERT INTO tags_plaintext (item_id, name, value) VALUES ($1, $2, $3)")?; + let stmt_e = match query_qualifier { + Some(_) => tx.prepare_cached("INSERT INTO tags_encrypted (item_id, name, value, wallet_id) VALUES ($1, $2, $3, $4)")?, + None => tx.prepare_cached("INSERT INTO tags_encrypted (item_id, name, value) VALUES ($1, $2, $3)")? + }; + let stmt_p = match query_qualifier { + Some(_) => tx.prepare_cached("INSERT INTO tags_plaintext (item_id, name, value, wallet_id) VALUES ($1, $2, $3, $4)")?, + None => tx.prepare_cached("INSERT INTO tags_plaintext (item_id, name, value) VALUES ($1, $2, $3)")? + }; for tag in tags { match tag { &Tag::Encrypted(ref tag_name, ref tag_data) => { - match stmt_e.execute(&[&item_id, tag_name, tag_data]) { + let res = match query_qualifier { + Some(_) => stmt_e.execute(&[&item_id, tag_name, tag_data, &self.wallet_id]), + None => stmt_e.execute(&[&item_id, tag_name, tag_data]) + }; + match res { Ok(_) => (), Err(err) => { if err.code() == Some(&postgres::error::UNIQUE_VIOLATION) || @@ -903,7 +944,11 @@ impl WalletStorage for PostgresStorage { } }, &Tag::PlainText(ref tag_name, ref tag_data) => { - match stmt_p.execute(&[&item_id, tag_name, tag_data]) { + let res = match query_qualifier { + Some(_) => stmt_p.execute(&[&item_id, tag_name, tag_data, &self.wallet_id]), + None => stmt_p.execute(&[&item_id, tag_name, tag_data]) + }; + match res { Ok(_) => (), Err(err) => { if err.code() == Some(&postgres::error::UNIQUE_VIOLATION) || @@ -927,8 +972,15 @@ impl WalletStorage for PostgresStorage { fn update(&self, type_: &[u8], id: &[u8], value: &EncryptedValue) -> Result<(), WalletStorageError> { let pool = self.pool.clone(); let conn = pool.get().unwrap(); - let res = conn.prepare_cached("UPDATE items SET value = $1, key = $2 WHERE type = $3 AND name = $4")? - .execute(&[&value.data, &value.key, &type_.to_vec(), &id.to_vec()]); + let query_qualifier = unsafe { + SELECTED_STRATEGY.query_qualifier() + }; + let res = match query_qualifier { + Some(_) => conn.prepare_cached("UPDATE items SET value = $1, key = $2 WHERE type = $3 AND name = $4 AND wallet_id = $5")? + .execute(&[&value.data, &value.key, &type_.to_vec(), &id.to_vec(), &self.wallet_id]), + None => conn.prepare_cached("UPDATE items SET value = $1, key = $2 WHERE type = $3 AND name = $4")? + .execute(&[&value.data, &value.key, &type_.to_vec(), &id.to_vec()]) + }; match res { Ok(1) => Ok(()), @@ -941,14 +993,27 @@ impl WalletStorage for PostgresStorage { fn add_tags(&self, type_: &[u8], id: &[u8], tags: &[Tag]) -> Result<(), WalletStorageError> { let pool = self.pool.clone(); let conn = pool.get().unwrap(); + let query_qualifier = unsafe { + SELECTED_STRATEGY.query_qualifier() + }; let tx: transaction::Transaction = transaction::Transaction::new(&conn)?; - let res = { - let mut rows = tx.prepare_cached("SELECT id FROM items WHERE type = $1 AND name = $2")? - .query(&[&type_.to_vec(), &id.to_vec()]); - match rows.as_mut().unwrap().iter().next() { - Some(row) => Ok(row.get(0)), - None => Err(WalletStorageError::ItemNotFound) + let res = match query_qualifier { + Some(_) => { + let mut rows = tx.prepare_cached("SELECT id FROM items WHERE type = $1 AND name = $2")? + .query(&[&type_.to_vec(), &id.to_vec()]); + match rows.as_mut().unwrap().iter().next() { + Some(row) => Ok(row.get(0)), + None => Err(WalletStorageError::ItemNotFound) + } + }, + None => { + let mut rows = tx.prepare_cached("SELECT id FROM items WHERE type = $1 AND name = $2")? + .query(&[&type_.to_vec(), &id.to_vec()]); + match rows.as_mut().unwrap().iter().next() { + Some(row) => Ok(row.get(0)), + None => Err(WalletStorageError::ItemNotFound) + } } }; @@ -959,15 +1024,27 @@ impl WalletStorage for PostgresStorage { }; if !tags.is_empty() { - let enc_tag_insert_stmt = tx.prepare_cached("INSERT INTO tags_encrypted (item_id, name, value) VALUES ($1, $2, $3) - ON CONFLICT (name, item_id) DO UPDATE SET value = excluded.value")?; - let plain_tag_insert_stmt = tx.prepare_cached("INSERT INTO tags_plaintext (item_id, name, value) VALUES ($1, $2, $3) - ON CONFLICT (name, item_id) DO UPDATE SET value = excluded.value")?; + let enc_tag_insert_stmt = match query_qualifier { + Some(_) => tx.prepare_cached("INSERT INTO tags_encrypted (item_id, name, value, wallet_id) VALUES ($1, $2, $3, $4) + ON CONFLICT (name, item_id, wallet_id) DO UPDATE SET value = excluded.value")?, + None => tx.prepare_cached("INSERT INTO tags_encrypted (item_id, name, value) VALUES ($1, $2, $3) + ON CONFLICT (name, item_id) DO UPDATE SET value = excluded.value")? + }; + let plain_tag_insert_stmt = match query_qualifier { + Some(_) => tx.prepare_cached("INSERT INTO tags_plaintext (item_id, name, value, wallet_id) VALUES ($1, $2, $3, $4) + ON CONFLICT (name, item_id, wallet_id) DO UPDATE SET value = excluded.value")?, + None => tx.prepare_cached("INSERT INTO tags_plaintext (item_id, name, value) VALUES ($1, $2, $3) + ON CONFLICT (name, item_id) DO UPDATE SET value = excluded.value")? + }; for tag in tags { match tag { &Tag::Encrypted(ref tag_name, ref tag_data) => { - match enc_tag_insert_stmt.execute(&[&item_id, tag_name, tag_data]) { + let res = match query_qualifier { + Some(_) => enc_tag_insert_stmt.execute(&[&item_id, tag_name, tag_data, &self.wallet_id]), + None => enc_tag_insert_stmt.execute(&[&item_id, tag_name, tag_data]) + }; + match res { Ok(_) => (), Err(err) => { if err.code() == Some(&postgres::error::UNIQUE_VIOLATION) || @@ -980,7 +1057,11 @@ impl WalletStorage for PostgresStorage { } }, &Tag::PlainText(ref tag_name, ref tag_data) => { - match plain_tag_insert_stmt.execute(&[&item_id, tag_name, tag_data]) { + let res = match query_qualifier { + Some(_) => plain_tag_insert_stmt.execute(&[&item_id, tag_name, tag_data, &self.wallet_id]), + None => plain_tag_insert_stmt.execute(&[&item_id, tag_name, tag_data]) + }; + match res { Ok(_) => (), Err(err) => { if err.code() == Some(&postgres::error::UNIQUE_VIOLATION) || @@ -1003,14 +1084,27 @@ impl WalletStorage for PostgresStorage { fn update_tags(&self, type_: &[u8], id: &[u8], tags: &[Tag]) -> Result<(), WalletStorageError> { let pool = self.pool.clone(); let conn = pool.get().unwrap(); + let query_qualifier = unsafe { + SELECTED_STRATEGY.query_qualifier() + }; let tx: transaction::Transaction = transaction::Transaction::new(&conn)?; - let res = { - let mut rows = tx.prepare_cached("SELECT id FROM items WHERE type = $1 AND name = $2")? - .query(&[&type_.to_vec(), &id.to_vec()]); - match rows.as_mut().unwrap().iter().next() { - Some(row) => Ok(row.get(0)), - None => Err(WalletStorageError::ItemNotFound) + let res = match query_qualifier { + Some(_) => { + let mut rows = tx.prepare_cached("SELECT id FROM items WHERE type = $1 AND name = $2 AND wallet_id = $3")? + .query(&[&type_.to_vec(), &id.to_vec(), &self.wallet_id]); + match rows.as_mut().unwrap().iter().next() { + Some(row) => Ok(row.get(0)), + None => Err(WalletStorageError::ItemNotFound) + } + }, + None => { + let mut rows = tx.prepare_cached("SELECT id FROM items WHERE type = $1 AND name = $2")? + .query(&[&type_.to_vec(), &id.to_vec()]); + match rows.as_mut().unwrap().iter().next() { + Some(row) => Ok(row.get(0)), + None => Err(WalletStorageError::ItemNotFound) + } } }; @@ -1020,17 +1114,41 @@ impl WalletStorage for PostgresStorage { Ok(id) => id }; - tx.execute("DELETE FROM tags_encrypted WHERE item_id = $1", &[&item_id])?; - tx.execute("DELETE FROM tags_plaintext WHERE item_id = $1", &[&item_id])?; + match query_qualifier { + Some(_) => { + tx.execute("DELETE FROM tags_encrypted WHERE item_id = $1 AND wallet_id = $2", &[&item_id, &self.wallet_id])?; + tx.execute("DELETE FROM tags_plaintext WHERE item_id = $1 AND wallet_id = $2", &[&item_id, &self.wallet_id])?; + }, + None => { + tx.execute("DELETE FROM tags_encrypted WHERE item_id = $1", &[&item_id])?; + tx.execute("DELETE FROM tags_plaintext WHERE item_id = $1", &[&item_id])?; + } + }; if !tags.is_empty() { - let enc_tag_insert_stmt = tx.prepare_cached("INSERT INTO tags_encrypted (item_id, name, value) VALUES ($1, $2, $3)")?; - let plain_tag_insert_stmt = tx.prepare_cached("INSERT INTO tags_plaintext (item_id, name, value) VALUES ($1, $2, $3)")?; + let enc_tag_insert_stmt = match query_qualifier { + Some(_) => tx.prepare_cached("INSERT INTO tags_encrypted (item_id, name, value, wallet_id) VALUES ($1, $2, $3, $4)")?, + None => tx.prepare_cached("INSERT INTO tags_encrypted (item_id, name, value) VALUES ($1, $2, $3)")? + }; + let plain_tag_insert_stmt = match query_qualifier { + Some(_) => tx.prepare_cached("INSERT INTO tags_plaintext (item_id, name, value, wallet_id) VALUES ($1, $2, $3, $4)")?, + None => tx.prepare_cached("INSERT INTO tags_plaintext (item_id, name, value) VALUES ($1, $2, $3)")? + }; for tag in tags { - match tag { - &Tag::Encrypted(ref tag_name, ref tag_data) => enc_tag_insert_stmt.execute(&[&item_id, tag_name, tag_data])?, - &Tag::PlainText(ref tag_name, ref tag_data) => plain_tag_insert_stmt.execute(&[&item_id, tag_name, tag_data])? + match query_qualifier { + Some(_) => { + match tag { + &Tag::Encrypted(ref tag_name, ref tag_data) => enc_tag_insert_stmt.execute(&[&item_id, tag_name, tag_data, &self.wallet_id])?, + &Tag::PlainText(ref tag_name, ref tag_data) => plain_tag_insert_stmt.execute(&[&item_id, tag_name, tag_data, &self.wallet_id])? + } + }, + None => { + match tag { + &Tag::Encrypted(ref tag_name, ref tag_data) => enc_tag_insert_stmt.execute(&[&item_id, tag_name, tag_data])?, + &Tag::PlainText(ref tag_name, ref tag_data) => plain_tag_insert_stmt.execute(&[&item_id, tag_name, tag_data])? + } + } }; } } @@ -1042,12 +1160,25 @@ impl WalletStorage for PostgresStorage { fn delete_tags(&self, type_: &[u8], id: &[u8], tag_names: &[TagName]) -> Result<(), WalletStorageError> { let pool = self.pool.clone(); let conn = pool.get().unwrap(); - let res = { - let mut rows = conn.prepare_cached("SELECT id FROM items WHERE type =$1 AND name = $2")? - .query(&[&type_.to_vec(), &id.to_vec()]); - match rows.as_mut().unwrap().iter().next() { - Some(row) => Ok(row.get(0)), - None => Err(WalletStorageError::ItemNotFound) + let query_qualifier = unsafe { + SELECTED_STRATEGY.query_qualifier() + }; + let res = match query_qualifier { + Some(_) => { + let mut rows = conn.prepare_cached("SELECT id FROM items WHERE type =$1 AND name = $2 AND wallet_id = $3")? + .query(&[&type_.to_vec(), &id.to_vec(), &self.wallet_id]); + match rows.as_mut().unwrap().iter().next() { + Some(row) => Ok(row.get(0)), + None => Err(WalletStorageError::ItemNotFound) + } + }, + None => { + let mut rows = conn.prepare_cached("SELECT id FROM items WHERE type =$1 AND name = $2")? + .query(&[&type_.to_vec(), &id.to_vec()]); + match rows.as_mut().unwrap().iter().next() { + Some(row) => Ok(row.get(0)), + None => Err(WalletStorageError::ItemNotFound) + } } }; @@ -1059,13 +1190,27 @@ impl WalletStorage for PostgresStorage { let tx: transaction::Transaction = transaction::Transaction::new(&conn)?; { - let enc_tag_delete_stmt = tx.prepare_cached("DELETE FROM tags_encrypted WHERE item_id = $1 AND name = $2")?; - let plain_tag_delete_stmt = tx.prepare_cached("DELETE FROM tags_plaintext WHERE item_id = $1 AND name = $2")?; + let enc_tag_delete_stmt = match query_qualifier { + Some(_) => tx.prepare_cached("DELETE FROM tags_encrypted WHERE item_id = $1 AND name = $2 AND wallet_id = $3")?, + None => tx.prepare_cached("DELETE FROM tags_encrypted WHERE item_id = $1 AND name = $2")? + }; + let plain_tag_delete_stmt = match query_qualifier { + Some(_) => tx.prepare_cached("DELETE FROM tags_plaintext WHERE item_id = $1 AND name = $2 AND wallet_id = $3")?, + None => tx.prepare_cached("DELETE FROM tags_plaintext WHERE item_id = $1 AND name = $2")? + }; for tag_name in tag_names { - match tag_name { - &TagName::OfEncrypted(ref tag_name) => enc_tag_delete_stmt.execute(&[&item_id, tag_name])?, - &TagName::OfPlain(ref tag_name) => plain_tag_delete_stmt.execute(&[&item_id, tag_name])?, + match query_qualifier { + Some(_) => + match tag_name { + &TagName::OfEncrypted(ref tag_name) => enc_tag_delete_stmt.execute(&[&item_id, tag_name, &self.wallet_id])?, + &TagName::OfPlain(ref tag_name) => plain_tag_delete_stmt.execute(&[&item_id, tag_name, &self.wallet_id])?, + }, + None => + match tag_name { + &TagName::OfEncrypted(ref tag_name) => enc_tag_delete_stmt.execute(&[&item_id, tag_name])?, + &TagName::OfPlain(ref tag_name) => plain_tag_delete_stmt.execute(&[&item_id, tag_name])?, + } }; } } @@ -1103,10 +1248,19 @@ impl WalletStorage for PostgresStorage { fn delete(&self, type_: &[u8], id: &[u8]) -> Result<(), WalletStorageError> { let pool = self.pool.clone(); let conn = pool.get().unwrap(); - let row_count = conn.execute( - "DELETE FROM items where type = $1 AND name = $2", - &[&type_.to_vec(), &id.to_vec()] - )?; + let query_qualifier = unsafe { + SELECTED_STRATEGY.query_qualifier() + }; + let row_count = match query_qualifier { + Some(_) => conn.execute( + "DELETE FROM items where type = $1 AND name = $2 AND wallet_id = $3", + &[&type_.to_vec(), &id.to_vec(), &self.wallet_id] + )?, + None => conn.execute( + "DELETE FROM items where type = $1 AND name = $2", + &[&type_.to_vec(), &id.to_vec()] + )? + }; if row_count == 1 { Ok(()) } else { @@ -1117,10 +1271,18 @@ impl WalletStorage for PostgresStorage { fn get_storage_metadata(&self) -> Result, WalletStorageError> { let pool = self.pool.clone(); let conn = pool.get().unwrap(); + let query_qualifier = unsafe { + SELECTED_STRATEGY.query_qualifier() + }; let res: Result, WalletStorageError> = { - let mut rows = conn.query( - "SELECT value FROM metadata", - &[]); + let mut rows = match query_qualifier { + Some(_) => conn.query( + "SELECT value FROM metadata WHERE wallet_id = $1", + &[&self.wallet_id]), + None => conn.query( + "SELECT value FROM metadata", + &[]) + }; match rows.as_mut().unwrap().iter().next() { Some(row) => Ok(row.get(0)), None => Err(WalletStorageError::ItemNotFound) @@ -1137,7 +1299,14 @@ impl WalletStorage for PostgresStorage { fn set_storage_metadata(&self, metadata: &[u8]) -> Result<(), WalletStorageError> { let pool = self.pool.clone(); let conn = pool.get().unwrap(); - match conn.execute("UPDATE metadata SET value = $1", &[&metadata.to_vec()]) { + let query_qualifier = unsafe { + SELECTED_STRATEGY.query_qualifier() + }; + let res = match query_qualifier { + Some(_) => conn.execute("UPDATE metadata SET value = $1 WHERE wallet_id = $2", &[&metadata.to_vec(), &self.wallet_id]), + None => conn.execute("UPDATE metadata SET value = $1", &[&metadata.to_vec()]) + }; + match res { Ok(_) => Ok(()), Err(error) => { Err(WalletStorageError::IOError(format!("Error occurred while inserting the keys: {}", error))) @@ -1146,7 +1315,13 @@ impl WalletStorage for PostgresStorage { } fn get_all(&self) -> Result, WalletStorageError> { - let statement = self._prepare_statement("SELECT id, name, value, key, type FROM items")?; + let query_qualifier = unsafe { + SELECTED_STRATEGY.query_qualifier() + }; + let statement = match query_qualifier { + Some(_) => self._prepare_statement("SELECT id, name, value, key, type FROM items WHERE wallet_id = $2")?, + None => self._prepare_statement("SELECT id, name, value, key, type FROM items")? + }; let fetch_options = RecordOptions { retrieve_type: true, retrieve_value: true, @@ -1155,10 +1330,14 @@ impl WalletStorage for PostgresStorage { let pool = self.pool.clone(); let tag_retriever = Some(TagRetriever::new_owned(Rc::new(pool.get().unwrap()).clone())?); - let storage_iterator = PostgresStorageIterator::new(Some(statement), &[], fetch_options, tag_retriever, None)?; + let storage_iterator = match query_qualifier { + Some(_) => PostgresStorageIterator::new(Some(statement), &[&self.wallet_id], fetch_options, tag_retriever, None)?, + None => PostgresStorageIterator::new(Some(statement), &[], fetch_options, tag_retriever, None)? + }; Ok(Box::new(storage_iterator)) } + // TODO add wallet_id limitation to search fn search(&self, type_: &[u8], query: &language::Operator, options: Option<&str>) -> Result, WalletStorageError> { let type_ = type_.to_vec(); // FIXME @@ -1169,6 +1348,10 @@ impl WalletStorage for PostgresStorage { let pool = self.pool.clone(); let conn = pool.get().unwrap(); + // TODO add wallet_id limitation to search + let query_qualifier = unsafe { + SELECTED_STRATEGY.query_qualifier() + }; let total_count: Option = if search_options.retrieve_total_count { let (query_string, query_arguments) = query::wql_to_sql_count(&type_, query)?; @@ -1211,6 +1394,7 @@ impl WalletStorage for PostgresStorage { fn close(&mut self) -> Result<(), WalletStorageError> { //let pool = self.pool.clone(); //let conn = pool.get().unwrap(); + // TODO throws a borrow error; temporary workaround is to rely on idle connection timeout //let _ret = conn.finish(); Ok(()) } From 7eb2f15398624f2a41c18ca055c8d329080c11d4 Mon Sep 17 00:00:00 2001 From: Ian Costanzo Date: Sat, 6 Jul 2019 08:18:19 -0700 Subject: [PATCH 008/320] Unit tests for multi scheme Signed-off-by: Ian Costanzo --- .../plugins/postgres_storage/src/lib.rs | 20 +++- .../postgres_storage/src/postgres_storage.rs | 104 ++++++++++++++---- 2 files changed, 98 insertions(+), 26 deletions(-) diff --git a/experimental/plugins/postgres_storage/src/lib.rs b/experimental/plugins/postgres_storage/src/lib.rs index 1fa2094331..bf8dbf5862 100644 --- a/experimental/plugins/postgres_storage/src/lib.rs +++ b/experimental/plugins/postgres_storage/src/lib.rs @@ -1014,8 +1014,8 @@ mod tests { use wql::storage::ENCRYPTED_KEY_LEN; // TODO We need init() to be the first test run in order to create the wallets database - #[test] - fn postgres_storage_type_init_works() { + //#[test] + fn _postgres_storage_type_init_works() { _cleanup(); let config = _wallet_config(); @@ -1706,6 +1706,10 @@ mod tests { let config = _wallet_config(); let credentials = _wallet_credentials(); + let err = PostgresWallet::init(config.as_ref().map_or(ptr::null(), |x| x.as_ptr()), + credentials.as_ref().map_or(ptr::null(), |x| x.as_ptr())); + assert_eq!(err, ErrorCode::Success); + let _err = PostgresWallet::delete(id.as_ptr(), config.as_ref().map_or(ptr::null(), |x| x.as_ptr()), credentials.as_ref().map_or(ptr::null(), |x| x.as_ptr())); @@ -1716,8 +1720,18 @@ mod tests { } fn _wallet_config() -> Option { + return _wallet_config_multi(); + //let config = Some(json!({ + // "url": "localhost:5432".to_owned() + //}).to_string()); + //config.map(CString::new) + // .map_or(Ok(None), |r| r.map(Some)).unwrap() + } + + fn _wallet_config_multi() -> Option { let config = Some(json!({ - "url": "localhost:5432".to_owned() + "url": "localhost:5432".to_owned(), + "wallet_scheme": "MultiWalletSingleTable".to_owned() }).to_string()); config.map(CString::new) .map_or(Ok(None), |r| r.map(Some)).unwrap() diff --git a/experimental/plugins/postgres_storage/src/postgres_storage.rs b/experimental/plugins/postgres_storage/src/postgres_storage.rs index 595c45ae53..fafc194d36 100644 --- a/experimental/plugins/postgres_storage/src/postgres_storage.rs +++ b/experimental/plugins/postgres_storage/src/postgres_storage.rs @@ -438,6 +438,8 @@ trait WalletStrategy { fn init_storage(&self, config: &PostgresConfig, credentials: &PostgresCredentials) -> Result<(), WalletStorageError>; // initialize a single wallet based on wallet storage strategy fn create_wallet(&self, id: &str, config: &PostgresConfig, credentials: &PostgresCredentials, metadata: &[u8]) -> Result<(), WalletStorageError>; + // open a wallet based on wallet storage strategy + fn open_wallet(&self, id: &str, config: &PostgresConfig, credentials: &PostgresCredentials) -> Result, WalletStorageError>; // delete a single wallet based on wallet storage strategy fn delete_wallet(&self, id: &str, config: &PostgresConfig, credentials: &PostgresCredentials) -> Result<(), WalletStorageError>; // determine phyisical table name based on wallet strategy @@ -515,6 +517,31 @@ impl WalletStrategy for DatabasePerWalletStrategy { conn.finish()?; ret } + // open a wallet based on wallet storage strategy + fn open_wallet(&self, id: &str, config: &PostgresConfig, credentials: &PostgresCredentials) -> Result, WalletStorageError> { + + let url = PostgresStorageType::_postgres_url(id, &config, &credentials); + + // don't need a connection, but connect just to verify we can + let _conn = match postgres::Connection::connect(&url[..], config.tls()) { + Ok(conn) => conn, + Err(_) => return Err(WalletStorageError::NotFound) + }; + + let manager = match PostgresConnectionManager::new(&url[..], config.r2d2_tls()) { + Ok(manager) => manager, + Err(_) => return Err(WalletStorageError::NotFound) + }; + let pool = match r2d2::Pool::builder().min_idle(Some(config.min_idle_time())).max_size(config.max_connections()).idle_timeout(Some(Duration::new(config.connection_timeout(), 0))).build(manager) { + Ok(pool) => pool, + Err(_) => return Err(WalletStorageError::NotFound) + }; + + Ok(Box::new(PostgresStorage { + pool: pool, + wallet_id: id.to_string() + })) + } // delete a single wallet based on wallet storage strategy fn delete_wallet(&self, id: &str, config: &PostgresConfig, credentials: &PostgresCredentials) -> Result<(), WalletStorageError> { // if admin user and password aren't provided then bail @@ -578,6 +605,10 @@ impl WalletStrategy for MultiWalletSingleTableStrategy { if error.code() != Some(&postgres::error::DUPLICATE_DATABASE) { conn.finish()?; return Err(WalletStorageError::IOError(format!("Error occurred while creating the database: {}", error))) + } else { + // if database already exists, assume tables are created already and return + conn.finish()?; + return Ok(()); } } conn.finish()?; @@ -624,6 +655,33 @@ impl WalletStrategy for MultiWalletSingleTableStrategy { conn.finish()?; ret } + // open a wallet based on wallet storage strategy + fn open_wallet(&self, id: &str, config: &PostgresConfig, credentials: &PostgresCredentials) -> Result, WalletStorageError> { + + let url = PostgresStorageType::_postgres_url(_WALLETS_DB, &config, &credentials); + + // don't need a connection, but connect just to verify we can + let _conn = match postgres::Connection::connect(&url[..], config.tls()) { + Ok(conn) => conn, + Err(_) => return Err(WalletStorageError::NotFound) + }; + + let manager = match PostgresConnectionManager::new(&url[..], config.r2d2_tls()) { + Ok(manager) => manager, + Err(_) => return Err(WalletStorageError::NotFound) + }; + let pool = match r2d2::Pool::builder().min_idle(Some(config.min_idle_time())).max_size(config.max_connections()).idle_timeout(Some(Duration::new(config.connection_timeout(), 0))).build(manager) { + Ok(pool) => pool, + Err(_) => return Err(WalletStorageError::NotFound) + }; + + // TODO select meta-data for this wallet to ensure it exists + + Ok(Box::new(PostgresStorage { + pool: pool, + wallet_id: id.to_string() + })) + } // delete a single wallet based on wallet storage strategy fn delete_wallet(&self, id: &str, config: &PostgresConfig, credentials: &PostgresCredentials) -> Result<(), WalletStorageError> { let url = PostgresStorageType::_postgres_url(&_WALLETS_DB, &config, &credentials); @@ -678,8 +736,14 @@ impl WalletStrategy for MultiWalletMultiTableStrategy { // TODO Ok(()) } + // open a wallet based on wallet storage strategy + fn open_wallet(&self, _id: &str, _config: &PostgresConfig, _credentials: &PostgresCredentials) -> Result, WalletStorageError> { + // TODO + Err(WalletStorageError::NotFound) + } // delete a single wallet based on wallet storage strategy fn delete_wallet(&self, _id: &str, _config: &PostgresConfig, _credentials: &PostgresCredentials) -> Result<(), WalletStorageError> { + // TODO Ok(()) } // determine phyisical table name based on wallet strategy @@ -1319,7 +1383,7 @@ impl WalletStorage for PostgresStorage { SELECTED_STRATEGY.query_qualifier() }; let statement = match query_qualifier { - Some(_) => self._prepare_statement("SELECT id, name, value, key, type FROM items WHERE wallet_id = $2")?, + Some(_) => self._prepare_statement("SELECT id, name, value, key, type FROM items WHERE wallet_id = $1")?, None => self._prepare_statement("SELECT id, name, value, key, type FROM items")? }; let fetch_options = RecordOptions { @@ -1620,27 +1684,10 @@ impl WalletStorageType for PostgresStorageType { None => return Err(WalletStorageError::ConfigError) }; - let url = PostgresStorageType::_postgres_url(id, &config, &credentials); - - // don't need a connection, but connect just to verify we can - let _conn = match postgres::Connection::connect(&url[..], config.tls()) { - Ok(conn) => conn, - Err(_) => return Err(WalletStorageError::NotFound) - }; - - let manager = match PostgresConnectionManager::new(&url[..], config.r2d2_tls()) { - Ok(manager) => manager, - Err(_) => return Err(WalletStorageError::NotFound) - }; - let pool = match r2d2::Pool::builder().min_idle(Some(config.min_idle_time())).max_size(config.max_connections()).idle_timeout(Some(Duration::new(config.connection_timeout(), 0))).build(manager) { - Ok(pool) => pool, - Err(_) => return Err(WalletStorageError::NotFound) - }; - - Ok(Box::new(PostgresStorage { - pool: pool, - wallet_id: id.to_string() - })) + // initialize using the global selected_strategy object + unsafe { + return SELECTED_STRATEGY.open_wallet(id, &config, &credentials); + } } } @@ -2117,6 +2164,8 @@ mod tests { fn _cleanup() { let storage_type = PostgresStorageType::new(); + + let _res = storage_type.init_storage(Some(&_wallet_config()[..]), Some(&_wallet_credentials()[..])).unwrap(); let _ret = storage_type.delete_storage(_wallet_id(), Some(&_wallet_config()[..]), Some(&_wallet_credentials()[..])); let res = test::cleanup_storage(); res @@ -2141,8 +2190,17 @@ mod tests { } fn _wallet_config() -> String { + return _wallet_config_multi(); + //let config = json!({ + // "url": "localhost:5432".to_owned() + //}).to_string(); + //config + } + + fn _wallet_config_multi() -> String { let config = json!({ - "url": "localhost:5432".to_owned() + "url": "localhost:5432".to_owned(), + "wallet_scheme": "MultiWalletSingleTable".to_owned() }).to_string(); config } From f44454277e315e0b1a6d2865d2b2b6580d9a935d Mon Sep 17 00:00:00 2001 From: Ian Costanzo Date: Sat, 6 Jul 2019 08:24:35 -0700 Subject: [PATCH 009/320] Unit tests for multi scheme Signed-off-by: Ian Costanzo --- .../postgres_storage/src/postgres_storage.rs | 24 ++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/experimental/plugins/postgres_storage/src/postgres_storage.rs b/experimental/plugins/postgres_storage/src/postgres_storage.rs index fafc194d36..7d9d8a3d3c 100644 --- a/experimental/plugins/postgres_storage/src/postgres_storage.rs +++ b/experimental/plugins/postgres_storage/src/postgres_storage.rs @@ -528,6 +528,8 @@ impl WalletStrategy for DatabasePerWalletStrategy { Err(_) => return Err(WalletStorageError::NotFound) }; + // TODO close _conn + let manager = match PostgresConnectionManager::new(&url[..], config.r2d2_tls()) { Ok(manager) => manager, Err(_) => return Err(WalletStorageError::NotFound) @@ -661,11 +663,29 @@ impl WalletStrategy for MultiWalletSingleTableStrategy { let url = PostgresStorageType::_postgres_url(_WALLETS_DB, &config, &credentials); // don't need a connection, but connect just to verify we can - let _conn = match postgres::Connection::connect(&url[..], config.tls()) { + let conn = match postgres::Connection::connect(&url[..], config.tls()) { Ok(conn) => conn, Err(_) => return Err(WalletStorageError::NotFound) }; + // select metadata for this wallet to ensure it exists + let res: Result, WalletStorageError> = { + let mut rows = conn.query( + "SELECT value FROM metadata WHERE wallet_id = $1", + &[&id]); + match rows.as_mut().unwrap().iter().next() { + Some(row) => Ok(row.get(0)), + None => Err(WalletStorageError::ItemNotFound) + } + }; + + match res { + Ok(_entity) => (), + Err(_) => return Err(WalletStorageError::NotFound) + }; + + // TODO close conn + let manager = match PostgresConnectionManager::new(&url[..], config.r2d2_tls()) { Ok(manager) => manager, Err(_) => return Err(WalletStorageError::NotFound) @@ -675,8 +695,6 @@ impl WalletStrategy for MultiWalletSingleTableStrategy { Err(_) => return Err(WalletStorageError::NotFound) }; - // TODO select meta-data for this wallet to ensure it exists - Ok(Box::new(PostgresStorage { pool: pool, wallet_id: id.to_string() From 5f542823da36fb365585e6fbd80c788bddb2f47a Mon Sep 17 00:00:00 2001 From: Ian Costanzo Date: Sat, 6 Jul 2019 09:04:36 -0700 Subject: [PATCH 010/320] Use env var to configure single or multi wallet database test mode Signed-off-by: Ian Costanzo --- .../plugins/postgres_storage/README.md | 22 +++++++++++++++++++ .../plugins/postgres_storage/src/lib.rs | 21 +++++++++++++----- .../postgres_storage/src/postgres_storage.rs | 19 +++++++++++----- 3 files changed, 51 insertions(+), 11 deletions(-) diff --git a/experimental/plugins/postgres_storage/README.md b/experimental/plugins/postgres_storage/README.md index c52b505fa1..da810a3727 100644 --- a/experimental/plugins/postgres_storage/README.md +++ b/experimental/plugins/postgres_storage/README.md @@ -75,6 +75,28 @@ cd indy-sdk/experimental/plugins/postgres_storage RUST_BACKTRACE=1 cargo test -- --nocapture --test-threads=1 ``` +## Database-per-wallet vs Multi-wallet database + +The plug-in supports two schemes - a database per wallet, or a single database containing multiple wallets. + +Note to use the multi-wallet-database mode you need to call an initial init() function in the plug-in. + +In the initial wallet config: + +``` +{"url":"localhost:5432", "wallet_scheme":"MultiWalletSingleTable"} +``` + +The default if not specified is database-per-wallet. + +To run unit tests in each mode, specify: + +``` +WALLET_SCHEME=MultiWalletSingleTable cargo test -- --nocapture --test-threads=1 +``` + +The default if not specified is database-per-wallet. + ## Running CLI with the Postgres Plug-in The CLI has been updated to include parameters to support loading external wallet storage from an external plug-in, and extra parameters to specify configuration and credentials when creating, opening and deleting a wallet: diff --git a/experimental/plugins/postgres_storage/src/lib.rs b/experimental/plugins/postgres_storage/src/lib.rs index bf8dbf5862..a7dce9809c 100644 --- a/experimental/plugins/postgres_storage/src/lib.rs +++ b/experimental/plugins/postgres_storage/src/lib.rs @@ -1009,6 +1009,7 @@ fn _tag_names_from_json(json: &str) -> Result, WalletStorageError> #[cfg(test)] mod tests { use super::*; + use std::env; use std::ffi::{CString, CStr}; use std::{slice, ptr}; use wql::storage::ENCRYPTED_KEY_LEN; @@ -1720,12 +1721,20 @@ mod tests { } fn _wallet_config() -> Option { - return _wallet_config_multi(); - //let config = Some(json!({ - // "url": "localhost:5432".to_owned() - //}).to_string()); - //config.map(CString::new) - // .map_or(Ok(None), |r| r.map(Some)).unwrap() + let wallet_scheme = env::var("WALLET_SCHEME"); + match wallet_scheme { + Ok(scheme) => { + if scheme == "MultiWalletSingleTable" { + return _wallet_config_multi(); + } + }, + Err(_) => () + }; + let config = Some(json!({ + "url": "localhost:5432".to_owned() + }).to_string()); + config.map(CString::new) + .map_or(Ok(None), |r| r.map(Some)).unwrap() } fn _wallet_config_multi() -> Option { diff --git a/experimental/plugins/postgres_storage/src/postgres_storage.rs b/experimental/plugins/postgres_storage/src/postgres_storage.rs index 7d9d8a3d3c..489707371b 100644 --- a/experimental/plugins/postgres_storage/src/postgres_storage.rs +++ b/experimental/plugins/postgres_storage/src/postgres_storage.rs @@ -1713,6 +1713,7 @@ impl WalletStorageType for PostgresStorageType { #[cfg(test)] mod tests { use super::*; + use std::env; use utils::test; @@ -2208,11 +2209,19 @@ mod tests { } fn _wallet_config() -> String { - return _wallet_config_multi(); - //let config = json!({ - // "url": "localhost:5432".to_owned() - //}).to_string(); - //config + let wallet_scheme = env::var("WALLET_SCHEME"); + match wallet_scheme { + Ok(scheme) => { + if scheme == "MultiWalletSingleTable" { + return _wallet_config_multi(); + } + }, + Err(_) => () + }; + let config = json!({ + "url": "localhost:5432".to_owned() + }).to_string(); + config } fn _wallet_config_multi() -> String { From e2a579fb64dc892289a400d4b50ae92285a3dd52 Mon Sep 17 00:00:00 2001 From: Ian Costanzo Date: Mon, 8 Jul 2019 07:52:55 -0700 Subject: [PATCH 011/320] Update search for multi-wallet db support Signed-off-by: Ian Costanzo --- .../postgres_storage/src/postgres_storage.rs | 27 +++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/experimental/plugins/postgres_storage/src/postgres_storage.rs b/experimental/plugins/postgres_storage/src/postgres_storage.rs index 489707371b..f9ce255a5f 100644 --- a/experimental/plugins/postgres_storage/src/postgres_storage.rs +++ b/experimental/plugins/postgres_storage/src/postgres_storage.rs @@ -1434,8 +1434,20 @@ impl WalletStorage for PostgresStorage { let query_qualifier = unsafe { SELECTED_STRATEGY.query_qualifier() }; + let wallet_id_arg = self.wallet_id.as_bytes().to_owned(); let total_count: Option = if search_options.retrieve_total_count { - let (query_string, query_arguments) = query::wql_to_sql_count(&type_, query)?; + // TODO add an extra parameter with the SELECTED_STRATEGY.query_qualifier to AND to the query + //let (query_string, query_arguments) = query::wql_to_sql_count(&type_, query)?; + let (query_string, query_arguments) = match query_qualifier { + Some(_) => { + let (mut query_string, mut query_arguments) = query::wql_to_sql_count(&type_, query)?; + query_arguments.push(&wallet_id_arg); + let arg_str = format!(" AND wallet_id = ${}", query_arguments.len()); + query_string.push_str(&arg_str); + (query_string, query_arguments) + }, + None => query::wql_to_sql_count(&type_, query)? + }; let mut rows = conn.query( &query_string, @@ -1456,7 +1468,18 @@ impl WalletStorage for PostgresStorage { retrieve_type: search_options.retrieve_type, }; - let (query_string, query_arguments) = query::wql_to_sql(&type_, query, options)?; + // TODO add an extra parameter with the SELECTED_STRATEGY.query_qualifier to AND to the query + //let (query_string, query_arguments) = query::wql_to_sql(&type_, query, options)?; + let (query_string, query_arguments) = match query_qualifier { + Some(_) => { + let (mut query_string, mut query_arguments) = query::wql_to_sql(&type_, query, options)?; + query_arguments.push(&wallet_id_arg); + let arg_str = format!(" AND wallet_id = ${}", query_arguments.len()); + query_string.push_str(&arg_str); + (query_string, query_arguments) + }, + None => query::wql_to_sql(&type_, query, options)? + }; let statement = self._prepare_statement(&query_string)?; let tag_retriever = if fetch_options.retrieve_tags { From b05729721752061474632e39bef2f5f74d60ed74 Mon Sep 17 00:00:00 2001 From: Ian Costanzo Date: Wed, 10 Jul 2019 07:58:49 -0700 Subject: [PATCH 012/320] Remove allow unauth Signed-off-by: Ian Costanzo --- ci/indy-pool.dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/indy-pool.dockerfile b/ci/indy-pool.dockerfile index 30b824e70c..7fc1d52c11 100644 --- a/ci/indy-pool.dockerfile +++ b/ci/indy-pool.dockerfile @@ -29,7 +29,7 @@ ARG indy_node_ver=1.9.0~dev1025 ARG python3_indy_crypto_ver=0.4.5 ARG indy_crypto_ver=0.4.5 -RUN apt-get update -y && apt-get install -y --allow-unauthenticated \ +RUN apt-get update -y && apt-get install -y \ indy-plenum=${indy_plenum_ver} \ indy-node=${indy_node_ver} \ python3-indy-crypto=${python3_indy_crypto_ver} \ From c9b965440a7afbd6bea0f3daeae71087bb65437c Mon Sep 17 00:00:00 2001 From: Ian Costanzo Date: Wed, 10 Jul 2019 09:04:03 -0700 Subject: [PATCH 013/320] Remove dead code Signed-off-by: Ian Costanzo --- experimental/plugins/postgres_storage/src/lib.rs | 13 ------------- .../postgres_storage/src/postgres_storage.rs | 11 +---------- 2 files changed, 1 insertion(+), 23 deletions(-) diff --git a/experimental/plugins/postgres_storage/src/lib.rs b/experimental/plugins/postgres_storage/src/lib.rs index a7dce9809c..d46052747e 100644 --- a/experimental/plugins/postgres_storage/src/lib.rs +++ b/experimental/plugins/postgres_storage/src/lib.rs @@ -1014,19 +1014,6 @@ mod tests { use std::{slice, ptr}; use wql::storage::ENCRYPTED_KEY_LEN; - // TODO We need init() to be the first test run in order to create the wallets database - //#[test] - fn _postgres_storage_type_init_works() { - _cleanup(); - - let config = _wallet_config(); - let credentials = _wallet_credentials(); - - let err = PostgresWallet::init(config.as_ref().map_or(ptr::null(), |x| x.as_ptr()), - credentials.as_ref().map_or(ptr::null(), |x| x.as_ptr())); - assert_eq!(err, ErrorCode::Success); - } - #[test] fn postgres_wallet_crud_works() { _cleanup(); diff --git a/experimental/plugins/postgres_storage/src/postgres_storage.rs b/experimental/plugins/postgres_storage/src/postgres_storage.rs index f9ce255a5f..5b969a7b0a 100644 --- a/experimental/plugins/postgres_storage/src/postgres_storage.rs +++ b/experimental/plugins/postgres_storage/src/postgres_storage.rs @@ -1419,7 +1419,6 @@ impl WalletStorage for PostgresStorage { Ok(Box::new(storage_iterator)) } - // TODO add wallet_id limitation to search fn search(&self, type_: &[u8], query: &language::Operator, options: Option<&str>) -> Result, WalletStorageError> { let type_ = type_.to_vec(); // FIXME @@ -1430,14 +1429,11 @@ impl WalletStorage for PostgresStorage { let pool = self.pool.clone(); let conn = pool.get().unwrap(); - // TODO add wallet_id limitation to search let query_qualifier = unsafe { SELECTED_STRATEGY.query_qualifier() }; let wallet_id_arg = self.wallet_id.as_bytes().to_owned(); let total_count: Option = if search_options.retrieve_total_count { - // TODO add an extra parameter with the SELECTED_STRATEGY.query_qualifier to AND to the query - //let (query_string, query_arguments) = query::wql_to_sql_count(&type_, query)?; let (query_string, query_arguments) = match query_qualifier { Some(_) => { let (mut query_string, mut query_arguments) = query::wql_to_sql_count(&type_, query)?; @@ -1468,8 +1464,6 @@ impl WalletStorage for PostgresStorage { retrieve_type: search_options.retrieve_type, }; - // TODO add an extra parameter with the SELECTED_STRATEGY.query_qualifier to AND to the query - //let (query_string, query_arguments) = query::wql_to_sql(&type_, query, options)?; let (query_string, query_arguments) = match query_qualifier { Some(_) => { let (mut query_string, mut query_arguments) = query::wql_to_sql(&type_, query, options)?; @@ -1497,10 +1491,7 @@ impl WalletStorage for PostgresStorage { } fn close(&mut self) -> Result<(), WalletStorageError> { - //let pool = self.pool.clone(); - //let conn = pool.get().unwrap(); - // TODO throws a borrow error; temporary workaround is to rely on idle connection timeout - //let _ret = conn.finish(); + // TODO throws a borrow error if we try to close the connection here; temporary workaround is to rely on idle connection timeout Ok(()) } } From 3a2ce7638d8cdd21bf65043006c814e09c5a77c4 Mon Sep 17 00:00:00 2001 From: Ian Costanzo Date: Thu, 11 Jul 2019 08:57:59 -0700 Subject: [PATCH 014/320] Fixes for wallet search, and additional docs Signed-off-by: Ian Costanzo --- .../plugins/postgres_storage/README.md | 80 +++++++++++++++++++ .../plugins/postgres_storage/src/lib.rs | 5 ++ .../postgres_storage/src/postgres_storage.rs | 6 +- 3 files changed, 88 insertions(+), 3 deletions(-) diff --git a/experimental/plugins/postgres_storage/README.md b/experimental/plugins/postgres_storage/README.md index da810a3727..659a7cf482 100644 --- a/experimental/plugins/postgres_storage/README.md +++ b/experimental/plugins/postgres_storage/README.md @@ -97,6 +97,86 @@ WALLET_SCHEME=MultiWalletSingleTable cargo test -- --nocapture --test-threads=1 The default if not specified is database-per-wallet. +## Loading and initializing the Postgres Plug-in + +There are two initialization methods to call now. (The default postgres method is wallet-per-database so if this is the one you want you don't need to make the second call.) + +You can see an example of how to load the library here: https://github.com/ianco/indy-sdk/blob/plugin_storage_tests/libindy/tests/utils/wallet.rs#L380 + +(Note that this is to support unit tests so the error handling isn't perfect.) + +``` +/* + * Dynamically loads the specified library and registers storage + */ +pub fn load_storage_library(_stg_type: &str, library: &str, initializer: &str, config: &str, credentials: &str) -> Result<(), ()> { + let lib_res = _load_lib(library); + match lib_res { + Ok(lib) => { + unsafe { + let init_func: libloading::Symbol ErrorCode> = lib.get(initializer.as_bytes()).unwrap(); + + match init_func() { + ErrorCode::Success => println!("Plugin has been loaded: \"{}\"", library), + _ => return Err(println!("Plugin has not been loaded: \"{}\"", library)) + } + + // call the one-time storage init() method to initialize storage + let init_storage_func: libloading::Symbol ErrorCode> = lib.get("init_storagetype".as_bytes()).unwrap(); + + let config = CString::new(config).expect("CString::new failed"); + let credentials = CString::new(credentials).expect("CString::new failed"); + + let err = init_storage_func(config.as_ptr(), credentials.as_ptr()); + + if err != ErrorCode::Success { + return Err(println!("Error init_storage returned an error {:?}", err)); + } + println!("Called init_storagetype() function successfully"); + } + }, + Err(_) => return Err(println!("Plugin has not been loaded: \"{}\"", library)) + } + + Ok(()) +} +``` + +## Unit testing the Postgres Plug-in + +This module contains some stand-alone unit tests, however there are also capabilities to run some of the general indy-sdk unit tests using the postgres plug-in (in both database-per-wallet and multi-wallet modes). + +The code is on this branch, as it has not been accepted into the indy-sdk: https://github.com/ianco/indy-sdk/tree/plugin_storage_tests + +To run the tests: + +```bash +git clone https://github.com/ianco/indy-sdk.git +git checkout plugin_storage_tests +cd indy-sdk/libindy +``` + +... or merge the code from this branch into a branch of your own fork of the indy-sdk repo. + +Build the libraries as usual ("cargo build" in libindy and postgres). + +Then to run the unit tests: + +```bash +RUST_BACKTRACE=1 STG_USE=postgres cargo test high_cases -- --nocapture --test-threads=1 +``` + +... or: + +```bash +RUST_BACKTRACE=1 STG_USE=postgres_multi cargo test high_cases -- --nocapture --test-threads=1 +``` + +The ```STG_USE``` is a shortcut, you can specify plug-in parameters in detail. Take a look at the code here: https://github.com/ianco/indy-sdk/blob/plugin_storage_tests/libindy/tests/utils/wallet.rs#L491 + +Some of the unit tests respect these parameters, and some don't. Mostly the wallet and non-secrets tests in the tests directory. + + ## Running CLI with the Postgres Plug-in The CLI has been updated to include parameters to support loading external wallet storage from an external plug-in, and extra parameters to specify configuration and credentials when creating, opening and deleting a wallet: diff --git a/experimental/plugins/postgres_storage/src/lib.rs b/experimental/plugins/postgres_storage/src/lib.rs index d46052747e..a7d2d63dd0 100644 --- a/experimental/plugins/postgres_storage/src/lib.rs +++ b/experimental/plugins/postgres_storage/src/lib.rs @@ -86,6 +86,11 @@ pub extern fn postgresstorage_init() -> libindy::ErrorCode { ) } +#[no_mangle] +pub extern fn init_storagetype(config: *const c_char, credentials: *const c_char) -> libindy::ErrorCode { + return PostgresWallet::init(config, credentials); +} + struct PostgresStorageContext { // TODO save handle, config and credentials in case we need to re-connect to database _xhandle: i32, // reference returned to client to track open wallet connection diff --git a/experimental/plugins/postgres_storage/src/postgres_storage.rs b/experimental/plugins/postgres_storage/src/postgres_storage.rs index 5b969a7b0a..b21666692e 100644 --- a/experimental/plugins/postgres_storage/src/postgres_storage.rs +++ b/experimental/plugins/postgres_storage/src/postgres_storage.rs @@ -1432,13 +1432,13 @@ impl WalletStorage for PostgresStorage { let query_qualifier = unsafe { SELECTED_STRATEGY.query_qualifier() }; - let wallet_id_arg = self.wallet_id.as_bytes().to_owned(); + let wallet_id_arg = self.wallet_id.to_owned(); let total_count: Option = if search_options.retrieve_total_count { let (query_string, query_arguments) = match query_qualifier { Some(_) => { let (mut query_string, mut query_arguments) = query::wql_to_sql_count(&type_, query)?; query_arguments.push(&wallet_id_arg); - let arg_str = format!(" AND wallet_id = ${}", query_arguments.len()); + let arg_str = format!(" AND i.wallet_id = ${}", query_arguments.len()); query_string.push_str(&arg_str); (query_string, query_arguments) }, @@ -1468,7 +1468,7 @@ impl WalletStorage for PostgresStorage { Some(_) => { let (mut query_string, mut query_arguments) = query::wql_to_sql(&type_, query, options)?; query_arguments.push(&wallet_id_arg); - let arg_str = format!(" AND wallet_id = ${}", query_arguments.len()); + let arg_str = format!(" AND i.wallet_id = ${}", query_arguments.len()); query_string.push_str(&arg_str); (query_string, query_arguments) }, From 2ee7ac8dce5019857cd6d5b66206e6222bfd39cd Mon Sep 17 00:00:00 2001 From: Ian Costanzo Date: Fri, 12 Jul 2019 08:06:15 -0700 Subject: [PATCH 015/320] Add postgres multi supper to getting started example Signed-off-by: Ian Costanzo --- .../postgres-getting-started-multi.sh | 3 +++ .../postgres_storage/postgres-getting-started.sh | 2 +- samples/python/src/getting_started.py | 12 ++++++++++++ 3 files changed, 16 insertions(+), 1 deletion(-) create mode 100755 experimental/plugins/postgres_storage/postgres-getting-started-multi.sh diff --git a/experimental/plugins/postgres_storage/postgres-getting-started-multi.sh b/experimental/plugins/postgres_storage/postgres-getting-started-multi.sh new file mode 100755 index 0000000000..6a54cd6a36 --- /dev/null +++ b/experimental/plugins/postgres_storage/postgres-getting-started-multi.sh @@ -0,0 +1,3 @@ +cd ../../../samples/python && \ +PYTHONPATH=.:../../wrappers/python/ python3 src/getting_started.py -t postgres_storage -l libindystrgpostgres.so -e postgresstorage_init -c '{"url":"localhost:5432","wallet_scheme":"MultiWalletSingleTable"}' -s '{"account":"postgres","password":"mysecretpassword","admin_account":"postgres","admin_password":"mysecretpassword"}' + diff --git a/experimental/plugins/postgres_storage/postgres-getting-started.sh b/experimental/plugins/postgres_storage/postgres-getting-started.sh index c45d7f0cfb..e1f158fc4e 100755 --- a/experimental/plugins/postgres_storage/postgres-getting-started.sh +++ b/experimental/plugins/postgres_storage/postgres-getting-started.sh @@ -1,3 +1,3 @@ cd ../../../samples/python && \ -PYTHONPATH=.:../../wrappers/python/ python3 src/getting_started.py -t postgres_storage -l ../../experimental/plugins/postgres_storage/target/debug/libindystrgpostgres.so -e postgresstorage_init -c '{"url":"localhost:5432"}' -s '{"account":"postgres","password":"mysecretpassword","admin_account":"postgres","admin_password":"mysecretpassword"}' +PYTHONPATH=.:../../wrappers/python/ python3 src/getting_started.py -t postgres_storage -l libindystrgpostgres.so -e postgresstorage_init -c '{"url":"localhost:5432"}' -s '{"account":"postgres","password":"mysecretpassword","admin_account":"postgres","admin_password":"mysecretpassword"}' diff --git a/samples/python/src/getting_started.py b/samples/python/src/getting_started.py index 6f2956247b..8f28bef439 100644 --- a/samples/python/src/getting_started.py +++ b/samples/python/src/getting_started.py @@ -38,6 +38,18 @@ print("Error unable to load wallet storage", result) parser.print_help() sys.exit(0) + + # for postgres storage, also call the storage init (non-standard) + if args.storage_type == "postgres_storage": + try: + print("Calling init_storagetype() for postgres:", args.config, args.creds) + init_storagetype = stg_lib["init_storagetype"] + c_config = c_char_p(args.config.encode('utf-8')) + c_credentials = c_char_p(args.creds.encode('utf-8')) + result = init_storagetype(c_config, c_credentials) + print(" ... returns ", result) + except RuntimeError as e: + print("Error initializing storage, ignoring ...", e) print("Success, loaded wallet storage", args.storage_type) From d30e3e1f718263a0e341366991c52fe5704728f4 Mon Sep 17 00:00:00 2001 From: Ian Costanzo Date: Mon, 15 Jul 2019 19:31:39 -0700 Subject: [PATCH 016/320] Performance tests for postgres wallet w.i.p. Signed-off-by: Ian Costanzo --- .../postgres-getting-started-multi.sh | 2 +- .../postgres_storage/postgres-perf-multi.sh | 2 + samples/python/src/getting_started_perf.py | 1211 +++++++++++++++++ 3 files changed, 1214 insertions(+), 1 deletion(-) create mode 100755 experimental/plugins/postgres_storage/postgres-perf-multi.sh create mode 100644 samples/python/src/getting_started_perf.py diff --git a/experimental/plugins/postgres_storage/postgres-getting-started-multi.sh b/experimental/plugins/postgres_storage/postgres-getting-started-multi.sh index 6a54cd6a36..effde72c0f 100755 --- a/experimental/plugins/postgres_storage/postgres-getting-started-multi.sh +++ b/experimental/plugins/postgres_storage/postgres-getting-started-multi.sh @@ -1,3 +1,3 @@ cd ../../../samples/python && \ -PYTHONPATH=.:../../wrappers/python/ python3 src/getting_started.py -t postgres_storage -l libindystrgpostgres.so -e postgresstorage_init -c '{"url":"localhost:5432","wallet_scheme":"MultiWalletSingleTable"}' -s '{"account":"postgres","password":"mysecretpassword","admin_account":"postgres","admin_password":"mysecretpassword"}' +PYTHONPATH=.:../../wrappers/python/ python3 src/getting_started.py -t postgres_storage -l libindystrgpostgres.dylib -e postgresstorage_init -c '{"url":"localhost:5432","wallet_scheme":"MultiWalletSingleTable"}' -s '{"account":"postgres","password":"mysecretpassword","admin_account":"postgres","admin_password":"mysecretpassword"}' diff --git a/experimental/plugins/postgres_storage/postgres-perf-multi.sh b/experimental/plugins/postgres_storage/postgres-perf-multi.sh new file mode 100755 index 0000000000..73c0fd8ac8 --- /dev/null +++ b/experimental/plugins/postgres_storage/postgres-perf-multi.sh @@ -0,0 +1,2 @@ +cd ../../../samples/python && \ +PYTHONPATH=.:../../wrappers/python/ python3 src/getting_started_perf.py -t postgres_storage -l libindystrgpostgres.dylib -e postgresstorage_init -c '{"url":"localhost:5432","wallet_scheme":"MultiWalletSingleTable"}' -s '{"account":"postgres","password":"mysecretpassword","admin_account":"postgres","admin_password":"mysecretpassword"}' diff --git a/samples/python/src/getting_started_perf.py b/samples/python/src/getting_started_perf.py new file mode 100644 index 0000000000..8ba48d6da7 --- /dev/null +++ b/samples/python/src/getting_started_perf.py @@ -0,0 +1,1211 @@ +import time + +from indy import anoncreds, crypto, did, ledger, pool, wallet, blob_storage + +import json +import logging + +import argparse +import sys +from ctypes import * +from os.path import dirname + +import random +import string + +from indy.error import ErrorCode, IndyError + +from src.utils import get_pool_genesis_txn_path, run_coroutine, PROTOCOL_VERSION + +logger = logging.getLogger(__name__) +logging.basicConfig(level=logging.WARNING) + +parser = argparse.ArgumentParser(description='Run python getting-started scenario (Alice/Faber)') +parser.add_argument('-t', '--storage_type', help='load custom wallet storage plug-in') +parser.add_argument('-l', '--library', help='dynamic library to load for plug-in') +parser.add_argument('-e', '--entrypoint', help='entry point for dynamic library') +parser.add_argument('-c', '--config', help='entry point for dynamic library') +parser.add_argument('-s', '--creds', help='entry point for dynamic library') + +args = parser.parse_args() + +# random string for multiple wallets +def random_str(N): + return ''.join(random.SystemRandom().choice(string.digits) for _ in range(N)) + + +# check if we need to dyna-load a custom wallet storage plug-in +if args.storage_type: + if not (args.library and args.entrypoint): + parser.print_help() + sys.exit(0) + stg_lib = CDLL(args.library) + result = stg_lib[args.entrypoint]() + if result != 0: + print("Error unable to load wallet storage", result) + parser.print_help() + sys.exit(0) + + # for postgres storage, also call the storage init (non-standard) + if args.storage_type == "postgres_storage": + try: + print("Calling init_storagetype() for postgres:", args.config, args.creds) + init_storagetype = stg_lib["init_storagetype"] + c_config = c_char_p(args.config.encode('utf-8')) + c_credentials = c_char_p(args.creds.encode('utf-8')) + result = init_storagetype(c_config, c_credentials) + print(" ... returns ", result) + except RuntimeError as e: + print("Error initializing storage, ignoring ...", e) + + print("Success, loaded wallet storage", args.storage_type) + + +async def run(): + logger.warning("Getting started -> started") + + alice_loop_count = 10 + alice_thread_count = 1 + rev_reg_max_cred_count = (alice_loop_count * alice_thread_count) + 100 + + pool_ = { + 'name': 'pool1' + } + logger.warning("Open Pool Ledger: {}".format(pool_['name'])) + pool_['genesis_txn_path'] = get_pool_genesis_txn_path(pool_['name']) + pool_['config'] = json.dumps({"genesis_txn": str(pool_['genesis_txn_path'])}) + + # Set protocol version 2 to work with Indy Node 1.4 + await pool.set_protocol_version(PROTOCOL_VERSION) + + try: + await pool.create_pool_ledger_config(pool_['name'], pool_['config']) + except IndyError as ex: + if ex.error_code == ErrorCode.PoolLedgerConfigAlreadyExistsError: + pass + pool_['handle'] = await pool.open_pool_ledger(pool_['name'], None) + + logger.warning("==============================") + logger.warning("=== Getting Trust Anchor credentials for Faber, Acme, Thrift and Government ==") + logger.warning("------------------------------") + + logger.info("\"Sovrin Steward\" -> Create wallet") + steward = { + 'name': "Sovrin Steward", + 'wallet_config': json.dumps({'id': 'sovrin_steward_wallet'}), + 'wallet_credentials': json.dumps({'key': 'steward_wallet_key'}), + 'pool': pool_['handle'], + 'seed': '000000000000000000000000Steward1' + } + + try: + await wallet.create_wallet(steward['wallet_config'], steward['wallet_credentials']) + except IndyError as ex: + if ex.error_code == ErrorCode.WalletAlreadyExistsError: + pass + + steward['wallet'] = await wallet.open_wallet(steward['wallet_config'], steward['wallet_credentials']) + + logger.info("\"Sovrin Steward\" -> Create and store in Wallet DID from seed") + steward['did_info'] = json.dumps({'seed': steward['seed']}) + steward['did'], steward['key'] = await did.create_and_store_my_did(steward['wallet'], steward['did_info']) + + logger.info("==============================") + logger.warning("== Getting Trust Anchor credentials - Government Onboarding ==") + logger.info("------------------------------") + + government = { + 'name': 'Government', + 'wallet_config': json.dumps({'id': 'government_wallet'}), + 'wallet_credentials': json.dumps({'key': 'government_wallet_key'}), + 'pool': pool_['handle'], + 'role': 'TRUST_ANCHOR' + } + steward['did_for_government'], steward['key_for_government'], government['did_for_steward'], \ + government['key_for_steward'], _ = await onboarding(steward, government) + + logger.info("==============================") + logger.warning("== Getting Trust Anchor credentials - Government getting Verinym ==") + logger.info("------------------------------") + + government['did'] = await get_verinym(steward, steward['did_for_government'], steward['key_for_government'], + government, government['did_for_steward'], government['key_for_steward']) + + logger.info("==============================") + logger.warning("== Getting Trust Anchor credentials - Faber Onboarding ==") + logger.info("------------------------------") + + faber = { + 'name': 'Faber', + 'wallet_config': json.dumps({'id': 'faber_wallet'}), + 'wallet_credentials': json.dumps({'key': 'faber_wallet_key'}), + 'pool': pool_['handle'], + 'role': 'TRUST_ANCHOR' + } + steward['did_for_faber'], steward['key_for_faber'], faber['did_for_steward'], faber['key_for_steward'], _ = \ + await onboarding(steward, faber) + + logger.info("==============================") + logger.warning("== Getting Trust Anchor credentials - Faber getting Verinym ==") + logger.info("------------------------------") + + faber['did'] = \ + await get_verinym(steward, steward['did_for_faber'], steward['key_for_faber'], + faber, faber['did_for_steward'], faber['key_for_steward']) + + logger.info("==============================") + logger.warning("== Getting Trust Anchor credentials - Acme Onboarding ==") + logger.info("------------------------------") + + acme = { + 'name': 'Acme', + 'wallet_config': json.dumps({'id': 'acme_wallet'}), + 'wallet_credentials': json.dumps({'key': 'acme_wallet_key'}), + 'pool': pool_['handle'], + 'role': 'TRUST_ANCHOR' + } + steward['did_for_acme'], steward['key_for_acme'], acme['did_for_steward'], acme['key_for_steward'], _ = \ + await onboarding(steward, acme) + + logger.info("==============================") + logger.warning("== Getting Trust Anchor credentials - Acme getting Verinym ==") + logger.info("------------------------------") + + acme['did'] = await get_verinym(steward, steward['did_for_acme'], steward['key_for_acme'], + acme, acme['did_for_steward'], acme['key_for_steward']) + + logger.info("==============================") + logger.warning("== Getting Trust Anchor credentials - Thrift Onboarding ==") + logger.info("------------------------------") + + thrift = { + 'name': 'Thrift', + 'wallet_config': json.dumps({'id': 'thrift_wallet'}), + 'wallet_credentials': json.dumps({'key': 'thrift_wallet_key'}), + 'pool': pool_['handle'], + 'role': 'TRUST_ANCHOR' + } + steward['did_for_thrift'], steward['key_for_thrift'], thrift['did_for_steward'], thrift['key_for_steward'], _ = \ + await onboarding(steward, thrift) + + logger.info("==============================") + logger.warning("== Getting Trust Anchor credentials - Thrift getting Verinym ==") + logger.info("------------------------------") + + thrift['did'] = await get_verinym(steward, steward['did_for_thrift'], steward['key_for_thrift'], + thrift, thrift['did_for_steward'], thrift['key_for_steward']) + + logger.info("==============================") + logger.warning("=== Credential Schemas Setup ==") + logger.info("------------------------------") + + logger.info("\"Government\" -> Create \"Job-Certificate\" Schema") + job_certificate = { + 'name': 'Job-Certificate', + 'version': '0.2', + 'attributes': ['first_name', 'last_name', 'salary', 'employee_status', 'experience'] + } + (government['job_certificate_schema_id'], government['job_certificate_schema']) = \ + await anoncreds.issuer_create_schema(government['did'], job_certificate['name'], job_certificate['version'], + json.dumps(job_certificate['attributes'])) + job_certificate_schema_id = government['job_certificate_schema_id'] + + logger.info("\"Government\" -> Send \"Job-Certificate\" Schema to Ledger") + await send_schema(government['pool'], government['wallet'], government['did'], government['job_certificate_schema']) + + logger.info("\"Government\" -> Create \"Transcript\" Schema") + transcript = { + 'name': 'Transcript', + 'version': '1.2', + 'attributes': ['first_name', 'last_name', 'degree', 'status', 'year', 'average', 'ssn'] + } + (government['transcript_schema_id'], government['transcript_schema']) = \ + await anoncreds.issuer_create_schema(government['did'], transcript['name'], transcript['version'], + json.dumps(transcript['attributes'])) + transcript_schema_id = government['transcript_schema_id'] + + logger.info("\"Government\" -> Send \"Transcript\" Schema to Ledger") + await send_schema(government['pool'], government['wallet'], government['did'], government['transcript_schema']) + + time.sleep(1) # sleep 1 second before getting schema + + logger.info("==============================") + logger.warning("=== Faber Credential Definition Setup ==") + logger.info("------------------------------") + + logger.info("\"Faber\" -> Get \"Transcript\" Schema from Ledger") + (faber['transcript_schema_id'], faber['transcript_schema']) = \ + await get_schema(faber['pool'], faber['did'], transcript_schema_id) + + logger.info("\"Faber\" -> Create and store in Wallet \"Faber Transcript\" Credential Definition") + transcript_cred_def = { + 'tag': 'TAG1', + 'type': 'CL', + 'config': {"support_revocation": False} + } + (faber['transcript_cred_def_id'], faber['transcript_cred_def']) = \ + await anoncreds.issuer_create_and_store_credential_def(faber['wallet'], faber['did'], + faber['transcript_schema'], transcript_cred_def['tag'], + transcript_cred_def['type'], + json.dumps(transcript_cred_def['config'])) + + logger.info("\"Faber\" -> Send \"Faber Transcript\" Credential Definition to Ledger") + await send_cred_def(faber['pool'], faber['wallet'], faber['did'], faber['transcript_cred_def']) + + logger.info("==============================") + logger.warning("=== Acme Credential Definition Setup ==") + logger.info("------------------------------") + + logger.info("\"Acme\" -> Get from Ledger \"Job-Certificate\" Schema") + (acme['job_certificate_schema_id'], acme['job_certificate_schema']) = \ + await get_schema(acme['pool'], acme['did'], job_certificate_schema_id) + + logger.info("\"Acme\" -> Create and store in Wallet \"Acme Job-Certificate\" Credential Definition") + job_certificate_cred_def = { + 'tag': 'TAG1', + 'type': 'CL', + 'config': {"support_revocation": True} + } + (acme['job_certificate_cred_def_id'], acme['job_certificate_cred_def']) = \ + await anoncreds.issuer_create_and_store_credential_def(acme['wallet'], acme['did'], + acme['job_certificate_schema'], + job_certificate_cred_def['tag'], + job_certificate_cred_def['type'], + json.dumps(job_certificate_cred_def['config'])) + + logger.info("\"Acme\" -> Send \"Acme Job-Certificate\" Credential Definition to Ledger") + await send_cred_def(acme['pool'], acme['wallet'], acme['did'], acme['job_certificate_cred_def']) + + logger.warning("\"Acme\" -> Creates Revocation Registry ({})".format(rev_reg_max_cred_count)) + acme['tails_writer_config'] = json.dumps({'base_dir': "/tmp/indy_acme_tails", 'uri_pattern': ''}) + tails_writer = await blob_storage.open_writer('default', acme['tails_writer_config']) + (acme['revoc_reg_id'], acme['revoc_reg_def'], acme['revoc_reg_entry']) = \ + await anoncreds.issuer_create_and_store_revoc_reg(acme['wallet'], acme['did'], 'CL_ACCUM', 'TAG1', + acme['job_certificate_cred_def_id'], + json.dumps({'max_cred_num': rev_reg_max_cred_count, + 'issuance_type': 'ISSUANCE_ON_DEMAND'}), + tails_writer) + + logger.warning("\"Acme\" -> Post Revocation Registry Definition to Ledger") + acme['revoc_reg_def_request'] = await ledger.build_revoc_reg_def_request(acme['did'], acme['revoc_reg_def']) + await ledger.sign_and_submit_request(acme['pool'], acme['wallet'], acme['did'], acme['revoc_reg_def_request']) + + logger.warning("\"Acme\" -> Post Revocation Registry Entry to Ledger") + acme['revoc_reg_entry_request'] = \ + await ledger.build_revoc_reg_entry_request(acme['did'], acme['revoc_reg_id'], 'CL_ACCUM', + acme['revoc_reg_entry']) + await ledger.sign_and_submit_request(acme['pool'], acme['wallet'], acme['did'], acme['revoc_reg_entry_request']) + + # loop for multiple alice's + for i_alice in range(alice_loop_count): + unique_str = random_str(16) + await run_alice_credential_loop(i_alice+1, alice_loop_count, unique_str, pool_, faber, acme, thrift) + + logger.info(" \"Sovrin Steward\" -> Close and Delete wallet") + await wallet.close_wallet(steward['wallet']) + await wallet.delete_wallet(steward['wallet_config'], steward['wallet_credentials']) + + logger.info("\"Government\" -> Close and Delete wallet") + await wallet.close_wallet(government['wallet']) + await wallet.delete_wallet(wallet_config("delete", government['wallet_config']), wallet_credentials("delete", government['wallet_credentials'])) + + logger.info("\"Faber\" -> Close and Delete wallet") + await wallet.close_wallet(faber['wallet']) + await wallet.delete_wallet(wallet_config("delete", faber['wallet_config']), wallet_credentials("delete", faber['wallet_credentials'])) + + logger.info("\"Acme\" -> Close and Delete wallet") + await wallet.close_wallet(acme['wallet']) + await wallet.delete_wallet(wallet_config("delete", acme['wallet_config']), wallet_credentials("delete", acme['wallet_credentials'])) + + logger.info("\"Thrift\" -> Close and Delete wallet") + await wallet.close_wallet(thrift['wallet']) + await wallet.delete_wallet(wallet_config("delete", thrift['wallet_config']), wallet_credentials("delete", thrift['wallet_credentials'])) + + #logger.info("\"Alice\" -> Close and Delete wallet") + #await wallet.close_wallet(alice['wallet']) + #await wallet.delete_wallet(wallet_config("delete", alice['wallet_config']), wallet_credentials("delete", alice['wallet_credentials'])) + + logger.info("Close and Delete pool") + await pool.close_pool_ledger(pool_['handle']) + await pool.delete_pool_ledger_config(pool_['name']) + + logger.info("Getting started -> done") + + +async def onboarding(_from, to): + logger.info("\"{}\" -> Create and store in Wallet \"{} {}\" DID".format(_from['name'], _from['name'], to['name'])) + (from_to_did, from_to_key) = await did.create_and_store_my_did(_from['wallet'], "{}") + + #logger.info("\"{}\" -> Send Nym to Ledger for \"{} {}\" DID".format(_from['name'], _from['name'], to['name'])) + await send_nym(_from['pool'], _from['wallet'], _from['did'], from_to_did, from_to_key, None) + + #logger.info("\"{}\" -> Send connection request to {} with \"{} {}\" DID and nonce" + # .format(_from['name'], to['name'], _from['name'], to['name'])) + connection_request = { + 'did': from_to_did, + 'nonce': 123456789 + } + + if 'wallet' not in to: + #logger.info("\"{}\" -> Create wallet".format(to['name'])) + try: + await wallet.create_wallet(wallet_config("create", to['wallet_config']), wallet_credentials("create", to['wallet_credentials'])) + except IndyError as ex: + if ex.error_code == ErrorCode.PoolLedgerConfigAlreadyExistsError: + pass + to['wallet'] = await wallet.open_wallet(wallet_config("open", to['wallet_config']), wallet_credentials("open", to['wallet_credentials'])) + + #logger.info("\"{}\" -> Create and store in Wallet \"{} {}\" DID".format(to['name'], to['name'], _from['name'])) + (to_from_did, to_from_key) = await did.create_and_store_my_did(to['wallet'], "{}") + + #logger.info("\"{}\" -> Get key for did from \"{}\" connection request".format(to['name'], _from['name'])) + from_to_verkey = await did.key_for_did(_from['pool'], to['wallet'], connection_request['did']) + + #logger.info("\"{}\" -> Anoncrypt connection response for \"{}\" with \"{} {}\" DID, verkey and nonce" + # .format(to['name'], _from['name'], to['name'], _from['name'])) + to['connection_response'] = json.dumps({ + 'did': to_from_did, + 'verkey': to_from_key, + 'nonce': connection_request['nonce'] + }) + to['anoncrypted_connection_response'] = \ + await crypto.anon_crypt(from_to_verkey, to['connection_response'].encode('utf-8')) + + #logger.info("\"{}\" -> Send anoncrypted connection response to \"{}\"".format(to['name'], _from['name'])) + _from['anoncrypted_connection_response'] = to['anoncrypted_connection_response'] + + #logger.info("\"{}\" -> Anondecrypt connection response from \"{}\"".format(_from['name'], to['name'])) + _from['connection_response'] = \ + json.loads((await crypto.anon_decrypt(_from['wallet'], from_to_key, + _from['anoncrypted_connection_response'])).decode("utf-8")) + + #logger.info("\"{}\" -> Authenticates \"{}\" by comparision of Nonce".format(_from['name'], to['name'])) + assert connection_request['nonce'] == _from['connection_response']['nonce'] + + #logger.info("\"{}\" -> Send Nym to Ledger for \"{} {}\" DID".format(_from['name'], to['name'], _from['name'])) + await send_nym(_from['pool'], _from['wallet'], _from['did'], to_from_did, to_from_key, None) + + return from_to_did, from_to_key, to_from_did, to_from_key, _from['connection_response'] + + +def wallet_config(operation, wallet_config_str): + if not args.storage_type: + return wallet_config_str + wallet_config_json = json.loads(wallet_config_str) + wallet_config_json['storage_type'] = args.storage_type + if args.config: + wallet_config_json['storage_config'] = json.loads(args.config) + #print(operation, json.dumps(wallet_config_json)) + return json.dumps(wallet_config_json) + + +def wallet_credentials(operation, wallet_credentials_str): + if not args.storage_type: + return wallet_credentials_str + wallet_credentials_json = json.loads(wallet_credentials_str) + if args.creds: + wallet_credentials_json['storage_credentials'] = json.loads(args.creds) + #print(operation, json.dumps(wallet_credentials_json)) + return json.dumps(wallet_credentials_json) + + +async def get_verinym(_from, from_to_did, from_to_key, to, to_from_did, to_from_key): + logger.info("\"{}\" -> Create and store in Wallet \"{}\" new DID".format(to['name'], to['name'])) + (to_did, to_key) = await did.create_and_store_my_did(to['wallet'], "{}") + + #logger.info("\"{}\" -> Authcrypt \"{} DID info\" for \"{}\"".format(to['name'], to['name'], _from['name'])) + to['did_info'] = json.dumps({ + 'did': to_did, + 'verkey': to_key + }) + to['authcrypted_did_info'] = \ + await crypto.auth_crypt(to['wallet'], to_from_key, from_to_key, to['did_info'].encode('utf-8')) + + #logger.info("\"{}\" -> Send authcrypted \"{} DID info\" to {}".format(to['name'], to['name'], _from['name'])) + + #logger.info("\"{}\" -> Authdecrypted \"{} DID info\" from {}".format(_from['name'], to['name'], to['name'])) + sender_verkey, authdecrypted_did_info_json, authdecrypted_did_info = \ + await auth_decrypt(_from['wallet'], from_to_key, to['authcrypted_did_info']) + + #logger.info("\"{}\" -> Authenticate {} by comparision of Verkeys".format(_from['name'], to['name'], )) + assert sender_verkey == await did.key_for_did(_from['pool'], _from['wallet'], to_from_did) + + #logger.info("\"{}\" -> Send Nym to Ledger for \"{} DID\" with {} Role" + # .format(_from['name'], to['name'], to['role'])) + await send_nym(_from['pool'], _from['wallet'], _from['did'], authdecrypted_did_info['did'], + authdecrypted_did_info['verkey'], to['role']) + + return to_did + + +async def send_nym(pool_handle, wallet_handle, _did, new_did, new_key, role): + nym_request = await ledger.build_nym_request(_did, new_did, new_key, None, role) + await ledger.sign_and_submit_request(pool_handle, wallet_handle, _did, nym_request) + + +async def send_schema(pool_handle, wallet_handle, _did, schema): + schema_request = await ledger.build_schema_request(_did, schema) + await ledger.sign_and_submit_request(pool_handle, wallet_handle, _did, schema_request) + + +async def send_cred_def(pool_handle, wallet_handle, _did, cred_def_json): + cred_def_request = await ledger.build_cred_def_request(_did, cred_def_json) + await ledger.sign_and_submit_request(pool_handle, wallet_handle, _did, cred_def_request) + + +async def get_schema(pool_handle, _did, schema_id): + get_schema_request = await ledger.build_get_schema_request(_did, schema_id) + get_schema_response = await ledger.submit_request(pool_handle, get_schema_request) + return await ledger.parse_get_schema_response(get_schema_response) + + +async def get_cred_def(pool_handle, _did, cred_def_id): + get_cred_def_request = await ledger.build_get_cred_def_request(_did, cred_def_id) + get_cred_def_response = await ledger.submit_request(pool_handle, get_cred_def_request) + return await ledger.parse_get_cred_def_response(get_cred_def_response) + + +async def get_credential_for_referent(search_handle, referent): + credentials = json.loads( + await anoncreds.prover_fetch_credentials_for_proof_req(search_handle, referent, 10)) + return credentials[0]['cred_info'] + + +def get_timestamp_for_attribute(cred_for_attribute, revoc_states): + if cred_for_attribute['rev_reg_id'] in revoc_states: + return int(next(iter(revoc_states[cred_for_attribute['rev_reg_id']]))) + else: + return None + + +async def prover_get_entities_from_ledger(pool_handle, _did, identifiers, actor, timestamp_from=None, timestamp_to=None): + schemas = {} + cred_defs = {} + rev_states = {} + for item in identifiers.values(): + #logger.info("\"{}\" -> Get Schema from Ledger".format(actor)) + (received_schema_id, received_schema) = await get_schema(pool_handle, _did, item['schema_id']) + schemas[received_schema_id] = json.loads(received_schema) + + #logger.info("\"{}\" -> Get Claim Definition from Ledger".format(actor)) + (received_cred_def_id, received_cred_def) = await get_cred_def(pool_handle, _did, item['cred_def_id']) + cred_defs[received_cred_def_id] = json.loads(received_cred_def) + + if 'rev_reg_id' in item and item['rev_reg_id'] is not None: + # Create Revocations States + #logger.info("\"{}\" -> Get Revocation Registry Definition from Ledger".format(actor)) + get_revoc_reg_def_request = await ledger.build_get_revoc_reg_def_request(_did, item['rev_reg_id']) + + get_revoc_reg_def_response = await ledger.submit_request(pool_handle, get_revoc_reg_def_request) + (rev_reg_id, revoc_reg_def_json) = await ledger.parse_get_revoc_reg_def_response(get_revoc_reg_def_response) + + #logger.info("\"{}\" -> Get Revocation Registry Delta from Ledger".format(actor)) + if not timestamp_to: timestamp_to = int(time.time()) + get_revoc_reg_delta_request = \ + await ledger.build_get_revoc_reg_delta_request(_did, item['rev_reg_id'], timestamp_from, timestamp_to) + get_revoc_reg_delta_response = \ + await ledger.submit_request(pool_handle, get_revoc_reg_delta_request) + (rev_reg_id, revoc_reg_delta_json, t) = \ + await ledger.parse_get_revoc_reg_delta_response(get_revoc_reg_delta_response) + + tails_reader_config = json.dumps( + {'base_dir': dirname(json.loads(revoc_reg_def_json)['value']['tailsLocation']), + 'uri_pattern': ''}) + blob_storage_reader_cfg_handle = await blob_storage.open_reader('default', tails_reader_config) + + #logger.info('%s - Create Revocation State', actor) + rev_state_json = \ + await anoncreds.create_revocation_state(blob_storage_reader_cfg_handle, revoc_reg_def_json, + revoc_reg_delta_json, t, item['cred_rev_id']) + rev_states[rev_reg_id] = {t: json.loads(rev_state_json)} + + return json.dumps(schemas), json.dumps(cred_defs), json.dumps(rev_states) + + +async def verifier_get_entities_from_ledger(pool_handle, _did, identifiers, actor, timestamp=None): + schemas = {} + cred_defs = {} + rev_reg_defs = {} + rev_regs = {} + for item in identifiers: + #logger.info("\"{}\" -> Get Schema from Ledger".format(actor)) + (received_schema_id, received_schema) = await get_schema(pool_handle, _did, item['schema_id']) + schemas[received_schema_id] = json.loads(received_schema) + + #logger.info("\"{}\" -> Get Claim Definition from Ledger".format(actor)) + (received_cred_def_id, received_cred_def) = await get_cred_def(pool_handle, _did, item['cred_def_id']) + cred_defs[received_cred_def_id] = json.loads(received_cred_def) + + if 'rev_reg_id' in item and item['rev_reg_id'] is not None: + # Get Revocation Definitions and Revocation Registries + #logger.info("\"{}\" -> Get Revocation Definition from Ledger".format(actor)) + get_revoc_reg_def_request = await ledger.build_get_revoc_reg_def_request(_did, item['rev_reg_id']) + + get_revoc_reg_def_response = await ledger.submit_request(pool_handle, get_revoc_reg_def_request) + (rev_reg_id, revoc_reg_def_json) = await ledger.parse_get_revoc_reg_def_response(get_revoc_reg_def_response) + + #logger.info("\"{}\" -> Get Revocation Registry from Ledger".format(actor)) + if not timestamp: timestamp = item['timestamp'] + get_revoc_reg_request = \ + await ledger.build_get_revoc_reg_request(_did, item['rev_reg_id'], timestamp) + get_revoc_reg_response = await ledger.submit_request(pool_handle, get_revoc_reg_request) + (rev_reg_id, rev_reg_json, timestamp2) = await ledger.parse_get_revoc_reg_response(get_revoc_reg_response) + + rev_regs[rev_reg_id] = {timestamp2: json.loads(rev_reg_json)} + rev_reg_defs[rev_reg_id] = json.loads(revoc_reg_def_json) + + return json.dumps(schemas), json.dumps(cred_defs), json.dumps(rev_reg_defs), json.dumps(rev_regs) + + +async def auth_decrypt(wallet_handle, key, message): + from_verkey, decrypted_message_json = await crypto.auth_decrypt(wallet_handle, key, message) + decrypted_message_json = decrypted_message_json.decode("utf-8") + decrypted_message = json.loads(decrypted_message_json) + return from_verkey, decrypted_message_json, decrypted_message + + +async def run_alice_credential_loop(i, j, unique_str, pool_in, faber_in, acme_in, thrift_in): + logger.warning("==============================") + logger.warning("Alice {} of {} (Alice{})".format(i, j, unique_str)) + logger.warning("==============================") + + # copy the input dicts so we don't overwrite each other + pool_ = pool_in.copy() + faber = faber_in.copy() + acme = acme_in.copy() + thrift = thrift_in.copy() + + logger.warning("==============================") + logger.warning("=== Getting Transcript with Faber ==") + logger.warning("==============================") + logger.warning("== Getting Transcript with Faber - Onboarding ==") + logger.warning("------------------------------") + + alice = { + 'name': 'Alice'+unique_str, + 'wallet_config': json.dumps({'id': 'alice_wallet'+unique_str}), + 'wallet_credentials': json.dumps({'key': 'alice_wallet_key'}), + 'pool': pool_['handle'], + } + faber['did_for_alice'], faber['key_for_alice'], alice['did_for_faber'], alice['key_for_faber'], \ + faber['alice_connection_response'] = await onboarding(faber, alice) + + logger.warning("==============================") + logger.warning("== Getting Transcript with Faber - Getting Transcript Credential ==") + logger.warning("------------------------------") + + #logger.info("\"Faber\" -> Create \"Transcript\" Credential Offer for Alice") + faber['transcript_cred_offer'] = \ + await anoncreds.issuer_create_credential_offer(faber['wallet'], faber['transcript_cred_def_id']) + + #logger.info("\"Faber\" -> Get key for Alice did") + faber['alice_key_for_faber'] = \ + await did.key_for_did(faber['pool'], faber['wallet'], faber['alice_connection_response']['did']) + + #logger.info("\"Faber\" -> Authcrypt \"Transcript\" Credential Offer for Alice") + faber['authcrypted_transcript_cred_offer'] = \ + await crypto.auth_crypt(faber['wallet'], faber['key_for_alice'], faber['alice_key_for_faber'], + faber['transcript_cred_offer'].encode('utf-8')) + + #logger.info("\"Faber\" -> Send authcrypted \"Transcript\" Credential Offer to Alice") + alice['authcrypted_transcript_cred_offer'] = faber['authcrypted_transcript_cred_offer'] + + #logger.info("\"Alice\" -> Authdecrypted \"Transcript\" Credential Offer from Faber") + alice['faber_key_for_alice'], alice['transcript_cred_offer'], authdecrypted_transcript_cred_offer = \ + await auth_decrypt(alice['wallet'], alice['key_for_faber'], alice['authcrypted_transcript_cred_offer']) + alice['transcript_schema_id'] = authdecrypted_transcript_cred_offer['schema_id'] + alice['transcript_cred_def_id'] = authdecrypted_transcript_cred_offer['cred_def_id'] + + #logger.info("\"Alice\" -> Create and store \"Alice\" Master Secret in Wallet") + alice['master_secret_id'] = await anoncreds.prover_create_master_secret(alice['wallet'], None) + + #logger.info("\"Alice\" -> Get \"Faber Transcript\" Credential Definition from Ledger") + (alice['faber_transcript_cred_def_id'], alice['faber_transcript_cred_def']) = \ + await get_cred_def(alice['pool'], alice['did_for_faber'], alice['transcript_cred_def_id']) + + #logger.info("\"Alice\" -> Create \"Transcript\" Credential Request for Faber") + (alice['transcript_cred_request'], alice['transcript_cred_request_metadata']) = \ + await anoncreds.prover_create_credential_req(alice['wallet'], alice['did_for_faber'], + alice['transcript_cred_offer'], alice['faber_transcript_cred_def'], + alice['master_secret_id']) + + #logger.info("\"Alice\" -> Authcrypt \"Transcript\" Credential Request for Faber") + alice['authcrypted_transcript_cred_request'] = \ + await crypto.auth_crypt(alice['wallet'], alice['key_for_faber'], alice['faber_key_for_alice'], + alice['transcript_cred_request'].encode('utf-8')) + + #logger.info("\"Alice\" -> Send authcrypted \"Transcript\" Credential Request to Faber") + faber['authcrypted_transcript_cred_request'] = alice['authcrypted_transcript_cred_request'] + + #logger.info("\"Faber\" -> Authdecrypt \"Transcript\" Credential Request from Alice") + faber['alice_key_for_faber'], faber['transcript_cred_request'], _ = \ + await auth_decrypt(faber['wallet'], faber['key_for_alice'], faber['authcrypted_transcript_cred_request']) + + #logger.info("\"Faber\" -> Create \"Transcript\" Credential for Alice") + faber['alice_transcript_cred_values'] = json.dumps({ + "first_name": {"raw": "Alice", "encoded": "1139481716457488690172217916278103335"}, + "last_name": {"raw": "Garcia", "encoded": "5321642780241790123587902456789123452"}, + "degree": {"raw": "Bachelor of Science, Marketing", "encoded": "12434523576212321"}, + "status": {"raw": "graduated", "encoded": "2213454313412354"}, + "ssn": {"raw": "123-45-6789", "encoded": "3124141231422543541"}, + "year": {"raw": "2015", "encoded": "2015"}, + "average": {"raw": "5", "encoded": "5"} + }) + faber['transcript_cred'], _, _ = \ + await anoncreds.issuer_create_credential(faber['wallet'], faber['transcript_cred_offer'], + faber['transcript_cred_request'], + faber['alice_transcript_cred_values'], None, None) + + #logger.info("\"Faber\" -> Authcrypt \"Transcript\" Credential for Alice") + faber['authcrypted_transcript_cred'] = \ + await crypto.auth_crypt(faber['wallet'], faber['key_for_alice'], faber['alice_key_for_faber'], + faber['transcript_cred'].encode('utf-8')) + + #logger.info("\"Faber\" -> Send authcrypted \"Transcript\" Credential to Alice") + alice['authcrypted_transcript_cred'] = faber['authcrypted_transcript_cred'] + + #logger.info("\"Alice\" -> Authdecrypted \"Transcript\" Credential from Faber") + _, alice['transcript_cred'], _ = \ + await auth_decrypt(alice['wallet'], alice['key_for_faber'], alice['authcrypted_transcript_cred']) + + #logger.info("\"Alice\" -> Store \"Transcript\" Credential from Faber") + _, alice['transcript_cred_def'] = await get_cred_def(alice['pool'], alice['did_for_faber'], + alice['transcript_cred_def_id']) + + await anoncreds.prover_store_credential(alice['wallet'], None, alice['transcript_cred_request_metadata'], + alice['transcript_cred'], alice['transcript_cred_def'], None) + + logger.warning("==============================") + logger.warning("=== Apply for the job with Acme ==") + logger.warning("==============================") + logger.warning("== Apply for the job with Acme - Onboarding ==") + logger.warning("------------------------------") + + acme['did_for_alice'], acme['key_for_alice'], alice['did_for_acme'], alice['key_for_acme'], \ + acme['alice_connection_response'] = await onboarding(acme, alice) + + #logger.info("==============================") + #logger.info("== Apply for the job with Acme - Transcript proving ==") + #logger.info("------------------------------") + + #logger.info("\"Acme\" -> Create \"Job-Application\" Proof Request") + acme['job_application_proof_request'] = json.dumps({ + 'nonce': '1432422343242122312411212', + 'name': 'Job-Application', + 'version': '0.1', + 'requested_attributes': { + 'attr1_referent': { + 'name': 'first_name' + }, + 'attr2_referent': { + 'name': 'last_name' + }, + 'attr3_referent': { + 'name': 'degree', + 'restrictions': [{'cred_def_id': faber['transcript_cred_def_id']}] + }, + 'attr4_referent': { + 'name': 'status', + 'restrictions': [{'cred_def_id': faber['transcript_cred_def_id']}] + }, + 'attr5_referent': { + 'name': 'ssn', + 'restrictions': [{'cred_def_id': faber['transcript_cred_def_id']}] + }, + 'attr6_referent': { + 'name': 'phone_number' + } + }, + 'requested_predicates': { + 'predicate1_referent': { + 'name': 'average', + 'p_type': '>=', + 'p_value': 4, + 'restrictions': [{'cred_def_id': faber['transcript_cred_def_id']}] + } + } + }) + + #logger.info("\"Acme\" -> Get key for Alice did") + acme['alice_key_for_acme'] = \ + await did.key_for_did(acme['pool'], acme['wallet'], acme['alice_connection_response']['did']) + + #logger.info("\"Acme\" -> Authcrypt \"Job-Application\" Proof Request for Alice") + acme['authcrypted_job_application_proof_request'] = \ + await crypto.auth_crypt(acme['wallet'], acme['key_for_alice'], acme['alice_key_for_acme'], + acme['job_application_proof_request'].encode('utf-8')) + + #logger.info("\"Acme\" -> Send authcrypted \"Job-Application\" Proof Request to Alice") + alice['authcrypted_job_application_proof_request'] = acme['authcrypted_job_application_proof_request'] + + #logger.info("\"Alice\" -> Authdecrypt \"Job-Application\" Proof Request from Acme") + alice['acme_key_for_alice'], alice['job_application_proof_request'], _ = \ + await auth_decrypt(alice['wallet'], alice['key_for_acme'], alice['authcrypted_job_application_proof_request']) + + #logger.info("\"Alice\" -> Get credentials for \"Job-Application\" Proof Request") + + search_for_job_application_proof_request = \ + await anoncreds.prover_search_credentials_for_proof_req(alice['wallet'], + alice['job_application_proof_request'], None) + + cred_for_attr1 = await get_credential_for_referent(search_for_job_application_proof_request, 'attr1_referent') + cred_for_attr2 = await get_credential_for_referent(search_for_job_application_proof_request, 'attr2_referent') + cred_for_attr3 = await get_credential_for_referent(search_for_job_application_proof_request, 'attr3_referent') + cred_for_attr4 = await get_credential_for_referent(search_for_job_application_proof_request, 'attr4_referent') + cred_for_attr5 = await get_credential_for_referent(search_for_job_application_proof_request, 'attr5_referent') + cred_for_predicate1 = \ + await get_credential_for_referent(search_for_job_application_proof_request, 'predicate1_referent') + + await anoncreds.prover_close_credentials_search_for_proof_req(search_for_job_application_proof_request) + + alice['creds_for_job_application_proof'] = {cred_for_attr1['referent']: cred_for_attr1, + cred_for_attr2['referent']: cred_for_attr2, + cred_for_attr3['referent']: cred_for_attr3, + cred_for_attr4['referent']: cred_for_attr4, + cred_for_attr5['referent']: cred_for_attr5, + cred_for_predicate1['referent']: cred_for_predicate1} + + alice['schemas_for_job_application'], alice['cred_defs_for_job_application'], \ + alice['revoc_states_for_job_application'] = \ + await prover_get_entities_from_ledger(alice['pool'], alice['did_for_acme'], + alice['creds_for_job_application_proof'], alice['name']) + + #logger.info("\"Alice\" -> Create \"Job-Application\" Proof") + alice['job_application_requested_creds'] = json.dumps({ + 'self_attested_attributes': { + 'attr1_referent': 'Alice', + 'attr2_referent': 'Garcia', + 'attr6_referent': '123-45-6789' + }, + 'requested_attributes': { + 'attr3_referent': {'cred_id': cred_for_attr3['referent'], 'revealed': True}, + 'attr4_referent': {'cred_id': cred_for_attr4['referent'], 'revealed': True}, + 'attr5_referent': {'cred_id': cred_for_attr5['referent'], 'revealed': True}, + }, + 'requested_predicates': {'predicate1_referent': {'cred_id': cred_for_predicate1['referent']}} + }) + + alice['job_application_proof'] = \ + await anoncreds.prover_create_proof(alice['wallet'], alice['job_application_proof_request'], + alice['job_application_requested_creds'], alice['master_secret_id'], + alice['schemas_for_job_application'], + alice['cred_defs_for_job_application'], + alice['revoc_states_for_job_application']) + + #logger.info("\"Alice\" -> Authcrypt \"Job-Application\" Proof for Acme") + alice['authcrypted_job_application_proof'] = \ + await crypto.auth_crypt(alice['wallet'], alice['key_for_acme'], alice['acme_key_for_alice'], + alice['job_application_proof'].encode('utf-8')) + + #logger.info("\"Alice\" -> Send authcrypted \"Job-Application\" Proof to Acme") + acme['authcrypted_job_application_proof'] = alice['authcrypted_job_application_proof'] + + #logger.info("\"Acme\" -> Authdecrypted \"Job-Application\" Proof from Alice") + _, acme['job_application_proof'], decrypted_job_application_proof = \ + await auth_decrypt(acme['wallet'], acme['key_for_alice'], acme['authcrypted_job_application_proof']) + + acme['schemas_for_job_application'], acme['cred_defs_for_job_application'], \ + acme['revoc_ref_defs_for_job_application'], acme['revoc_regs_for_job_application'] = \ + await verifier_get_entities_from_ledger(acme['pool'], acme['did'], + decrypted_job_application_proof['identifiers'], acme['name']) + + #logger.info("\"Acme\" -> Verify \"Job-Application\" Proof from Alice") + assert 'Bachelor of Science, Marketing' == \ + decrypted_job_application_proof['requested_proof']['revealed_attrs']['attr3_referent']['raw'] + assert 'graduated' == \ + decrypted_job_application_proof['requested_proof']['revealed_attrs']['attr4_referent']['raw'] + assert '123-45-6789' == \ + decrypted_job_application_proof['requested_proof']['revealed_attrs']['attr5_referent']['raw'] + + assert 'Alice' == decrypted_job_application_proof['requested_proof']['self_attested_attrs']['attr1_referent'] + assert 'Garcia' == decrypted_job_application_proof['requested_proof']['self_attested_attrs']['attr2_referent'] + assert '123-45-6789' == decrypted_job_application_proof['requested_proof']['self_attested_attrs']['attr6_referent'] + + assert await anoncreds.verifier_verify_proof(acme['job_application_proof_request'], acme['job_application_proof'], + acme['schemas_for_job_application'], + acme['cred_defs_for_job_application'], + acme['revoc_ref_defs_for_job_application'], + acme['revoc_regs_for_job_application']) + + #logger.info("==============================") + #logger.info("== Apply for the job with Acme - Getting Job-Certificate Credential ==") + #logger.info("------------------------------") + + #logger.info("\"Acme\" -> Create \"Job-Certificate\" Credential Offer for Alice") + acme['job_certificate_cred_offer'] = \ + await anoncreds.issuer_create_credential_offer(acme['wallet'], acme['job_certificate_cred_def_id']) + + #logger.info("\"Acme\" -> Get key for Alice did") + acme['alice_key_for_acme'] = \ + await did.key_for_did(acme['pool'], acme['wallet'], acme['alice_connection_response']['did']) + + #logger.info("\"Acme\" -> Authcrypt \"Job-Certificate\" Credential Offer for Alice") + acme['authcrypted_job_certificate_cred_offer'] = \ + await crypto.auth_crypt(acme['wallet'], acme['key_for_alice'], acme['alice_key_for_acme'], + acme['job_certificate_cred_offer'].encode('utf-8')) + + #logger.info("\"Acme\" -> Send authcrypted \"Job-Certificate\" Credential Offer to Alice") + alice['authcrypted_job_certificate_cred_offer'] = acme['authcrypted_job_certificate_cred_offer'] + + #logger.info("\"Alice\" -> Authdecrypted \"Job-Certificate\" Credential Offer from Acme") + alice['acme_key_for_alice_alice'], alice['job_certificate_cred_offer'], job_certificate_cred_offer = \ + await auth_decrypt(alice['wallet'], alice['key_for_acme'], alice['authcrypted_job_certificate_cred_offer']) + + #logger.info("\"Alice\" -> Get \"Acme Job-Certificate\" Credential Definition from Ledger") + (alice['acme_job_certificate_cred_def_id'], alice['acme_job_certificate_cred_def']) = \ + await get_cred_def(alice['pool'], alice['did_for_acme'], job_certificate_cred_offer['cred_def_id']) + + #logger.info("\"Alice\" -> Create and store in Wallet \"Job-Certificate\" Credential Request for Acme") + (alice['job_certificate_cred_request'], alice['job_certificate_cred_request_metadata']) = \ + await anoncreds.prover_create_credential_req(alice['wallet'], alice['did_for_acme'], + alice['job_certificate_cred_offer'], + alice['acme_job_certificate_cred_def'], alice['master_secret_id']) + + #logger.info("\"Alice\" -> Authcrypt \"Job-Certificate\" Credential Request for Acme") + alice['authcrypted_job_certificate_cred_request'] = \ + await crypto.auth_crypt(alice['wallet'], alice['key_for_acme'], alice['acme_key_for_alice'], + alice['job_certificate_cred_request'].encode('utf-8')) + + #logger.info("\"Alice\" -> Send authcrypted \"Job-Certificate\" Credential Request to Acme") + alice['job_certificate_cred_values'] = json.dumps({ + "first_name": {"raw": "Alice", "encoded": "245712572474217942457235975012103335"}, + "last_name": {"raw": "Garcia", "encoded": "312643218496194691632153761283356127"}, + "employee_status": {"raw": "Permanent", "encoded": "2143135425425143112321314321"}, + "salary": {"raw": "2400", "encoded": "2400"}, + "experience": {"raw": "10", "encoded": "10"} + }) + acme['authcrypted_job_certificate_cred_request'] = alice['authcrypted_job_certificate_cred_request'] + acme['job_certificate_cred_values'] = alice['job_certificate_cred_values'] + + #logger.info("\"Acme\" -> Authdecrypt \"Job-Certificate\" Credential Request from Alice") + acme['alice_key_for_acme'], acme['job_certificate_cred_request'], _ = \ + await auth_decrypt(acme['wallet'], acme['key_for_alice'], acme['authcrypted_job_certificate_cred_request']) + + #logger.info("\"Acme\" -> Create \"Job-Certificate\" Credential for Alice") + acme['blob_storage_reader_cfg_handle'] = await blob_storage.open_reader('default', acme['tails_writer_config']) + acme['job_certificate_cred'], acme['job_certificate_cred_rev_id'], acme['alice_cert_rev_reg_delta'] = \ + await anoncreds.issuer_create_credential(acme['wallet'], acme['job_certificate_cred_offer'], + acme['job_certificate_cred_request'], + acme['job_certificate_cred_values'], + acme['revoc_reg_id'], + acme['blob_storage_reader_cfg_handle']) + + #logger.info("\"Acme\" -> Post Revocation Registry Delta to Ledger") + acme['revoc_reg_entry_req'] = \ + await ledger.build_revoc_reg_entry_request(acme['did'], acme['revoc_reg_id'], 'CL_ACCUM', + acme['alice_cert_rev_reg_delta']) + await ledger.sign_and_submit_request(acme['pool'], acme['wallet'], acme['did'], acme['revoc_reg_entry_req']) + + #logger.info("\"Acme\" -> Authcrypt \"Job-Certificate\" Credential for Alice") + acme['authcrypted_job_certificate_cred'] = \ + await crypto.auth_crypt(acme['wallet'], acme['key_for_alice'], acme['alice_key_for_acme'], + acme['job_certificate_cred'].encode('utf-8')) + + #logger.info("\"Acme\" -> Send authcrypted \"Job-Certificate\" Credential to Alice") + alice['authcrypted_job_certificate_cred'] = acme['authcrypted_job_certificate_cred'] + + #logger.info("\"Alice\" -> Authdecrypted \"Job-Certificate\" Credential from Acme") + _, alice['job_certificate_cred'], alice_job_certificate_cred = \ + await auth_decrypt(alice['wallet'], alice['key_for_acme'], alice['authcrypted_job_certificate_cred']) + + #logger.info("\"Alice\" -> Gets RevocationRegistryDefinition for \"Job-Certificate\" Credential from Acme") + alice['acme_revoc_reg_des_req'] = \ + await ledger.build_get_revoc_reg_def_request(alice['did_for_acme'], + alice_job_certificate_cred['rev_reg_id']) + alice['acme_revoc_reg_des_resp'] = await ledger.submit_request(alice['pool'], alice['acme_revoc_reg_des_req']) + (alice['acme_revoc_reg_def_id'], alice['acme_revoc_reg_def_json']) = \ + await ledger.parse_get_revoc_reg_def_response(alice['acme_revoc_reg_des_resp']) + + #logger.info("\"Alice\" -> Store \"Job-Certificate\" Credential") + await anoncreds.prover_store_credential(alice['wallet'], None, alice['job_certificate_cred_request_metadata'], + alice['job_certificate_cred'], + alice['acme_job_certificate_cred_def'], alice['acme_revoc_reg_def_json']) + + logger.warning("==============================") + logger.warning("=== Apply for the loan with Thrift ==") + logger.warning("==============================") + logger.warning("== Apply for the loan with Thrift - Onboarding ==") + logger.warning("------------------------------") + + thrift['did_for_alice'], thrift['key_for_alice'], alice['did_for_thrift'], alice['key_for_thrift'], \ + thrift['alice_connection_response'] = await onboarding(thrift, alice) + + async def apply_loan_basic(): + # This method will be called twice: once with a valid Job-Certificate and + # the second time after the Job-Certificate has been revoked. + #logger.info("==============================") + #logger.info("== Apply for the loan with Thrift - Job-Certificate proving ==") + #logger.info("------------------------------") + + #logger.info("\"Thrift\" -> Create \"Loan-Application-Basic\" Proof Request") + thrift['apply_loan_proof_request'] = json.dumps({ + 'nonce': '123432421212', + 'name': 'Loan-Application-Basic', + 'version': '0.1', + 'requested_attributes': { + 'attr1_referent': { + 'name': 'employee_status', + 'restrictions': [{'cred_def_id': acme['job_certificate_cred_def_id']}] + } + }, + 'requested_predicates': { + 'predicate1_referent': { + 'name': 'salary', + 'p_type': '>=', + 'p_value': 2000, + 'restrictions': [{'cred_def_id': acme['job_certificate_cred_def_id']}] + }, + 'predicate2_referent': { + 'name': 'experience', + 'p_type': '>=', + 'p_value': 1, + 'restrictions': [{'cred_def_id': acme['job_certificate_cred_def_id']}] + } + }, + 'non_revoked': {'to': int(time.time())} + }) + + #logger.info("\"Thrift\" -> Get key for Alice did") + thrift['alice_key_for_thrift'] = \ + await did.key_for_did(thrift['pool'], thrift['wallet'], thrift['alice_connection_response']['did']) + + #logger.info("\"Thrift\" -> Authcrypt \"Loan-Application-Basic\" Proof Request for Alice") + thrift['authcrypted_apply_loan_proof_request'] = \ + await crypto.auth_crypt(thrift['wallet'], thrift['key_for_alice'], thrift['alice_key_for_thrift'], + thrift['apply_loan_proof_request'].encode('utf-8')) + + #logger.info("\"Thrift\" -> Send authcrypted \"Loan-Application-Basic\" Proof Request to Alice") + alice['authcrypted_apply_loan_proof_request'] = thrift['authcrypted_apply_loan_proof_request'] + + #logger.info("\"Alice\" -> Authdecrypt \"Loan-Application-Basic\" Proof Request from Thrift") + alice['thrift_key_for_alice'], alice['apply_loan_proof_request'], _ = \ + await auth_decrypt(alice['wallet'], alice['key_for_thrift'], alice['authcrypted_apply_loan_proof_request']) + + #logger.info("\"Alice\" -> Get credentials for \"Loan-Application-Basic\" Proof Request") + + search_for_apply_loan_proof_request = \ + await anoncreds.prover_search_credentials_for_proof_req(alice['wallet'], + alice['apply_loan_proof_request'], None) + + cred_for_attr1 = await get_credential_for_referent(search_for_apply_loan_proof_request, 'attr1_referent') + cred_for_predicate1 = await get_credential_for_referent(search_for_apply_loan_proof_request, 'predicate1_referent') + cred_for_predicate2 = await get_credential_for_referent(search_for_apply_loan_proof_request, 'predicate2_referent') + + await anoncreds.prover_close_credentials_search_for_proof_req(search_for_apply_loan_proof_request) + + alice['creds_for_apply_loan_proof'] = {cred_for_attr1['referent']: cred_for_attr1, + cred_for_predicate1['referent']: cred_for_predicate1, + cred_for_predicate2['referent']: cred_for_predicate2} + + requested_timestamp = int(json.loads(thrift['apply_loan_proof_request'])['non_revoked']['to']) + alice['schemas_for_loan_app'], alice['cred_defs_for_loan_app'], alice['revoc_states_for_loan_app'] = \ + await prover_get_entities_from_ledger(alice['pool'], alice['did_for_thrift'], + alice['creds_for_apply_loan_proof'], + alice['name'], None, requested_timestamp) + + #logger.info("\"Alice\" -> Create \"Loan-Application-Basic\" Proof") + revoc_states_for_loan_app = json.loads(alice['revoc_states_for_loan_app']) + timestamp_for_attr1 = get_timestamp_for_attribute(cred_for_attr1, revoc_states_for_loan_app) + timestamp_for_predicate1 = get_timestamp_for_attribute(cred_for_predicate1, revoc_states_for_loan_app) + timestamp_for_predicate2 = get_timestamp_for_attribute(cred_for_predicate2, revoc_states_for_loan_app) + alice['apply_loan_requested_creds'] = json.dumps({ + 'self_attested_attributes': {}, + 'requested_attributes': { + 'attr1_referent': {'cred_id': cred_for_attr1['referent'], 'revealed': True, 'timestamp': timestamp_for_attr1} + }, + 'requested_predicates': { + 'predicate1_referent': {'cred_id': cred_for_predicate1['referent'], 'timestamp': timestamp_for_predicate1}, + 'predicate2_referent': {'cred_id': cred_for_predicate2['referent'], 'timestamp': timestamp_for_predicate2} + } + }) + alice['apply_loan_proof'] = \ + await anoncreds.prover_create_proof(alice['wallet'], alice['apply_loan_proof_request'], + alice['apply_loan_requested_creds'], alice['master_secret_id'], + alice['schemas_for_loan_app'], alice['cred_defs_for_loan_app'], + alice['revoc_states_for_loan_app']) + + #logger.info("\"Alice\" -> Authcrypt \"Loan-Application-Basic\" Proof for Thrift") + alice['authcrypted_alice_apply_loan_proof'] = \ + await crypto.auth_crypt(alice['wallet'], alice['key_for_thrift'], alice['thrift_key_for_alice'], + alice['apply_loan_proof'].encode('utf-8')) + + #logger.info("\"Alice\" -> Send authcrypted \"Loan-Application-Basic\" Proof to Thrift") + thrift['authcrypted_alice_apply_loan_proof'] = alice['authcrypted_alice_apply_loan_proof'] + + #logger.info("\"Thrift\" -> Authdecrypted \"Loan-Application-Basic\" Proof from Alice") + _, thrift['alice_apply_loan_proof'], authdecrypted_alice_apply_loan_proof = \ + await auth_decrypt(thrift['wallet'], thrift['key_for_alice'], thrift['authcrypted_alice_apply_loan_proof']) + + #logger.info("\"Thrift\" -> Get Schemas, Credential Definitions and Revocation Registries from Ledger" + # " required for Proof verifying") + + thrift['schemas_for_loan_app'], thrift['cred_defs_for_loan_app'], thrift['revoc_defs_for_loan_app'], \ + thrift['revoc_regs_for_loan_app'] = \ + await verifier_get_entities_from_ledger(thrift['pool'], thrift['did'], + authdecrypted_alice_apply_loan_proof['identifiers'], + thrift['name'], requested_timestamp) + + #logger.info("\"Thrift\" -> Verify \"Loan-Application-Basic\" Proof from Alice") + assert 'Permanent' == \ + authdecrypted_alice_apply_loan_proof['requested_proof']['revealed_attrs']['attr1_referent']['raw'] + + await apply_loan_basic() + + assert await anoncreds.verifier_verify_proof(thrift['apply_loan_proof_request'], + thrift['alice_apply_loan_proof'], + thrift['schemas_for_loan_app'], + thrift['cred_defs_for_loan_app'], + thrift['revoc_defs_for_loan_app'], + thrift['revoc_regs_for_loan_app']) + + #logger.info("==============================") + #logger.info("== Apply for the loan with Thrift - Transcript and Job-Certificate proving ==") + #logger.info("------------------------------") + + #logger.info("\"Thrift\" -> Create \"Loan-Application-KYC\" Proof Request") + thrift['apply_loan_kyc_proof_request'] = json.dumps({ + 'nonce': '123432421212', + 'name': 'Loan-Application-KYC', + 'version': '0.1', + 'requested_attributes': { + 'attr1_referent': {'name': 'first_name'}, + 'attr2_referent': {'name': 'last_name'}, + 'attr3_referent': {'name': 'ssn'} + }, + 'requested_predicates': {} + }) + + #logger.info("\"Thrift\" -> Get key for Alice did") + thrift['alice_key_for_thrift'] = await did.key_for_did(thrift['pool'], thrift['wallet'], + thrift['alice_connection_response']['did']) + + #logger.info("\"Thrift\" -> Authcrypt \"Loan-Application-KYC\" Proof Request for Alice") + thrift['authcrypted_apply_loan_kyc_proof_request'] = \ + await crypto.auth_crypt(thrift['wallet'], thrift['key_for_alice'], thrift['alice_key_for_thrift'], + thrift['apply_loan_kyc_proof_request'].encode('utf-8')) + + #logger.info("\"Thrift\" -> Send authcrypted \"Loan-Application-KYC\" Proof Request to Alice") + alice['authcrypted_apply_loan_kyc_proof_request'] = thrift['authcrypted_apply_loan_kyc_proof_request'] + + #logger.info("\"Alice\" -> Authdecrypt \"Loan-Application-KYC\" Proof Request from Thrift") + alice['thrift_key_for_alice'], alice['apply_loan_kyc_proof_request'], _ = \ + await auth_decrypt(alice['wallet'], alice['key_for_thrift'], alice['authcrypted_apply_loan_kyc_proof_request']) + + #logger.info("\"Alice\" -> Get credentials for \"Loan-Application-KYC\" Proof Request") + + search_for_apply_loan_kyc_proof_request = \ + await anoncreds.prover_search_credentials_for_proof_req(alice['wallet'], + alice['apply_loan_kyc_proof_request'], None) + + cred_for_attr1 = await get_credential_for_referent(search_for_apply_loan_kyc_proof_request, 'attr1_referent') + cred_for_attr2 = await get_credential_for_referent(search_for_apply_loan_kyc_proof_request, 'attr2_referent') + cred_for_attr3 = await get_credential_for_referent(search_for_apply_loan_kyc_proof_request, 'attr3_referent') + + await anoncreds.prover_close_credentials_search_for_proof_req(search_for_apply_loan_kyc_proof_request) + + alice['creds_for_apply_loan_kyc_proof'] = {cred_for_attr1['referent']: cred_for_attr1, + cred_for_attr2['referent']: cred_for_attr2, + cred_for_attr3['referent']: cred_for_attr3} + + alice['schemas_for_loan_kyc_app'], alice['cred_defs_for_loan_kyc_app'], alice['revoc_states_for_loan_kyc_app'] = \ + await prover_get_entities_from_ledger(alice['pool'], alice['did_for_thrift'], + alice['creds_for_apply_loan_kyc_proof'], alice['name'],) + + #logger.info("\"Alice\" -> Create \"Loan-Application-KYC\" Proof") + revoc_states_for_loan_app = json.loads(alice['revoc_states_for_loan_kyc_app']) + timestamp_for_attr1 = get_timestamp_for_attribute(cred_for_attr1, revoc_states_for_loan_app) + timestamp_for_attr2 = get_timestamp_for_attribute(cred_for_attr2, revoc_states_for_loan_app) + timestamp_for_attr3 = get_timestamp_for_attribute(cred_for_attr3, revoc_states_for_loan_app) + alice['apply_loan_kyc_requested_creds'] = json.dumps({ + 'self_attested_attributes': {}, + 'requested_attributes': { + 'attr1_referent': {'cred_id': cred_for_attr1['referent'], 'revealed': True, 'timestamp': timestamp_for_attr1}, + 'attr2_referent': {'cred_id': cred_for_attr2['referent'], 'revealed': True, 'timestamp': timestamp_for_attr2}, + 'attr3_referent': {'cred_id': cred_for_attr3['referent'], 'revealed': True, 'timestamp': timestamp_for_attr3} + }, + 'requested_predicates': {} + }) + + alice['apply_loan_kyc_proof'] = \ + await anoncreds.prover_create_proof(alice['wallet'], alice['apply_loan_kyc_proof_request'], + alice['apply_loan_kyc_requested_creds'], alice['master_secret_id'], + alice['schemas_for_loan_kyc_app'], alice['cred_defs_for_loan_kyc_app'], + alice['revoc_states_for_loan_kyc_app']) + + #logger.info("\"Alice\" -> Authcrypt \"Loan-Application-KYC\" Proof for Thrift") + alice['authcrypted_alice_apply_loan_kyc_proof'] = \ + await crypto.auth_crypt(alice['wallet'], alice['key_for_thrift'], alice['thrift_key_for_alice'], + alice['apply_loan_kyc_proof'].encode('utf-8')) + + #logger.info("\"Alice\" -> Send authcrypted \"Loan-Application-KYC\" Proof to Thrift") + thrift['authcrypted_alice_apply_loan_kyc_proof'] = alice['authcrypted_alice_apply_loan_kyc_proof'] + + #logger.info("\"Thrift\" -> Authdecrypted \"Loan-Application-KYC\" Proof from Alice") + _, thrift['alice_apply_loan_kyc_proof'], alice_apply_loan_kyc_proof = \ + await auth_decrypt(thrift['wallet'], thrift['key_for_alice'], thrift['authcrypted_alice_apply_loan_kyc_proof']) + + #logger.info("\"Thrift\" -> Get Schemas, Credential Definitions and Revocation Registries from Ledger" + # " required for Proof verifying") + + thrift['schemas_for_loan_kyc_app'], thrift['cred_defs_for_loan_kyc_app'], thrift['revoc_defs_for_loan_kyc_app'], \ + thrift['revoc_regs_for_loan_kyc_app'] = \ + await verifier_get_entities_from_ledger(thrift['pool'], thrift['did'], + alice_apply_loan_kyc_proof['identifiers'], thrift['name']) + + #logger.info("\"Thrift\" -> Verify \"Loan-Application-KYC\" Proof from Alice") + assert 'Alice' == \ + alice_apply_loan_kyc_proof['requested_proof']['revealed_attrs']['attr1_referent']['raw'] + assert 'Garcia' == \ + alice_apply_loan_kyc_proof['requested_proof']['revealed_attrs']['attr2_referent']['raw'] + assert '123-45-6789' == \ + alice_apply_loan_kyc_proof['requested_proof']['revealed_attrs']['attr3_referent']['raw'] + + assert await anoncreds.verifier_verify_proof(thrift['apply_loan_kyc_proof_request'], + thrift['alice_apply_loan_kyc_proof'], + thrift['schemas_for_loan_kyc_app'], thrift['cred_defs_for_loan_kyc_app'], + thrift['revoc_defs_for_loan_kyc_app'], + thrift['revoc_regs_for_loan_kyc_app']) + + #logger.info("==============================") + + logger.warning("==============================") + logger.warning("== Credential revocation - Acme revokes Alice's Job-Certificate ==") + logger.warning("------------------------------") + + #logger.info("\"Acme\" - Revoke credential") + acme['alice_cert_rev_reg_delta'] = \ + await anoncreds.issuer_revoke_credential(acme['wallet'], + acme['blob_storage_reader_cfg_handle'], + acme['revoc_reg_id'], + acme['job_certificate_cred_rev_id']) + + #logger.info("\"Acme\" - Post RevocationRegistryDelta to Ledger") + acme['revoc_reg_entry_req'] = \ + await ledger.build_revoc_reg_entry_request(acme['did'], acme['revoc_reg_id'], 'CL_ACCUM', + acme['alice_cert_rev_reg_delta']) + await ledger.sign_and_submit_request(acme['pool'], acme['wallet'], acme['did'], acme['revoc_reg_entry_req']) + + #logger.info("==============================") + + logger.warning("==============================") + logger.warning("== Apply for the loan with Thrift again - Job-Certificate proving ==") + logger.warning("------------------------------") + + await apply_loan_basic() + + assert not await anoncreds.verifier_verify_proof(thrift['apply_loan_proof_request'], + thrift['alice_apply_loan_proof'], + thrift['schemas_for_loan_app'], + thrift['cred_defs_for_loan_app'], + thrift['revoc_defs_for_loan_app'], + thrift['revoc_regs_for_loan_app']) + + logger.warning("==============================") + + logger.warning("\"Alice\" -> Close wallet") + await wallet.close_wallet(alice['wallet']) + + +if __name__ == '__main__': + run_coroutine(run) + time.sleep(1) # FIXME waiting for libindy thread complete From c1e7b5458ebbd9f8d67c18a940fca4e94b8285ec Mon Sep 17 00:00:00 2001 From: lovesh Date: Thu, 18 Jul 2019 13:49:47 +0530 Subject: [PATCH 017/320] write failing tests for bug where raw and encoded values in proof are ignored Signed-off-by: lovesh --- libindy/src/services/anoncreds/verifier.rs | 10 ++++- libindy/tests/anoncreds.rs | 52 +++++++++++++++++++++- 2 files changed, 58 insertions(+), 4 deletions(-) diff --git a/libindy/src/services/anoncreds/verifier.rs b/libindy/src/services/anoncreds/verifier.rs index 121ce4269d..75934b8269 100644 --- a/libindy/src/services/anoncreds/verifier.rs +++ b/libindy/src/services/anoncreds/verifier.rs @@ -45,12 +45,16 @@ impl Verifier { let received_predicates: HashMap = Verifier::_received_predicates(&full_proof)?; let received_self_attested_attrs: HashSet = Verifier::_received_self_attested_attrs(&full_proof); + println!("received_revealed_attrs={:?}", &received_revealed_attrs); + println!("received_predicates={:?}", &received_predicates); + println!("received_self_attested_attrs={:?}", &received_self_attested_attrs); + Verifier::_compare_attr_from_proof_and_request(proof_req, &received_revealed_attrs, &received_unrevealed_attrs, &received_self_attested_attrs, &received_predicates)?; - + println!("Requested attributes and predicates present"); Verifier::_verify_requested_restrictions(&proof_req, schemas, cred_defs, @@ -58,7 +62,7 @@ impl Verifier { &received_unrevealed_attrs, &received_predicates, &received_self_attested_attrs)?; - + println!("Requested restrictions satisfy"); let mut proof_verifier = CryptoVerifier::new_proof_verifier()?; let non_credential_schema = build_non_credential_schema()?; @@ -96,6 +100,7 @@ impl Verifier { } else { (None, None) }; let attrs_for_credential = Verifier::_get_revealed_attributes_for_credential(sub_proof_index, &full_proof.requested_proof, proof_req)?; + println!("revealed attrs_for_credential={:?}", &attrs_for_credential); let predicates_for_credential = Verifier::_get_predicates_for_credential(sub_proof_index, &full_proof.requested_proof, proof_req)?; let credential_schema = build_credential_schema(&schema.attr_names)?; @@ -278,6 +283,7 @@ impl Verifier { let op = parse_from_json( &build_wql_query(&info.name, &referent, &info.restrictions, &None)? )?; + println!("Operator is {:?}", &op); let filter = Verifier::_gather_filter_info(&referent, &proof_attr_identifiers, schemas, cred_defs)?; diff --git a/libindy/tests/anoncreds.rs b/libindy/tests/anoncreds.rs index 5f56ada40e..00460b5eff 100644 --- a/libindy/tests/anoncreds.rs +++ b/libindy/tests/anoncreds.rs @@ -3107,8 +3107,56 @@ mod high_cases { } #[test] - fn verifier_verify_proof_works_for_wrong_proof() { - let proof_json = anoncreds::proof_json().replace("1139481716457488690172217916278103335", "1111111111111111111111111111111111111"); + fn verifier_verify_proof_works_for_proof_does_not_correspond_to_request_attribute() { + let other_proof_req_json = json!({ + "nonce":"123432421212", + "name":"proof_req_1", + "version":"0.1", + "requested_attributes": json!({ + "attr1_referent": json!({ + "name":"sex" + }) + }), + "requested_predicates": json!({}), + }).to_string(); + let res = anoncreds::verifier_verify_proof(&other_proof_req_json, + &anoncreds::proof_json(), + &anoncreds::schemas_for_proof(), + &anoncreds::cred_defs_for_proof(), + "{}", + "{}"); + assert_code!(ErrorCode::AnoncredsProofRejected, res); + } + + #[test] + fn verifier_verify_proof_works_for_wrong_revealed_attr_value() { + let proof_json = anoncreds::proof_json().replace(r#"name":"1139481716457488690172217916278103335"#, r#"name":"1111111111111111111111111111111111111"#); + + let valid = anoncreds::verifier_verify_proof(&anoncreds::proof_request_attr(), + &proof_json, + &anoncreds::schemas_for_proof(), + &anoncreds::cred_defs_for_proof(), + "{}", + "{}").unwrap(); + assert!(!valid); + } + + #[test] + fn verifier_verify_proof_works_for_wrong_encoded() { + let proof_json = anoncreds::proof_json().replace(r#"encoded":"1139481716457488690172217916278103335"#, r#"encoded":"1111111111111111111111111111111111111"#); + + let valid = anoncreds::verifier_verify_proof(&anoncreds::proof_request_attr(), + &proof_json, + &anoncreds::schemas_for_proof(), + &anoncreds::cred_defs_for_proof(), + "{}", + "{}").unwrap(); + assert!(!valid); + } + + #[test] + fn verifier_verify_proof_works_for_wrong_raw() { + let proof_json = anoncreds::proof_json().replace(r#"encoded":"Alex"#, r#"encoded":"Bob"#); let valid = anoncreds::verifier_verify_proof(&anoncreds::proof_request_attr(), &proof_json, From 331dae46e71e0c842347272edbf18c30657b8490 Mon Sep 17 00:00:00 2001 From: Ian Costanzo Date: Thu, 18 Jul 2019 09:02:38 -0700 Subject: [PATCH 018/320] Remove perf testing scripts Signed-off-by: Ian Costanzo --- .../plugins/postgres_storage/Cargo.lock | 48 +- .../postgres_storage/postgres-perf-multi.sh | 2 - samples/python/src/getting_started_perf.py | 1211 ----------------- 3 files changed, 24 insertions(+), 1237 deletions(-) delete mode 100755 experimental/plugins/postgres_storage/postgres-perf-multi.sh delete mode 100644 samples/python/src/getting_started_perf.py diff --git a/experimental/plugins/postgres_storage/Cargo.lock b/experimental/plugins/postgres_storage/Cargo.lock index 95c46cc3b6..4ef72a6bd3 100644 --- a/experimental/plugins/postgres_storage/Cargo.lock +++ b/experimental/plugins/postgres_storage/Cargo.lock @@ -45,7 +45,7 @@ name = "atty" version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", "termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -63,7 +63,7 @@ dependencies = [ "autocfg 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "backtrace-sys 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-demangle 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -74,7 +74,7 @@ version = "0.1.26" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -165,7 +165,7 @@ name = "dirs" version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", "redox_users 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -193,7 +193,7 @@ version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "errno-dragonfly 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -203,7 +203,7 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "gcc 0.3.55 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -329,7 +329,7 @@ dependencies = [ "failure 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "int_traits 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "openssl 0.10.12 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)", @@ -351,7 +351,7 @@ name = "iovec" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -377,7 +377,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "libc" -version = "0.2.45" +version = "0.2.60" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -385,7 +385,7 @@ name = "libsodium-sys" version = "0.0.16" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -428,7 +428,7 @@ name = "memchr" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -437,7 +437,7 @@ version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", "version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -561,7 +561,7 @@ dependencies = [ "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", "openssl-sys 0.9.39 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -571,7 +571,7 @@ version = "0.9.39" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", "vcpkg 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -699,7 +699,7 @@ version = "0.3.22" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -709,7 +709,7 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -883,7 +883,7 @@ version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", "redox_syscall 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -893,7 +893,7 @@ name = "sodiumoxide" version = "0.0.16" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", "libsodium-sys 0.0.16 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -919,7 +919,7 @@ dependencies = [ "indy-crypto 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "int_traits 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "log-panics 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "named_type 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1005,7 +1005,7 @@ name = "termion" version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", "redox_syscall 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", "redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1023,7 +1023,7 @@ name = "time" version = "0.1.40" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", "redox_syscall 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1135,7 +1135,7 @@ name = "zmq" version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", "zmq-sys 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1145,7 +1145,7 @@ name = "zmq-sys" version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", "metadeps 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1200,7 +1200,7 @@ dependencies = [ "checksum keccak 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "67c21572b4949434e4fc1e1978b99c5f77064153c59d998bf13ecd96fb5ecba7" "checksum lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "76f033c7ad61445c5b347c7382dd1237847eb1bce590fe50365dcb33d546be73" "checksum lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a374c89b9db55895453a74c1e38861d9deec0b01b405a82516e9d5de4820dea1" -"checksum libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)" = "2d2857ec59fadc0773853c664d2d18e7198e83883e7060b63c924cb077bd5c74" +"checksum libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)" = "d44e80633f007889c7eff624b709ab43c92d708caad982295768a7b13ca3b5eb" "checksum libsodium-sys 0.0.16 (registry+https://github.com/rust-lang/crates.io-index)" = "fcbd1beeed8d44caa8a669ebaa697c313976e242c03cc9fb23d88bf1656f5542" "checksum log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "e19e8d5c34a3e0e2223db8e060f9e8264aeeb5c5fc64a4ee9965c062211c024b" "checksum log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c84ec4b527950aa83a329754b01dbe3f58361d1c5efacd1f6d68c494d08a17c6" diff --git a/experimental/plugins/postgres_storage/postgres-perf-multi.sh b/experimental/plugins/postgres_storage/postgres-perf-multi.sh deleted file mode 100755 index 73c0fd8ac8..0000000000 --- a/experimental/plugins/postgres_storage/postgres-perf-multi.sh +++ /dev/null @@ -1,2 +0,0 @@ -cd ../../../samples/python && \ -PYTHONPATH=.:../../wrappers/python/ python3 src/getting_started_perf.py -t postgres_storage -l libindystrgpostgres.dylib -e postgresstorage_init -c '{"url":"localhost:5432","wallet_scheme":"MultiWalletSingleTable"}' -s '{"account":"postgres","password":"mysecretpassword","admin_account":"postgres","admin_password":"mysecretpassword"}' diff --git a/samples/python/src/getting_started_perf.py b/samples/python/src/getting_started_perf.py deleted file mode 100644 index 8ba48d6da7..0000000000 --- a/samples/python/src/getting_started_perf.py +++ /dev/null @@ -1,1211 +0,0 @@ -import time - -from indy import anoncreds, crypto, did, ledger, pool, wallet, blob_storage - -import json -import logging - -import argparse -import sys -from ctypes import * -from os.path import dirname - -import random -import string - -from indy.error import ErrorCode, IndyError - -from src.utils import get_pool_genesis_txn_path, run_coroutine, PROTOCOL_VERSION - -logger = logging.getLogger(__name__) -logging.basicConfig(level=logging.WARNING) - -parser = argparse.ArgumentParser(description='Run python getting-started scenario (Alice/Faber)') -parser.add_argument('-t', '--storage_type', help='load custom wallet storage plug-in') -parser.add_argument('-l', '--library', help='dynamic library to load for plug-in') -parser.add_argument('-e', '--entrypoint', help='entry point for dynamic library') -parser.add_argument('-c', '--config', help='entry point for dynamic library') -parser.add_argument('-s', '--creds', help='entry point for dynamic library') - -args = parser.parse_args() - -# random string for multiple wallets -def random_str(N): - return ''.join(random.SystemRandom().choice(string.digits) for _ in range(N)) - - -# check if we need to dyna-load a custom wallet storage plug-in -if args.storage_type: - if not (args.library and args.entrypoint): - parser.print_help() - sys.exit(0) - stg_lib = CDLL(args.library) - result = stg_lib[args.entrypoint]() - if result != 0: - print("Error unable to load wallet storage", result) - parser.print_help() - sys.exit(0) - - # for postgres storage, also call the storage init (non-standard) - if args.storage_type == "postgres_storage": - try: - print("Calling init_storagetype() for postgres:", args.config, args.creds) - init_storagetype = stg_lib["init_storagetype"] - c_config = c_char_p(args.config.encode('utf-8')) - c_credentials = c_char_p(args.creds.encode('utf-8')) - result = init_storagetype(c_config, c_credentials) - print(" ... returns ", result) - except RuntimeError as e: - print("Error initializing storage, ignoring ...", e) - - print("Success, loaded wallet storage", args.storage_type) - - -async def run(): - logger.warning("Getting started -> started") - - alice_loop_count = 10 - alice_thread_count = 1 - rev_reg_max_cred_count = (alice_loop_count * alice_thread_count) + 100 - - pool_ = { - 'name': 'pool1' - } - logger.warning("Open Pool Ledger: {}".format(pool_['name'])) - pool_['genesis_txn_path'] = get_pool_genesis_txn_path(pool_['name']) - pool_['config'] = json.dumps({"genesis_txn": str(pool_['genesis_txn_path'])}) - - # Set protocol version 2 to work with Indy Node 1.4 - await pool.set_protocol_version(PROTOCOL_VERSION) - - try: - await pool.create_pool_ledger_config(pool_['name'], pool_['config']) - except IndyError as ex: - if ex.error_code == ErrorCode.PoolLedgerConfigAlreadyExistsError: - pass - pool_['handle'] = await pool.open_pool_ledger(pool_['name'], None) - - logger.warning("==============================") - logger.warning("=== Getting Trust Anchor credentials for Faber, Acme, Thrift and Government ==") - logger.warning("------------------------------") - - logger.info("\"Sovrin Steward\" -> Create wallet") - steward = { - 'name': "Sovrin Steward", - 'wallet_config': json.dumps({'id': 'sovrin_steward_wallet'}), - 'wallet_credentials': json.dumps({'key': 'steward_wallet_key'}), - 'pool': pool_['handle'], - 'seed': '000000000000000000000000Steward1' - } - - try: - await wallet.create_wallet(steward['wallet_config'], steward['wallet_credentials']) - except IndyError as ex: - if ex.error_code == ErrorCode.WalletAlreadyExistsError: - pass - - steward['wallet'] = await wallet.open_wallet(steward['wallet_config'], steward['wallet_credentials']) - - logger.info("\"Sovrin Steward\" -> Create and store in Wallet DID from seed") - steward['did_info'] = json.dumps({'seed': steward['seed']}) - steward['did'], steward['key'] = await did.create_and_store_my_did(steward['wallet'], steward['did_info']) - - logger.info("==============================") - logger.warning("== Getting Trust Anchor credentials - Government Onboarding ==") - logger.info("------------------------------") - - government = { - 'name': 'Government', - 'wallet_config': json.dumps({'id': 'government_wallet'}), - 'wallet_credentials': json.dumps({'key': 'government_wallet_key'}), - 'pool': pool_['handle'], - 'role': 'TRUST_ANCHOR' - } - steward['did_for_government'], steward['key_for_government'], government['did_for_steward'], \ - government['key_for_steward'], _ = await onboarding(steward, government) - - logger.info("==============================") - logger.warning("== Getting Trust Anchor credentials - Government getting Verinym ==") - logger.info("------------------------------") - - government['did'] = await get_verinym(steward, steward['did_for_government'], steward['key_for_government'], - government, government['did_for_steward'], government['key_for_steward']) - - logger.info("==============================") - logger.warning("== Getting Trust Anchor credentials - Faber Onboarding ==") - logger.info("------------------------------") - - faber = { - 'name': 'Faber', - 'wallet_config': json.dumps({'id': 'faber_wallet'}), - 'wallet_credentials': json.dumps({'key': 'faber_wallet_key'}), - 'pool': pool_['handle'], - 'role': 'TRUST_ANCHOR' - } - steward['did_for_faber'], steward['key_for_faber'], faber['did_for_steward'], faber['key_for_steward'], _ = \ - await onboarding(steward, faber) - - logger.info("==============================") - logger.warning("== Getting Trust Anchor credentials - Faber getting Verinym ==") - logger.info("------------------------------") - - faber['did'] = \ - await get_verinym(steward, steward['did_for_faber'], steward['key_for_faber'], - faber, faber['did_for_steward'], faber['key_for_steward']) - - logger.info("==============================") - logger.warning("== Getting Trust Anchor credentials - Acme Onboarding ==") - logger.info("------------------------------") - - acme = { - 'name': 'Acme', - 'wallet_config': json.dumps({'id': 'acme_wallet'}), - 'wallet_credentials': json.dumps({'key': 'acme_wallet_key'}), - 'pool': pool_['handle'], - 'role': 'TRUST_ANCHOR' - } - steward['did_for_acme'], steward['key_for_acme'], acme['did_for_steward'], acme['key_for_steward'], _ = \ - await onboarding(steward, acme) - - logger.info("==============================") - logger.warning("== Getting Trust Anchor credentials - Acme getting Verinym ==") - logger.info("------------------------------") - - acme['did'] = await get_verinym(steward, steward['did_for_acme'], steward['key_for_acme'], - acme, acme['did_for_steward'], acme['key_for_steward']) - - logger.info("==============================") - logger.warning("== Getting Trust Anchor credentials - Thrift Onboarding ==") - logger.info("------------------------------") - - thrift = { - 'name': 'Thrift', - 'wallet_config': json.dumps({'id': 'thrift_wallet'}), - 'wallet_credentials': json.dumps({'key': 'thrift_wallet_key'}), - 'pool': pool_['handle'], - 'role': 'TRUST_ANCHOR' - } - steward['did_for_thrift'], steward['key_for_thrift'], thrift['did_for_steward'], thrift['key_for_steward'], _ = \ - await onboarding(steward, thrift) - - logger.info("==============================") - logger.warning("== Getting Trust Anchor credentials - Thrift getting Verinym ==") - logger.info("------------------------------") - - thrift['did'] = await get_verinym(steward, steward['did_for_thrift'], steward['key_for_thrift'], - thrift, thrift['did_for_steward'], thrift['key_for_steward']) - - logger.info("==============================") - logger.warning("=== Credential Schemas Setup ==") - logger.info("------------------------------") - - logger.info("\"Government\" -> Create \"Job-Certificate\" Schema") - job_certificate = { - 'name': 'Job-Certificate', - 'version': '0.2', - 'attributes': ['first_name', 'last_name', 'salary', 'employee_status', 'experience'] - } - (government['job_certificate_schema_id'], government['job_certificate_schema']) = \ - await anoncreds.issuer_create_schema(government['did'], job_certificate['name'], job_certificate['version'], - json.dumps(job_certificate['attributes'])) - job_certificate_schema_id = government['job_certificate_schema_id'] - - logger.info("\"Government\" -> Send \"Job-Certificate\" Schema to Ledger") - await send_schema(government['pool'], government['wallet'], government['did'], government['job_certificate_schema']) - - logger.info("\"Government\" -> Create \"Transcript\" Schema") - transcript = { - 'name': 'Transcript', - 'version': '1.2', - 'attributes': ['first_name', 'last_name', 'degree', 'status', 'year', 'average', 'ssn'] - } - (government['transcript_schema_id'], government['transcript_schema']) = \ - await anoncreds.issuer_create_schema(government['did'], transcript['name'], transcript['version'], - json.dumps(transcript['attributes'])) - transcript_schema_id = government['transcript_schema_id'] - - logger.info("\"Government\" -> Send \"Transcript\" Schema to Ledger") - await send_schema(government['pool'], government['wallet'], government['did'], government['transcript_schema']) - - time.sleep(1) # sleep 1 second before getting schema - - logger.info("==============================") - logger.warning("=== Faber Credential Definition Setup ==") - logger.info("------------------------------") - - logger.info("\"Faber\" -> Get \"Transcript\" Schema from Ledger") - (faber['transcript_schema_id'], faber['transcript_schema']) = \ - await get_schema(faber['pool'], faber['did'], transcript_schema_id) - - logger.info("\"Faber\" -> Create and store in Wallet \"Faber Transcript\" Credential Definition") - transcript_cred_def = { - 'tag': 'TAG1', - 'type': 'CL', - 'config': {"support_revocation": False} - } - (faber['transcript_cred_def_id'], faber['transcript_cred_def']) = \ - await anoncreds.issuer_create_and_store_credential_def(faber['wallet'], faber['did'], - faber['transcript_schema'], transcript_cred_def['tag'], - transcript_cred_def['type'], - json.dumps(transcript_cred_def['config'])) - - logger.info("\"Faber\" -> Send \"Faber Transcript\" Credential Definition to Ledger") - await send_cred_def(faber['pool'], faber['wallet'], faber['did'], faber['transcript_cred_def']) - - logger.info("==============================") - logger.warning("=== Acme Credential Definition Setup ==") - logger.info("------------------------------") - - logger.info("\"Acme\" -> Get from Ledger \"Job-Certificate\" Schema") - (acme['job_certificate_schema_id'], acme['job_certificate_schema']) = \ - await get_schema(acme['pool'], acme['did'], job_certificate_schema_id) - - logger.info("\"Acme\" -> Create and store in Wallet \"Acme Job-Certificate\" Credential Definition") - job_certificate_cred_def = { - 'tag': 'TAG1', - 'type': 'CL', - 'config': {"support_revocation": True} - } - (acme['job_certificate_cred_def_id'], acme['job_certificate_cred_def']) = \ - await anoncreds.issuer_create_and_store_credential_def(acme['wallet'], acme['did'], - acme['job_certificate_schema'], - job_certificate_cred_def['tag'], - job_certificate_cred_def['type'], - json.dumps(job_certificate_cred_def['config'])) - - logger.info("\"Acme\" -> Send \"Acme Job-Certificate\" Credential Definition to Ledger") - await send_cred_def(acme['pool'], acme['wallet'], acme['did'], acme['job_certificate_cred_def']) - - logger.warning("\"Acme\" -> Creates Revocation Registry ({})".format(rev_reg_max_cred_count)) - acme['tails_writer_config'] = json.dumps({'base_dir': "/tmp/indy_acme_tails", 'uri_pattern': ''}) - tails_writer = await blob_storage.open_writer('default', acme['tails_writer_config']) - (acme['revoc_reg_id'], acme['revoc_reg_def'], acme['revoc_reg_entry']) = \ - await anoncreds.issuer_create_and_store_revoc_reg(acme['wallet'], acme['did'], 'CL_ACCUM', 'TAG1', - acme['job_certificate_cred_def_id'], - json.dumps({'max_cred_num': rev_reg_max_cred_count, - 'issuance_type': 'ISSUANCE_ON_DEMAND'}), - tails_writer) - - logger.warning("\"Acme\" -> Post Revocation Registry Definition to Ledger") - acme['revoc_reg_def_request'] = await ledger.build_revoc_reg_def_request(acme['did'], acme['revoc_reg_def']) - await ledger.sign_and_submit_request(acme['pool'], acme['wallet'], acme['did'], acme['revoc_reg_def_request']) - - logger.warning("\"Acme\" -> Post Revocation Registry Entry to Ledger") - acme['revoc_reg_entry_request'] = \ - await ledger.build_revoc_reg_entry_request(acme['did'], acme['revoc_reg_id'], 'CL_ACCUM', - acme['revoc_reg_entry']) - await ledger.sign_and_submit_request(acme['pool'], acme['wallet'], acme['did'], acme['revoc_reg_entry_request']) - - # loop for multiple alice's - for i_alice in range(alice_loop_count): - unique_str = random_str(16) - await run_alice_credential_loop(i_alice+1, alice_loop_count, unique_str, pool_, faber, acme, thrift) - - logger.info(" \"Sovrin Steward\" -> Close and Delete wallet") - await wallet.close_wallet(steward['wallet']) - await wallet.delete_wallet(steward['wallet_config'], steward['wallet_credentials']) - - logger.info("\"Government\" -> Close and Delete wallet") - await wallet.close_wallet(government['wallet']) - await wallet.delete_wallet(wallet_config("delete", government['wallet_config']), wallet_credentials("delete", government['wallet_credentials'])) - - logger.info("\"Faber\" -> Close and Delete wallet") - await wallet.close_wallet(faber['wallet']) - await wallet.delete_wallet(wallet_config("delete", faber['wallet_config']), wallet_credentials("delete", faber['wallet_credentials'])) - - logger.info("\"Acme\" -> Close and Delete wallet") - await wallet.close_wallet(acme['wallet']) - await wallet.delete_wallet(wallet_config("delete", acme['wallet_config']), wallet_credentials("delete", acme['wallet_credentials'])) - - logger.info("\"Thrift\" -> Close and Delete wallet") - await wallet.close_wallet(thrift['wallet']) - await wallet.delete_wallet(wallet_config("delete", thrift['wallet_config']), wallet_credentials("delete", thrift['wallet_credentials'])) - - #logger.info("\"Alice\" -> Close and Delete wallet") - #await wallet.close_wallet(alice['wallet']) - #await wallet.delete_wallet(wallet_config("delete", alice['wallet_config']), wallet_credentials("delete", alice['wallet_credentials'])) - - logger.info("Close and Delete pool") - await pool.close_pool_ledger(pool_['handle']) - await pool.delete_pool_ledger_config(pool_['name']) - - logger.info("Getting started -> done") - - -async def onboarding(_from, to): - logger.info("\"{}\" -> Create and store in Wallet \"{} {}\" DID".format(_from['name'], _from['name'], to['name'])) - (from_to_did, from_to_key) = await did.create_and_store_my_did(_from['wallet'], "{}") - - #logger.info("\"{}\" -> Send Nym to Ledger for \"{} {}\" DID".format(_from['name'], _from['name'], to['name'])) - await send_nym(_from['pool'], _from['wallet'], _from['did'], from_to_did, from_to_key, None) - - #logger.info("\"{}\" -> Send connection request to {} with \"{} {}\" DID and nonce" - # .format(_from['name'], to['name'], _from['name'], to['name'])) - connection_request = { - 'did': from_to_did, - 'nonce': 123456789 - } - - if 'wallet' not in to: - #logger.info("\"{}\" -> Create wallet".format(to['name'])) - try: - await wallet.create_wallet(wallet_config("create", to['wallet_config']), wallet_credentials("create", to['wallet_credentials'])) - except IndyError as ex: - if ex.error_code == ErrorCode.PoolLedgerConfigAlreadyExistsError: - pass - to['wallet'] = await wallet.open_wallet(wallet_config("open", to['wallet_config']), wallet_credentials("open", to['wallet_credentials'])) - - #logger.info("\"{}\" -> Create and store in Wallet \"{} {}\" DID".format(to['name'], to['name'], _from['name'])) - (to_from_did, to_from_key) = await did.create_and_store_my_did(to['wallet'], "{}") - - #logger.info("\"{}\" -> Get key for did from \"{}\" connection request".format(to['name'], _from['name'])) - from_to_verkey = await did.key_for_did(_from['pool'], to['wallet'], connection_request['did']) - - #logger.info("\"{}\" -> Anoncrypt connection response for \"{}\" with \"{} {}\" DID, verkey and nonce" - # .format(to['name'], _from['name'], to['name'], _from['name'])) - to['connection_response'] = json.dumps({ - 'did': to_from_did, - 'verkey': to_from_key, - 'nonce': connection_request['nonce'] - }) - to['anoncrypted_connection_response'] = \ - await crypto.anon_crypt(from_to_verkey, to['connection_response'].encode('utf-8')) - - #logger.info("\"{}\" -> Send anoncrypted connection response to \"{}\"".format(to['name'], _from['name'])) - _from['anoncrypted_connection_response'] = to['anoncrypted_connection_response'] - - #logger.info("\"{}\" -> Anondecrypt connection response from \"{}\"".format(_from['name'], to['name'])) - _from['connection_response'] = \ - json.loads((await crypto.anon_decrypt(_from['wallet'], from_to_key, - _from['anoncrypted_connection_response'])).decode("utf-8")) - - #logger.info("\"{}\" -> Authenticates \"{}\" by comparision of Nonce".format(_from['name'], to['name'])) - assert connection_request['nonce'] == _from['connection_response']['nonce'] - - #logger.info("\"{}\" -> Send Nym to Ledger for \"{} {}\" DID".format(_from['name'], to['name'], _from['name'])) - await send_nym(_from['pool'], _from['wallet'], _from['did'], to_from_did, to_from_key, None) - - return from_to_did, from_to_key, to_from_did, to_from_key, _from['connection_response'] - - -def wallet_config(operation, wallet_config_str): - if not args.storage_type: - return wallet_config_str - wallet_config_json = json.loads(wallet_config_str) - wallet_config_json['storage_type'] = args.storage_type - if args.config: - wallet_config_json['storage_config'] = json.loads(args.config) - #print(operation, json.dumps(wallet_config_json)) - return json.dumps(wallet_config_json) - - -def wallet_credentials(operation, wallet_credentials_str): - if not args.storage_type: - return wallet_credentials_str - wallet_credentials_json = json.loads(wallet_credentials_str) - if args.creds: - wallet_credentials_json['storage_credentials'] = json.loads(args.creds) - #print(operation, json.dumps(wallet_credentials_json)) - return json.dumps(wallet_credentials_json) - - -async def get_verinym(_from, from_to_did, from_to_key, to, to_from_did, to_from_key): - logger.info("\"{}\" -> Create and store in Wallet \"{}\" new DID".format(to['name'], to['name'])) - (to_did, to_key) = await did.create_and_store_my_did(to['wallet'], "{}") - - #logger.info("\"{}\" -> Authcrypt \"{} DID info\" for \"{}\"".format(to['name'], to['name'], _from['name'])) - to['did_info'] = json.dumps({ - 'did': to_did, - 'verkey': to_key - }) - to['authcrypted_did_info'] = \ - await crypto.auth_crypt(to['wallet'], to_from_key, from_to_key, to['did_info'].encode('utf-8')) - - #logger.info("\"{}\" -> Send authcrypted \"{} DID info\" to {}".format(to['name'], to['name'], _from['name'])) - - #logger.info("\"{}\" -> Authdecrypted \"{} DID info\" from {}".format(_from['name'], to['name'], to['name'])) - sender_verkey, authdecrypted_did_info_json, authdecrypted_did_info = \ - await auth_decrypt(_from['wallet'], from_to_key, to['authcrypted_did_info']) - - #logger.info("\"{}\" -> Authenticate {} by comparision of Verkeys".format(_from['name'], to['name'], )) - assert sender_verkey == await did.key_for_did(_from['pool'], _from['wallet'], to_from_did) - - #logger.info("\"{}\" -> Send Nym to Ledger for \"{} DID\" with {} Role" - # .format(_from['name'], to['name'], to['role'])) - await send_nym(_from['pool'], _from['wallet'], _from['did'], authdecrypted_did_info['did'], - authdecrypted_did_info['verkey'], to['role']) - - return to_did - - -async def send_nym(pool_handle, wallet_handle, _did, new_did, new_key, role): - nym_request = await ledger.build_nym_request(_did, new_did, new_key, None, role) - await ledger.sign_and_submit_request(pool_handle, wallet_handle, _did, nym_request) - - -async def send_schema(pool_handle, wallet_handle, _did, schema): - schema_request = await ledger.build_schema_request(_did, schema) - await ledger.sign_and_submit_request(pool_handle, wallet_handle, _did, schema_request) - - -async def send_cred_def(pool_handle, wallet_handle, _did, cred_def_json): - cred_def_request = await ledger.build_cred_def_request(_did, cred_def_json) - await ledger.sign_and_submit_request(pool_handle, wallet_handle, _did, cred_def_request) - - -async def get_schema(pool_handle, _did, schema_id): - get_schema_request = await ledger.build_get_schema_request(_did, schema_id) - get_schema_response = await ledger.submit_request(pool_handle, get_schema_request) - return await ledger.parse_get_schema_response(get_schema_response) - - -async def get_cred_def(pool_handle, _did, cred_def_id): - get_cred_def_request = await ledger.build_get_cred_def_request(_did, cred_def_id) - get_cred_def_response = await ledger.submit_request(pool_handle, get_cred_def_request) - return await ledger.parse_get_cred_def_response(get_cred_def_response) - - -async def get_credential_for_referent(search_handle, referent): - credentials = json.loads( - await anoncreds.prover_fetch_credentials_for_proof_req(search_handle, referent, 10)) - return credentials[0]['cred_info'] - - -def get_timestamp_for_attribute(cred_for_attribute, revoc_states): - if cred_for_attribute['rev_reg_id'] in revoc_states: - return int(next(iter(revoc_states[cred_for_attribute['rev_reg_id']]))) - else: - return None - - -async def prover_get_entities_from_ledger(pool_handle, _did, identifiers, actor, timestamp_from=None, timestamp_to=None): - schemas = {} - cred_defs = {} - rev_states = {} - for item in identifiers.values(): - #logger.info("\"{}\" -> Get Schema from Ledger".format(actor)) - (received_schema_id, received_schema) = await get_schema(pool_handle, _did, item['schema_id']) - schemas[received_schema_id] = json.loads(received_schema) - - #logger.info("\"{}\" -> Get Claim Definition from Ledger".format(actor)) - (received_cred_def_id, received_cred_def) = await get_cred_def(pool_handle, _did, item['cred_def_id']) - cred_defs[received_cred_def_id] = json.loads(received_cred_def) - - if 'rev_reg_id' in item and item['rev_reg_id'] is not None: - # Create Revocations States - #logger.info("\"{}\" -> Get Revocation Registry Definition from Ledger".format(actor)) - get_revoc_reg_def_request = await ledger.build_get_revoc_reg_def_request(_did, item['rev_reg_id']) - - get_revoc_reg_def_response = await ledger.submit_request(pool_handle, get_revoc_reg_def_request) - (rev_reg_id, revoc_reg_def_json) = await ledger.parse_get_revoc_reg_def_response(get_revoc_reg_def_response) - - #logger.info("\"{}\" -> Get Revocation Registry Delta from Ledger".format(actor)) - if not timestamp_to: timestamp_to = int(time.time()) - get_revoc_reg_delta_request = \ - await ledger.build_get_revoc_reg_delta_request(_did, item['rev_reg_id'], timestamp_from, timestamp_to) - get_revoc_reg_delta_response = \ - await ledger.submit_request(pool_handle, get_revoc_reg_delta_request) - (rev_reg_id, revoc_reg_delta_json, t) = \ - await ledger.parse_get_revoc_reg_delta_response(get_revoc_reg_delta_response) - - tails_reader_config = json.dumps( - {'base_dir': dirname(json.loads(revoc_reg_def_json)['value']['tailsLocation']), - 'uri_pattern': ''}) - blob_storage_reader_cfg_handle = await blob_storage.open_reader('default', tails_reader_config) - - #logger.info('%s - Create Revocation State', actor) - rev_state_json = \ - await anoncreds.create_revocation_state(blob_storage_reader_cfg_handle, revoc_reg_def_json, - revoc_reg_delta_json, t, item['cred_rev_id']) - rev_states[rev_reg_id] = {t: json.loads(rev_state_json)} - - return json.dumps(schemas), json.dumps(cred_defs), json.dumps(rev_states) - - -async def verifier_get_entities_from_ledger(pool_handle, _did, identifiers, actor, timestamp=None): - schemas = {} - cred_defs = {} - rev_reg_defs = {} - rev_regs = {} - for item in identifiers: - #logger.info("\"{}\" -> Get Schema from Ledger".format(actor)) - (received_schema_id, received_schema) = await get_schema(pool_handle, _did, item['schema_id']) - schemas[received_schema_id] = json.loads(received_schema) - - #logger.info("\"{}\" -> Get Claim Definition from Ledger".format(actor)) - (received_cred_def_id, received_cred_def) = await get_cred_def(pool_handle, _did, item['cred_def_id']) - cred_defs[received_cred_def_id] = json.loads(received_cred_def) - - if 'rev_reg_id' in item and item['rev_reg_id'] is not None: - # Get Revocation Definitions and Revocation Registries - #logger.info("\"{}\" -> Get Revocation Definition from Ledger".format(actor)) - get_revoc_reg_def_request = await ledger.build_get_revoc_reg_def_request(_did, item['rev_reg_id']) - - get_revoc_reg_def_response = await ledger.submit_request(pool_handle, get_revoc_reg_def_request) - (rev_reg_id, revoc_reg_def_json) = await ledger.parse_get_revoc_reg_def_response(get_revoc_reg_def_response) - - #logger.info("\"{}\" -> Get Revocation Registry from Ledger".format(actor)) - if not timestamp: timestamp = item['timestamp'] - get_revoc_reg_request = \ - await ledger.build_get_revoc_reg_request(_did, item['rev_reg_id'], timestamp) - get_revoc_reg_response = await ledger.submit_request(pool_handle, get_revoc_reg_request) - (rev_reg_id, rev_reg_json, timestamp2) = await ledger.parse_get_revoc_reg_response(get_revoc_reg_response) - - rev_regs[rev_reg_id] = {timestamp2: json.loads(rev_reg_json)} - rev_reg_defs[rev_reg_id] = json.loads(revoc_reg_def_json) - - return json.dumps(schemas), json.dumps(cred_defs), json.dumps(rev_reg_defs), json.dumps(rev_regs) - - -async def auth_decrypt(wallet_handle, key, message): - from_verkey, decrypted_message_json = await crypto.auth_decrypt(wallet_handle, key, message) - decrypted_message_json = decrypted_message_json.decode("utf-8") - decrypted_message = json.loads(decrypted_message_json) - return from_verkey, decrypted_message_json, decrypted_message - - -async def run_alice_credential_loop(i, j, unique_str, pool_in, faber_in, acme_in, thrift_in): - logger.warning("==============================") - logger.warning("Alice {} of {} (Alice{})".format(i, j, unique_str)) - logger.warning("==============================") - - # copy the input dicts so we don't overwrite each other - pool_ = pool_in.copy() - faber = faber_in.copy() - acme = acme_in.copy() - thrift = thrift_in.copy() - - logger.warning("==============================") - logger.warning("=== Getting Transcript with Faber ==") - logger.warning("==============================") - logger.warning("== Getting Transcript with Faber - Onboarding ==") - logger.warning("------------------------------") - - alice = { - 'name': 'Alice'+unique_str, - 'wallet_config': json.dumps({'id': 'alice_wallet'+unique_str}), - 'wallet_credentials': json.dumps({'key': 'alice_wallet_key'}), - 'pool': pool_['handle'], - } - faber['did_for_alice'], faber['key_for_alice'], alice['did_for_faber'], alice['key_for_faber'], \ - faber['alice_connection_response'] = await onboarding(faber, alice) - - logger.warning("==============================") - logger.warning("== Getting Transcript with Faber - Getting Transcript Credential ==") - logger.warning("------------------------------") - - #logger.info("\"Faber\" -> Create \"Transcript\" Credential Offer for Alice") - faber['transcript_cred_offer'] = \ - await anoncreds.issuer_create_credential_offer(faber['wallet'], faber['transcript_cred_def_id']) - - #logger.info("\"Faber\" -> Get key for Alice did") - faber['alice_key_for_faber'] = \ - await did.key_for_did(faber['pool'], faber['wallet'], faber['alice_connection_response']['did']) - - #logger.info("\"Faber\" -> Authcrypt \"Transcript\" Credential Offer for Alice") - faber['authcrypted_transcript_cred_offer'] = \ - await crypto.auth_crypt(faber['wallet'], faber['key_for_alice'], faber['alice_key_for_faber'], - faber['transcript_cred_offer'].encode('utf-8')) - - #logger.info("\"Faber\" -> Send authcrypted \"Transcript\" Credential Offer to Alice") - alice['authcrypted_transcript_cred_offer'] = faber['authcrypted_transcript_cred_offer'] - - #logger.info("\"Alice\" -> Authdecrypted \"Transcript\" Credential Offer from Faber") - alice['faber_key_for_alice'], alice['transcript_cred_offer'], authdecrypted_transcript_cred_offer = \ - await auth_decrypt(alice['wallet'], alice['key_for_faber'], alice['authcrypted_transcript_cred_offer']) - alice['transcript_schema_id'] = authdecrypted_transcript_cred_offer['schema_id'] - alice['transcript_cred_def_id'] = authdecrypted_transcript_cred_offer['cred_def_id'] - - #logger.info("\"Alice\" -> Create and store \"Alice\" Master Secret in Wallet") - alice['master_secret_id'] = await anoncreds.prover_create_master_secret(alice['wallet'], None) - - #logger.info("\"Alice\" -> Get \"Faber Transcript\" Credential Definition from Ledger") - (alice['faber_transcript_cred_def_id'], alice['faber_transcript_cred_def']) = \ - await get_cred_def(alice['pool'], alice['did_for_faber'], alice['transcript_cred_def_id']) - - #logger.info("\"Alice\" -> Create \"Transcript\" Credential Request for Faber") - (alice['transcript_cred_request'], alice['transcript_cred_request_metadata']) = \ - await anoncreds.prover_create_credential_req(alice['wallet'], alice['did_for_faber'], - alice['transcript_cred_offer'], alice['faber_transcript_cred_def'], - alice['master_secret_id']) - - #logger.info("\"Alice\" -> Authcrypt \"Transcript\" Credential Request for Faber") - alice['authcrypted_transcript_cred_request'] = \ - await crypto.auth_crypt(alice['wallet'], alice['key_for_faber'], alice['faber_key_for_alice'], - alice['transcript_cred_request'].encode('utf-8')) - - #logger.info("\"Alice\" -> Send authcrypted \"Transcript\" Credential Request to Faber") - faber['authcrypted_transcript_cred_request'] = alice['authcrypted_transcript_cred_request'] - - #logger.info("\"Faber\" -> Authdecrypt \"Transcript\" Credential Request from Alice") - faber['alice_key_for_faber'], faber['transcript_cred_request'], _ = \ - await auth_decrypt(faber['wallet'], faber['key_for_alice'], faber['authcrypted_transcript_cred_request']) - - #logger.info("\"Faber\" -> Create \"Transcript\" Credential for Alice") - faber['alice_transcript_cred_values'] = json.dumps({ - "first_name": {"raw": "Alice", "encoded": "1139481716457488690172217916278103335"}, - "last_name": {"raw": "Garcia", "encoded": "5321642780241790123587902456789123452"}, - "degree": {"raw": "Bachelor of Science, Marketing", "encoded": "12434523576212321"}, - "status": {"raw": "graduated", "encoded": "2213454313412354"}, - "ssn": {"raw": "123-45-6789", "encoded": "3124141231422543541"}, - "year": {"raw": "2015", "encoded": "2015"}, - "average": {"raw": "5", "encoded": "5"} - }) - faber['transcript_cred'], _, _ = \ - await anoncreds.issuer_create_credential(faber['wallet'], faber['transcript_cred_offer'], - faber['transcript_cred_request'], - faber['alice_transcript_cred_values'], None, None) - - #logger.info("\"Faber\" -> Authcrypt \"Transcript\" Credential for Alice") - faber['authcrypted_transcript_cred'] = \ - await crypto.auth_crypt(faber['wallet'], faber['key_for_alice'], faber['alice_key_for_faber'], - faber['transcript_cred'].encode('utf-8')) - - #logger.info("\"Faber\" -> Send authcrypted \"Transcript\" Credential to Alice") - alice['authcrypted_transcript_cred'] = faber['authcrypted_transcript_cred'] - - #logger.info("\"Alice\" -> Authdecrypted \"Transcript\" Credential from Faber") - _, alice['transcript_cred'], _ = \ - await auth_decrypt(alice['wallet'], alice['key_for_faber'], alice['authcrypted_transcript_cred']) - - #logger.info("\"Alice\" -> Store \"Transcript\" Credential from Faber") - _, alice['transcript_cred_def'] = await get_cred_def(alice['pool'], alice['did_for_faber'], - alice['transcript_cred_def_id']) - - await anoncreds.prover_store_credential(alice['wallet'], None, alice['transcript_cred_request_metadata'], - alice['transcript_cred'], alice['transcript_cred_def'], None) - - logger.warning("==============================") - logger.warning("=== Apply for the job with Acme ==") - logger.warning("==============================") - logger.warning("== Apply for the job with Acme - Onboarding ==") - logger.warning("------------------------------") - - acme['did_for_alice'], acme['key_for_alice'], alice['did_for_acme'], alice['key_for_acme'], \ - acme['alice_connection_response'] = await onboarding(acme, alice) - - #logger.info("==============================") - #logger.info("== Apply for the job with Acme - Transcript proving ==") - #logger.info("------------------------------") - - #logger.info("\"Acme\" -> Create \"Job-Application\" Proof Request") - acme['job_application_proof_request'] = json.dumps({ - 'nonce': '1432422343242122312411212', - 'name': 'Job-Application', - 'version': '0.1', - 'requested_attributes': { - 'attr1_referent': { - 'name': 'first_name' - }, - 'attr2_referent': { - 'name': 'last_name' - }, - 'attr3_referent': { - 'name': 'degree', - 'restrictions': [{'cred_def_id': faber['transcript_cred_def_id']}] - }, - 'attr4_referent': { - 'name': 'status', - 'restrictions': [{'cred_def_id': faber['transcript_cred_def_id']}] - }, - 'attr5_referent': { - 'name': 'ssn', - 'restrictions': [{'cred_def_id': faber['transcript_cred_def_id']}] - }, - 'attr6_referent': { - 'name': 'phone_number' - } - }, - 'requested_predicates': { - 'predicate1_referent': { - 'name': 'average', - 'p_type': '>=', - 'p_value': 4, - 'restrictions': [{'cred_def_id': faber['transcript_cred_def_id']}] - } - } - }) - - #logger.info("\"Acme\" -> Get key for Alice did") - acme['alice_key_for_acme'] = \ - await did.key_for_did(acme['pool'], acme['wallet'], acme['alice_connection_response']['did']) - - #logger.info("\"Acme\" -> Authcrypt \"Job-Application\" Proof Request for Alice") - acme['authcrypted_job_application_proof_request'] = \ - await crypto.auth_crypt(acme['wallet'], acme['key_for_alice'], acme['alice_key_for_acme'], - acme['job_application_proof_request'].encode('utf-8')) - - #logger.info("\"Acme\" -> Send authcrypted \"Job-Application\" Proof Request to Alice") - alice['authcrypted_job_application_proof_request'] = acme['authcrypted_job_application_proof_request'] - - #logger.info("\"Alice\" -> Authdecrypt \"Job-Application\" Proof Request from Acme") - alice['acme_key_for_alice'], alice['job_application_proof_request'], _ = \ - await auth_decrypt(alice['wallet'], alice['key_for_acme'], alice['authcrypted_job_application_proof_request']) - - #logger.info("\"Alice\" -> Get credentials for \"Job-Application\" Proof Request") - - search_for_job_application_proof_request = \ - await anoncreds.prover_search_credentials_for_proof_req(alice['wallet'], - alice['job_application_proof_request'], None) - - cred_for_attr1 = await get_credential_for_referent(search_for_job_application_proof_request, 'attr1_referent') - cred_for_attr2 = await get_credential_for_referent(search_for_job_application_proof_request, 'attr2_referent') - cred_for_attr3 = await get_credential_for_referent(search_for_job_application_proof_request, 'attr3_referent') - cred_for_attr4 = await get_credential_for_referent(search_for_job_application_proof_request, 'attr4_referent') - cred_for_attr5 = await get_credential_for_referent(search_for_job_application_proof_request, 'attr5_referent') - cred_for_predicate1 = \ - await get_credential_for_referent(search_for_job_application_proof_request, 'predicate1_referent') - - await anoncreds.prover_close_credentials_search_for_proof_req(search_for_job_application_proof_request) - - alice['creds_for_job_application_proof'] = {cred_for_attr1['referent']: cred_for_attr1, - cred_for_attr2['referent']: cred_for_attr2, - cred_for_attr3['referent']: cred_for_attr3, - cred_for_attr4['referent']: cred_for_attr4, - cred_for_attr5['referent']: cred_for_attr5, - cred_for_predicate1['referent']: cred_for_predicate1} - - alice['schemas_for_job_application'], alice['cred_defs_for_job_application'], \ - alice['revoc_states_for_job_application'] = \ - await prover_get_entities_from_ledger(alice['pool'], alice['did_for_acme'], - alice['creds_for_job_application_proof'], alice['name']) - - #logger.info("\"Alice\" -> Create \"Job-Application\" Proof") - alice['job_application_requested_creds'] = json.dumps({ - 'self_attested_attributes': { - 'attr1_referent': 'Alice', - 'attr2_referent': 'Garcia', - 'attr6_referent': '123-45-6789' - }, - 'requested_attributes': { - 'attr3_referent': {'cred_id': cred_for_attr3['referent'], 'revealed': True}, - 'attr4_referent': {'cred_id': cred_for_attr4['referent'], 'revealed': True}, - 'attr5_referent': {'cred_id': cred_for_attr5['referent'], 'revealed': True}, - }, - 'requested_predicates': {'predicate1_referent': {'cred_id': cred_for_predicate1['referent']}} - }) - - alice['job_application_proof'] = \ - await anoncreds.prover_create_proof(alice['wallet'], alice['job_application_proof_request'], - alice['job_application_requested_creds'], alice['master_secret_id'], - alice['schemas_for_job_application'], - alice['cred_defs_for_job_application'], - alice['revoc_states_for_job_application']) - - #logger.info("\"Alice\" -> Authcrypt \"Job-Application\" Proof for Acme") - alice['authcrypted_job_application_proof'] = \ - await crypto.auth_crypt(alice['wallet'], alice['key_for_acme'], alice['acme_key_for_alice'], - alice['job_application_proof'].encode('utf-8')) - - #logger.info("\"Alice\" -> Send authcrypted \"Job-Application\" Proof to Acme") - acme['authcrypted_job_application_proof'] = alice['authcrypted_job_application_proof'] - - #logger.info("\"Acme\" -> Authdecrypted \"Job-Application\" Proof from Alice") - _, acme['job_application_proof'], decrypted_job_application_proof = \ - await auth_decrypt(acme['wallet'], acme['key_for_alice'], acme['authcrypted_job_application_proof']) - - acme['schemas_for_job_application'], acme['cred_defs_for_job_application'], \ - acme['revoc_ref_defs_for_job_application'], acme['revoc_regs_for_job_application'] = \ - await verifier_get_entities_from_ledger(acme['pool'], acme['did'], - decrypted_job_application_proof['identifiers'], acme['name']) - - #logger.info("\"Acme\" -> Verify \"Job-Application\" Proof from Alice") - assert 'Bachelor of Science, Marketing' == \ - decrypted_job_application_proof['requested_proof']['revealed_attrs']['attr3_referent']['raw'] - assert 'graduated' == \ - decrypted_job_application_proof['requested_proof']['revealed_attrs']['attr4_referent']['raw'] - assert '123-45-6789' == \ - decrypted_job_application_proof['requested_proof']['revealed_attrs']['attr5_referent']['raw'] - - assert 'Alice' == decrypted_job_application_proof['requested_proof']['self_attested_attrs']['attr1_referent'] - assert 'Garcia' == decrypted_job_application_proof['requested_proof']['self_attested_attrs']['attr2_referent'] - assert '123-45-6789' == decrypted_job_application_proof['requested_proof']['self_attested_attrs']['attr6_referent'] - - assert await anoncreds.verifier_verify_proof(acme['job_application_proof_request'], acme['job_application_proof'], - acme['schemas_for_job_application'], - acme['cred_defs_for_job_application'], - acme['revoc_ref_defs_for_job_application'], - acme['revoc_regs_for_job_application']) - - #logger.info("==============================") - #logger.info("== Apply for the job with Acme - Getting Job-Certificate Credential ==") - #logger.info("------------------------------") - - #logger.info("\"Acme\" -> Create \"Job-Certificate\" Credential Offer for Alice") - acme['job_certificate_cred_offer'] = \ - await anoncreds.issuer_create_credential_offer(acme['wallet'], acme['job_certificate_cred_def_id']) - - #logger.info("\"Acme\" -> Get key for Alice did") - acme['alice_key_for_acme'] = \ - await did.key_for_did(acme['pool'], acme['wallet'], acme['alice_connection_response']['did']) - - #logger.info("\"Acme\" -> Authcrypt \"Job-Certificate\" Credential Offer for Alice") - acme['authcrypted_job_certificate_cred_offer'] = \ - await crypto.auth_crypt(acme['wallet'], acme['key_for_alice'], acme['alice_key_for_acme'], - acme['job_certificate_cred_offer'].encode('utf-8')) - - #logger.info("\"Acme\" -> Send authcrypted \"Job-Certificate\" Credential Offer to Alice") - alice['authcrypted_job_certificate_cred_offer'] = acme['authcrypted_job_certificate_cred_offer'] - - #logger.info("\"Alice\" -> Authdecrypted \"Job-Certificate\" Credential Offer from Acme") - alice['acme_key_for_alice_alice'], alice['job_certificate_cred_offer'], job_certificate_cred_offer = \ - await auth_decrypt(alice['wallet'], alice['key_for_acme'], alice['authcrypted_job_certificate_cred_offer']) - - #logger.info("\"Alice\" -> Get \"Acme Job-Certificate\" Credential Definition from Ledger") - (alice['acme_job_certificate_cred_def_id'], alice['acme_job_certificate_cred_def']) = \ - await get_cred_def(alice['pool'], alice['did_for_acme'], job_certificate_cred_offer['cred_def_id']) - - #logger.info("\"Alice\" -> Create and store in Wallet \"Job-Certificate\" Credential Request for Acme") - (alice['job_certificate_cred_request'], alice['job_certificate_cred_request_metadata']) = \ - await anoncreds.prover_create_credential_req(alice['wallet'], alice['did_for_acme'], - alice['job_certificate_cred_offer'], - alice['acme_job_certificate_cred_def'], alice['master_secret_id']) - - #logger.info("\"Alice\" -> Authcrypt \"Job-Certificate\" Credential Request for Acme") - alice['authcrypted_job_certificate_cred_request'] = \ - await crypto.auth_crypt(alice['wallet'], alice['key_for_acme'], alice['acme_key_for_alice'], - alice['job_certificate_cred_request'].encode('utf-8')) - - #logger.info("\"Alice\" -> Send authcrypted \"Job-Certificate\" Credential Request to Acme") - alice['job_certificate_cred_values'] = json.dumps({ - "first_name": {"raw": "Alice", "encoded": "245712572474217942457235975012103335"}, - "last_name": {"raw": "Garcia", "encoded": "312643218496194691632153761283356127"}, - "employee_status": {"raw": "Permanent", "encoded": "2143135425425143112321314321"}, - "salary": {"raw": "2400", "encoded": "2400"}, - "experience": {"raw": "10", "encoded": "10"} - }) - acme['authcrypted_job_certificate_cred_request'] = alice['authcrypted_job_certificate_cred_request'] - acme['job_certificate_cred_values'] = alice['job_certificate_cred_values'] - - #logger.info("\"Acme\" -> Authdecrypt \"Job-Certificate\" Credential Request from Alice") - acme['alice_key_for_acme'], acme['job_certificate_cred_request'], _ = \ - await auth_decrypt(acme['wallet'], acme['key_for_alice'], acme['authcrypted_job_certificate_cred_request']) - - #logger.info("\"Acme\" -> Create \"Job-Certificate\" Credential for Alice") - acme['blob_storage_reader_cfg_handle'] = await blob_storage.open_reader('default', acme['tails_writer_config']) - acme['job_certificate_cred'], acme['job_certificate_cred_rev_id'], acme['alice_cert_rev_reg_delta'] = \ - await anoncreds.issuer_create_credential(acme['wallet'], acme['job_certificate_cred_offer'], - acme['job_certificate_cred_request'], - acme['job_certificate_cred_values'], - acme['revoc_reg_id'], - acme['blob_storage_reader_cfg_handle']) - - #logger.info("\"Acme\" -> Post Revocation Registry Delta to Ledger") - acme['revoc_reg_entry_req'] = \ - await ledger.build_revoc_reg_entry_request(acme['did'], acme['revoc_reg_id'], 'CL_ACCUM', - acme['alice_cert_rev_reg_delta']) - await ledger.sign_and_submit_request(acme['pool'], acme['wallet'], acme['did'], acme['revoc_reg_entry_req']) - - #logger.info("\"Acme\" -> Authcrypt \"Job-Certificate\" Credential for Alice") - acme['authcrypted_job_certificate_cred'] = \ - await crypto.auth_crypt(acme['wallet'], acme['key_for_alice'], acme['alice_key_for_acme'], - acme['job_certificate_cred'].encode('utf-8')) - - #logger.info("\"Acme\" -> Send authcrypted \"Job-Certificate\" Credential to Alice") - alice['authcrypted_job_certificate_cred'] = acme['authcrypted_job_certificate_cred'] - - #logger.info("\"Alice\" -> Authdecrypted \"Job-Certificate\" Credential from Acme") - _, alice['job_certificate_cred'], alice_job_certificate_cred = \ - await auth_decrypt(alice['wallet'], alice['key_for_acme'], alice['authcrypted_job_certificate_cred']) - - #logger.info("\"Alice\" -> Gets RevocationRegistryDefinition for \"Job-Certificate\" Credential from Acme") - alice['acme_revoc_reg_des_req'] = \ - await ledger.build_get_revoc_reg_def_request(alice['did_for_acme'], - alice_job_certificate_cred['rev_reg_id']) - alice['acme_revoc_reg_des_resp'] = await ledger.submit_request(alice['pool'], alice['acme_revoc_reg_des_req']) - (alice['acme_revoc_reg_def_id'], alice['acme_revoc_reg_def_json']) = \ - await ledger.parse_get_revoc_reg_def_response(alice['acme_revoc_reg_des_resp']) - - #logger.info("\"Alice\" -> Store \"Job-Certificate\" Credential") - await anoncreds.prover_store_credential(alice['wallet'], None, alice['job_certificate_cred_request_metadata'], - alice['job_certificate_cred'], - alice['acme_job_certificate_cred_def'], alice['acme_revoc_reg_def_json']) - - logger.warning("==============================") - logger.warning("=== Apply for the loan with Thrift ==") - logger.warning("==============================") - logger.warning("== Apply for the loan with Thrift - Onboarding ==") - logger.warning("------------------------------") - - thrift['did_for_alice'], thrift['key_for_alice'], alice['did_for_thrift'], alice['key_for_thrift'], \ - thrift['alice_connection_response'] = await onboarding(thrift, alice) - - async def apply_loan_basic(): - # This method will be called twice: once with a valid Job-Certificate and - # the second time after the Job-Certificate has been revoked. - #logger.info("==============================") - #logger.info("== Apply for the loan with Thrift - Job-Certificate proving ==") - #logger.info("------------------------------") - - #logger.info("\"Thrift\" -> Create \"Loan-Application-Basic\" Proof Request") - thrift['apply_loan_proof_request'] = json.dumps({ - 'nonce': '123432421212', - 'name': 'Loan-Application-Basic', - 'version': '0.1', - 'requested_attributes': { - 'attr1_referent': { - 'name': 'employee_status', - 'restrictions': [{'cred_def_id': acme['job_certificate_cred_def_id']}] - } - }, - 'requested_predicates': { - 'predicate1_referent': { - 'name': 'salary', - 'p_type': '>=', - 'p_value': 2000, - 'restrictions': [{'cred_def_id': acme['job_certificate_cred_def_id']}] - }, - 'predicate2_referent': { - 'name': 'experience', - 'p_type': '>=', - 'p_value': 1, - 'restrictions': [{'cred_def_id': acme['job_certificate_cred_def_id']}] - } - }, - 'non_revoked': {'to': int(time.time())} - }) - - #logger.info("\"Thrift\" -> Get key for Alice did") - thrift['alice_key_for_thrift'] = \ - await did.key_for_did(thrift['pool'], thrift['wallet'], thrift['alice_connection_response']['did']) - - #logger.info("\"Thrift\" -> Authcrypt \"Loan-Application-Basic\" Proof Request for Alice") - thrift['authcrypted_apply_loan_proof_request'] = \ - await crypto.auth_crypt(thrift['wallet'], thrift['key_for_alice'], thrift['alice_key_for_thrift'], - thrift['apply_loan_proof_request'].encode('utf-8')) - - #logger.info("\"Thrift\" -> Send authcrypted \"Loan-Application-Basic\" Proof Request to Alice") - alice['authcrypted_apply_loan_proof_request'] = thrift['authcrypted_apply_loan_proof_request'] - - #logger.info("\"Alice\" -> Authdecrypt \"Loan-Application-Basic\" Proof Request from Thrift") - alice['thrift_key_for_alice'], alice['apply_loan_proof_request'], _ = \ - await auth_decrypt(alice['wallet'], alice['key_for_thrift'], alice['authcrypted_apply_loan_proof_request']) - - #logger.info("\"Alice\" -> Get credentials for \"Loan-Application-Basic\" Proof Request") - - search_for_apply_loan_proof_request = \ - await anoncreds.prover_search_credentials_for_proof_req(alice['wallet'], - alice['apply_loan_proof_request'], None) - - cred_for_attr1 = await get_credential_for_referent(search_for_apply_loan_proof_request, 'attr1_referent') - cred_for_predicate1 = await get_credential_for_referent(search_for_apply_loan_proof_request, 'predicate1_referent') - cred_for_predicate2 = await get_credential_for_referent(search_for_apply_loan_proof_request, 'predicate2_referent') - - await anoncreds.prover_close_credentials_search_for_proof_req(search_for_apply_loan_proof_request) - - alice['creds_for_apply_loan_proof'] = {cred_for_attr1['referent']: cred_for_attr1, - cred_for_predicate1['referent']: cred_for_predicate1, - cred_for_predicate2['referent']: cred_for_predicate2} - - requested_timestamp = int(json.loads(thrift['apply_loan_proof_request'])['non_revoked']['to']) - alice['schemas_for_loan_app'], alice['cred_defs_for_loan_app'], alice['revoc_states_for_loan_app'] = \ - await prover_get_entities_from_ledger(alice['pool'], alice['did_for_thrift'], - alice['creds_for_apply_loan_proof'], - alice['name'], None, requested_timestamp) - - #logger.info("\"Alice\" -> Create \"Loan-Application-Basic\" Proof") - revoc_states_for_loan_app = json.loads(alice['revoc_states_for_loan_app']) - timestamp_for_attr1 = get_timestamp_for_attribute(cred_for_attr1, revoc_states_for_loan_app) - timestamp_for_predicate1 = get_timestamp_for_attribute(cred_for_predicate1, revoc_states_for_loan_app) - timestamp_for_predicate2 = get_timestamp_for_attribute(cred_for_predicate2, revoc_states_for_loan_app) - alice['apply_loan_requested_creds'] = json.dumps({ - 'self_attested_attributes': {}, - 'requested_attributes': { - 'attr1_referent': {'cred_id': cred_for_attr1['referent'], 'revealed': True, 'timestamp': timestamp_for_attr1} - }, - 'requested_predicates': { - 'predicate1_referent': {'cred_id': cred_for_predicate1['referent'], 'timestamp': timestamp_for_predicate1}, - 'predicate2_referent': {'cred_id': cred_for_predicate2['referent'], 'timestamp': timestamp_for_predicate2} - } - }) - alice['apply_loan_proof'] = \ - await anoncreds.prover_create_proof(alice['wallet'], alice['apply_loan_proof_request'], - alice['apply_loan_requested_creds'], alice['master_secret_id'], - alice['schemas_for_loan_app'], alice['cred_defs_for_loan_app'], - alice['revoc_states_for_loan_app']) - - #logger.info("\"Alice\" -> Authcrypt \"Loan-Application-Basic\" Proof for Thrift") - alice['authcrypted_alice_apply_loan_proof'] = \ - await crypto.auth_crypt(alice['wallet'], alice['key_for_thrift'], alice['thrift_key_for_alice'], - alice['apply_loan_proof'].encode('utf-8')) - - #logger.info("\"Alice\" -> Send authcrypted \"Loan-Application-Basic\" Proof to Thrift") - thrift['authcrypted_alice_apply_loan_proof'] = alice['authcrypted_alice_apply_loan_proof'] - - #logger.info("\"Thrift\" -> Authdecrypted \"Loan-Application-Basic\" Proof from Alice") - _, thrift['alice_apply_loan_proof'], authdecrypted_alice_apply_loan_proof = \ - await auth_decrypt(thrift['wallet'], thrift['key_for_alice'], thrift['authcrypted_alice_apply_loan_proof']) - - #logger.info("\"Thrift\" -> Get Schemas, Credential Definitions and Revocation Registries from Ledger" - # " required for Proof verifying") - - thrift['schemas_for_loan_app'], thrift['cred_defs_for_loan_app'], thrift['revoc_defs_for_loan_app'], \ - thrift['revoc_regs_for_loan_app'] = \ - await verifier_get_entities_from_ledger(thrift['pool'], thrift['did'], - authdecrypted_alice_apply_loan_proof['identifiers'], - thrift['name'], requested_timestamp) - - #logger.info("\"Thrift\" -> Verify \"Loan-Application-Basic\" Proof from Alice") - assert 'Permanent' == \ - authdecrypted_alice_apply_loan_proof['requested_proof']['revealed_attrs']['attr1_referent']['raw'] - - await apply_loan_basic() - - assert await anoncreds.verifier_verify_proof(thrift['apply_loan_proof_request'], - thrift['alice_apply_loan_proof'], - thrift['schemas_for_loan_app'], - thrift['cred_defs_for_loan_app'], - thrift['revoc_defs_for_loan_app'], - thrift['revoc_regs_for_loan_app']) - - #logger.info("==============================") - #logger.info("== Apply for the loan with Thrift - Transcript and Job-Certificate proving ==") - #logger.info("------------------------------") - - #logger.info("\"Thrift\" -> Create \"Loan-Application-KYC\" Proof Request") - thrift['apply_loan_kyc_proof_request'] = json.dumps({ - 'nonce': '123432421212', - 'name': 'Loan-Application-KYC', - 'version': '0.1', - 'requested_attributes': { - 'attr1_referent': {'name': 'first_name'}, - 'attr2_referent': {'name': 'last_name'}, - 'attr3_referent': {'name': 'ssn'} - }, - 'requested_predicates': {} - }) - - #logger.info("\"Thrift\" -> Get key for Alice did") - thrift['alice_key_for_thrift'] = await did.key_for_did(thrift['pool'], thrift['wallet'], - thrift['alice_connection_response']['did']) - - #logger.info("\"Thrift\" -> Authcrypt \"Loan-Application-KYC\" Proof Request for Alice") - thrift['authcrypted_apply_loan_kyc_proof_request'] = \ - await crypto.auth_crypt(thrift['wallet'], thrift['key_for_alice'], thrift['alice_key_for_thrift'], - thrift['apply_loan_kyc_proof_request'].encode('utf-8')) - - #logger.info("\"Thrift\" -> Send authcrypted \"Loan-Application-KYC\" Proof Request to Alice") - alice['authcrypted_apply_loan_kyc_proof_request'] = thrift['authcrypted_apply_loan_kyc_proof_request'] - - #logger.info("\"Alice\" -> Authdecrypt \"Loan-Application-KYC\" Proof Request from Thrift") - alice['thrift_key_for_alice'], alice['apply_loan_kyc_proof_request'], _ = \ - await auth_decrypt(alice['wallet'], alice['key_for_thrift'], alice['authcrypted_apply_loan_kyc_proof_request']) - - #logger.info("\"Alice\" -> Get credentials for \"Loan-Application-KYC\" Proof Request") - - search_for_apply_loan_kyc_proof_request = \ - await anoncreds.prover_search_credentials_for_proof_req(alice['wallet'], - alice['apply_loan_kyc_proof_request'], None) - - cred_for_attr1 = await get_credential_for_referent(search_for_apply_loan_kyc_proof_request, 'attr1_referent') - cred_for_attr2 = await get_credential_for_referent(search_for_apply_loan_kyc_proof_request, 'attr2_referent') - cred_for_attr3 = await get_credential_for_referent(search_for_apply_loan_kyc_proof_request, 'attr3_referent') - - await anoncreds.prover_close_credentials_search_for_proof_req(search_for_apply_loan_kyc_proof_request) - - alice['creds_for_apply_loan_kyc_proof'] = {cred_for_attr1['referent']: cred_for_attr1, - cred_for_attr2['referent']: cred_for_attr2, - cred_for_attr3['referent']: cred_for_attr3} - - alice['schemas_for_loan_kyc_app'], alice['cred_defs_for_loan_kyc_app'], alice['revoc_states_for_loan_kyc_app'] = \ - await prover_get_entities_from_ledger(alice['pool'], alice['did_for_thrift'], - alice['creds_for_apply_loan_kyc_proof'], alice['name'],) - - #logger.info("\"Alice\" -> Create \"Loan-Application-KYC\" Proof") - revoc_states_for_loan_app = json.loads(alice['revoc_states_for_loan_kyc_app']) - timestamp_for_attr1 = get_timestamp_for_attribute(cred_for_attr1, revoc_states_for_loan_app) - timestamp_for_attr2 = get_timestamp_for_attribute(cred_for_attr2, revoc_states_for_loan_app) - timestamp_for_attr3 = get_timestamp_for_attribute(cred_for_attr3, revoc_states_for_loan_app) - alice['apply_loan_kyc_requested_creds'] = json.dumps({ - 'self_attested_attributes': {}, - 'requested_attributes': { - 'attr1_referent': {'cred_id': cred_for_attr1['referent'], 'revealed': True, 'timestamp': timestamp_for_attr1}, - 'attr2_referent': {'cred_id': cred_for_attr2['referent'], 'revealed': True, 'timestamp': timestamp_for_attr2}, - 'attr3_referent': {'cred_id': cred_for_attr3['referent'], 'revealed': True, 'timestamp': timestamp_for_attr3} - }, - 'requested_predicates': {} - }) - - alice['apply_loan_kyc_proof'] = \ - await anoncreds.prover_create_proof(alice['wallet'], alice['apply_loan_kyc_proof_request'], - alice['apply_loan_kyc_requested_creds'], alice['master_secret_id'], - alice['schemas_for_loan_kyc_app'], alice['cred_defs_for_loan_kyc_app'], - alice['revoc_states_for_loan_kyc_app']) - - #logger.info("\"Alice\" -> Authcrypt \"Loan-Application-KYC\" Proof for Thrift") - alice['authcrypted_alice_apply_loan_kyc_proof'] = \ - await crypto.auth_crypt(alice['wallet'], alice['key_for_thrift'], alice['thrift_key_for_alice'], - alice['apply_loan_kyc_proof'].encode('utf-8')) - - #logger.info("\"Alice\" -> Send authcrypted \"Loan-Application-KYC\" Proof to Thrift") - thrift['authcrypted_alice_apply_loan_kyc_proof'] = alice['authcrypted_alice_apply_loan_kyc_proof'] - - #logger.info("\"Thrift\" -> Authdecrypted \"Loan-Application-KYC\" Proof from Alice") - _, thrift['alice_apply_loan_kyc_proof'], alice_apply_loan_kyc_proof = \ - await auth_decrypt(thrift['wallet'], thrift['key_for_alice'], thrift['authcrypted_alice_apply_loan_kyc_proof']) - - #logger.info("\"Thrift\" -> Get Schemas, Credential Definitions and Revocation Registries from Ledger" - # " required for Proof verifying") - - thrift['schemas_for_loan_kyc_app'], thrift['cred_defs_for_loan_kyc_app'], thrift['revoc_defs_for_loan_kyc_app'], \ - thrift['revoc_regs_for_loan_kyc_app'] = \ - await verifier_get_entities_from_ledger(thrift['pool'], thrift['did'], - alice_apply_loan_kyc_proof['identifiers'], thrift['name']) - - #logger.info("\"Thrift\" -> Verify \"Loan-Application-KYC\" Proof from Alice") - assert 'Alice' == \ - alice_apply_loan_kyc_proof['requested_proof']['revealed_attrs']['attr1_referent']['raw'] - assert 'Garcia' == \ - alice_apply_loan_kyc_proof['requested_proof']['revealed_attrs']['attr2_referent']['raw'] - assert '123-45-6789' == \ - alice_apply_loan_kyc_proof['requested_proof']['revealed_attrs']['attr3_referent']['raw'] - - assert await anoncreds.verifier_verify_proof(thrift['apply_loan_kyc_proof_request'], - thrift['alice_apply_loan_kyc_proof'], - thrift['schemas_for_loan_kyc_app'], thrift['cred_defs_for_loan_kyc_app'], - thrift['revoc_defs_for_loan_kyc_app'], - thrift['revoc_regs_for_loan_kyc_app']) - - #logger.info("==============================") - - logger.warning("==============================") - logger.warning("== Credential revocation - Acme revokes Alice's Job-Certificate ==") - logger.warning("------------------------------") - - #logger.info("\"Acme\" - Revoke credential") - acme['alice_cert_rev_reg_delta'] = \ - await anoncreds.issuer_revoke_credential(acme['wallet'], - acme['blob_storage_reader_cfg_handle'], - acme['revoc_reg_id'], - acme['job_certificate_cred_rev_id']) - - #logger.info("\"Acme\" - Post RevocationRegistryDelta to Ledger") - acme['revoc_reg_entry_req'] = \ - await ledger.build_revoc_reg_entry_request(acme['did'], acme['revoc_reg_id'], 'CL_ACCUM', - acme['alice_cert_rev_reg_delta']) - await ledger.sign_and_submit_request(acme['pool'], acme['wallet'], acme['did'], acme['revoc_reg_entry_req']) - - #logger.info("==============================") - - logger.warning("==============================") - logger.warning("== Apply for the loan with Thrift again - Job-Certificate proving ==") - logger.warning("------------------------------") - - await apply_loan_basic() - - assert not await anoncreds.verifier_verify_proof(thrift['apply_loan_proof_request'], - thrift['alice_apply_loan_proof'], - thrift['schemas_for_loan_app'], - thrift['cred_defs_for_loan_app'], - thrift['revoc_defs_for_loan_app'], - thrift['revoc_regs_for_loan_app']) - - logger.warning("==============================") - - logger.warning("\"Alice\" -> Close wallet") - await wallet.close_wallet(alice['wallet']) - - -if __name__ == '__main__': - run_coroutine(run) - time.sleep(1) # FIXME waiting for libindy thread complete From 6d5d7335e3cd6e35fb0593d7f348b723f88da616 Mon Sep 17 00:00:00 2001 From: Ian Costanzo Date: Thu, 18 Jul 2019 18:17:54 -0700 Subject: [PATCH 019/320] Remove id column from metadata table Signed-off-by: Ian Costanzo --- .../plugins/postgres_storage/src/postgres_storage.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/experimental/plugins/postgres_storage/src/postgres_storage.rs b/experimental/plugins/postgres_storage/src/postgres_storage.rs index b21666692e..0f4b781b22 100644 --- a/experimental/plugins/postgres_storage/src/postgres_storage.rs +++ b/experimental/plugins/postgres_storage/src/postgres_storage.rs @@ -159,11 +159,10 @@ const _CREATE_SCHEMA: [&str; 12] = [ const _CREATE_SCHEMA_MULTI: [&str; 14] = [ "CREATE TABLE IF NOT EXISTS metadata ( wallet_id VARCHAR(64) NOT NULL, - id BIGSERIAL NOT NULL, value BYTEA NOT NULL, - PRIMARY KEY(wallet_id, id) + PRIMARY KEY(wallet_id) )", - "CREATE UNIQUE INDEX IF NOT EXISTS ux_metadata_wallet_id_id ON metadata(wallet_id, id)", + "CREATE UNIQUE INDEX IF NOT EXISTS ux_metadata_wallet_id_id ON metadata(wallet_id)", "CREATE UNIQUE INDEX IF NOT EXISTS ux_metadata_values ON metadata(wallet_id, value)", "CREATE TABLE IF NOT EXISTS items( wallet_id VARCHAR(64) NOT NULL, From a4a6a9e43cd9e47b1e54ca078917f7a5032cdf1b Mon Sep 17 00:00:00 2001 From: Axel Nennker Date: Fri, 19 Jul 2019 17:17:20 +0200 Subject: [PATCH 020/320] current libsodium version is now 1.0.18 Signed-off-by: Axel Nennker --- docs/build-guides/rhel-build.md | 6 +++--- docs/build-guides/ubuntu-build.md | 8 ++++---- docs/build-guides/windows-build.md | 2 +- libindy/ci/amazon.dockerfile | 6 +++--- libindy/ci/ubuntu.dockerfile | 2 +- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/docs/build-guides/rhel-build.md b/docs/build-guides/rhel-build.md index 29ce55b27b..c470491966 100644 --- a/docs/build-guides/rhel-build.md +++ b/docs/build-guides/rhel-build.md @@ -42,12 +42,12 @@ dnf install -y \ For Amazon Linux 2017.03 or other distributions without `libsodium` available in system repositories: ``` cd /tmp -curl https://download.libsodium.org/libsodium/releases/libsodium-1.0.17.tar.gz | tar -xz -cd /tmp/libsodium-1.0.17 +curl https://download.libsodium.org/libsodium/releases/libsodium-1.0.18.tar.gz | tar -xz +cd /tmp/libsodium-1.0.18 ./configure make make install -rm -rf /tmp/libsodium-1.0.17 +rm -rf /tmp/libsodium-1.0.18 export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib diff --git a/docs/build-guides/ubuntu-build.md b/docs/build-guides/ubuntu-build.md index a3afc34d81..9f152c3221 100644 --- a/docs/build-guides/ubuntu-build.md +++ b/docs/build-guides/ubuntu-build.md @@ -15,16 +15,16 @@ libncursesw5-dev ``` -1. `libindy` requires the modern `1.0.17` version of `libsodium` but Ubuntu 16.04 does not support installation it's from `apt` repository. +1. `libindy` requires the modern `1.0.18` version of `libsodium` but Ubuntu 16.04 does not support installation it's from `apt` repository. Because of this, it requires to build and install `libsodium` from source: ``` cd /tmp && \ - curl https://download.libsodium.org/libsodium/releases/libsodium-1.0.17.tar.gz | tar -xz && \ - cd /tmp/libsodium-1.0.17 && \ + curl https://download.libsodium.org/libsodium/releases/libsodium-1.0.18.tar.gz | tar -xz && \ + cd /tmp/libsodium-1.0.18 && \ ./configure && \ make && \ make install && \ - rm -rf /tmp/libsodium-1.0.17 + rm -rf /tmp/libsodium-1.0.18 ``` 1. Build `libindy` diff --git a/docs/build-guides/windows-build.md b/docs/build-guides/windows-build.md index 3d32da1225..2ce820528f 100644 --- a/docs/build-guides/windows-build.md +++ b/docs/build-guides/windows-build.md @@ -43,7 +43,7 @@ git clone https://github.com/hyperledger/indy-sdk.git ### Binary deps - https://www.npcglib.org/~stathis/downloads/openssl-1.0.2k-vs2017.7z -- https://download.libsodium.org/libsodium/releases/libsodium-1.0.17-msvc.zip +- https://download.libsodium.org/libsodium/releases/libsodium-1.0.18-msvc.zip ### Source deps diff --git a/libindy/ci/amazon.dockerfile b/libindy/ci/amazon.dockerfile index d444bd2198..5e2a1c3eae 100755 --- a/libindy/ci/amazon.dockerfile +++ b/libindy/ci/amazon.dockerfile @@ -22,12 +22,12 @@ RUN curl --silent --location https://rpm.nodesource.com/setup_8.x | bash - RUN yum -y install nodejs RUN cd /tmp && \ - curl https://download.libsodium.org/libsodium/releases/libsodium-1.0.17.tar.gz | tar -xz && \ - cd /tmp/libsodium-1.0.17 && \ + curl https://download.libsodium.org/libsodium/releases/libsodium-1.0.18.tar.gz | tar -xz && \ + cd /tmp/libsodium-1.0.18 && \ ./configure && \ make && \ make install && \ - rm -rf /tmp/libsodium-1.0.17 + rm -rf /tmp/libsodium-1.0.18 ENV PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib diff --git a/libindy/ci/ubuntu.dockerfile b/libindy/ci/ubuntu.dockerfile index bfa68dbcc1..7fd5f99057 100755 --- a/libindy/ci/ubuntu.dockerfile +++ b/libindy/ci/ubuntu.dockerfile @@ -40,7 +40,7 @@ RUN pip3 install -U \ plumbum \ deb-pkg-tools -ARG LIBSODIUM_VERSION=1.0.17 +ARG LIBSODIUM_VERSION=1.0.18 RUN cd /tmp && \ curl https://download.libsodium.org/libsodium/releases/libsodium-$LIBSODIUM_VERSION.tar.gz | tar -xz && \ From b15d8232692013cd65f949db31cefaf273a128e5 Mon Sep 17 00:00:00 2001 From: Ian Costanzo Date: Sun, 21 Jul 2019 10:03:21 -0700 Subject: [PATCH 021/320] Fix queries for tags for multi-wallet db Signed-off-by: Ian Costanzo --- .../postgres-getting-started.sh | 2 +- .../postgres_storage/src/postgres_storage.rs | 51 ++++++++++++++++--- 2 files changed, 45 insertions(+), 8 deletions(-) diff --git a/experimental/plugins/postgres_storage/postgres-getting-started.sh b/experimental/plugins/postgres_storage/postgres-getting-started.sh index e1f158fc4e..7063ceb54c 100755 --- a/experimental/plugins/postgres_storage/postgres-getting-started.sh +++ b/experimental/plugins/postgres_storage/postgres-getting-started.sh @@ -1,3 +1,3 @@ cd ../../../samples/python && \ -PYTHONPATH=.:../../wrappers/python/ python3 src/getting_started.py -t postgres_storage -l libindystrgpostgres.so -e postgresstorage_init -c '{"url":"localhost:5432"}' -s '{"account":"postgres","password":"mysecretpassword","admin_account":"postgres","admin_password":"mysecretpassword"}' +PYTHONPATH=.:../../wrappers/python/ python3 src/getting_started.py -t postgres_storage -l libindystrgpostgres.dylib -e postgresstorage_init -c '{"url":"localhost:5432"}' -s '{"account":"postgres","password":"mysecretpassword","admin_account":"postgres","admin_password":"mysecretpassword"}' diff --git a/experimental/plugins/postgres_storage/src/postgres_storage.rs b/experimental/plugins/postgres_storage/src/postgres_storage.rs index 0f4b781b22..9dd410fcc0 100644 --- a/experimental/plugins/postgres_storage/src/postgres_storage.rs +++ b/experimental/plugins/postgres_storage/src/postgres_storage.rs @@ -112,6 +112,8 @@ const _POSTGRES_DB: &str = "postgres"; const _WALLETS_DB: &str = "wallets"; const _PLAIN_TAGS_QUERY: &str = "SELECT name, value from tags_plaintext where item_id = $1"; const _ENCRYPTED_TAGS_QUERY: &str = "SELECT name, value from tags_encrypted where item_id = $1"; +const _PLAIN_TAGS_QUERY_MULTI: &str = "SELECT name, value from tags_plaintext where item_id = $1 and wallet_id = $2"; +const _ENCRYPTED_TAGS_QUERY_MULTI: &str = "SELECT name, value from tags_encrypted where item_id = $1 and wallet_id = $2"; const _CREATE_WALLET_DATABASE: &str = "CREATE DATABASE $1"; const _CREATE_WALLETS_DATABASE: &str = "CREATE DATABASE wallets"; // Note: wallet id length was constrained before by postgres database name length to 64 characters, keeping the same restrictions @@ -223,20 +225,26 @@ const _DELETE_WALLET_MULTI: [&str; 4] = [ struct TagRetriever<'a> { plain_tags_stmt: postgres::stmt::Statement<'a>, encrypted_tags_stmt: postgres::stmt::Statement<'a>, + wallet_id: Option, } type TagRetrieverOwned = OwningHandle>, Box>>; impl<'a> TagRetriever<'a> { - fn new_owned(conn: Rc>) -> Result { + fn new_owned(conn: Rc>, wallet_id: Option) -> Result { OwningHandle::try_new(conn.clone(), |conn| -> Result<_, postgres::Error> { let (plain_tags_stmt, encrypted_tags_stmt) = unsafe { - ((*conn).prepare(_PLAIN_TAGS_QUERY)?, - (*conn).prepare(_ENCRYPTED_TAGS_QUERY)?) + match wallet_id { + Some(_) => ((*conn).prepare(_PLAIN_TAGS_QUERY_MULTI)?, + (*conn).prepare(_ENCRYPTED_TAGS_QUERY_MULTI)?), + None => ((*conn).prepare(_PLAIN_TAGS_QUERY)?, + (*conn).prepare(_ENCRYPTED_TAGS_QUERY)?) + } }; let tr = TagRetriever { plain_tags_stmt, encrypted_tags_stmt, + wallet_id }; Ok(Box::new(tr)) }).map_err(WalletStorageError::from) @@ -245,14 +253,20 @@ impl<'a> TagRetriever<'a> { fn retrieve(&mut self, id: i64) -> Result, WalletStorageError> { let mut tags = Vec::new(); - let plain_results = self.plain_tags_stmt.query(&[&id])?; + let plain_results = match self.wallet_id { + Some(ref w_id) => self.plain_tags_stmt.query(&[&id, &w_id])?, + None => self.plain_tags_stmt.query(&[&id])? + }; let mut iter_plain = plain_results.iter(); while let Some(res) = iter_plain.next() { let row = res; tags.push(Tag::PlainText(row.get(0), row.get(1))); } - let encrypted_results = self.encrypted_tags_stmt.query(&[&id])?; + let encrypted_results = match self.wallet_id { + Some(ref w_id) => self.encrypted_tags_stmt.query(&[&id, &w_id])?, + None => self.encrypted_tags_stmt.query(&[&id])? + }; let mut iter_encrypted = encrypted_results.iter(); while let Some(res) = iter_encrypted.next() { let row = res; @@ -1409,7 +1423,10 @@ impl WalletStorage for PostgresStorage { retrieve_tags: true, }; let pool = self.pool.clone(); - let tag_retriever = Some(TagRetriever::new_owned(Rc::new(pool.get().unwrap()).clone())?); + let tag_retriever = match query_qualifier { + Some(_) => Some(TagRetriever::new_owned(Rc::new(pool.get().unwrap()).clone(), Some(self.wallet_id.clone()))?), + None => Some(TagRetriever::new_owned(Rc::new(pool.get().unwrap()).clone(), None)?) + }; let storage_iterator = match query_qualifier { Some(_) => PostgresStorageIterator::new(Some(statement), &[&self.wallet_id], fetch_options, tag_retriever, None)?, @@ -1439,6 +1456,23 @@ impl WalletStorage for PostgresStorage { query_arguments.push(&wallet_id_arg); let arg_str = format!(" AND i.wallet_id = ${}", query_arguments.len()); query_string.push_str(&arg_str); + let mut with_clause = false; + if query_string.contains("tags_plaintext") { + query_arguments.push(&wallet_id_arg); + query_string = format!("tags_plaintext as (select * from tags_plaintext where wallet_id = ${}) {}", query_arguments.len(), query_string); + with_clause = true; + } + if query_string.contains("tags_encrypted") { + if with_clause { + query_string = format!(", {}", query_string); + } + query_arguments.push(&wallet_id_arg); + query_string = format!("tags_encrypted as (select * from tags_encrypted where wallet_id = ${}) {}", query_arguments.len(), query_string); + with_clause = true; + } + if with_clause { + query_string = format!("WITH {}", query_string); + } (query_string, query_arguments) }, None => query::wql_to_sql_count(&type_, query)? @@ -1477,7 +1511,10 @@ impl WalletStorage for PostgresStorage { let statement = self._prepare_statement(&query_string)?; let tag_retriever = if fetch_options.retrieve_tags { let pool = self.pool.clone(); - Some(TagRetriever::new_owned(Rc::new(pool.get().unwrap()).clone())?) + match query_qualifier { + Some(_) => Some(TagRetriever::new_owned(Rc::new(pool.get().unwrap()).clone(), Some(self.wallet_id.clone()))?), + None => Some(TagRetriever::new_owned(Rc::new(pool.get().unwrap()).clone(), None)?) + } } else { None }; From 345d060665089ea32072a9ad25d6a1a73f038901 Mon Sep 17 00:00:00 2001 From: Ian Costanzo Date: Sun, 21 Jul 2019 10:17:30 -0700 Subject: [PATCH 022/320] Fix queries for tags for multi-wallet db Signed-off-by: Ian Costanzo --- .../postgres_storage/src/postgres_storage.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/experimental/plugins/postgres_storage/src/postgres_storage.rs b/experimental/plugins/postgres_storage/src/postgres_storage.rs index 9dd410fcc0..f88d45aaad 100644 --- a/experimental/plugins/postgres_storage/src/postgres_storage.rs +++ b/experimental/plugins/postgres_storage/src/postgres_storage.rs @@ -1503,6 +1503,23 @@ impl WalletStorage for PostgresStorage { query_arguments.push(&wallet_id_arg); let arg_str = format!(" AND i.wallet_id = ${}", query_arguments.len()); query_string.push_str(&arg_str); + let mut with_clause = false; + if query_string.contains("tags_plaintext") { + query_arguments.push(&wallet_id_arg); + query_string = format!("tags_plaintext as (select * from tags_plaintext where wallet_id = ${}) {}", query_arguments.len(), query_string); + with_clause = true; + } + if query_string.contains("tags_encrypted") { + if with_clause { + query_string = format!(", {}", query_string); + } + query_arguments.push(&wallet_id_arg); + query_string = format!("tags_encrypted as (select * from tags_encrypted where wallet_id = ${}) {}", query_arguments.len(), query_string); + with_clause = true; + } + if with_clause { + query_string = format!("WITH {}", query_string); + } (query_string, query_arguments) }, None => query::wql_to_sql(&type_, query, options)? From d326eaa9ff59c804b2dd6a732dae996e38dccb50 Mon Sep 17 00:00:00 2001 From: Axel Nennker Date: Wed, 24 Jul 2019 15:26:14 +0200 Subject: [PATCH 023/320] initial commit, does not compile Signed-off-by: Axel Nennker --- libindy/src/api/crypto.rs | 6 +- libindy/src/api/ledger.rs | 2 +- libindy/src/api/mod.rs | 14 +- libindy/src/api/pool.rs | 4 +- libindy/src/commands/anoncreds/issuer.rs | 10 +- libindy/src/commands/cache.rs | 16 +- libindy/src/commands/did.rs | 33 ++- libindy/src/commands/ledger.rs | 46 +-- libindy/src/commands/payments.rs | 66 ++--- libindy/src/commands/pool.rs | 33 +-- libindy/src/services/payments.rs | 66 ++--- libindy/src/services/pool/commander.rs | 12 +- libindy/src/services/pool/events.rs | 9 +- libindy/src/services/pool/mod.rs | 84 +++--- libindy/src/services/pool/pool.rs | 278 ++++++++++++++----- libindy/src/services/pool/request_handler.rs | 26 +- libindy/src/services/pool/types.rs | 3 +- libindy/tests/anoncreds.rs | 5 +- libindy/tests/demo.rs | 1 + libindy/tests/interaction.rs | 1 + libindy/tests/ledger.rs | 1 + libindy/tests/logger.rs | 1 + libindy/tests/utils/cache.rs | 8 +- libindy/tests/utils/did.rs | 13 +- libindy/tests/utils/ledger.rs | 8 +- libindy/tests/utils/mod.rs | 4 +- libindy/tests/utils/payments.rs | 2 +- libindy/tests/utils/pool.rs | 9 +- libindy/tests/utils/wallet.rs | 17 +- 29 files changed, 466 insertions(+), 312 deletions(-) diff --git a/libindy/src/api/crypto.rs b/libindy/src/api/crypto.rs index 721b4d331c..2e6df8435e 100644 --- a/libindy/src/api/crypto.rs +++ b/libindy/src/api/crypto.rs @@ -637,7 +637,7 @@ pub extern fn indy_pack_message( message_len: u32, receiver_keys: *const c_char, sender: *const c_char, - cb: Option, + cb: Option, ) -> ErrorCode { trace!("indy_pack_message: >>> wallet_handle: {:?}, message: {:?}, message_len {:?},\ receiver_keys: {:?}, sender: {:?}", wallet_handle, message, message_len, receiver_keys, sender); @@ -718,13 +718,13 @@ pub extern fn indy_pack_message( /// Crypto* #[no_mangle] pub extern fn indy_unpack_message( - command_handle: i32, + command_handle: CommandHandle, wallet_handle: WalletHandle, jwe_data: *const u8, jwe_len: u32, cb: Option< extern fn( - xcommand_handle: i32, + xcommand_handle: CommandHandle, err: ErrorCode, res_json_data : *const u8, res_json_len : u32 diff --git a/libindy/src/api/ledger.rs b/libindy/src/api/ledger.rs index b8f7846cd5..9ca2be0da6 100644 --- a/libindy/src/api/ledger.rs +++ b/libindy/src/api/ledger.rs @@ -1037,7 +1037,7 @@ pub extern fn indy_build_get_txn_request(command_handle: CommandHandle, seq_no, Box::new(move |result| { let (err, request_json) = prepare_result_1!(result, String::new()); - trace!("indy_build_get_txn_request: request_json: {:?}, cmd_handle: {}", request_json, command_handle); + trace!("indy_build_get_txn_request: request_json: {:?}, cmd_handle: {:?}", request_json, command_handle); let request_json = ctypes::string_to_cstring(request_json); cb(command_handle, err, request_json.as_ptr()) }) diff --git a/libindy/src/api/mod.rs b/libindy/src/api/mod.rs index 3f8fd0a79d..59587ac080 100644 --- a/libindy/src/api/mod.rs +++ b/libindy/src/api/mod.rs @@ -27,8 +27,18 @@ pub struct WalletHandle(pub i32); pub const INVALID_WALLET_HANDLE : WalletHandle = WalletHandle(0); pub type CallbackHandle = i32; -pub type PoolHandle = i32; -pub type CommandHandle = i32; +//pub type PoolHandle = i32; +#[repr(transparent)] +#[derive(Debug, Hash, PartialEq, Eq, Copy, Clone)] +pub struct PoolHandle(pub i32); +pub const INVALID_POOL_HANDLE : PoolHandle = PoolHandle(0); + +//pub type CommandHandle = i32; +#[repr(transparent)] +#[derive(Debug, Hash, PartialEq, Eq, Copy, Clone)] +pub struct CommandHandle(pub i32); +pub const INVALID_COMMAND_HANDLE : CommandHandle = CommandHandle(0); + pub type StorageHandle = i32; pub type SearchHandle = i32; diff --git a/libindy/src/api/pool.rs b/libindy/src/api/pool.rs index fdc62de3c1..4e5a11d2aa 100755 --- a/libindy/src/api/pool.rs +++ b/libindy/src/api/pool.rs @@ -1,5 +1,5 @@ -use api::{ErrorCode, CommandHandle, PoolHandle}; +use api::{ErrorCode, CommandHandle, PoolHandle, INVALID_POOL_HANDLE}; use commands::{Command, CommandExecutor}; use commands::pool::PoolCommand; use domain::pool::{PoolConfig, PoolOpenConfig}; @@ -100,7 +100,7 @@ pub extern fn indy_open_pool_ledger(command_handle: CommandHandle, config_name, config, Box::new(move |result| { - let (err, pool_handle) = prepare_result_1!(result, 0); + let (err, pool_handle) = prepare_result_1!(result, INVALID_POOL_HANDLE); trace!("indy_open_pool_ledger: pool_handle: {:?}", pool_handle); cb(command_handle, err, pool_handle) }) diff --git a/libindy/src/commands/anoncreds/issuer.rs b/libindy/src/commands/anoncreds/issuer.rs index 8b1dd06a7f..0a0b928653 100644 --- a/libindy/src/commands/anoncreds/issuer.rs +++ b/libindy/src/commands/anoncreds/issuer.rs @@ -52,7 +52,7 @@ use services::pool::PoolService; use services::wallet::{RecordOptions, WalletService}; use super::tails::{SDKTailsAccessor, store_tails_from_generator}; -use api::{WalletHandle, CallbackHandle}; +use api::{WalletHandle, CommandHandle}; pub enum IssuerCommand { CreateSchema( @@ -84,7 +84,7 @@ pub enum IssuerCommand { IndyResult<(CredentialDefinitionData, CredentialPrivateKey, CredentialKeyCorrectnessProof)>, - i32), + CommandHandle), CreateAndStoreRevocationRegistry( WalletHandle, String, // issuer did @@ -130,7 +130,7 @@ pub struct IssuerCommandExecutor { pub pool_service: Rc, pub wallet_service: Rc, pub crypto_service: Rc, - pending_callbacks: RefCell) + Send>>>, + pending_callbacks: RefCell) + Send>>>, } impl IssuerCommandExecutor { @@ -248,7 +248,7 @@ impl IssuerCommandExecutor { let (cred_def_config, schema_id, cred_def_id, signature_type) = try_cb!(self._prepare_create_and_store_credential_definition(wallet_handle, issuer_did, schema, tag, type_, config), cb); - let cb_id = ::utils::sequence::get_next_id(); + let cb_id = CommandHandle(::utils::sequence::get_next_id()); self.pending_callbacks.borrow_mut().insert(cb_id, cb); let tag = tag.to_string(); @@ -290,7 +290,7 @@ impl IssuerCommandExecutor { } fn _create_and_store_credential_definition_continue(&self, - cb_id: CallbackHandle, + cb_id: CommandHandle, wallet_handle: WalletHandle, schema: &SchemaV1, schema_id: &str, diff --git a/libindy/src/commands/cache.rs b/libindy/src/commands/cache.rs index 8e5afa11f2..a83c768508 100644 --- a/libindy/src/commands/cache.rs +++ b/libindy/src/commands/cache.rs @@ -6,7 +6,7 @@ use std::time::{SystemTime, UNIX_EPOCH}; use domain::wallet::Tags; use errors::prelude::*; use services::wallet::WalletService; -use api::{WalletHandle, PoolHandle}; +use api::{WalletHandle, PoolHandle, CommandHandle}; use commands::{Command, CommandExecutor}; use commands::ledger::LedgerCommand; @@ -24,7 +24,7 @@ pub enum CacheCommand { WalletHandle, IndyResult<(String, String)>, // ledger_response GetCacheOptions, // options - i32, // cb_id + CommandHandle, // cb_id ), GetCredDef(PoolHandle, WalletHandle, @@ -36,7 +36,7 @@ pub enum CacheCommand { WalletHandle, IndyResult<(String, String)>, // ledger_response GetCacheOptions, // options - i32, // cb_id + CommandHandle, // cb_id ), PurgeSchemaCache(WalletHandle, String, // options json @@ -49,7 +49,7 @@ pub enum CacheCommand { pub struct CacheCommandExecutor { wallet_service: Rc, - pending_callbacks: RefCell)>>>, + pending_callbacks: RefCell)>>>, } impl CacheCommandExecutor { @@ -136,7 +136,7 @@ impl CacheCommandExecutor { return cb(Err(IndyError::from(IndyErrorKind::LedgerItemNotFound))); } - let cb_id = ::utils::sequence::get_next_id(); + let cb_id = CommandHandle(::utils::sequence::get_next_id()); self.pending_callbacks.borrow_mut().insert(cb_id, cb); CommandExecutor::instance().send( @@ -162,7 +162,7 @@ impl CacheCommandExecutor { ).unwrap(); } - fn _get_schema_continue(&self, wallet_handle: WalletHandle, ledger_response: IndyResult<(String, String)>, options: GetCacheOptions, cb_id: i32) { + fn _get_schema_continue(&self, wallet_handle: WalletHandle, ledger_response: IndyResult<(String, String)>, options: GetCacheOptions, cb_id: CommandHandle) { let cb = self.pending_callbacks.borrow_mut().remove(&cb_id).expect("FIXME INVALID STATE"); let (schema_id, schema_json) = try_cb!(ledger_response, cb); @@ -231,7 +231,7 @@ impl CacheCommandExecutor { return cb(Err(IndyError::from(IndyErrorKind::LedgerItemNotFound))); } - let cb_id = ::utils::sequence::get_next_id(); + let cb_id = CommandHandle(::utils::sequence::get_next_id()); self.pending_callbacks.borrow_mut().insert(cb_id, cb); CommandExecutor::instance().send( @@ -257,7 +257,7 @@ impl CacheCommandExecutor { ).unwrap(); } - fn _get_cred_def_continue(&self, wallet_handle: WalletHandle, ledger_response: IndyResult<(String, String)>, options: GetCacheOptions, cb_id: i32) { + fn _get_cred_def_continue(&self, wallet_handle: WalletHandle, ledger_response: IndyResult<(String, String)>, options: GetCacheOptions, cb_id: CommandHandle) { let cb = self.pending_callbacks.borrow_mut().remove(&cb_id).expect("FIXME INVALID STATE"); let (cred_def_id, cred_def_json) = try_cb!(ledger_response, cb); diff --git a/libindy/src/commands/did.rs b/libindy/src/commands/did.rs index e0ce9a8be0..6d1c3812f4 100644 --- a/libindy/src/commands/did.rs +++ b/libindy/src/commands/did.rs @@ -17,8 +17,7 @@ use services::crypto::CryptoService; use services::ledger::LedgerService; use services::wallet::{RecordOptions, SearchOptions, WalletService}; use utils::sequence; -use api::WalletHandle; -use rust_base58::{FromBase58, ToBase58}; +use api::{WalletHandle, PoolHandle, CommandHandle}; pub enum DidCommand { CreateAndStoreMyDid( @@ -46,7 +45,7 @@ pub enum DidCommand { WalletHandle, Box) + Send>), KeyForDid( - i32, // pool handle + PoolHandle, // pool handle WalletHandle, String, // did (my or their) Box) + Send>), @@ -61,7 +60,7 @@ pub enum DidCommand { Box) + Send>), GetEndpointForDid( WalletHandle, - i32, // pool handle + PoolHandle, // pool handle String, // did Box)>) + Send>), SetDidMetadata( @@ -81,13 +80,13 @@ pub enum DidCommand { GetNymAck( WalletHandle, IndyResult, // GetNym Result - i32, // deferred cmd id + CommandHandle, // deferred cmd id ), // Internal commands GetAttribAck( WalletHandle, IndyResult, // GetAttrib Result - i32, // deferred cmd id + CommandHandle, // deferred cmd id ), } @@ -104,7 +103,7 @@ pub struct DidCommandExecutor { wallet_service: Rc, crypto_service: Rc, ledger_service: Rc, - deferred_commands: RefCell>, + deferred_commands: RefCell>, } impl DidCommandExecutor { @@ -325,7 +324,7 @@ impl DidCommandExecutor { } fn key_for_did(&self, - pool_handle: i32, + pool_handle: PoolHandle, wallet_handle: WalletHandle, did: String, cb: Box) + Send>) { @@ -405,7 +404,7 @@ impl DidCommandExecutor { fn get_endpoint_for_did(&self, wallet_handle: WalletHandle, - pool_handle: i32, + pool_handle: PoolHandle, did: String, cb: Box)>) + Send>) { debug!("get_endpoint_for_did >>> wallet_handle: {:?}, pool_handle: {:?}, did: {:?}", wallet_handle, pool_handle, did); @@ -489,7 +488,7 @@ impl DidCommandExecutor { fn get_nym_ack(&self, wallet_handle: WalletHandle, get_nym_reply_result: IndyResult, - deferred_cmd_id: i32) { + deferred_cmd_id: CommandHandle) { let res = self._get_nym_ack(wallet_handle, get_nym_reply_result); self._execute_deferred_command(deferred_cmd_id, res.err()); } @@ -528,7 +527,7 @@ impl DidCommandExecutor { fn get_attrib_ack(&self, wallet_handle: WalletHandle, get_attrib_reply_result: IndyResult, - deferred_cmd_id: i32) { + deferred_cmd_id: CommandHandle) { let res = self._get_attrib_ack(wallet_handle, get_attrib_reply_result); self._execute_deferred_command(deferred_cmd_id, res.err()); } @@ -558,13 +557,13 @@ impl DidCommandExecutor { Ok(()) } - fn _defer_command(&self, cmd: DidCommand) -> i32 { - let deferred_cmd_id = sequence::get_next_id(); + fn _defer_command(&self, cmd: DidCommand) -> CommandHandle { + let deferred_cmd_id = CommandHandle(sequence::get_next_id()); self.deferred_commands.borrow_mut().insert(deferred_cmd_id, cmd); deferred_cmd_id } - fn _execute_deferred_command(&self, deferred_cmd_id: i32, err: Option) { + fn _execute_deferred_command(&self, deferred_cmd_id: CommandHandle, err: Option) { if let Some(cmd) = self.deferred_commands.borrow_mut().remove(&deferred_cmd_id) { if let Some(err) = err { self._call_error_cb(cmd, err); @@ -572,7 +571,7 @@ impl DidCommandExecutor { self.execute(cmd); } } else { - error!("No deferred command for id: {}", deferred_cmd_id) + error!("No deferred command for id: {:?}", deferred_cmd_id) } } @@ -601,7 +600,7 @@ impl DidCommandExecutor { } fn _fetch_their_did_from_ledger(&self, - wallet_handle: WalletHandle, pool_handle: i32, + wallet_handle: WalletHandle, pool_handle: PoolHandle, did: &str, deferred_cmd: DidCommand) { // Defer this command until their did is fetched from ledger. let deferred_cmd_id = self._defer_command(deferred_cmd); @@ -626,7 +625,7 @@ impl DidCommandExecutor { } fn _fetch_attrib_from_ledger(&self, - wallet_handle: WalletHandle, pool_handle: i32, + wallet_handle: WalletHandle, pool_handle: PoolHandle, did: &str, deferred_cmd: DidCommand) { // Defer this command until their did is fetched from ledger. let deferred_cmd_id = self._defer_command(deferred_cmd); diff --git a/libindy/src/commands/ledger.rs b/libindy/src/commands/ledger.rs index b19b0737fa..6ab1e93e29 100644 --- a/libindy/src/commands/ledger.rs +++ b/libindy/src/commands/ledger.rs @@ -25,27 +25,27 @@ use services::pool::{ }; use services::wallet::{RecordOptions, WalletService}; use utils::crypto::signature_serializer::serialize_signature; -use api::WalletHandle; +use api::{WalletHandle, PoolHandle, CommandHandle}; use commands::{Command, CommandExecutor}; use rust_base58::ToBase58; pub enum LedgerCommand { SignAndSubmitRequest( - i32, // pool handle + PoolHandle, // pool handle WalletHandle, String, // submitter did String, // request json Box) + Send>), SubmitRequest( - i32, // pool handle + PoolHandle, // pool handle String, // request json Box) + Send>), SubmitAck( - i32, // cmd_id + CommandHandle, IndyResult, // result json or error ), SubmitAction( - i32, // pool handle + PoolHandle, // pool handle String, // request json Option, // nodes Option, // timeout @@ -211,24 +211,24 @@ pub enum LedgerCommand { Option, // new value Box) + Send>), GetSchema( - i32, + PoolHandle, Option, String, Box) + Send>, ), GetSchemaContinue( IndyResult, - i32, + CommandHandle, ), GetCredDef( - i32, + PoolHandle, Option, String, Box) + Send>, ), GetCredDefContinue( IndyResult, - i32, + CommandHandle, ), BuildTxnAuthorAgreementRequest( String, // submitter did @@ -266,8 +266,8 @@ pub struct LedgerCommandExecutor { wallet_service: Rc, ledger_service: Rc, - send_callbacks: RefCell)>>>, - pending_callbacks: RefCell)>>>, + send_callbacks: RefCell)>>>, + pending_callbacks: RefCell)>>>, } impl LedgerCommandExecutor { @@ -300,7 +300,7 @@ impl LedgerCommandExecutor { match self.send_callbacks.borrow_mut().remove(&handle) { Some(cb) => cb(result.map_err(IndyError::from)), None => { - error!("Can't process LedgerCommand::SubmitAck for handle {} with result {:?} - appropriate callback not found!", + error!("Can't process LedgerCommand::SubmitAck for handle {:?} with result {:?} - appropriate callback not found!", handle, result); } } @@ -510,7 +510,7 @@ impl LedgerCommandExecutor { } fn sign_and_submit_request(&self, - pool_handle: i32, + pool_handle: PoolHandle, wallet_handle: WalletHandle, submitter_did: &str, request_json: &str, @@ -572,12 +572,12 @@ impl LedgerCommandExecutor { } fn submit_request(&self, - handle: i32, + handle: PoolHandle, request_json: &str, cb: Box) + Send>) { debug!("submit_request >>> handle: {:?}, request_json: {:?}", handle, request_json); - let x: IndyResult = self.pool_service.send_tx(handle, request_json); + let x: IndyResult = self.pool_service.send_tx(handle, request_json); match x { Ok(cmd_id) => { self.send_callbacks.borrow_mut().insert(cmd_id, cb); } Err(err) => { cb(Err(err)); } @@ -585,7 +585,7 @@ impl LedgerCommandExecutor { } fn submit_action(&self, - handle: i32, + handle: PoolHandle, request_json: &str, nodes: Option<&str>, timeout: Option, @@ -596,7 +596,7 @@ impl LedgerCommandExecutor { return cb(Err(err)); } - let x: IndyResult = self.pool_service.send_action(handle, request_json, nodes, timeout); + let x: IndyResult = self.pool_service.send_action(handle, request_json, nodes, timeout); match x { Ok(cmd_id) => { self.send_callbacks.borrow_mut().insert(cmd_id, cb); } Err(err) => { cb(Err(err)); } @@ -1173,11 +1173,11 @@ impl LedgerCommandExecutor { } } - fn get_schema(&self, pool_handle: i32, submitter_did: Option<&str>, id: &str, cb: Box) + Send>) { + fn get_schema(&self, pool_handle: PoolHandle, submitter_did: Option<&str>, id: &str, cb: Box) + Send>) { let request_json = try_cb!(self.build_get_schema_request(submitter_did, id), cb); - let cb_id = ::utils::sequence::get_next_id(); + let cb_id = CommandHandle(::utils::sequence::get_next_id()); self.pending_callbacks.borrow_mut().insert(cb_id, cb); self.submit_request(pool_handle, &request_json, Box::new(move |response| { @@ -1192,17 +1192,17 @@ impl LedgerCommandExecutor { })); } - fn _get_schema_continue(&self, pool_response: IndyResult, cb_id: i32) { + fn _get_schema_continue(&self, pool_response: IndyResult, cb_id: CommandHandle) { let cb = self.pending_callbacks.borrow_mut().remove(&cb_id).expect("FIXME INVALID STATE"); let pool_response = try_cb!(pool_response, cb); cb(self.parse_get_schema_response(&pool_response)); } - fn get_cred_def(&self, pool_handle: i32, submitter_did: Option<&str>, id: &str, cb: Box) + Send>) { + fn get_cred_def(&self, pool_handle: PoolHandle, submitter_did: Option<&str>, id: &str, cb: Box) + Send>) { let request_json = try_cb!(self.build_get_cred_def_request(submitter_did, id), cb); - let cb_id = ::utils::sequence::get_next_id(); + let cb_id = CommandHandle(::utils::sequence::get_next_id()); self.pending_callbacks.borrow_mut().insert(cb_id, cb); self.submit_request(pool_handle, &request_json, Box::new(move |response| { @@ -1217,7 +1217,7 @@ impl LedgerCommandExecutor { })); } - fn _get_cred_def_continue(&self, pool_response: IndyResult, cb_id: i32) { + fn _get_cred_def_continue(&self, pool_response: IndyResult, cb_id: CommandHandle) { let cb = self.pending_callbacks.borrow_mut().remove(&cb_id).expect("FIXME INVALID STATE"); let pool_response = try_cb!(pool_response, cb); cb(self.parse_get_cred_def_response(&pool_response)); diff --git a/libindy/src/commands/payments.rs b/libindy/src/commands/payments.rs index f814547a69..5cf6759b53 100644 --- a/libindy/src/commands/payments.rs +++ b/libindy/src/commands/payments.rs @@ -11,7 +11,7 @@ use services::crypto::CryptoService; use services::ledger::LedgerService; use services::payments::{PaymentsMethodCBs, PaymentsService, RequesterInfo, Fees}; use services::wallet::{RecordOptions, WalletService}; -use api::WalletHandle; +use api::{WalletHandle, CommandHandle}; use domain::ledger::auth_rule::AuthRule; pub enum PaymentsCommand { @@ -25,7 +25,7 @@ pub enum PaymentsCommand { String, //config Box) + Send>), CreateAddressAck( - i32, //handle + CommandHandle, WalletHandle, IndyResult), ListAddresses( @@ -40,14 +40,14 @@ pub enum PaymentsCommand { Option, //extra Box) + Send>), AddRequestFeesAck( - i32, //handle + CommandHandle, //handle IndyResult), ParseResponseWithFees( String, //type String, //response Box) + Send>), ParseResponseWithFeesAck( - i32, //handle + CommandHandle, //handle IndyResult), BuildGetPaymentSourcesRequest( WalletHandle, @@ -55,14 +55,14 @@ pub enum PaymentsCommand { String, //payment address Box) + Send>), BuildGetPaymentSourcesRequestAck( - i32, //handle + CommandHandle, //handle IndyResult), ParseGetPaymentSourcesResponse( String, //type String, //response Box) + Send>), ParseGetPaymentSourcesResponseAck( - i32, //cmd_handle + CommandHandle, IndyResult), BuildPaymentReq( WalletHandle, @@ -72,14 +72,14 @@ pub enum PaymentsCommand { Option, //extra Box) + Send>), BuildPaymentReqAck( - i32, + CommandHandle, IndyResult), ParsePaymentResponse( String, //payment_method String, //response Box) + Send>), ParsePaymentResponseAck( - i32, + CommandHandle, IndyResult), AppendTxnAuthorAgreementAcceptanceToExtra( Option, // extra json @@ -96,7 +96,7 @@ pub enum PaymentsCommand { Option, //extra Box) + Send>), BuildMintReqAck( - i32, + CommandHandle, IndyResult), BuildSetTxnFeesReq( WalletHandle, @@ -105,7 +105,7 @@ pub enum PaymentsCommand { String, //fees Box) + Send>), BuildSetTxnFeesReqAck( - i32, + CommandHandle, IndyResult), BuildGetTxnFeesReq( WalletHandle, @@ -113,14 +113,14 @@ pub enum PaymentsCommand { String, //method Box) + Send>), BuildGetTxnFeesReqAck( - i32, + CommandHandle, IndyResult), ParseGetTxnFeesResponse( String, //method String, //response Box) + Send>), ParseGetTxnFeesResponseAck( - i32, + CommandHandle, IndyResult), BuildVerifyPaymentReq( WalletHandle, @@ -128,14 +128,14 @@ pub enum PaymentsCommand { String, //receipt Box) + Send>), BuildVerifyPaymentReqAck( - i32, + CommandHandle, IndyResult), ParseVerifyPaymentResponse( String, //payment_method String, //resp_json Box) + Send>), ParseVerifyPaymentResponseAck( - i32, + CommandHandle, IndyResult), GetRequestInfo( String, // get auth rule response json @@ -149,7 +149,7 @@ pub struct PaymentsCommandExecutor { wallet_service: Rc, crypto_service: Rc, ledger_service: Rc, - pending_callbacks: RefCell) + Send>>>, + pending_callbacks: RefCell) + Send>>>, } impl PaymentsCommandExecutor { @@ -315,7 +315,7 @@ impl PaymentsCommandExecutor { trace!("create_address <<<"); } - fn create_address_ack(&self, handle: i32, wallet_handle: WalletHandle, result: IndyResult) { + fn create_address_ack(&self, handle: CommandHandle, wallet_handle: WalletHandle, result: IndyResult) { trace!("create_address_ack >>> wallet_handle: {:?}, result: {:?}", wallet_handle, result); let total_result: IndyResult = match result { Ok(res) => { @@ -396,7 +396,7 @@ impl PaymentsCommandExecutor { trace!("add_request_fees <<<"); } - fn add_request_fees_ack(&self, cmd_handle: i32, result: IndyResult) { + fn add_request_fees_ack(&self, cmd_handle: CommandHandle, result: IndyResult) { trace!("add_request_fees_ack >>> result: {:?}", result); self._common_ack_payments(cmd_handle, result, "AddRequestFeesAck"); trace!("add_request_fees_ack <<<"); @@ -408,7 +408,7 @@ impl PaymentsCommandExecutor { trace!("parse_response_with_fees <<<"); } - fn parse_response_with_fees_ack(&self, cmd_handle: i32, result: IndyResult) { + fn parse_response_with_fees_ack(&self, cmd_handle: CommandHandle, result: IndyResult) { trace!("parse_response_with_fees_ack >>> result: {:?}", result); self._common_ack_payments(cmd_handle, result, "ParseResponseWithFeesFeesAck"); trace!("parse_response_with_fees_ack <<<"); @@ -443,7 +443,7 @@ impl PaymentsCommandExecutor { trace!("build_get_payment_sources_request <<<"); } - fn build_get_payment_sources_request_ack(&self, cmd_handle: i32, result: IndyResult) { + fn build_get_payment_sources_request_ack(&self, cmd_handle: CommandHandle, result: IndyResult) { trace!("build_get_payment_sources_request_ack >>> result: {:?}", result); self._common_ack_payments(cmd_handle, result, "BuildGetSourcesRequestAck"); trace!("build_get_payment_sources_request_ack <<<"); @@ -455,7 +455,7 @@ impl PaymentsCommandExecutor { trace!("parse_get_payment_sources_response <<<"); } - fn parse_get_payment_sources_response_ack(&self, cmd_handle: i32, result: IndyResult) { + fn parse_get_payment_sources_response_ack(&self, cmd_handle: CommandHandle, result: IndyResult) { trace!("parse_get_payment_sources_response_ack >>> result: {:?}", result); self._common_ack_payments(cmd_handle, result, "ParseGetSourcesResponseAck"); trace!("parse_get_payment_sources_response_ack <<<"); @@ -519,7 +519,7 @@ impl PaymentsCommandExecutor { Ok(res) } - fn build_payment_req_ack(&self, cmd_handle: i32, result: IndyResult) { + fn build_payment_req_ack(&self, cmd_handle: CommandHandle, result: IndyResult) { trace!("build_payment_req_ack >>> result: {:?}", result); self._common_ack_payments(cmd_handle, result, "BuildPaymentReqAck"); trace!("build_payment_req_ack <<<"); @@ -531,7 +531,7 @@ impl PaymentsCommandExecutor { trace!("parse_payment_response <<<"); } - fn parse_payment_response_ack(&self, cmd_handle: i32, result: IndyResult) { + fn parse_payment_response_ack(&self, cmd_handle: CommandHandle, result: IndyResult) { trace!("parse_payment_response_ack >>> result: {:?}", result); self._common_ack_payments(cmd_handle, result, "ParsePaymentResponseAck"); trace!("parse_payment_response_ack <<<"); @@ -565,7 +565,7 @@ impl PaymentsCommandExecutor { trace!("build_mint_req <<<"); } - fn build_mint_req_ack(&self, cmd_handle: i32, result: IndyResult) { + fn build_mint_req_ack(&self, cmd_handle: CommandHandle, result: IndyResult) { trace!("build_mint_req_ack >>> result: {:?}", result); self._common_ack_payments(cmd_handle, result, "BuildMintReqAck"); trace!("build_mint_req_ack <<<"); @@ -594,7 +594,7 @@ impl PaymentsCommandExecutor { trace!("build_set_txn_fees_req <<<"); } - fn build_set_txn_fees_req_ack(&self, cmd_handle: i32, result: IndyResult) { + fn build_set_txn_fees_req_ack(&self, cmd_handle: CommandHandle, result: IndyResult) { trace!("build_set_txn_fees_req_ack >>> result: {:?}", result); self._common_ack_payments(cmd_handle, result, "BuildSetTxnFeesReq"); trace!("build_set_txn_fees_req_ack <<<"); @@ -617,7 +617,7 @@ impl PaymentsCommandExecutor { trace!("build_get_txn_fees_req <<<"); } - fn build_get_txn_fees_req_ack(&self, cmd_handle: i32, result: IndyResult) { + fn build_get_txn_fees_req_ack(&self, cmd_handle: CommandHandle, result: IndyResult) { trace!("build_get_txn_fees_req_ack >>> result: {:?}", result); self._common_ack_payments(cmd_handle, result, "BuildGetTxnFeesReqAck"); trace!("build_get_txn_fees_req_ack <<<"); @@ -629,7 +629,7 @@ impl PaymentsCommandExecutor { trace!("parse_get_txn_fees_response <<<"); } - fn parse_get_txn_fees_response_ack(&self, cmd_handle: i32, result: IndyResult) { + fn parse_get_txn_fees_response_ack(&self, cmd_handle: CommandHandle, result: IndyResult) { trace!("parse_get_txn_fees_response_ack >>> result: {:?}", result); self._common_ack_payments(cmd_handle, result, "ParseGetTxnFeesResponseAck"); trace!("parse_get_txn_fees_response_ack <<<"); @@ -663,7 +663,7 @@ impl PaymentsCommandExecutor { trace!("build_verify_payment_request <<<"); } - fn build_verify_payment_request_ack(&self, cmd_handle: i32, result: IndyResult) { + fn build_verify_payment_request_ack(&self, cmd_handle: CommandHandle, result: IndyResult) { trace!("build_verify_payment_request_ack >>> result: {:?}", result); self._common_ack_payments(cmd_handle, result, "BuildVerifyPaymentReqAck"); trace!("build_verify_payment_request_ack <<<"); @@ -675,7 +675,7 @@ impl PaymentsCommandExecutor { trace!("parse_verify_payment_response <<<"); } - fn parse_verify_payment_response_ack(&self, cmd_handle: i32, result: IndyResult) { + fn parse_verify_payment_response_ack(&self, cmd_handle: CommandHandle, result: IndyResult) { trace!("parse_verify_payment_response_ack >>> result: {:?}", result); self._common_ack_payments(cmd_handle, result, "ParseVerifyPaymentResponseAck"); trace!("parse_verify_payment_response_ack <<<"); @@ -684,8 +684,8 @@ impl PaymentsCommandExecutor { // HELPERS fn _process_method(&self, cb: Box) + Send>, - method: &Fn(i32) -> IndyResult<()>) { - let cmd_handle = ::utils::sequence::get_next_id(); + method: &Fn(CommandHandle) -> IndyResult<()>) { + let cmd_handle = CommandHandle(::utils::sequence::get_next_id()); match method(cmd_handle) { Ok(()) => { self.pending_callbacks.borrow_mut().insert(cmd_handle, cb); @@ -694,16 +694,16 @@ impl PaymentsCommandExecutor { } } - fn _common_ack_payments(&self, cmd_handle: i32, result: IndyResult, name: &str) { + fn _common_ack_payments(&self, cmd_handle: CommandHandle, result: IndyResult, name: &str) { self._common_ack(cmd_handle, result.map_err(IndyError::from), name) } - fn _common_ack(&self, cmd_handle: i32, result: IndyResult, name: &str) { + fn _common_ack(&self, cmd_handle: CommandHandle, result: IndyResult, name: &str) { match self.pending_callbacks.borrow_mut().remove(&cmd_handle) { Some(cb) => { cb(result) } - None => error!("Can't process PaymentsCommand::{} for handle {} with result {:?} - appropriate callback not found!", + None => error!("Can't process PaymentsCommand::{} for handle {:?} with result {:?} - appropriate callback not found!", name, cmd_handle, result), } } diff --git a/libindy/src/commands/pool.rs b/libindy/src/commands/pool.rs index fa433a4335..c0d6d074f0 100644 --- a/libindy/src/commands/pool.rs +++ b/libindy/src/commands/pool.rs @@ -6,6 +6,7 @@ use domain::ledger::request::ProtocolVersion; use domain::pool::{PoolConfig, PoolOpenConfig}; use errors::prelude::*; use services::pool::PoolService; +use api::{PoolHandle, CommandHandle}; pub enum PoolCommand { Create( @@ -18,21 +19,21 @@ pub enum PoolCommand { Open( String, // name Option, // config - Box) + Send>), + Box) + Send>), OpenAck( - i32, // cmd id - i32, // pool handle + CommandHandle, // cmd id + PoolHandle, // pool handle IndyResult<()>), List(Box) + Send>), Close( - i32, // pool handle + PoolHandle, // pool handle Box) + Send>), - CloseAck(i32, + CloseAck(CommandHandle, IndyResult<()>), Refresh( - i32, // pool handle + PoolHandle, // pool handle Box) + Send>), - RefreshAck(i32, + RefreshAck(CommandHandle, IndyResult<()>), SetProtocolVersion( usize, // protocol version @@ -41,9 +42,9 @@ pub enum PoolCommand { pub struct PoolCommandExecutor { pool_service: Rc, - close_callbacks: RefCell)>>>, - refresh_callbacks: RefCell)>>>, - open_callbacks: RefCell)>>>, + close_callbacks: RefCell)>>>, + refresh_callbacks: RefCell)>>>, + open_callbacks: RefCell)>>>, } impl PoolCommandExecutor { @@ -79,7 +80,7 @@ impl PoolCommandExecutor { cb(result.and_then(|_| self.pool_service.add_open_pool(pool_id))) } None => { - error!("Can't process PoolCommand::OpenAck for handle {} with result {:?} - appropriate callback not found!", handle, result); + error!("Can't process PoolCommand::OpenAck for handle {:?} with result {:?} - appropriate callback not found!", handle, result); } } } @@ -101,7 +102,7 @@ impl PoolCommandExecutor { match cbs.remove(&handle) { Some(cb) => cb(result.map_err(IndyError::from)), None => { - error!("Can't process PoolCommand::CloseAck for handle {} with result {:?} - appropriate callback not found!", handle, result); + error!("Can't process PoolCommand::CloseAck for handle {:?} with result {:?} - appropriate callback not found!", handle, result); } } } @@ -119,7 +120,7 @@ impl PoolCommandExecutor { match cbs.remove(&handle) { Some(cb) => cb(result), None => { - error!("Can't process PoolCommand::RefreshAck for handle {} with result {:?} - appropriate callback not found!", + error!("Can't process PoolCommand::RefreshAck for handle {:?} with result {:?} - appropriate callback not found!", handle, result); } } @@ -154,7 +155,7 @@ impl PoolCommandExecutor { Ok(res) } - fn open(&self, name: &str, config: Option, cb: Box) + Send>) { + fn open(&self, name: &str, config: Option, cb: Box) + Send>) { debug!("open >>> name: {:?}, config: {:?}", name, config); let result = self.pool_service.open(name, config) @@ -184,7 +185,7 @@ impl PoolCommandExecutor { Ok(res) } - fn close(&self, handle: i32, cb: Box) + Send>) { + fn close(&self, handle: PoolHandle, cb: Box) + Send>) { debug!("close >>> handle: {:?}", handle); let result = self.pool_service.close(handle) @@ -202,7 +203,7 @@ impl PoolCommandExecutor { debug!("close <<<"); } - fn refresh(&self, handle: i32, cb: Box) + Send>) { + fn refresh(&self, handle: PoolHandle, cb: Box) + Send>) { debug!("refresh >>> handle: {:?}", handle); let result = self.pool_service.refresh(handle) diff --git a/libindy/src/services/payments.rs b/libindy/src/services/payments.rs index 0cb30e5ec5..3efd54401d 100644 --- a/libindy/src/services/payments.rs +++ b/libindy/src/services/payments.rs @@ -7,7 +7,7 @@ use std::ops::Not; use serde_json; -use api::{ErrorCode, WalletHandle}; +use api::{ErrorCode, WalletHandle, CommandHandle}; use api::payments::*; use errors::prelude::*; use utils::ctypes; @@ -85,7 +85,7 @@ impl PaymentsService { trace!("register_payment_method <<<"); } - pub fn create_address(&self, cmd_handle: i32, wallet_handle: WalletHandle, method_type: &str, config: &str) -> IndyResult<()> { + pub fn create_address(&self, cmd_handle: CommandHandle, wallet_handle: WalletHandle, method_type: &str, config: &str) -> IndyResult<()> { trace!("create_address >>> wallet_handle: {:?}, method_type: {:?}, config: {:?}", wallet_handle, method_type, config); let create_address: CreatePaymentAddressCB = self.methods.borrow().get(method_type) .ok_or(err_msg(IndyErrorKind::UnknownPaymentMethodType, format!("Unknown payment method {}", method_type)))?.create_address; @@ -99,7 +99,7 @@ impl PaymentsService { res } - pub fn add_request_fees(&self, cmd_handle: i32, method_type: &str, wallet_handle: WalletHandle, submitter_did: Option<&str>, req: &str, inputs: &str, outputs: &str, extra: Option<&str>) -> IndyResult<()> { + pub fn add_request_fees(&self, cmd_handle: CommandHandle, method_type: &str, wallet_handle: WalletHandle, submitter_did: Option<&str>, req: &str, inputs: &str, outputs: &str, extra: Option<&str>) -> IndyResult<()> { trace!("add_request_fees >>> method_type: {:?}, wallet_handle: {:?}, submitter_did: {:?}, req: {:?}, inputs: {:?}, outputs: {:?}, extra: {:?}", method_type, wallet_handle, submitter_did, req, inputs, outputs, extra); let add_request_fees: AddRequestFeesCB = self.methods.borrow().get(method_type) @@ -125,7 +125,7 @@ impl PaymentsService { res } - pub fn parse_response_with_fees(&self, cmd_handle: i32, type_: &str, response: &str) -> IndyResult<()> { + pub fn parse_response_with_fees(&self, cmd_handle: CommandHandle, type_: &str, response: &str) -> IndyResult<()> { trace!("parse_response_with_fees >>> type_: {:?}, response: {:?}", type_, response); let parse_response_with_fees: ParseResponseWithFeesCB = self.methods.borrow().get(type_) .ok_or(err_msg(IndyErrorKind::UnknownPaymentMethodType, format!("Unknown payment method {}", type_)))?.parse_response_with_fees; @@ -138,7 +138,7 @@ impl PaymentsService { res } - pub fn build_get_payment_sources_request(&self, cmd_handle: i32, type_: &str, wallet_handle: WalletHandle, submitter_did: Option<&str>, address: &str) -> IndyResult<()> { + pub fn build_get_payment_sources_request(&self, cmd_handle: CommandHandle, type_: &str, wallet_handle: WalletHandle, submitter_did: Option<&str>, address: &str) -> IndyResult<()> { trace!("build_get_payment_sources_request >>> type_: {:?}, wallet_handle: {:?}, submitter_did: {:?}, address: {:?}", type_, wallet_handle, submitter_did, address); let build_get_payment_sources_request: BuildGetPaymentSourcesRequestCB = self.methods.borrow().get(type_) .ok_or(err_msg(IndyErrorKind::UnknownPaymentMethodType, format!("Unknown payment method {}", type_)))?.build_get_payment_sources_request; @@ -157,7 +157,7 @@ impl PaymentsService { res } - pub fn parse_get_payment_sources_response(&self, cmd_handle: i32, type_: &str, response: &str) -> IndyResult<()> { + pub fn parse_get_payment_sources_response(&self, cmd_handle: CommandHandle, type_: &str, response: &str) -> IndyResult<()> { trace!("parse_get_payment_sources_response >>> type_: {:?}, response: {:?}", type_, response); let parse_get_payment_sources_response: ParseGetPaymentSourcesResponseCB = self.methods.borrow().get(type_) @@ -171,7 +171,7 @@ impl PaymentsService { res } - pub fn build_payment_req(&self, cmd_handle: i32, type_: &str, wallet_handle: WalletHandle, submitter_did: Option<&str>, inputs: &str, outputs: &str, extra: Option<&str>) -> IndyResult<()> { + pub fn build_payment_req(&self, cmd_handle: CommandHandle, type_: &str, wallet_handle: WalletHandle, submitter_did: Option<&str>, inputs: &str, outputs: &str, extra: Option<&str>) -> IndyResult<()> { trace!("build_payment_req >>> type_: {:?}, wallet_handle: {:?}, submitter_did: {:?}, inputs: {:?}, outputs: {:?}, extra: {:?}", type_, wallet_handle, submitter_did, inputs, outputs, extra); let build_payment_req: BuildPaymentReqCB = self.methods.borrow().get(type_) .ok_or(err_msg(IndyErrorKind::UnknownPaymentMethodType, format!("Unknown payment method {}", type_)))?.build_payment_req; @@ -194,7 +194,7 @@ impl PaymentsService { res } - pub fn parse_payment_response(&self, cmd_handle: i32, type_: &str, response: &str) -> IndyResult<()> { + pub fn parse_payment_response(&self, cmd_handle: CommandHandle, type_: &str, response: &str) -> IndyResult<()> { trace!("parse_payment_response >>> type_: {:?}, response: {:?}", type_, response); let parse_payment_response: ParsePaymentResponseCB = self.methods.borrow().get(type_) .ok_or(err_msg(IndyErrorKind::UnknownPaymentMethodType, format!("Unknown payment method {}", type_)))?.parse_payment_response; @@ -208,7 +208,7 @@ impl PaymentsService { res } - pub fn build_mint_req(&self, cmd_handle: i32, type_: &str, wallet_handle: WalletHandle, submitter_did: Option<&str>, outputs: &str, extra: Option<&str>) -> IndyResult<()> { + pub fn build_mint_req(&self, cmd_handle: CommandHandle, type_: &str, wallet_handle: WalletHandle, submitter_did: Option<&str>, outputs: &str, extra: Option<&str>) -> IndyResult<()> { trace!("build_mint_req >>> type_: {:?}, wallet_handle: {:?}, submitter_did: {:?}, outputs: {:?}, extra: {:?}", type_, wallet_handle, submitter_did, outputs, extra); let build_mint_req: BuildMintReqCB = self.methods.borrow().get(type_) .ok_or(err_msg(IndyErrorKind::UnknownPaymentMethodType, format!("Unknown payment method {}", type_)))?.build_mint_req; @@ -229,7 +229,7 @@ impl PaymentsService { res } - pub fn build_set_txn_fees_req(&self, cmd_handle: i32, type_: &str, wallet_handle: WalletHandle, submitter_did: Option<&str>, fees: &str) -> IndyResult<()> { + pub fn build_set_txn_fees_req(&self, cmd_handle: CommandHandle, type_: &str, wallet_handle: WalletHandle, submitter_did: Option<&str>, fees: &str) -> IndyResult<()> { trace!("build_set_txn_fees_req >>> type_: {:?}, wallet_handle: {:?}, submitter_did: {:?}, fees: {:?}", type_, wallet_handle, submitter_did, fees); let build_set_txn_fees_req: BuildSetTxnFeesReqCB = self.methods.borrow().get(type_) .ok_or(err_msg(IndyErrorKind::UnknownPaymentMethodType, format!("Unknown payment method {}", type_)))?.build_set_txn_fees_req; @@ -248,7 +248,7 @@ impl PaymentsService { res } - pub fn build_get_txn_fees_req(&self, cmd_handle: i32, type_: &str, wallet_handle: WalletHandle, submitter_did: Option<&str>) -> IndyResult<()> { + pub fn build_get_txn_fees_req(&self, cmd_handle: CommandHandle, type_: &str, wallet_handle: WalletHandle, submitter_did: Option<&str>) -> IndyResult<()> { trace!("build_get_txn_fees_req >>> type_: {:?}, wallet_handle: {:?}, submitter_did: {:?}", type_, wallet_handle, submitter_did); let build_get_txn_fees_req: BuildGetTxnFeesReqCB = self.methods.borrow().get(type_) .ok_or(err_msg(IndyErrorKind::UnknownPaymentMethodType, format!("Unknown payment method {}", type_)))?.build_get_txn_fees_req; @@ -265,7 +265,7 @@ impl PaymentsService { res } - pub fn parse_get_txn_fees_response(&self, cmd_handle: i32, type_: &str, response: &str) -> IndyResult<()> { + pub fn parse_get_txn_fees_response(&self, cmd_handle: CommandHandle, type_: &str, response: &str) -> IndyResult<()> { trace!("parse_get_txn_fees_response >>> type_: {:?}, response: {:?}", type_, response); let parse_get_txn_fees_response: ParseGetTxnFeesResponseCB = self.methods.borrow().get(type_) .ok_or(err_msg(IndyErrorKind::UnknownPaymentMethodType, format!("Unknown payment method {}", type_)))?.parse_get_txn_fees_response; @@ -279,7 +279,7 @@ impl PaymentsService { res } - pub fn build_verify_payment_req(&self, cmd_handle: i32, type_: &str, wallet_handle: WalletHandle, submitter_did: Option<&str>, receipt: &str) -> IndyResult<()> { + pub fn build_verify_payment_req(&self, cmd_handle: CommandHandle, type_: &str, wallet_handle: WalletHandle, submitter_did: Option<&str>, receipt: &str) -> IndyResult<()> { trace!("build_verify_payment_req >>> type_: {:?}, wallet_handle: {:?}, submitter_did: {:?}, receipt: {:?}", type_, wallet_handle, submitter_did, receipt); let build_verify_payment_req: BuildVerifyPaymentReqCB = self.methods.borrow().get(type_) .ok_or(err_msg(IndyErrorKind::UnknownPaymentMethodType, format!("Unknown payment method {}", type_)))?.build_verify_payment_req; @@ -298,7 +298,7 @@ impl PaymentsService { res } - pub fn parse_verify_payment_response(&self, cmd_handle: i32, type_: &str, resp_json: &str) -> IndyResult<()> { + pub fn parse_verify_payment_response(&self, cmd_handle: CommandHandle, type_: &str, resp_json: &str) -> IndyResult<()> { trace!("parse_verify_payment_response >>> type_: {:?}, resp_json: {:?}", type_, resp_json); let parse_verify_payment_response: ParseVerifyPaymentResponseCB = self.methods.borrow().get(type_) .ok_or(err_msg(IndyErrorKind::UnknownPaymentMethodType, format!("Unknown payment method {}", type_)))?.parse_verify_payment_response; @@ -590,85 +590,85 @@ mod cbs { use libc::c_char; - pub fn create_address_cb(cmd_handle: i32, wallet_handle: WalletHandle) -> Option Option ErrorCode> { send_ack(cmd_handle, Box::new(move |cmd_handle, result| PaymentsCommand::CreateAddressAck(cmd_handle, wallet_handle, result))) } - pub fn add_request_fees_cb(cmd_handle: i32) -> Option Option ErrorCode> { send_ack(cmd_handle, Box::new(move |cmd_handle, result| PaymentsCommand::AddRequestFeesAck(cmd_handle, result))) } - pub fn parse_response_with_fees_cb(cmd_handle: i32) -> Option Option ErrorCode> { send_ack(cmd_handle, Box::new(move |cmd_handle, result| PaymentsCommand::ParseResponseWithFeesAck(cmd_handle, result))) } - pub fn build_get_payment_sources_request_cb(cmd_handle: i32) -> Option Option ErrorCode> { send_ack(cmd_handle, Box::new(move |cmd_handle, result| PaymentsCommand::BuildGetPaymentSourcesRequestAck(cmd_handle, result))) } - pub fn parse_get_payment_sources_response_cb(cmd_handle: i32) -> Option Option ErrorCode> { send_ack(cmd_handle, Box::new(move |cmd_handle, result| PaymentsCommand::ParseGetPaymentSourcesResponseAck(cmd_handle, result))) } - pub fn build_payment_req_cb(cmd_handle: i32) -> Option Option ErrorCode> { send_ack(cmd_handle, Box::new(move |cmd_handle, result| PaymentsCommand::BuildPaymentReqAck(cmd_handle, result))) } - pub fn parse_payment_response_cb(cmd_handle: i32) -> Option Option ErrorCode> { send_ack(cmd_handle, Box::new(move |cmd_handle, result| PaymentsCommand::ParsePaymentResponseAck(cmd_handle, result))) } - pub fn build_mint_req_cb(cmd_handle: i32) -> Option Option ErrorCode> { send_ack(cmd_handle, Box::new(move |cmd_handle, result| PaymentsCommand::BuildMintReqAck(cmd_handle, result))) } - pub fn build_set_txn_fees_req_cb(cmd_handle: i32) -> Option Option ErrorCode> { send_ack(cmd_handle, Box::new(move |cmd_handle, result| PaymentsCommand::BuildSetTxnFeesReqAck(cmd_handle, result))) } - pub fn build_get_txn_fees_req(cmd_handle: i32) -> Option Option ErrorCode> { send_ack(cmd_handle, Box::new(move |cmd_handle, result| PaymentsCommand::BuildGetTxnFeesReqAck(cmd_handle, result))) } - pub fn parse_get_txn_fees_response(cmd_handle: i32) -> Option Option ErrorCode> { send_ack(cmd_handle, Box::new(move |cmd_handle, result| PaymentsCommand::ParseGetTxnFeesResponseAck(cmd_handle, result))) } - pub fn build_verify_payment_req(cmd_handle: i32) -> Option Option ErrorCode> { send_ack(cmd_handle, Box::new(move |cmd_handle, result| PaymentsCommand::BuildVerifyPaymentReqAck(cmd_handle, result))) } - pub fn parse_verify_payment_response(cmd_handle: i32) -> Option Option ErrorCode> { send_ack(cmd_handle, Box::new(move |cmd_handle, result| PaymentsCommand::ParseVerifyPaymentResponseAck(cmd_handle, result))) } - fn send_ack(cmd_handle: i32, builder: Box) -> PaymentsCommand + Send>) -> Option) -> PaymentsCommand + Send>) -> Option ErrorCode> { cbs::_closure_to_cb_str(cmd_handle, Box::new(move |err, mint_req_json| -> ErrorCode { @@ -682,17 +682,17 @@ mod cbs { })) } - pub fn _closure_to_cb_str(command_handle: i32, closure: Box ErrorCode + Send>) - -> Option ErrorCode + Send>) + -> Option ErrorCode> { lazy_static! { - static ref CALLBACKS: Mutex < HashMap < i32, Box < FnMut(ErrorCode, String) -> ErrorCode + Send > >> = Default::default(); + static ref CALLBACKS: Mutex < HashMap < CommandHandle, Box < FnMut(ErrorCode, String) -> ErrorCode + Send > >> = Default::default(); } - extern "C" fn _callback(command_handle: i32, err: ErrorCode, c_str: *const c_char) -> ErrorCode { + extern "C" fn _callback(command_handle_: CommandHandle, err: ErrorCode, c_str: *const c_char) -> ErrorCode { let mut callbacks = CALLBACKS.lock().unwrap(); - let mut cb = callbacks.remove(&command_handle).unwrap(); + let mut cb = callbacks.remove(&command_handle_).unwrap(); let metadata = unsafe { CStr::from_ptr(c_str).to_str().unwrap().to_string() }; cb(err, metadata) } diff --git a/libindy/src/services/pool/commander.rs b/libindy/src/services/pool/commander.rs index 9821a080bb..502eb92c5e 100644 --- a/libindy/src/services/pool/commander.rs +++ b/libindy/src/services/pool/commander.rs @@ -4,6 +4,7 @@ use services::pool::events::PoolEvent; use super::zmq; use byteorder::{ByteOrder, LittleEndian}; +use api::{CommandHandle, INVALID_COMMAND_HANDLE}; pub struct Commander { cmd_socket: zmq::Socket, @@ -28,8 +29,8 @@ impl Commander { .to_indy(IndyErrorKind::InvalidState, "Invalid utf8 sequence in command") // FIXME: review kind .map_err(map_err_trace!()).ok()?; - let id = cmd_parts.get(1).map(|cmd: &Vec| LittleEndian::read_i32(cmd.as_slice())) - .unwrap_or(-1); + let id = cmd_parts.get(1).map(|cmd: &Vec| CommandHandle(LittleEndian::read_i32(cmd.as_slice()))) + .unwrap_or(INVALID_COMMAND_HANDLE); if "exit".eq(cmd_s.as_str()) { Some(PoolEvent::Close(id)) @@ -63,6 +64,7 @@ mod commander_tests { use utils::sequence; use super::*; + use api::CommandHandle; #[test] pub fn commander_new_works() { @@ -106,7 +108,7 @@ mod commander_tests { let cmd = Commander::new(recv_cmd_sock); - let cmd_id: i32 = sequence::get_next_id(); + let cmd_id: CommandHandle = CommandHandle(sequence::get_next_id()); let mut buf = [0u8; 4]; LittleEndian::write_i32(&mut buf, cmd_id); let msg = "exit"; @@ -134,7 +136,7 @@ mod commander_tests { let cmd = Commander::new(recv_cmd_sock); - let cmd_id: i32 = sequence::get_next_id(); + let cmd_id = sequence::get_next_id(); let mut buf = [0u8; 4]; LittleEndian::write_i32(&mut buf, cmd_id); let msg = "connect"; @@ -148,7 +150,7 @@ mod commander_tests { let cmd = Commander::new(recv_cmd_sock); - let cmd_id: i32 = sequence::get_next_id(); + let cmd_id = sequence::get_next_id(); let mut buf = [0u8; 4]; LittleEndian::write_i32(&mut buf, cmd_id); let mut buf_to = [0u8; 4]; diff --git a/libindy/src/services/pool/events.rs b/libindy/src/services/pool/events.rs index ee53d94075..240a10dbc1 100644 --- a/libindy/src/services/pool/events.rs +++ b/libindy/src/services/pool/events.rs @@ -5,6 +5,7 @@ use domain::ledger::constants; use errors::prelude::*; use services::ledger::merkletree::merkletree::MerkleTree; use services::pool::{PoolService, types:: *}; +use api::CommandHandle; pub const REQUESTS_FOR_STATE_PROOFS: [&str; 10] = [ constants::GET_NYM, @@ -68,16 +69,16 @@ pub enum NetworkerEvent { #[derive(Clone, Debug)] pub enum PoolEvent { - CheckCache(i32), + CheckCache(CommandHandle), NodeReply( String, // reply String, // node alias ), Close( - i32, //cmd_id + CommandHandle ), Refresh( - i32, //cmd_id + CommandHandle ), CatchupTargetFound( Vec, //target_mt_root @@ -96,7 +97,7 @@ pub enum PoolEvent { #[allow(dead_code)] //FIXME NodesBlacklisted, SendRequest( - i32, // cmd_id + CommandHandle, String, // request Option, // timeout Option, // node list diff --git a/libindy/src/services/pool/mod.rs b/libindy/src/services/pool/mod.rs index cb168cd7f8..8267f97661 100644 --- a/libindy/src/services/pool/mod.rs +++ b/libindy/src/services/pool/mod.rs @@ -30,6 +30,7 @@ use errors::*; use services::pool::pool::{Pool, ZMQPool}; use utils::environment; use utils::sequence; +use api::{PoolHandle, CommandHandle}; mod catchup; mod commander; @@ -46,8 +47,8 @@ lazy_static! { } pub struct PoolService { - open_pools: RefCell>, - pending_pools: RefCell>, + open_pools: RefCell>, + pending_pools: RefCell>, } impl PoolService { @@ -138,7 +139,7 @@ impl PoolService { .to_indy(IndyErrorKind::IOError, "Can't delete pool config directory") } - pub fn open(&self, name: &str, config: Option) -> IndyResult { + pub fn open(&self, name: &str, config: Option) -> IndyResult { for ref pool in self.open_pools.try_borrow()?.values() { if name.eq(pool.pool.get_name()) { //TODO change error @@ -148,7 +149,7 @@ impl PoolService { let config = config.unwrap_or(PoolOpenConfig::default()); - let pool_handle: i32 = sequence::get_next_id(); + let pool_handle: PoolHandle = PoolHandle(sequence::get_next_id()); let mut new_pool = Pool::new(name, pool_handle, config); let zmq_ctx = zmq::Context::new(); @@ -168,10 +169,10 @@ impl PoolService { Ok(pool_handle) } - pub fn add_open_pool(&self, pool_id: i32) -> IndyResult { + pub fn add_open_pool(&self, pool_id: PoolHandle) -> IndyResult { let pool = self.pending_pools.try_borrow_mut()? .remove(&pool_id) - .ok_or(err_msg(IndyErrorKind::InvalidPoolHandle, format!("No pool with requested handle {}", pool_id)))?; + .ok_or(err_msg(IndyErrorKind::InvalidPoolHandle, format!("No pool with requested handle {:?}", pool_id)))?; self.open_pools.try_borrow_mut()?.insert(pool_id, pool); @@ -179,19 +180,19 @@ impl PoolService { } - pub fn send_tx(&self, handle: i32, msg: &str) -> IndyResult { + pub fn send_tx(&self, handle: PoolHandle, msg: &str) -> IndyResult { self.send_action(handle, msg, None, None) } - pub fn send_action(&self, handle: i32, msg: &str, nodes: Option<&str>, timeout: Option) -> IndyResult { + pub fn send_action(&self, handle: PoolHandle, msg: &str, nodes: Option<&str>, timeout: Option) -> IndyResult { let pools = self.open_pools.try_borrow()?; if let Some(ref pool) = pools.get(&handle) { - let cmd_id: i32 = sequence::get_next_id(); + let cmd_id: CommandHandle = CommandHandle(sequence::get_next_id()); self._send_msg(cmd_id, msg, &pool.cmd_socket, nodes, timeout)?; Ok(cmd_id) } else { - Err(err_msg(IndyErrorKind::InvalidPoolHandle, format!("No pool with requested handle {}", handle))) + Err(err_msg(IndyErrorKind::InvalidPoolHandle, format!("No pool with requested handle {:?}", handle))) } } @@ -216,24 +217,24 @@ impl PoolService { parsers.get(txn_type).map(Clone::clone) } - pub fn close(&self, handle: i32) -> IndyResult { - let cmd_id: i32 = sequence::get_next_id(); + pub fn close(&self, handle: PoolHandle) -> IndyResult { + let cmd_id: CommandHandle = CommandHandle(sequence::get_next_id()); let mut pools = self.open_pools.try_borrow_mut()?; match pools.remove(&handle) { Some(ref pool) => self._send_msg(cmd_id, "exit", &pool.cmd_socket, None, None)?, - None => return Err(err_msg(IndyErrorKind::InvalidPoolHandle, format!("No pool with requested handle {}", handle))) + None => return Err(err_msg(IndyErrorKind::InvalidPoolHandle, format!("No pool with requested handle {:?}", handle))) } Ok(cmd_id) } - pub fn refresh(&self, handle: i32) -> IndyResult { + pub fn refresh(&self, handle: PoolHandle) -> IndyResult { self.send_action(handle, "refresh", None, None) } - fn _send_msg(&self, cmd_id: i32, msg: &str, socket: &Socket, nodes: Option<&str>, timeout: Option) -> IndyResult<()> { + fn _send_msg(&self, cmd_id: CommandHandle, msg: &str, socket: &Socket, nodes: Option<&str>, timeout: Option) -> IndyResult<()> { let mut buf = [0u8; 4]; let mut buf_to = [0u8; 4]; LittleEndian::write_i32(&mut buf, cmd_id); @@ -348,7 +349,7 @@ mod tests { use libc::c_char; - use api::ErrorCode; + use api::{ErrorCode, INVALID_POOL_HANDLE}; use super::*; @@ -373,7 +374,7 @@ mod tests { test::cleanup_storage("pool_service_close_works"); let ps = PoolService::new(); - let pool_id = sequence::get_next_id(); + let pool_id = PoolHandle(sequence::get_next_id()); let ctx = zmq::Context::new(); let send_soc = ctx.socket(zmq::SocketType::PAIR).unwrap(); let recv_soc = ctx.socket(zmq::SocketType::PAIR).unwrap(); @@ -392,7 +393,7 @@ mod tests { test::cleanup_storage("pool_service_refresh_works"); let ps = PoolService::new(); - let pool_id = sequence::get_next_id(); + let pool_id = PoolHandle(sequence::get_next_id()); let ctx = zmq::Context::new(); let send_soc = ctx.socket(zmq::SocketType::PAIR).unwrap(); let recv_soc = ctx.socket(zmq::SocketType::PAIR).unwrap(); @@ -403,7 +404,7 @@ mod tests { let recv = recv_soc.recv_multipart(zmq::DONTWAIT).unwrap(); assert_eq!(recv.len(), 3); assert_eq!("refresh", String::from_utf8(recv[0].clone()).unwrap()); - assert_eq!(cmd_id, LittleEndian::read_i32(recv[1].as_slice())); + assert_eq!(cmd_id, CommandHandle(LittleEndian::read_i32(recv[1].as_slice()))); } #[test] @@ -431,7 +432,7 @@ mod tests { let ps = PoolService::new(); let pool_name = "pool_service_delete_works_for_opened"; let path: path::PathBuf = environment::pool_path(pool_name); - let pool_id = sequence::get_next_id(); + let pool_id = PoolHandle(sequence::get_next_id()); let inproc_sock_name: String = format!("inproc://pool_{}", pool_name); recv_cmd_sock.bind(inproc_sock_name.as_str()).unwrap(); @@ -460,11 +461,12 @@ mod tests { let inproc_sock_name: String = format!("inproc://pool_{}", name); recv_cmd_sock.bind(inproc_sock_name.as_str()).unwrap(); send_cmd_sock.connect(inproc_sock_name.as_str()).unwrap(); - let pool = Pool::new(name, 0, PoolOpenConfig::default()); + let pool_id = PoolHandle(sequence::get_next_id()); + let pool = Pool::new(name, pool_id, PoolOpenConfig::default()); let ps = PoolService::new(); - ps.open_pools.borrow_mut().insert(-1, ZMQPool::new(pool, send_cmd_sock)); + ps.open_pools.borrow_mut().insert(pool_id, ZMQPool::new(pool, send_cmd_sock)); let test_data = "str_instead_of_tx_json"; - ps.send_tx(-1, test_data).unwrap(); + ps.send_tx(pool_id, test_data).unwrap(); assert_eq!(recv_cmd_sock.recv_string(zmq::DONTWAIT).unwrap().unwrap(), test_data); } @@ -476,10 +478,11 @@ mod tests { let zmq_ctx = zmq::Context::new(); let send_cmd_sock = zmq_ctx.socket(zmq::SocketType::PAIR).unwrap(); - let pool = Pool::new(name, 0, PoolOpenConfig::default()); + let pool_id = PoolHandle(sequence::get_next_id()); + let pool = Pool::new(name, pool_id, PoolOpenConfig::default()); let ps = PoolService::new(); - ps.open_pools.borrow_mut().insert(-1, ZMQPool::new(pool, send_cmd_sock)); - let res = ps.send_tx(-1, "test_data"); + ps.open_pools.borrow_mut().insert(pool_id, ZMQPool::new(pool, send_cmd_sock)); + let res = ps.send_tx(pool_id, "test_data"); assert_eq!(IndyErrorKind::IOError, res.unwrap_err().kind()); } @@ -487,7 +490,7 @@ mod tests { fn pool_send_tx_works_for_invalid_handle() { test::cleanup_storage("pool_send_tx_works_for_invalid_handle"); let ps = PoolService::new(); - let res = ps.send_tx(-1, "txn"); + let res = ps.send_tx(INVALID_POOL_HANDLE, "txn"); assert_eq!(IndyErrorKind::InvalidPoolHandle, res.unwrap_err().kind()); } @@ -502,11 +505,12 @@ mod tests { let inproc_sock_name: String = format!("inproc://pool_{}", name); recv_cmd_sock.bind(inproc_sock_name.as_str()).unwrap(); send_cmd_sock.connect(inproc_sock_name.as_str()).unwrap(); - let pool = Pool::new(name, 0, PoolOpenConfig::default()); + let pool_id = PoolHandle(sequence::get_next_id()); + let pool = Pool::new(name, pool_id, PoolOpenConfig::default()); let ps = PoolService::new(); - ps.open_pools.borrow_mut().insert(-1, ZMQPool::new(pool, send_cmd_sock)); + ps.open_pools.borrow_mut().insert(pool_id, ZMQPool::new(pool, send_cmd_sock)); let test_data = "str_instead_of_tx_json"; - ps.send_action(-1, test_data, None, None).unwrap(); + ps.send_action(pool_id, test_data, None, None).unwrap(); assert_eq!(recv_cmd_sock.recv_string(zmq::DONTWAIT).unwrap().unwrap(), test_data); } @@ -514,7 +518,7 @@ mod tests { fn pool_close_works_for_invalid_handle() { test::cleanup_storage("pool_close_works_for_invalid_handle"); let ps = PoolService::new(); - let res = ps.close(-1); + let res = ps.close(INVALID_POOL_HANDLE); assert_eq!(IndyErrorKind::InvalidPoolHandle, res.unwrap_err().kind()); } @@ -522,7 +526,7 @@ mod tests { fn pool_refresh_works_for_invalid_handle() { test::cleanup_storage("pool_refresh_works_for_invalid_handle"); let ps = PoolService::new(); - let res = ps.refresh(-1); + let res = ps.refresh(INVALID_POOL_HANDLE); assert_eq!(IndyErrorKind::InvalidPoolHandle, res.unwrap_err().kind()); } @@ -567,16 +571,17 @@ mod tests { let ps = PoolService::new(); let zmq_ctx = zmq::Context::new(); let send_cmd_sock = zmq_ctx.socket(zmq::SocketType::PAIR).unwrap(); - let pool = Pool::new(name, 0, PoolOpenConfig::default()); - ps.pending_pools.borrow_mut().insert(-1, ZMQPool::new(pool, send_cmd_sock)); - assert_match!(Ok(-1), ps.add_open_pool(-1)); + let pool_id = PoolHandle(sequence::get_next_id()); + let pool = Pool::new(name, pool_id, PoolOpenConfig::default()); + ps.pending_pools.borrow_mut().insert(pool_id, ZMQPool::new(pool, send_cmd_sock)); + assert_match!(Ok(pool_id), ps.add_open_pool(pool_id)); } #[test] pub fn pool_add_open_pool_works_for_no_pending_pool() { test::cleanup_storage("pool_add_open_pool_works_for_no_pending_pool"); let ps = PoolService::new(); - let res = ps.add_open_pool(-1); + let res = ps.add_open_pool(INVALID_POOL_HANDLE); assert_eq!(IndyErrorKind::InvalidPoolHandle, res.unwrap_err().kind()); } } @@ -610,11 +615,12 @@ mod tests { let mut file = fs::File::create(pool_path).unwrap(); file.write(&gen_txn.as_bytes()).unwrap(); - let mut pool = Pool::new(pool_name, -1, PoolOpenConfig::default()); + let pool_id = PoolHandle(sequence::get_next_id()); + let mut pool = Pool::new(pool_name, pool_id, PoolOpenConfig::default()); pool.work(recv_cmd_sock); - ps.open_pools.borrow_mut().insert(-1, ZMQPool::new(pool, send_cmd_sock)); + ps.open_pools.borrow_mut().insert(pool_id, ZMQPool::new(pool, send_cmd_sock)); thread::sleep(time::Duration::from_secs(1)); - ps.close(-1).unwrap(); + ps.close(pool_id).unwrap(); thread::sleep(time::Duration::from_secs(1)); } diff --git a/libindy/src/services/pool/pool.rs b/libindy/src/services/pool/pool.rs index a6da2a6509..9714f8d824 100644 --- a/libindy/src/services/pool/pool.rs +++ b/libindy/src/services/pool/pool.rs @@ -27,10 +27,11 @@ use utils::crypto::ed25519_sign; use super::ursa::bls::VerKey; use super::zmq; +use api::{PoolHandle, CommandHandle}; struct PoolSM> { pool_name: String, - id: i32, + id: PoolHandle, timeout: i64, extended_timeout: i64, state: PoolState, @@ -59,7 +60,7 @@ struct InitializationState { struct GettingCatchupTargetState> { networker: Rc>, request_handler: R, - cmd_id: i32, + cmd_id: CommandHandle, refresh: bool, } @@ -72,7 +73,7 @@ struct ActiveState> { struct SyncCatchupState> { networker: Rc>, request_handler: R, - cmd_id: i32, + cmd_id: CommandHandle, refresh: bool, } @@ -83,7 +84,7 @@ struct TerminatedState { struct ClosedState {} impl> PoolSM { - pub fn new(networker: Rc>, pname: &str, id: i32, timeout: i64, extended_timeout: i64) -> PoolSM { + pub fn new(networker: Rc>, pname: &str, id: PoolHandle, timeout: i64, extended_timeout: i64) -> PoolSM { PoolSM { pool_name: pname.to_string(), id, @@ -95,15 +96,15 @@ impl> PoolSM { } } - pub fn step(pool_name: String, id: i32, timeout: i64, extended_timeout: i64, state: PoolState) -> Self { + pub fn step(pool_name: String, id: PoolHandle, timeout: i64, extended_timeout: i64, state: PoolState) -> Self { PoolSM { pool_name, id, timeout, extended_timeout, state } } } // transitions from Initialization -impl> From<(R, i32, InitializationState)> for GettingCatchupTargetState { - fn from((request_handler, cmd_id, state): (R, i32, InitializationState)) -> GettingCatchupTargetState { +impl> From<(R, CommandHandle, InitializationState)> for GettingCatchupTargetState { + fn from((request_handler, cmd_id, state): (R, CommandHandle, InitializationState)) -> GettingCatchupTargetState { trace!("PoolSM: from init to getting catchup target"); //TODO: fill it up! GettingCatchupTargetState { @@ -183,8 +184,8 @@ impl> From> f // transitions from Active -impl> From<(ActiveState, R, i32)> for GettingCatchupTargetState { - fn from((state, request_handler, cmd_id): (ActiveState, R, i32)) -> Self { +impl> From<(ActiveState, R, CommandHandle)> for GettingCatchupTargetState { + fn from((state, request_handler, cmd_id): (ActiveState, R, CommandHandle)) -> Self { trace!("PoolSM: from active to getting catchup target"); //TODO: close connections! GettingCatchupTargetState { @@ -244,8 +245,8 @@ impl> From> for Closed // transitions from Terminated -impl> From<(TerminatedState, R, i32)> for GettingCatchupTargetState { - fn from((state, request_handler, cmd_id): (TerminatedState, R, i32)) -> Self { +impl> From<(TerminatedState, R, CommandHandle)> for GettingCatchupTargetState { + fn from((state, request_handler, cmd_id): (TerminatedState, R, CommandHandle)) -> Self { trace!("PoolSM: from terminated to getting catchup target"); GettingCatchupTargetState { networker: state.networker, @@ -466,7 +467,7 @@ pub struct Pool> { _pd: PhantomData<(S, R)>, worker: Option>, name: String, - id: i32, + id: PoolHandle, timeout: i64, extended_timeout: i64, active_timeout: i64, @@ -475,8 +476,8 @@ pub struct Pool> { } impl> Pool { - pub fn new(name: &str, id: i32, config: PoolOpenConfig) -> Self { - trace!("Pool::new name {}, id {}, config {:?}", name, id, config); + pub fn new(name: &str, id: PoolHandle, config: PoolOpenConfig) -> Self { + trace!("Pool::new name {}, id {:?}, config {:?}", name, id, config); Pool { _pd: PhantomData::<(S, R)>, worker: None, @@ -511,7 +512,7 @@ impl> Pool { &self.name } - pub fn get_id(&self) -> i32 { + pub fn get_id(&self) -> PoolHandle { self.id } } @@ -524,7 +525,7 @@ struct PoolThread> { } impl> PoolThread { - pub fn new(cmd_socket: zmq::Socket, name: String, id: i32, timeout: i64, extended_timeout: i64, active_timeout: i64, conn_limit: usize, preordered_nodes: Vec) -> Self { + pub fn new(cmd_socket: zmq::Socket, name: String, id: PoolHandle, timeout: i64, extended_timeout: i64, active_timeout: i64, conn_limit: usize, preordered_nodes: Vec) -> Self { let networker = Rc::new(RefCell::new(S::new(active_timeout, conn_limit, preordered_nodes))); PoolThread { pool_sm: Some(PoolSM::new(networker.clone(), &name, id, timeout, extended_timeout)), @@ -626,7 +627,7 @@ fn _get_request_handler_with_ledger_status_sent LedgerStatus{ +fn _ledger_status(merkle: &MerkleTree) -> LedgerStatus { let protocol_version = ProtocolVersion::get(); LedgerStatus { @@ -682,7 +683,7 @@ fn _get_nodes_and_remotes(merkle: &MerkleTree) -> IndyResult<(HashMap None, }; Ok(((node_alias, verkey), remote)) @@ -703,17 +704,17 @@ fn _get_nodes_and_remotes(merkle: &MerkleTree) -> IndyResult<(HashMap) { +fn _send_submit_ack(cmd_id: CommandHandle, res: IndyResult) { let lc = LedgerCommand::SubmitAck(cmd_id.clone(), res); CommandExecutor::instance().send(Command::Ledger(lc)).unwrap(); } -fn _send_open_refresh_ack(cmd_id: i32, id: i32, is_refresh: bool) { +fn _send_open_refresh_ack(cmd_id: CommandHandle, id: PoolHandle, is_refresh: bool) { trace!("PoolSM: from getting catchup target to active"); let pc = if is_refresh { PoolCommand::RefreshAck(cmd_id.clone(), Ok(())) @@ -769,20 +770,20 @@ mod tests { #[test] pub fn pool_new_works() { - let _p: Pool = Pool::new("pool_new_works", 1, PoolOpenConfig::default()); + let _p: Pool = Pool::new("pool_new_works", PoolHandle(1), PoolOpenConfig::default()); } #[test] pub fn pool_get_name_works() { let name = "pool_get_name_works"; - let p: Pool = Pool::new(name, 1, PoolOpenConfig::default()); + let p: Pool = Pool::new(name, PoolHandle(1), PoolOpenConfig::default()); assert_eq!(name, p.get_name()); } #[test] pub fn pool_get_id_works() { let name = "pool_get_id_works"; - let id = 1; + let id = PoolHandle(1); let p: Pool = Pool::new(name, id, PoolOpenConfig::default()); assert_eq!(id, p.get_id()); } @@ -794,10 +795,11 @@ mod tests { use serde_json; use super::*; + use utils::sequence; #[test] pub fn pool_wrapper_new_initialization_works() { - let _p: PoolSM = PoolSM::new(Rc::new(RefCell::new(MockNetworker::new(0, 0, vec![]))), "name", 1, 0, 0); + let _p: PoolSM = PoolSM::new(Rc::new(RefCell::new(MockNetworker::new(0, 0, vec![]))), "name", PoolHandle(1), 0, 0); } #[test] @@ -807,8 +809,9 @@ mod tests { ProtocolVersion::set(2); _write_genesis_txns("pool_wrapper_check_cache_works"); - let p: PoolSM = PoolSM::new(Rc::new(RefCell::new(MockNetworker::new(0, 0, vec![]))), "pool_wrapper_check_cache_works", 1, 0, 0); - let p = p.handle_event(PoolEvent::CheckCache(1)); + let p: PoolSM = PoolSM::new(Rc::new(RefCell::new(MockNetworker::new(0, 0, vec![]))), "pool_wrapper_check_cache_works", PoolHandle(1), 0, 0); + let cmd_id: CommandHandle = CommandHandle(sequence::get_next_id()); + let p = p.handle_event(PoolEvent::CheckCache(cmd_id)); assert_match!(PoolState::GettingCatchupTarget(_), p.state); test::cleanup_storage("pool_wrapper_check_cache_works"); @@ -818,29 +821,34 @@ mod tests { pub fn pool_wrapper_check_cache_works_for_no_pool_created() { let p: PoolSM = PoolSM::new(Rc::new(RefCell::new(MockNetworker::new(0, 0, vec![]))), - "pool_wrapper_check_cache_works_for_no_pool_created", 1, 0, 0); - let p = p.handle_event(PoolEvent::CheckCache(1)); + "pool_wrapper_check_cache_works_for_no_pool_created", PoolHandle(1), 0, 0); + let cmd_id: CommandHandle = CommandHandle(sequence::get_next_id()); + let p = p.handle_event(PoolEvent::CheckCache(cmd_id)); assert_match!(PoolState::Terminated(_), p.state); } #[test] pub fn pool_wrapper_terminated_close_works() { - let p: PoolSM = PoolSM::new(Rc::new(RefCell::new(MockNetworker::new(0, 0, vec![]))), "pool_wrapper_terminated_close_works", 1, 0, 0); - let p = p.handle_event(PoolEvent::CheckCache(1)); - let p = p.handle_event(PoolEvent::Close(2)); + let p: PoolSM = PoolSM::new(Rc::new(RefCell::new(MockNetworker::new(0, 0, vec![]))), "pool_wrapper_terminated_close_works", PoolHandle(1), 0, 0); + let cmd_id: CommandHandle = CommandHandle(sequence::get_next_id()); + let p = p.handle_event(PoolEvent::CheckCache(cmd_id)); + let cmd_id: CommandHandle = CommandHandle(sequence::get_next_id()); + let p = p.handle_event(PoolEvent::Close(cmd_id)); assert_match!(PoolState::Closed(_), p.state); } #[test] pub fn pool_wrapper_terminated_refresh_works() { test::cleanup_pool("pool_wrapper_terminated_refresh_works"); - let p: PoolSM = PoolSM::new(Rc::new(RefCell::new(MockNetworker::new(0, 0, vec![]))), "pool_wrapper_terminated_refresh_works", 1, 0, 0); - let p = p.handle_event(PoolEvent::CheckCache(1)); + let p: PoolSM = PoolSM::new(Rc::new(RefCell::new(MockNetworker::new(0, 0, vec![]))), "pool_wrapper_terminated_refresh_works", PoolHandle(1), 0, 0); + let cmd_id: CommandHandle = CommandHandle(sequence::get_next_id()); + let p = p.handle_event(PoolEvent::CheckCache(cmd_id)); ProtocolVersion::set(2); _write_genesis_txns("pool_wrapper_terminated_refresh_works"); - let p = p.handle_event(PoolEvent::Refresh(2)); + let cmd_id: CommandHandle = CommandHandle(sequence::get_next_id()); + let p = p.handle_event(PoolEvent::Refresh(cmd_id)); assert_match!(PoolState::GettingCatchupTarget(_), p.state); test::cleanup_pool("pool_wrapper_terminated_refresh_works"); } @@ -849,7 +857,7 @@ mod tests { pub fn pool_wrapper_terminated_timeout_works() { let p: PoolSM = PoolSM { pool_name: "pool_wrapper_terminated_timeout_works".to_string(), - id: 1, + id: PoolHandle(1), state: PoolState::Terminated(TerminatedState { networker: Rc::new(RefCell::new(MockNetworker::new(0, 0, vec![]))), }), @@ -871,8 +879,9 @@ mod tests { #[test] pub fn pool_wrapper_cloe_works_from_initialization() { - let p: PoolSM = PoolSM::new(Rc::new(RefCell::new(MockNetworker::new(0, 0, vec![]))), "pool_wrapper_cloe_works_from_initialization", 1, 0, 0); - let p = p.handle_event(PoolEvent::Close(1)); + let p: PoolSM = PoolSM::new(Rc::new(RefCell::new(MockNetworker::new(0, 0, vec![]))), "pool_wrapper_cloe_works_from_initialization", PoolHandle(1), 0, 0); + let cmd_id: CommandHandle = CommandHandle(sequence::get_next_id()); + let p = p.handle_event(PoolEvent::Close(cmd_id)); assert_match!(PoolState::Closed(_), p.state); } @@ -883,9 +892,12 @@ mod tests { ProtocolVersion::set(2); _write_genesis_txns("pool_wrapper_close_works_from_getting_catchup_target"); - let p: PoolSM = PoolSM::new(Rc::new(RefCell::new(MockNetworker::new(0, 0, vec![]))), "pool_wrapper_close_works_from_getting_catchup_target", 1, 0, 0); - let p = p.handle_event(PoolEvent::CheckCache(1)); - let p = p.handle_event(PoolEvent::Close(2)); + let p: PoolSM = + PoolSM::new(Rc::new(RefCell::new(MockNetworker::new(0, 0, vec![]))), "pool_wrapper_close_works_from_getting_catchup_target", PoolHandle(1), 0, 0); + let cmd_id: CommandHandle = CommandHandle(sequence::get_next_id()); + let p = p.handle_event(PoolEvent::CheckCache(cmd_id)); + let cmd_id: CommandHandle = CommandHandle(sequence::get_next_id()); + let p = p.handle_event(PoolEvent::Close(cmd_id)); assert_match!(PoolState::Closed(_), p.state); test::cleanup_storage("pool_wrapper_close_works_from_getting_catchup_target"); @@ -898,8 +910,10 @@ mod tests { ProtocolVersion::set(2); _write_genesis_txns("pool_wrapper_catchup_target_not_found_works"); - let p: PoolSM = PoolSM::new(Rc::new(RefCell::new(MockNetworker::new(0, 0, vec![]))), "pool_wrapper_catchup_target_not_found_works", 1, 0, 0); - let p = p.handle_event(PoolEvent::CheckCache(1)); + let p: PoolSM = + PoolSM::new(Rc::new(RefCell::new(MockNetworker::new(0, 0, vec![]))), "pool_wrapper_catchup_target_not_found_works", PoolHandle(1), 0, 0); + let cmd_id: CommandHandle = CommandHandle(sequence::get_next_id()); + let p = p.handle_event(PoolEvent::CheckCache(cmd_id)); let p = p.handle_event(PoolEvent::CatchupTargetNotFound(err_msg(IndyErrorKind::PoolTimeout, "Pool timeout"))); assert_match!(PoolState::Terminated(_), p.state); @@ -913,8 +927,10 @@ mod tests { ProtocolVersion::set(2); _write_genesis_txns("pool_wrapper_getting_catchup_target_synced_works"); - let p: PoolSM = PoolSM::new(Rc::new(RefCell::new(MockNetworker::new(0, 0, vec![]))), "pool_wrapper_getting_catchup_target_synced_works", 1, 0, 0); - let p = p.handle_event(PoolEvent::CheckCache(1)); + let p: PoolSM = + PoolSM::new(Rc::new(RefCell::new(MockNetworker::new(0, 0, vec![]))), "pool_wrapper_getting_catchup_target_synced_works", PoolHandle(1), 0, 0); + let cmd_id: CommandHandle = CommandHandle(sequence::get_next_id()); + let p = p.handle_event(PoolEvent::CheckCache(cmd_id)); let p = p.handle_event(PoolEvent::Synced(MerkleTree::from_vec(vec![]).unwrap())); assert_match!(PoolState::Active(_), p.state); @@ -928,8 +944,16 @@ mod tests { ProtocolVersion::set(2); _write_genesis_txns("pool_wrapper_getting_catchup_target_synced_works_for_node_state_error"); - let p: PoolSM = PoolSM::new(Rc::new(RefCell::new(MockNetworker::new(0, 0, vec![]))), "pool_wrapper_getting_catchup_target_synced_works_for_node_state_error", 1, 0, 0); - let p = p.handle_event(PoolEvent::CheckCache(1)); + let p: PoolSM = PoolSM::new( + Rc::new(RefCell::new( + MockNetworker::new(0, + 0, vec![]))), + "pool_wrapper_getting_catchup_target_synced_works_for_node_state_error", + PoolHandle(1), + 0, + 0); + let cmd_id: CommandHandle = CommandHandle(sequence::get_next_id()); + let p = p.handle_event(PoolEvent::CheckCache(cmd_id)); ProtocolVersion::set(1); let p = p.handle_event(PoolEvent::Synced(merkle_tree_factory::create("pool_wrapper_getting_catchup_target_synced_works_for_node_state_error").unwrap())); assert_match!(PoolState::Terminated(_), p.state); @@ -946,8 +970,17 @@ mod tests { let mt = merkle_tree_factory::create("pool_wrapper_getting_catchup_target_catchup_target_found_works").unwrap(); - let p: PoolSM = PoolSM::new(Rc::new(RefCell::new(MockNetworker::new(0, 0, vec![]))), "pool_wrapper_getting_catchup_target_catchup_target_found_works", 1, 0, 0); - let p = p.handle_event(PoolEvent::CheckCache(1)); + let p: PoolSM = PoolSM::new( + Rc::new(RefCell::new( + MockNetworker::new(0, + 0, + vec![]))), + "pool_wrapper_getting_catchup_target_catchup_target_found_works", + PoolHandle(1), + 0, + 0); + let cmd_id: CommandHandle = CommandHandle(sequence::get_next_id()); + let p = p.handle_event(PoolEvent::CheckCache(cmd_id)); let p = p.handle_event(PoolEvent::CatchupTargetFound(mt.root_hash().to_vec(), mt.count, mt)); assert_match!(PoolState::SyncCatchup(_), p.state); @@ -963,8 +996,15 @@ mod tests { let mt = merkle_tree_factory::create("pool_wrapper_getting_catchup_target_catchup_target_found_works_for_node_state_error").unwrap(); - let p: PoolSM = PoolSM::new(Rc::new(RefCell::new(MockNetworker::new(0, 0, vec![]))), "pool_wrapper_getting_catchup_target_catchup_target_found_works_for_node_state_error", 1, 0, 0); - let p = p.handle_event(PoolEvent::CheckCache(1)); + let p: PoolSM = + PoolSM::new(Rc::new(RefCell::new( + MockNetworker::new(0, 0, vec![]))), + "pool_wrapper_getting_catchup_target_catchup_target_found_works_for_node_state_error", + PoolHandle(1), + 0, + 0); + let cmd_id: CommandHandle = CommandHandle(sequence::get_next_id()); + let p = p.handle_event(PoolEvent::CheckCache(cmd_id)); ProtocolVersion::set(1); let p = p.handle_event(PoolEvent::CatchupTargetFound(mt.root_hash().to_vec(), mt.count, mt)); assert_match!(PoolState::Terminated(_), p.state); @@ -981,10 +1021,21 @@ mod tests { let mt = merkle_tree_factory::create("pool_wrapper_sync_catchup_close_works").unwrap(); - let p: PoolSM = PoolSM::new(Rc::new(RefCell::new(MockNetworker::new(0, 0, vec![]))), "pool_wrapper_sync_catchup_close_works", 1, 0, 0); - let p = p.handle_event(PoolEvent::CheckCache(1)); + let p: PoolSM = + PoolSM::new(Rc::new( + RefCell::new( + MockNetworker::new(0, + 0, + vec![]))), + "pool_wrapper_sync_catchup_close_works", + PoolHandle(1), + 0, + 0); + let cmd_id: CommandHandle = CommandHandle(sequence::get_next_id()); + let p = p.handle_event(PoolEvent::CheckCache(cmd_id)); let p = p.handle_event(PoolEvent::CatchupTargetFound(mt.root_hash().to_vec(), mt.count, mt)); - let p = p.handle_event(PoolEvent::Close(2)); + let cmd_id: CommandHandle = CommandHandle(sequence::get_next_id()); + let p = p.handle_event(PoolEvent::Close(cmd_id)); assert_match!(PoolState::Closed(_), p.state); test::cleanup_storage("pool_wrapper_sync_catchup_close_works"); @@ -999,8 +1050,17 @@ mod tests { let mt = merkle_tree_factory::create("pool_wrapper_sync_catchup_synced_works").unwrap(); - let p: PoolSM = PoolSM::new(Rc::new(RefCell::new(MockNetworker::new(0, 0, vec![]))), "pool_wrapper_sync_catchup_synced_works", 1, 0, 0); - let p = p.handle_event(PoolEvent::CheckCache(1)); + let p: PoolSM = PoolSM::new( + Rc::new(RefCell::new( + MockNetworker::new(0, + 0, + vec![]))), + "pool_wrapper_sync_catchup_synced_works", + PoolHandle(1), + 0, + 0); + let cmd_id: CommandHandle = CommandHandle(sequence::get_next_id()); + let p = p.handle_event(PoolEvent::CheckCache(cmd_id)); let p = p.handle_event(PoolEvent::CatchupTargetFound(mt.root_hash().to_vec(), mt.count, mt)); let p = p.handle_event(PoolEvent::Synced(merkle_tree_factory::create("pool_wrapper_sync_catchup_synced_works").unwrap())); assert_match!(PoolState::Active(_), p.state); @@ -1017,8 +1077,17 @@ mod tests { let mt = merkle_tree_factory::create("pool_wrapper_sync_catchup_synced_works_for_node_state_error").unwrap(); - let p: PoolSM = PoolSM::new(Rc::new(RefCell::new(MockNetworker::new(0, 0, vec![]))), "pool_wrapper_sync_catchup_synced_works_for_node_state_error", 1, 0, 0); - let p = p.handle_event(PoolEvent::CheckCache(1)); + let p: PoolSM = PoolSM::new( + Rc::new(RefCell::new( + MockNetworker::new(0, + 0, + vec![]))), + "pool_wrapper_sync_catchup_synced_works_for_node_state_error", + PoolHandle(1), + 0, + 0); + let cmd_id: CommandHandle = CommandHandle(sequence::get_next_id()); + let p = p.handle_event(PoolEvent::CheckCache(cmd_id)); let p = p.handle_event(PoolEvent::CatchupTargetFound(mt.root_hash().to_vec(), mt.count, mt)); ProtocolVersion::set(1); let p = p.handle_event(PoolEvent::Synced(merkle_tree_factory::create("pool_wrapper_sync_catchup_synced_works_for_node_state_error").unwrap())); @@ -1041,10 +1110,19 @@ mod tests { } }).to_string(); - let p: PoolSM = PoolSM::new(Rc::new(RefCell::new(MockNetworker::new(0, 0, vec![]))), "pool_wrapper_active_send_request_works", 1, 0, 0); - let p = p.handle_event(PoolEvent::CheckCache(1)); + let p: PoolSM = PoolSM::new(Rc::new( + RefCell::new(MockNetworker::new(0, + 0, + vec![]))), + "pool_wrapper_active_send_request_works", + PoolHandle(1), + 0, + 0); + let cmd_id: CommandHandle = CommandHandle(sequence::get_next_id()); + let p = p.handle_event(PoolEvent::CheckCache(cmd_id)); let p = p.handle_event(PoolEvent::Synced(MerkleTree::from_vec(vec![]).unwrap())); - let p = p.handle_event(PoolEvent::SendRequest(3, req, None, None)); + let cmd_id: CommandHandle = CommandHandle(sequence::get_next_id()); + let p = p.handle_event(PoolEvent::SendRequest(cmd_id, req, None, None)); assert_match!(PoolState::Active(_), p.state); match p.state { PoolState::Active(state) => { @@ -1070,10 +1148,21 @@ mod tests { } }).to_string(); - let p: PoolSM = PoolSM::new(Rc::new(RefCell::new(MockNetworker::new(0, 0, vec![]))), "pool_wrapper_active_send_request_works_for_no_req_id", 1, 0, 0); - let p = p.handle_event(PoolEvent::CheckCache(1)); + let p: PoolSM = + PoolSM::new(Rc::new(RefCell::new( + MockNetworker::new( + 0, + 0, + vec![]))), + "pool_wrapper_active_send_request_works_for_no_req_id", + PoolHandle(1), + 0, + 0); + let cmd_id: CommandHandle = CommandHandle(sequence::get_next_id()); + let p = p.handle_event(PoolEvent::CheckCache(cmd_id)); let p = p.handle_event(PoolEvent::Synced(MerkleTree::from_vec(vec![]).unwrap())); - let p = p.handle_event(PoolEvent::SendRequest(3, req, None, None)); + let cmd_id: CommandHandle = CommandHandle(sequence::get_next_id()); + let p = p.handle_event(PoolEvent::SendRequest(cmd_id, req, None, None)); assert_match!(PoolState::Active(_), p.state); match p.state { PoolState::Active(state) => { @@ -1113,10 +1202,20 @@ mod tests { let rep = serde_json::to_string(&rep).unwrap(); - let p: PoolSM = PoolSM::new(Rc::new(RefCell::new(MockNetworker::new(0, 0, vec![]))), "pool_wrapper_active_node_reply_works", 1, 0, 0); - let p = p.handle_event(PoolEvent::CheckCache(1)); + let p: PoolSM = PoolSM::new( + Rc::new(RefCell::new( + MockNetworker::new(0, + 0, + vec![]))), + "pool_wrapper_active_node_reply_works", + PoolHandle(1), + 0, + 0); + let cmd_id: CommandHandle = CommandHandle(sequence::get_next_id()); + let p = p.handle_event(PoolEvent::CheckCache(cmd_id)); let p = p.handle_event(PoolEvent::Synced(MerkleTree::from_vec(vec![]).unwrap())); - let p = p.handle_event(PoolEvent::SendRequest(3, req, None, None)); + let cmd_id: CommandHandle = CommandHandle(sequence::get_next_id()); + let p = p.handle_event(PoolEvent::SendRequest(cmd_id, req, None, None)); let p = p.handle_event(PoolEvent::NodeReply(rep, "node".to_string())); assert_match!(PoolState::Active(_), p.state); match p.state { @@ -1143,10 +1242,18 @@ mod tests { } }).to_string(); - let p: PoolSM = PoolSM::new(Rc::new(RefCell::new(MockNetworker::new(0, 0, vec![]))), "pool_wrapper_sends_requests_to_two_nodes", 1, 0, 0); - let p = p.handle_event(PoolEvent::CheckCache(1)); + let p: PoolSM = + PoolSM::new(Rc::new(RefCell::new( + MockNetworker::new(0, + 0, + vec![]))), + "pool_wrapper_sends_requests_to_two_nodes", + PoolHandle(1), 0, 0); + let cmd_id: CommandHandle = CommandHandle(sequence::get_next_id()); + let p = p.handle_event(PoolEvent::CheckCache(cmd_id)); let p = p.handle_event(PoolEvent::Synced(MerkleTree::from_vec(vec![]).unwrap())); - let p = p.handle_event(PoolEvent::SendRequest(3, req, None, None)); + let cmd_id: CommandHandle = CommandHandle(sequence::get_next_id()); + let p = p.handle_event(PoolEvent::SendRequest(cmd_id, req, None, None)); assert_match!(PoolState::Active(_), p.state); match p.state { PoolState::Active(state) => { @@ -1186,10 +1293,19 @@ mod tests { let rep = serde_json::to_string(&rep).unwrap(); - let p: PoolSM = PoolSM::new(Rc::new(RefCell::new(MockNetworker::new(0, 0, vec![]))), "pool_wrapper_active_node_reply_works_for_no_request", 1, 0, 0); - let p = p.handle_event(PoolEvent::CheckCache(1)); + let p: PoolSM = PoolSM::new(Rc::new( + RefCell::new(MockNetworker::new(0, + 0, + vec![]))), + "pool_wrapper_active_node_reply_works_for_no_request", + PoolHandle(1), + 0, + 0); + let cmd_id: CommandHandle = CommandHandle(sequence::get_next_id()); + let p = p.handle_event(PoolEvent::CheckCache(cmd_id)); let p = p.handle_event(PoolEvent::Synced(MerkleTree::from_vec(vec![]).unwrap())); - let p = p.handle_event(PoolEvent::SendRequest(3, req, None, None)); + let cmd_id: CommandHandle = CommandHandle(sequence::get_next_id()); + let p = p.handle_event(PoolEvent::SendRequest(cmd_id, req, None, None)); let p = p.handle_event(PoolEvent::NodeReply(rep, "node".to_string())); assert_match!(PoolState::Active(_), p.state); match p.state { @@ -1219,10 +1335,20 @@ mod tests { let rep = r#"{}"#; - let p: PoolSM = PoolSM::new(Rc::new(RefCell::new(MockNetworker::new(0, 0, vec![]))), "pool_wrapper_active_node_reply_works_for_invalid_reply", 1, 0, 0); - let p = p.handle_event(PoolEvent::CheckCache(1)); + let p: PoolSM = + PoolSM::new(Rc::new(RefCell::new(MockNetworker::new( + 0, + 0, + vec![]))), + "pool_wrapper_active_node_reply_works_for_invalid_reply", + PoolHandle(1), + 0, + 0); + let cmd_id: CommandHandle = CommandHandle(sequence::get_next_id()); + let p = p.handle_event(PoolEvent::CheckCache(cmd_id)); let p = p.handle_event(PoolEvent::Synced(MerkleTree::from_vec(vec![]).unwrap())); - let p = p.handle_event(PoolEvent::SendRequest(3, req, None, None)); + let cmd_id: CommandHandle = CommandHandle(sequence::get_next_id()); + let p = p.handle_event(PoolEvent::SendRequest(cmd_id, req, None, None)); let p = p.handle_event(PoolEvent::NodeReply(rep.to_string(), "node".to_string())); assert_match!(PoolState::Active(_), p.state); match p.state { diff --git a/libindy/src/services/pool/request_handler.rs b/libindy/src/services/pool/request_handler.rs index de8eb9c83c..9e9ea9b3e1 100644 --- a/libindy/src/services/pool/request_handler.rs +++ b/libindy/src/services/pool/request_handler.rs @@ -32,11 +32,11 @@ use super::ursa::bls::VerKey; use std::hash::{Hash, Hasher}; use log_derive::logfn; -use rust_base58::FromBase58; +use api::CommandHandle; struct RequestSM { f: usize, - cmd_ids: Vec, + cmd_ids: Vec, nodes: HashMap>, generator: Generator, pool_name: String, @@ -68,7 +68,7 @@ pub const DEFAULT_GENERATOR: &str = "3LHpUjiyFC2q2hD7MnwwNmVXiuaFbQx2XkAFJWzswCj impl RequestSM { pub fn new(networker: Rc>, f: usize, - cmd_ids: &Vec, + cmd_ids: &Vec, nodes: &HashMap>, pool_name: &str, timeout: i64, extended_timeout: i64) -> Self { let generator : Generator = Generator::from_bytes(&DEFAULT_GENERATOR.from_base58().unwrap()).unwrap(); @@ -87,7 +87,7 @@ impl RequestSM { } pub fn step(f: usize, - cmd_ids: Vec, + cmd_ids: Vec, nodes: HashMap>, generator: Generator, pool_name: String, @@ -514,7 +514,7 @@ impl RequestSM { fn _full_request_handle_consensus_state(mut state: FullState, req_id: String, node_alias: String, node_result: String, - cmd_ids: &Vec, + cmd_ids: &Vec, nodes: &HashMap>) -> RequestState { let is_first_resp = state.accum_reply.is_none(); if is_first_resp { @@ -600,7 +600,7 @@ impl RequestSM { } pub trait RequestHandler { - fn new(networker: Rc>, f: usize, cmd_ids: &Vec, nodes: &HashMap>, pool_name: &str, timeout: i64, extended_timeout: i64) -> Self; + fn new(networker: Rc>, f: usize, cmd_ids: &Vec, nodes: &HashMap>, generator: Option, pool_name: &str, timeout: i64, extended_timeout: i64) -> Self; fn process_event(&mut self, ore: Option) -> Option; fn is_terminal(&self) -> bool; } @@ -610,7 +610,7 @@ pub struct RequestHandlerImpl { } impl RequestHandler for RequestHandlerImpl { - fn new(networker: Rc>, f: usize, cmd_ids: &Vec, nodes: &HashMap>, pool_name: &str, timeout: i64, extended_timeout: i64) -> Self { + fn new(networker: Rc>, f: usize, cmd_ids: &Vec, nodes: &HashMap>, generator: Option, pool_name: &str, timeout: i64, extended_timeout: i64) -> Self { RequestHandlerImpl { request_wrapper: Some(RequestSM::new(networker, f, cmd_ids, nodes, pool_name, timeout, extended_timeout)), } @@ -642,7 +642,7 @@ impl SingleState { < total_nodes_cnt } - fn try_to_continue(self, req_id: String, node_alias: String, cmd_ids: &Vec, nodes_cnt: usize, timeout: i64) -> RequestState { + fn try_to_continue(self, req_id: String, node_alias: String, cmd_ids: &Vec, nodes_cnt: usize, timeout: i64) -> RequestState { if self.is_consensus_reachable(nodes_cnt) { self.networker.borrow_mut().process_event(Some(NetworkerEvent::Resend(req_id.clone(), timeout))); self.networker.borrow_mut().process_event(Some(NetworkerEvent::Resend(req_id.clone(), timeout))); @@ -665,7 +665,7 @@ impl ConsensusState { } } -fn _parse_nack(denied_nodes: &mut HashSet, f: usize, raw_msg: &str, cmd_ids: &Vec, node_alias: &str) -> bool { +fn _parse_nack(denied_nodes: &mut HashSet, f: usize, raw_msg: &str, cmd_ids: &Vec, node_alias: &str) -> bool { if denied_nodes.len() == f { _send_ok_replies(cmd_ids, raw_msg); true @@ -695,15 +695,15 @@ fn _process_catchup_reply(rep: &mut CatchupRep, merkle: &MerkleTree, target_mt_r Ok(merkle) } -fn _send_ok_replies(cmd_ids: &Vec, msg: &str) { +fn _send_ok_replies(cmd_ids: &Vec, msg: &str) { _send_replies(cmd_ids, Ok(msg.to_string())) } -fn _finish_request(cmd_ids: &Vec) { +fn _finish_request(cmd_ids: &Vec) { _send_replies(cmd_ids, Err(err_msg(IndyErrorKind::PoolTerminated, "Pool is terminated"))) } -fn _send_replies(cmd_ids: &Vec, msg: IndyResult) { +fn _send_replies(cmd_ids: &Vec, msg: IndyResult) { cmd_ids.into_iter().for_each(|id| { CommandExecutor::instance().send( Command::Ledger( @@ -849,7 +849,7 @@ pub mod tests { pub struct MockRequestHandler {} impl RequestHandler for MockRequestHandler { - fn new(_networker: Rc>, _f: usize, _cmd_ids: &Vec, _nodes: &HashMap>, _pool_name: &str, _timeout: i64, _extended_timeout: i64) -> Self { + fn new(_networker: Rc>, _f: usize, _cmd_ids: &Vec, _nodes: &HashMap>, _generator: Option, _pool_name: &str, _timeout: i64, _extended_timeout: i64) -> Self { MockRequestHandler {} } diff --git a/libindy/src/services/pool/types.rs b/libindy/src/services/pool/types.rs index 0a6c47b103..24bb0f51f4 100644 --- a/libindy/src/services/pool/types.rs +++ b/libindy/src/services/pool/types.rs @@ -4,6 +4,7 @@ use std::hash::{Hash, Hasher}; use errors::prelude::*; use utils::crypto::verkey_builder::build_full_verkey; +use api::CommandHandle; #[derive(Serialize, Deserialize, Debug, Eq, PartialEq)] pub struct NodeData { @@ -531,7 +532,7 @@ pub struct CommandProcess { pub nack_cnt: usize, pub replies: HashMap, pub accum_replies: Option, - pub parent_cmd_ids: Vec, + pub parent_cmd_ids: Vec, pub resendable_request: Option, pub full_cmd_timeout: Option, } diff --git a/libindy/tests/anoncreds.rs b/libindy/tests/anoncreds.rs index 5f56ada40e..2a95716ce4 100644 --- a/libindy/tests/anoncreds.rs +++ b/libindy/tests/anoncreds.rs @@ -23,6 +23,7 @@ extern crate rmp_serde; extern crate rust_base58; extern crate time; extern crate serde; +extern crate indy_sys; #[macro_use] mod utils; @@ -60,6 +61,7 @@ mod high_cases { mod issuer_create_and_store_credential_def { use super::*; + use indy_sys::INVALID_WALLET_HANDLE; #[test] fn issuer_create_and_store_credential_def_works() { @@ -72,8 +74,7 @@ mod high_cases { let wallet_handle = wallet::open_wallet(ANONCREDS_WALLET_CONFIG, WALLET_CREDENTIALS).unwrap(); - let invalid_wallet_handle = wallet_handle + 100; - let res = anoncreds::issuer_create_credential_definition(invalid_wallet_handle, + let res = anoncreds::issuer_create_credential_definition(INVALID_WALLET_HANDLE, ISSUER_DID, &anoncreds::gvt_schema_json(), TAG_1, diff --git a/libindy/tests/demo.rs b/libindy/tests/demo.rs index 0b2f93605a..f9a65c26c1 100644 --- a/libindy/tests/demo.rs +++ b/libindy/tests/demo.rs @@ -24,6 +24,7 @@ extern crate rmp_serde; extern crate rust_base58; extern crate time; extern crate serde; +extern crate indy; #[macro_use] mod utils; diff --git a/libindy/tests/interaction.rs b/libindy/tests/interaction.rs index e5f582e38b..7703ad3ade 100644 --- a/libindy/tests/interaction.rs +++ b/libindy/tests/interaction.rs @@ -24,6 +24,7 @@ extern crate rust_base58; extern crate time; extern crate serde; extern crate core; +extern crate indy; #[macro_use] mod utils; diff --git a/libindy/tests/ledger.rs b/libindy/tests/ledger.rs index ceef5e617d..6945e2a8b8 100644 --- a/libindy/tests/ledger.rs +++ b/libindy/tests/ledger.rs @@ -27,6 +27,7 @@ extern crate time; extern crate serde; extern crate sodiumoxide; extern crate rand; +extern crate indy; #[macro_use] mod utils; diff --git a/libindy/tests/logger.rs b/libindy/tests/logger.rs index c93ce3a1e1..997b7dff71 100644 --- a/libindy/tests/logger.rs +++ b/libindy/tests/logger.rs @@ -24,6 +24,7 @@ extern crate rust_base58; extern crate time; extern crate serde; extern crate log; +extern crate indy; #[macro_use] mod utils; diff --git a/libindy/tests/utils/cache.rs b/libindy/tests/utils/cache.rs index 6b33b6d3eb..013f8f5ff7 100644 --- a/libindy/tests/utils/cache.rs +++ b/libindy/tests/utils/cache.rs @@ -6,18 +6,18 @@ use self::futures::Future; use indy::cache; -pub fn get_schema_cache(pool_handle: i32, wallet_handle: i32, submitter_did: &str, id: &str, options_json: &str) -> Result { +pub fn get_schema_cache(pool_handle: PoolHandle, wallet_handle: i32, submitter_did: &str, id: &str, options_json: &str) -> Result { cache::get_schema(pool_handle, wallet_handle, submitter_did, id, options_json).wait() } -pub fn get_cred_def_cache(pool_handle: i32, wallet_handle: i32, submitter_did: &str, id: &str, options_json: &str) -> Result { +pub fn get_cred_def_cache(pool_handle: PoolHandle, wallet_handle: i32, submitter_did: &str, id: &str, options_json: &str) -> Result { cache::get_cred_def(pool_handle, wallet_handle, submitter_did, id, options_json).wait() } -pub fn purge_schema_cache(wallet_handle: i32, options_json: &str) -> Result<(), IndyError> { +pub fn purge_schema_cache(wallet_handle: PoolHandle, options_json: &str) -> Result<(), IndyError> { cache::purge_schema_cache(wallet_handle, options_json).wait() } -pub fn purge_cred_def_cache(wallet_handle: i32, options_json: &str) -> Result<(), IndyError> { +pub fn purge_cred_def_cache(wallet_handle: PoolHandle, options_json: &str) -> Result<(), IndyError> { cache::purge_cred_def_cache(wallet_handle, options_json).wait() } \ No newline at end of file diff --git a/libindy/tests/utils/did.rs b/libindy/tests/utils/did.rs index c8d22fc6bb..db163066bb 100644 --- a/libindy/tests/utils/did.rs +++ b/libindy/tests/utils/did.rs @@ -6,9 +6,10 @@ use self::futures::Future; use utils::{ledger, pool}; use utils::types::ResponseType; +use indy::api::PoolHandle; -pub fn create_store_and_publish_my_did_from_trustee(wallet_handle: i32, pool_handle: i32) -> Result<(String, String), IndyError> { +pub fn create_store_and_publish_my_did_from_trustee(wallet_handle: i32, pool_handle: PoolHandle) -> Result<(String, String), IndyError> { let (trustee_did, _) = create_and_store_my_did(wallet_handle, Some(::utils::constants::TRUSTEE_SEED))?; let (my_did, my_vk) = create_and_store_my_did(wallet_handle, None)?; let nym = ledger::build_nym_request(&trustee_did, &my_did, Some(&my_vk), None, Some("TRUSTEE"))?; @@ -17,7 +18,7 @@ pub fn create_store_and_publish_my_did_from_trustee(wallet_handle: i32, pool_han Ok((my_did, my_vk)) } -pub fn create_store_and_publish_my_did_from_steward(wallet_handle: i32, pool_handle: i32) -> Result<(String, String), IndyError> { +pub fn create_store_and_publish_my_did_from_steward(wallet_handle: i32, pool_handle: PoolHandle) -> Result<(String, String), IndyError> { let (trustee_did, _) = create_and_store_my_did(wallet_handle, Some(::utils::constants::TRUSTEE_SEED))?; let (my_did, my_vk) = create_and_store_my_did(wallet_handle, None)?; let nym = ledger::build_nym_request(&trustee_did, &my_did, Some(&my_vk), None, Some("STEWARD"))?; @@ -52,7 +53,7 @@ pub fn replace_keys_apply(wallet_handle: i32, did: &str) -> Result<(), IndyError did::replace_keys_apply(wallet_handle, did).wait() } -pub fn replace_keys(pool_handle: i32, wallet_handle: i32, did: &str) -> Result { +pub fn replace_keys(pool_handle: PoolHandle, wallet_handle: i32, did: &str) -> Result { let verkey = did::replace_keys_start(wallet_handle, did, "{}").wait().unwrap(); let nym_request = ledger::build_nym_request(did, did, Some(&verkey), None, None).unwrap(); @@ -63,11 +64,11 @@ pub fn replace_keys(pool_handle: i32, wallet_handle: i32, did: &str) -> Result Result { +pub fn key_for_did(pool_handle: PoolHandle, wallet_handle: i32, did: &str) -> Result { did::key_for_did(pool_handle, wallet_handle, did).wait() } -pub fn key_for_local_did(wallet_handle: i32, did: &str) -> Result { +pub fn key_for_local_did(wallet_handle: PoolHandle, did: &str) -> Result { did::key_for_local_did(wallet_handle, did).wait() } @@ -75,7 +76,7 @@ pub fn set_endpoint_for_did(wallet_handle: i32, did: &str, address: &str, transp did::set_endpoint_for_did(wallet_handle, did, address, transport_key).wait() } -pub fn get_endpoint_for_did(wallet_handle: i32, pool_handle: i32, did: &str) -> Result<(String, Option), IndyError> { +pub fn get_endpoint_for_did(wallet_handle: i32, pool_handle: PoolHandle, did: &str) -> Result<(String, Option), IndyError> { did::get_endpoint_for_did(wallet_handle, pool_handle, did).wait() } diff --git a/libindy/tests/utils/ledger.rs b/libindy/tests/utils/ledger.rs index 3327a707d8..a2c74ae6da 100644 --- a/libindy/tests/utils/ledger.rs +++ b/libindy/tests/utils/ledger.rs @@ -20,21 +20,21 @@ pub const SCHEMA_DATA: &'static str = r#"{"id":"id","name":"gvt","version":"1.0" const SUBMIT_RETRY_CNT: usize = 3; -pub fn sign_and_submit_request(pool_handle: i32, wallet_handle: i32, submitter_did: &str, request_json: &str) -> Result { +pub fn sign_and_submit_request(pool_handle: PoolHandle, wallet_handle: i32, submitter_did: &str, request_json: &str) -> Result { ledger::sign_and_submit_request(pool_handle, wallet_handle, submitter_did, request_json).wait() } -pub fn submit_request_with_retries(pool_handle: i32, request_json: &str, previous_response: &str) -> Result { +pub fn submit_request_with_retries(pool_handle: PoolHandle, request_json: &str, previous_response: &str) -> Result { _submit_retry(extract_seq_no_from_reply(previous_response).unwrap(), || { submit_request(pool_handle, request_json) }) } -pub fn submit_request(pool_handle: i32, request_json: &str) -> Result { +pub fn submit_request(pool_handle: PoolHandle, request_json: &str) -> Result { ledger::submit_request(pool_handle, request_json).wait() } -pub fn submit_action(pool_handle: i32, request_json: &str, nodes: Option<&str>, timeout: Option) -> Result { +pub fn submit_action(pool_handle: PoolHandle, request_json: &str, nodes: Option<&str>, timeout: Option) -> Result { ledger::submit_action(pool_handle, request_json, nodes, timeout).wait() } diff --git a/libindy/tests/utils/mod.rs b/libindy/tests/utils/mod.rs index a8bd631508..98dc919626 100644 --- a/libindy/tests/utils/mod.rs +++ b/libindy/tests/utils/mod.rs @@ -85,7 +85,7 @@ pub fn setup_with_pool(name: &str) -> i32 { pool::create_and_open_pool_ledger(name).unwrap() } -pub fn tear_down_with_pool(pool_handle: i32, name: &str) { +pub fn tear_down_with_pool(pool_handle: PoolHandle, name: &str) { pool::close(pool_handle).unwrap(); tear_down(name); } @@ -96,7 +96,7 @@ pub fn setup_with_wallet_and_pool(name: &str) -> (i32, i32, String) { (wallet_handle, pool_handle, config) } -pub fn tear_down_with_wallet_and_pool(wallet_handle: i32, pool_handle: i32, name: &str, wallet_config: &str) { +pub fn tear_down_with_wallet_and_pool(wallet_handle: i32, pool_handle: PoolHandle, name: &str, wallet_config: &str) { pool::close(pool_handle).unwrap(); tear_down_with_wallet(wallet_handle, name, wallet_config); } diff --git a/libindy/tests/utils/payments.rs b/libindy/tests/utils/payments.rs index cd60b06626..b52face379 100644 --- a/libindy/tests/utils/payments.rs +++ b/libindy/tests/utils/payments.rs @@ -22,7 +22,7 @@ macro_rules! mocked_handler { static ref INJECTIONS: Mutex> = Default::default(); } - pub extern fn handle(cmd_handle: i32, + pub extern fn handle(cmd_handle: CommandHandle, $first_param_name: $first_param_type, $($param_name: $param_type,)* cb: Option) -> i32 { diff --git a/libindy/tests/utils/pool.rs b/libindy/tests/utils/pool.rs index 4095b1dccd..96fff2e3ea 100644 --- a/libindy/tests/utils/pool.rs +++ b/libindy/tests/utils/pool.rs @@ -17,6 +17,7 @@ use time; use utils::types::{Response, ResponseType}; use utils::constants::PROTOCOL_VERSION; use utils::{environment, test}; +use indy::api::PoolHandle; #[derive(Serialize, Deserialize)] struct PoolConfig { @@ -116,7 +117,7 @@ pub fn create_pool_ledger_config(pool_name: &str, pool_config: Option<&str>) -> } #[cfg(feature = "local_nodes_pool")] -pub fn open_pool_ledger(pool_name: &str, config: Option<&str>) -> Result { +pub fn open_pool_ledger(pool_name: &str, config: Option<&str>) -> Result { pool::open_pool_ledger(pool_name, config).wait() } @@ -164,7 +165,7 @@ fn _dump_genesis_txns_to_cache(pool_name: &str, node_txns: &Vec) -> Resu Ok(()) } -pub fn create_and_open_pool_ledger(pool_name: &str) -> Result { +pub fn create_and_open_pool_ledger(pool_name: &str) -> Result { set_protocol_version(PROTOCOL_VERSION).unwrap(); let txn_file_path = create_genesis_txn_file_for_test_pool(pool_name, None, None); let pool_config = pool_config_json(txn_file_path.as_path()); @@ -172,11 +173,11 @@ pub fn create_and_open_pool_ledger(pool_name: &str) -> Result { open_pool_ledger(pool_name, None) } -pub fn refresh(pool_handle: i32) -> Result<(), IndyError> { +pub fn refresh(pool_handle: PoolHandle) -> Result<(), IndyError> { pool::refresh_pool_ledger(pool_handle).wait() } -pub fn close(pool_handle: i32) -> Result<(), IndyError> { +pub fn close(pool_handle: PoolHandle) -> Result<(), IndyError> { pool::close_pool_ledger(pool_handle).wait() } diff --git a/libindy/tests/utils/wallet.rs b/libindy/tests/utils/wallet.rs index b56126fe34..02ab9da6a2 100644 --- a/libindy/tests/utils/wallet.rs +++ b/libindy/tests/utils/wallet.rs @@ -18,6 +18,7 @@ use super::libc::c_char; use utils::constants::{TYPE, INMEM_TYPE, WALLET_CREDENTIALS}; use std::path::{Path, PathBuf}; +use indy::api::{WalletHandle, CommandHandle}; pub fn register_wallet_storage(xtype: &str, force_create: bool) -> Result<(), ErrorCode> { lazy_static! { @@ -76,11 +77,11 @@ pub fn create_wallet(config: &str, credentials: &str) -> Result<(), IndyError> { wallet::create_wallet(config, credentials).wait() } -pub fn open_wallet(config: &str, credentials: &str) -> Result { +pub fn open_wallet(config: &str, credentials: &str) -> Result { wallet::open_wallet(config, credentials).wait() } -pub fn create_and_open_wallet(storage_type: Option<&str>) -> Result<(i32, String), IndyError> { +pub fn create_and_open_wallet(storage_type: Option<&str>) -> Result<(WalletHandle, String), IndyError> { let config = json!({ "id": format!("default-wallet_id-{}", sequence::get_next_id()), "storage_type": storage_type.unwrap_or(TYPE) @@ -91,7 +92,7 @@ pub fn create_and_open_wallet(storage_type: Option<&str>) -> Result<(i32, String Ok((wallet_handle, config)) } -pub fn create_and_open_default_wallet(wallet_name: &str) -> Result<(i32, String), IndyError> { +pub fn create_and_open_default_wallet(wallet_name: &str) -> Result<(WalletHandle, String), IndyError> { let config = json!({ "id": format!("default-wallet_id-{}-{}", wallet_name, sequence::get_next_id()), "storage_type": TYPE @@ -102,7 +103,7 @@ pub fn create_and_open_default_wallet(wallet_name: &str) -> Result<(i32, String) Ok((wallet_handle, config)) } -pub fn create_and_open_plugged_wallet() -> Result<(i32, String), IndyError> { +pub fn create_and_open_plugged_wallet() -> Result<(WalletHandle, String), IndyError> { let config = json!({ "id": format!("default-wallet_id-{}", sequence::get_next_id()), "storage_type": INMEM_TYPE @@ -118,16 +119,16 @@ pub fn delete_wallet(config: &str, credentials: &str) -> Result<(), IndyError> { wallet::delete_wallet(config, credentials).wait() } -pub fn close_wallet(wallet_handle: i32) -> Result<(), IndyError> { +pub fn close_wallet(wallet_handle: WalletHandle) -> Result<(), IndyError> { wallet::close_wallet(wallet_handle).wait() } -pub fn close_and_delete_wallet(wallet_handle: i32, wallet_config: &str) -> Result<(), IndyError> { +pub fn close_and_delete_wallet(wallet_handle: WalletHandle, wallet_config: &str) -> Result<(), IndyError> { close_wallet(wallet_handle)?; delete_wallet(wallet_config, WALLET_CREDENTIALS) } -pub fn export_wallet(wallet_handle: i32, export_config_json: &str) -> Result<(), IndyError> { +pub fn export_wallet(wallet_handle: WalletHandle, export_config_json: &str) -> Result<(), IndyError> { wallet::export_wallet(wallet_handle, export_config_json).wait() } @@ -153,7 +154,7 @@ pub fn generate_wallet_key(config: Option<&str>) -> Result { extern { #[no_mangle] - pub fn indy_register_wallet_storage(command_handle: i32, + pub fn indy_register_wallet_storage(command_handle: CommandHandle, type_: *const c_char, create: Option, open: Option, From 22e9c5db81bdf3b0c3a2dcef5fd9c3682998b6b3 Mon Sep 17 00:00:00 2001 From: Axel Nennker Date: Fri, 26 Jul 2019 11:06:11 +0200 Subject: [PATCH 024/320] PoolHandle to i32 Signed-off-by: Axel Nennker --- libindy/src/services/pool/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libindy/src/services/pool/mod.rs b/libindy/src/services/pool/mod.rs index 8267f97661..438f4b5fbe 100644 --- a/libindy/src/services/pool/mod.rs +++ b/libindy/src/services/pool/mod.rs @@ -237,7 +237,7 @@ impl PoolService { fn _send_msg(&self, cmd_id: CommandHandle, msg: &str, socket: &Socket, nodes: Option<&str>, timeout: Option) -> IndyResult<()> { let mut buf = [0u8; 4]; let mut buf_to = [0u8; 4]; - LittleEndian::write_i32(&mut buf, cmd_id); + LittleEndian::write_i32(&mut buf, cmd_id.0); let timeout = timeout.unwrap_or(-1); LittleEndian::write_i32(&mut buf_to, timeout); if let Some(nodes) = nodes { From 880ef30e5e8ba38c4dd40fb6e396b992f56804fc Mon Sep 17 00:00:00 2001 From: Axel Nennker Date: Fri, 26 Jul 2019 11:07:01 +0200 Subject: [PATCH 025/320] more specific variable names Signed-off-by: Axel Nennker --- libindy/src/commands/pool.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/libindy/src/commands/pool.rs b/libindy/src/commands/pool.rs index c0d6d074f0..5894270d92 100644 --- a/libindy/src/commands/pool.rs +++ b/libindy/src/commands/pool.rs @@ -185,19 +185,19 @@ impl PoolCommandExecutor { Ok(res) } - fn close(&self, handle: PoolHandle, cb: Box) + Send>) { - debug!("close >>> handle: {:?}", handle); + fn close(&self, pool_handle: PoolHandle, cb: Box) + Send>) { + debug!("close >>> handle: {:?}", pool_handle); - let result = self.pool_service.close(handle) - .and_then(|handle| { + let result = self.pool_service.close(pool_handle) + .and_then(|cmd_id| { match self.close_callbacks.try_borrow_mut() { - Ok(cbs) => Ok((cbs, handle)), + Ok(cbs) => Ok((cbs, cmd_id)), Err(err) => Err(err.into()) } }); match result { Err(err) => { cb(Err(err)); } - Ok((mut cbs, handle)) => { cbs.insert(handle, cb); /* TODO check if map contains same key */ } + Ok((mut cbs, cmd_id)) => { cbs.insert(cmd_id, cb); /* TODO check if map contains same key */ } }; debug!("close <<<"); From 2febb95ff82b664c5355edf808f643cd65767470 Mon Sep 17 00:00:00 2001 From: Axel Nennker Date: Fri, 26 Jul 2019 13:45:59 +0200 Subject: [PATCH 026/320] fixed compiler errors Signed-off-by: Axel Nennker --- libindy/src/api/mod.rs | 28 +++--- libindy/src/commands/anoncreds/issuer.rs | 4 +- libindy/src/commands/cache.rs | 6 +- libindy/src/commands/did.rs | 6 +- libindy/src/commands/ledger.rs | 6 +- libindy/src/commands/payments.rs | 4 +- libindy/src/services/mod.rs | 2 +- libindy/src/services/pool/commander.rs | 33 +++---- libindy/src/services/pool/mod.rs | 51 ++++++---- libindy/src/services/pool/pool.rs | 119 ++++++++++++----------- libindy/src/services/wallet/mod.rs | 12 ++- libindy/tests/demo.rs | 1 - libindy/tests/interaction.rs | 1 - libindy/tests/ledger.rs | 1 - libindy/tests/logger.rs | 1 - libindy/tests/utils/cache.rs | 8 +- libindy/tests/utils/did.rs | 2 +- libindy/tests/utils/ledger.rs | 8 +- libindy/tests/utils/mod.rs | 4 +- libindy/tests/utils/payments.rs | 2 +- libindy/tests/utils/pool.rs | 2 +- libindy/tests/utils/wallet.rs | 2 +- 22 files changed, 162 insertions(+), 141 deletions(-) diff --git a/libindy/src/api/mod.rs b/libindy/src/api/mod.rs index 59587ac080..f66b13f245 100644 --- a/libindy/src/api/mod.rs +++ b/libindy/src/api/mod.rs @@ -16,7 +16,7 @@ use libc::c_char; use domain::IndyConfig; use errors::prelude::*; -use utils::ctypes; +use utils::{ctypes, sequence}; pub type IndyHandle = i32; @@ -27,17 +27,23 @@ pub struct WalletHandle(pub i32); pub const INVALID_WALLET_HANDLE : WalletHandle = WalletHandle(0); pub type CallbackHandle = i32; -//pub type PoolHandle = i32; -#[repr(transparent)] -#[derive(Debug, Hash, PartialEq, Eq, Copy, Clone)] -pub struct PoolHandle(pub i32); -pub const INVALID_POOL_HANDLE : PoolHandle = PoolHandle(0); -//pub type CommandHandle = i32; -#[repr(transparent)] -#[derive(Debug, Hash, PartialEq, Eq, Copy, Clone)] -pub struct CommandHandle(pub i32); -pub const INVALID_COMMAND_HANDLE : CommandHandle = CommandHandle(0); +pub type PoolHandle = i32; +pub const INVALID_POOL_HANDLE : PoolHandle = 0; +//#[repr(transparent)] +//#[derive(Debug, Hash, PartialEq, Eq, Copy, Clone)] +//pub struct PoolHandle(pub i32); +//pub const INVALID_POOL_HANDLE : PoolHandle = PoolHandle(0); + +pub type CommandHandle = i32; +pub const INVALID_COMMAND_HANDLE : CommandHandle = 0; +pub (crate) fn next_command_handle() -> CommandHandle { + sequence::get_next_id() +} +//#[repr(transparent)] +//#[derive(Debug, Hash, PartialEq, Eq, Copy, Clone)] +//pub struct CommandHandle(pub i32); +//pub const INVALID_COMMAND_HANDLE : CommandHandle = CommandHandle(0); pub type StorageHandle = i32; pub type SearchHandle = i32; diff --git a/libindy/src/commands/anoncreds/issuer.rs b/libindy/src/commands/anoncreds/issuer.rs index 0a0b928653..065f427234 100644 --- a/libindy/src/commands/anoncreds/issuer.rs +++ b/libindy/src/commands/anoncreds/issuer.rs @@ -52,7 +52,7 @@ use services::pool::PoolService; use services::wallet::{RecordOptions, WalletService}; use super::tails::{SDKTailsAccessor, store_tails_from_generator}; -use api::{WalletHandle, CommandHandle}; +use api::{WalletHandle, CommandHandle, next_command_handle}; pub enum IssuerCommand { CreateSchema( @@ -248,7 +248,7 @@ impl IssuerCommandExecutor { let (cred_def_config, schema_id, cred_def_id, signature_type) = try_cb!(self._prepare_create_and_store_credential_definition(wallet_handle, issuer_did, schema, tag, type_, config), cb); - let cb_id = CommandHandle(::utils::sequence::get_next_id()); + let cb_id = next_command_handle(); self.pending_callbacks.borrow_mut().insert(cb_id, cb); let tag = tag.to_string(); diff --git a/libindy/src/commands/cache.rs b/libindy/src/commands/cache.rs index a83c768508..f1477bad8f 100644 --- a/libindy/src/commands/cache.rs +++ b/libindy/src/commands/cache.rs @@ -10,6 +10,8 @@ use api::{WalletHandle, PoolHandle, CommandHandle}; use commands::{Command, CommandExecutor}; use commands::ledger::LedgerCommand; +use api::next_command_handle; + const CRED_DEF_CACHE: &str = "cred_def_cache"; const SCHEMA_CACHE: &str = "schema_cache"; @@ -136,7 +138,7 @@ impl CacheCommandExecutor { return cb(Err(IndyError::from(IndyErrorKind::LedgerItemNotFound))); } - let cb_id = CommandHandle(::utils::sequence::get_next_id()); + let cb_id = next_command_handle(); self.pending_callbacks.borrow_mut().insert(cb_id, cb); CommandExecutor::instance().send( @@ -231,7 +233,7 @@ impl CacheCommandExecutor { return cb(Err(IndyError::from(IndyErrorKind::LedgerItemNotFound))); } - let cb_id = CommandHandle(::utils::sequence::get_next_id()); + let cb_id = next_command_handle(); self.pending_callbacks.borrow_mut().insert(cb_id, cb); CommandExecutor::instance().send( diff --git a/libindy/src/commands/did.rs b/libindy/src/commands/did.rs index 6d1c3812f4..a3f93aa4d2 100644 --- a/libindy/src/commands/did.rs +++ b/libindy/src/commands/did.rs @@ -16,8 +16,8 @@ use errors::prelude::*; use services::crypto::CryptoService; use services::ledger::LedgerService; use services::wallet::{RecordOptions, SearchOptions, WalletService}; -use utils::sequence; -use api::{WalletHandle, PoolHandle, CommandHandle}; +use utils::crypto::base58; +use api::{WalletHandle, PoolHandle, CommandHandle, next_command_handle}; pub enum DidCommand { CreateAndStoreMyDid( @@ -558,7 +558,7 @@ impl DidCommandExecutor { } fn _defer_command(&self, cmd: DidCommand) -> CommandHandle { - let deferred_cmd_id = CommandHandle(sequence::get_next_id()); + let deferred_cmd_id = next_command_handle(); self.deferred_commands.borrow_mut().insert(deferred_cmd_id, cmd); deferred_cmd_id } diff --git a/libindy/src/commands/ledger.rs b/libindy/src/commands/ledger.rs index 6ab1e93e29..e5a698c94a 100644 --- a/libindy/src/commands/ledger.rs +++ b/libindy/src/commands/ledger.rs @@ -25,7 +25,7 @@ use services::pool::{ }; use services::wallet::{RecordOptions, WalletService}; use utils::crypto::signature_serializer::serialize_signature; -use api::{WalletHandle, PoolHandle, CommandHandle}; +use api::{WalletHandle, PoolHandle, CommandHandle, next_command_handle}; use commands::{Command, CommandExecutor}; use rust_base58::ToBase58; @@ -1177,7 +1177,7 @@ impl LedgerCommandExecutor { let request_json = try_cb!(self.build_get_schema_request(submitter_did, id), cb); - let cb_id = CommandHandle(::utils::sequence::get_next_id()); + let cb_id = next_command_handle(); self.pending_callbacks.borrow_mut().insert(cb_id, cb); self.submit_request(pool_handle, &request_json, Box::new(move |response| { @@ -1202,7 +1202,7 @@ impl LedgerCommandExecutor { let request_json = try_cb!(self.build_get_cred_def_request(submitter_did, id), cb); - let cb_id = CommandHandle(::utils::sequence::get_next_id()); + let cb_id = next_command_handle(); self.pending_callbacks.borrow_mut().insert(cb_id, cb); self.submit_request(pool_handle, &request_json, Box::new(move |response| { diff --git a/libindy/src/commands/payments.rs b/libindy/src/commands/payments.rs index 5cf6759b53..2ec4ebf00b 100644 --- a/libindy/src/commands/payments.rs +++ b/libindy/src/commands/payments.rs @@ -14,6 +14,8 @@ use services::wallet::{RecordOptions, WalletService}; use api::{WalletHandle, CommandHandle}; use domain::ledger::auth_rule::AuthRule; +use api::next_command_handle; + pub enum PaymentsCommand { RegisterMethod( String, //type @@ -685,7 +687,7 @@ impl PaymentsCommandExecutor { fn _process_method(&self, cb: Box) + Send>, method: &Fn(CommandHandle) -> IndyResult<()>) { - let cmd_handle = CommandHandle(::utils::sequence::get_next_id()); + let cmd_handle = next_command_handle(); match method(cmd_handle) { Ok(()) => { self.pending_callbacks.borrow_mut().insert(cmd_handle, cb); diff --git a/libindy/src/services/mod.rs b/libindy/src/services/mod.rs index ea1ae0535f..f0a12db83b 100644 --- a/libindy/src/services/mod.rs +++ b/libindy/src/services/mod.rs @@ -4,4 +4,4 @@ pub mod crypto; pub mod ledger; pub mod payments; pub mod pool; -pub mod wallet; +pub mod wallet; \ No newline at end of file diff --git a/libindy/src/services/pool/commander.rs b/libindy/src/services/pool/commander.rs index 502eb92c5e..5635ff2ec1 100644 --- a/libindy/src/services/pool/commander.rs +++ b/libindy/src/services/pool/commander.rs @@ -4,7 +4,8 @@ use services::pool::events::PoolEvent; use super::zmq; use byteorder::{ByteOrder, LittleEndian}; -use api::{CommandHandle, INVALID_COMMAND_HANDLE}; +use api::INVALID_COMMAND_HANDLE; +use services::pool::{COMMAND_CONNECT, COMMAND_EXIT, COMMAND_REFRESH}; pub struct Commander { cmd_socket: zmq::Socket, @@ -29,14 +30,14 @@ impl Commander { .to_indy(IndyErrorKind::InvalidState, "Invalid utf8 sequence in command") // FIXME: review kind .map_err(map_err_trace!()).ok()?; - let id = cmd_parts.get(1).map(|cmd: &Vec| CommandHandle(LittleEndian::read_i32(cmd.as_slice()))) + let id = cmd_parts.get(1).map(|cmd: &Vec| LittleEndian::read_i32(cmd.as_slice())) .unwrap_or(INVALID_COMMAND_HANDLE); - if "exit".eq(cmd_s.as_str()) { + if COMMAND_EXIT.eq(cmd_s.as_str()) { Some(PoolEvent::Close(id)) - } else if "refresh".eq(cmd_s.as_str()) { + } else if COMMAND_REFRESH.eq(cmd_s.as_str()) { Some(PoolEvent::Refresh(id)) - } else if "connect".eq(cmd_s.as_str()) { + } else if COMMAND_CONNECT.eq(cmd_s.as_str()) { Some(PoolEvent::CheckCache(id)) } else { let timeout = LittleEndian::read_i32(cmd_parts[2].as_slice()); @@ -61,10 +62,9 @@ impl Commander { #[cfg(test)] mod commander_tests { - use utils::sequence; - use super::*; - use api::CommandHandle; + use api::{CommandHandle, next_command_handle}; + use services::pool::{COMMAND_REFRESH, COMMAND_EXIT}; #[test] pub fn commander_new_works() { @@ -108,11 +108,10 @@ mod commander_tests { let cmd = Commander::new(recv_cmd_sock); - let cmd_id: CommandHandle = CommandHandle(sequence::get_next_id()); + let cmd_id: CommandHandle = next_command_handle(); let mut buf = [0u8; 4]; LittleEndian::write_i32(&mut buf, cmd_id); - let msg = "exit"; - send_cmd_sock.send_multipart(&[msg.as_bytes(), &buf], zmq::DONTWAIT).expect("FIXME"); + send_cmd_sock.send_multipart(&[COMMAND_EXIT.as_bytes(), &buf], zmq::DONTWAIT).expect("FIXME"); assert_match!(Some(PoolEvent::Close(cmd_id_)), cmd.fetch_events(), cmd_id_, cmd_id); } @@ -122,11 +121,10 @@ mod commander_tests { let cmd = Commander::new(recv_cmd_sock); - let cmd_id: i32 = sequence::get_next_id(); + let cmd_id: CommandHandle = next_command_handle(); let mut buf = [0u8; 4]; LittleEndian::write_i32(&mut buf, cmd_id); - let msg = "refresh"; - send_cmd_sock.send_multipart(&[msg.as_bytes(), &buf], zmq::DONTWAIT).expect("FIXME"); + send_cmd_sock.send_multipart(&[COMMAND_REFRESH.as_bytes(), &buf], zmq::DONTWAIT).expect("FIXME"); assert_match!(Some(PoolEvent::Refresh(cmd_id_)), cmd.fetch_events(), cmd_id_, cmd_id); } @@ -136,11 +134,10 @@ mod commander_tests { let cmd = Commander::new(recv_cmd_sock); - let cmd_id = sequence::get_next_id(); + let cmd_id: CommandHandle = next_command_handle(); let mut buf = [0u8; 4]; LittleEndian::write_i32(&mut buf, cmd_id); - let msg = "connect"; - send_cmd_sock.send_multipart(&[msg.as_bytes(), &buf], zmq::DONTWAIT).expect("FIXME"); + send_cmd_sock.send_multipart(&[COMMAND_CONNECT.as_bytes(), &buf], zmq::DONTWAIT).expect("FIXME"); assert_match!(Some(PoolEvent::CheckCache(cmd_id_)), cmd.fetch_events(), cmd_id_, cmd_id); } @@ -150,7 +147,7 @@ mod commander_tests { let cmd = Commander::new(recv_cmd_sock); - let cmd_id = sequence::get_next_id(); + let cmd_id: CommandHandle = next_command_handle(); let mut buf = [0u8; 4]; LittleEndian::write_i32(&mut buf, cmd_id); let mut buf_to = [0u8; 4]; diff --git a/libindy/src/services/pool/mod.rs b/libindy/src/services/pool/mod.rs index 438f4b5fbe..c64652ebc1 100644 --- a/libindy/src/services/pool/mod.rs +++ b/libindy/src/services/pool/mod.rs @@ -30,7 +30,7 @@ use errors::*; use services::pool::pool::{Pool, ZMQPool}; use utils::environment; use utils::sequence; -use api::{PoolHandle, CommandHandle}; +use api::{PoolHandle, CommandHandle, next_command_handle}; mod catchup; mod commander; @@ -42,10 +42,21 @@ mod request_handler; mod state_proof; mod types; +const COMMAND_CONNECT: &str = "connect"; +const COMMAND_EXIT: &str = "exit"; +const COMMAND_REFRESH: &str = "refresh"; + lazy_static! { static ref REGISTERED_SP_PARSERS: Mutex> = Mutex::new(HashMap::new()); } +fn next_pool_handle() -> PoolHandle { + PoolHandle(sequence::get_next_id()) +} +//fn next_pool_handle() -> PoolHandle { +// sequence::get_next_id() +//} + pub struct PoolService { open_pools: RefCell>, pending_pools: RefCell>, @@ -149,7 +160,7 @@ impl PoolService { let config = config.unwrap_or(PoolOpenConfig::default()); - let pool_handle: PoolHandle = PoolHandle(sequence::get_next_id()); + let pool_handle: PoolHandle = next_pool_handle(); let mut new_pool = Pool::new(name, pool_handle, config); let zmq_ctx = zmq::Context::new(); @@ -162,7 +173,7 @@ impl PoolService { send_cmd_sock.connect(inproc_sock_name.as_str())?; new_pool.work(recv_cmd_sock); - self._send_msg(pool_handle, "connect", &send_cmd_sock, None, None)?; + self._send_msg(pool_handle, COMMAND_CONNECT, &send_cmd_sock, None, None)?; self.pending_pools.try_borrow_mut()? .insert(new_pool.get_id(), ZMQPool::new(new_pool, send_cmd_sock)); @@ -188,7 +199,7 @@ impl PoolService { let pools = self.open_pools.try_borrow()?; if let Some(ref pool) = pools.get(&handle) { - let cmd_id: CommandHandle = CommandHandle(sequence::get_next_id()); + let cmd_id: CommandHandle = next_command_handle(); self._send_msg(cmd_id, msg, &pool.cmd_socket, nodes, timeout)?; Ok(cmd_id) } else { @@ -218,12 +229,12 @@ impl PoolService { } pub fn close(&self, handle: PoolHandle) -> IndyResult { - let cmd_id: CommandHandle = CommandHandle(sequence::get_next_id()); + let cmd_id: CommandHandle = next_command_handle(); let mut pools = self.open_pools.try_borrow_mut()?; match pools.remove(&handle) { - Some(ref pool) => self._send_msg(cmd_id, "exit", &pool.cmd_socket, None, None)?, + Some(ref pool) => self._send_msg(cmd_id, COMMAND_EXIT, &pool.cmd_socket, None, None)?, None => return Err(err_msg(IndyErrorKind::InvalidPoolHandle, format!("No pool with requested handle {:?}", handle))) } @@ -231,13 +242,13 @@ impl PoolService { } pub fn refresh(&self, handle: PoolHandle) -> IndyResult { - self.send_action(handle, "refresh", None, None) + self.send_action(handle, COMMAND_REFRESH, None, None) } fn _send_msg(&self, cmd_id: CommandHandle, msg: &str, socket: &Socket, nodes: Option<&str>, timeout: Option) -> IndyResult<()> { let mut buf = [0u8; 4]; let mut buf_to = [0u8; 4]; - LittleEndian::write_i32(&mut buf, cmd_id.0); + LittleEndian::write_i32(&mut buf, cmd_id); let timeout = timeout.unwrap_or(-1); LittleEndian::write_i32(&mut buf_to, timeout); if let Some(nodes) = nodes { @@ -374,7 +385,7 @@ mod tests { test::cleanup_storage("pool_service_close_works"); let ps = PoolService::new(); - let pool_id = PoolHandle(sequence::get_next_id()); + let pool_id = next_pool_handle(); let ctx = zmq::Context::new(); let send_soc = ctx.socket(zmq::SocketType::PAIR).unwrap(); let recv_soc = ctx.socket(zmq::SocketType::PAIR).unwrap(); @@ -384,7 +395,7 @@ mod tests { let cmd_id = ps.close(pool_id).unwrap(); let recv = recv_soc.recv_multipart(zmq::DONTWAIT).unwrap(); assert_eq!(recv.len(), 3); - assert_eq!("exit", String::from_utf8(recv[0].clone()).unwrap()); + assert_eq!(COMMAND_EXIT, String::from_utf8(recv[0].clone()).unwrap()); assert_eq!(cmd_id, LittleEndian::read_i32(recv[1].as_slice())); } @@ -393,7 +404,7 @@ mod tests { test::cleanup_storage("pool_service_refresh_works"); let ps = PoolService::new(); - let pool_id = PoolHandle(sequence::get_next_id()); + let pool_id = next_pool_handle(); let ctx = zmq::Context::new(); let send_soc = ctx.socket(zmq::SocketType::PAIR).unwrap(); let recv_soc = ctx.socket(zmq::SocketType::PAIR).unwrap(); @@ -403,8 +414,8 @@ mod tests { let cmd_id = ps.refresh(pool_id).unwrap(); let recv = recv_soc.recv_multipart(zmq::DONTWAIT).unwrap(); assert_eq!(recv.len(), 3); - assert_eq!("refresh", String::from_utf8(recv[0].clone()).unwrap()); - assert_eq!(cmd_id, CommandHandle(LittleEndian::read_i32(recv[1].as_slice()))); + assert_eq!(COMMAND_REFRESH, String::from_utf8(recv[0].clone()).unwrap()); + assert_eq!(cmd_id, LittleEndian::read_i32(recv[1].as_slice())); } #[test] @@ -432,7 +443,7 @@ mod tests { let ps = PoolService::new(); let pool_name = "pool_service_delete_works_for_opened"; let path: path::PathBuf = environment::pool_path(pool_name); - let pool_id = PoolHandle(sequence::get_next_id()); + let pool_id = next_pool_handle(); let inproc_sock_name: String = format!("inproc://pool_{}", pool_name); recv_cmd_sock.bind(inproc_sock_name.as_str()).unwrap(); @@ -461,7 +472,7 @@ mod tests { let inproc_sock_name: String = format!("inproc://pool_{}", name); recv_cmd_sock.bind(inproc_sock_name.as_str()).unwrap(); send_cmd_sock.connect(inproc_sock_name.as_str()).unwrap(); - let pool_id = PoolHandle(sequence::get_next_id()); + let pool_id = next_pool_handle(); let pool = Pool::new(name, pool_id, PoolOpenConfig::default()); let ps = PoolService::new(); ps.open_pools.borrow_mut().insert(pool_id, ZMQPool::new(pool, send_cmd_sock)); @@ -478,7 +489,7 @@ mod tests { let zmq_ctx = zmq::Context::new(); let send_cmd_sock = zmq_ctx.socket(zmq::SocketType::PAIR).unwrap(); - let pool_id = PoolHandle(sequence::get_next_id()); + let pool_id = next_pool_handle(); let pool = Pool::new(name, pool_id, PoolOpenConfig::default()); let ps = PoolService::new(); ps.open_pools.borrow_mut().insert(pool_id, ZMQPool::new(pool, send_cmd_sock)); @@ -505,7 +516,7 @@ mod tests { let inproc_sock_name: String = format!("inproc://pool_{}", name); recv_cmd_sock.bind(inproc_sock_name.as_str()).unwrap(); send_cmd_sock.connect(inproc_sock_name.as_str()).unwrap(); - let pool_id = PoolHandle(sequence::get_next_id()); + let pool_id = next_pool_handle(); let pool = Pool::new(name, pool_id, PoolOpenConfig::default()); let ps = PoolService::new(); ps.open_pools.borrow_mut().insert(pool_id, ZMQPool::new(pool, send_cmd_sock)); @@ -571,10 +582,10 @@ mod tests { let ps = PoolService::new(); let zmq_ctx = zmq::Context::new(); let send_cmd_sock = zmq_ctx.socket(zmq::SocketType::PAIR).unwrap(); - let pool_id = PoolHandle(sequence::get_next_id()); + let pool_id = next_pool_handle(); let pool = Pool::new(name, pool_id, PoolOpenConfig::default()); ps.pending_pools.borrow_mut().insert(pool_id, ZMQPool::new(pool, send_cmd_sock)); - assert_match!(Ok(pool_id), ps.add_open_pool(pool_id)); + assert_match!(Ok(_pool_id), ps.add_open_pool(pool_id)); } #[test] @@ -615,7 +626,7 @@ mod tests { let mut file = fs::File::create(pool_path).unwrap(); file.write(&gen_txn.as_bytes()).unwrap(); - let pool_id = PoolHandle(sequence::get_next_id()); + let pool_id = next_pool_handle(); let mut pool = Pool::new(pool_name, pool_id, PoolOpenConfig::default()); pool.work(recv_cmd_sock); ps.open_pools.borrow_mut().insert(pool_id, ZMQPool::new(pool, send_cmd_sock)); diff --git a/libindy/src/services/pool/pool.rs b/libindy/src/services/pool/pool.rs index 9714f8d824..0ecf8e65ad 100644 --- a/libindy/src/services/pool/pool.rs +++ b/libindy/src/services/pool/pool.rs @@ -18,7 +18,7 @@ use errors::prelude::*; use services::ledger::merkletree::merkletree::MerkleTree; use services::pool::commander::Commander; use services::pool::events::*; -use services::pool::merkle_tree_factory; +use services::pool::{merkle_tree_factory, COMMAND_EXIT}; use services::pool::networker::{Networker, ZMQNetworker}; use services::pool::request_handler::{RequestHandler, RequestHandlerImpl}; use rust_base58::{FromBase58, ToBase58}; @@ -742,7 +742,7 @@ impl Drop for ZMQPool { fn drop(&mut self) { info!("Drop started"); - if let Err(err) = self.cmd_socket.send("exit".as_bytes(), zmq::DONTWAIT) { + if let Err(err) = self.cmd_socket.send(COMMAND_EXIT.as_bytes(), zmq::DONTWAIT) { warn!("Can't send exit command to pool worker thread (may be already finished) {}", err); } @@ -763,27 +763,30 @@ mod tests { use utils::test; use utils::test::test_pool_create_poolfile; + use api::next_command_handle; + use super::*; mod pool { use super::*; + use services::pool::next_pool_handle; #[test] pub fn pool_new_works() { - let _p: Pool = Pool::new("pool_new_works", PoolHandle(1), PoolOpenConfig::default()); + let _p: Pool = Pool::new("pool_new_works", next_pool_handle(), PoolOpenConfig::default()); } #[test] pub fn pool_get_name_works() { let name = "pool_get_name_works"; - let p: Pool = Pool::new(name, PoolHandle(1), PoolOpenConfig::default()); + let p: Pool = Pool::new(name, next_pool_handle(), PoolOpenConfig::default()); assert_eq!(name, p.get_name()); } #[test] pub fn pool_get_id_works() { let name = "pool_get_id_works"; - let id = PoolHandle(1); + let id = next_pool_handle();; let p: Pool = Pool::new(name, id, PoolOpenConfig::default()); assert_eq!(id, p.get_id()); } @@ -795,11 +798,11 @@ mod tests { use serde_json; use super::*; - use utils::sequence; + use services::pool::next_pool_handle; #[test] pub fn pool_wrapper_new_initialization_works() { - let _p: PoolSM = PoolSM::new(Rc::new(RefCell::new(MockNetworker::new(0, 0, vec![]))), "name", PoolHandle(1), 0, 0); + let _p: PoolSM = PoolSM::new(Rc::new(RefCell::new(MockNetworker::new(0, 0, vec![]))), "name", next_pool_handle(), 0, 0); } #[test] @@ -809,8 +812,8 @@ mod tests { ProtocolVersion::set(2); _write_genesis_txns("pool_wrapper_check_cache_works"); - let p: PoolSM = PoolSM::new(Rc::new(RefCell::new(MockNetworker::new(0, 0, vec![]))), "pool_wrapper_check_cache_works", PoolHandle(1), 0, 0); - let cmd_id: CommandHandle = CommandHandle(sequence::get_next_id()); + let p: PoolSM = PoolSM::new(Rc::new(RefCell::new(MockNetworker::new(0, 0, vec![]))), "pool_wrapper_check_cache_works", next_pool_handle(), 0, 0); + let cmd_id: CommandHandle = next_command_handle(); let p = p.handle_event(PoolEvent::CheckCache(cmd_id)); assert_match!(PoolState::GettingCatchupTarget(_), p.state); @@ -821,18 +824,18 @@ mod tests { pub fn pool_wrapper_check_cache_works_for_no_pool_created() { let p: PoolSM = PoolSM::new(Rc::new(RefCell::new(MockNetworker::new(0, 0, vec![]))), - "pool_wrapper_check_cache_works_for_no_pool_created", PoolHandle(1), 0, 0); - let cmd_id: CommandHandle = CommandHandle(sequence::get_next_id()); + "pool_wrapper_check_cache_works_for_no_pool_created", next_pool_handle(), 0, 0); + let cmd_id: CommandHandle = next_command_handle(); let p = p.handle_event(PoolEvent::CheckCache(cmd_id)); assert_match!(PoolState::Terminated(_), p.state); } #[test] pub fn pool_wrapper_terminated_close_works() { - let p: PoolSM = PoolSM::new(Rc::new(RefCell::new(MockNetworker::new(0, 0, vec![]))), "pool_wrapper_terminated_close_works", PoolHandle(1), 0, 0); - let cmd_id: CommandHandle = CommandHandle(sequence::get_next_id()); + let p: PoolSM = PoolSM::new(Rc::new(RefCell::new(MockNetworker::new(0, 0, vec![]))), "pool_wrapper_terminated_close_works", next_pool_handle(), 0, 0); + let cmd_id: CommandHandle = next_command_handle(); let p = p.handle_event(PoolEvent::CheckCache(cmd_id)); - let cmd_id: CommandHandle = CommandHandle(sequence::get_next_id()); + let cmd_id: CommandHandle = next_command_handle(); let p = p.handle_event(PoolEvent::Close(cmd_id)); assert_match!(PoolState::Closed(_), p.state); } @@ -840,14 +843,14 @@ mod tests { #[test] pub fn pool_wrapper_terminated_refresh_works() { test::cleanup_pool("pool_wrapper_terminated_refresh_works"); - let p: PoolSM = PoolSM::new(Rc::new(RefCell::new(MockNetworker::new(0, 0, vec![]))), "pool_wrapper_terminated_refresh_works", PoolHandle(1), 0, 0); - let cmd_id: CommandHandle = CommandHandle(sequence::get_next_id()); + let p: PoolSM = PoolSM::new(Rc::new(RefCell::new(MockNetworker::new(0, 0, vec![]))), "pool_wrapper_terminated_refresh_works", next_pool_handle(), 0, 0); + let cmd_id: CommandHandle = next_command_handle(); let p = p.handle_event(PoolEvent::CheckCache(cmd_id)); ProtocolVersion::set(2); _write_genesis_txns("pool_wrapper_terminated_refresh_works"); - let cmd_id: CommandHandle = CommandHandle(sequence::get_next_id()); + let cmd_id: CommandHandle = next_command_handle(); let p = p.handle_event(PoolEvent::Refresh(cmd_id)); assert_match!(PoolState::GettingCatchupTarget(_), p.state); test::cleanup_pool("pool_wrapper_terminated_refresh_works"); @@ -857,7 +860,7 @@ mod tests { pub fn pool_wrapper_terminated_timeout_works() { let p: PoolSM = PoolSM { pool_name: "pool_wrapper_terminated_timeout_works".to_string(), - id: PoolHandle(1), + id: next_pool_handle(), state: PoolState::Terminated(TerminatedState { networker: Rc::new(RefCell::new(MockNetworker::new(0, 0, vec![]))), }), @@ -879,8 +882,8 @@ mod tests { #[test] pub fn pool_wrapper_cloe_works_from_initialization() { - let p: PoolSM = PoolSM::new(Rc::new(RefCell::new(MockNetworker::new(0, 0, vec![]))), "pool_wrapper_cloe_works_from_initialization", PoolHandle(1), 0, 0); - let cmd_id: CommandHandle = CommandHandle(sequence::get_next_id()); + let p: PoolSM = PoolSM::new(Rc::new(RefCell::new(MockNetworker::new(0, 0, vec![]))), "pool_wrapper_cloe_works_from_initialization", next_pool_handle(), 0, 0); + let cmd_id: CommandHandle = next_command_handle(); let p = p.handle_event(PoolEvent::Close(cmd_id)); assert_match!(PoolState::Closed(_), p.state); } @@ -893,10 +896,10 @@ mod tests { _write_genesis_txns("pool_wrapper_close_works_from_getting_catchup_target"); let p: PoolSM = - PoolSM::new(Rc::new(RefCell::new(MockNetworker::new(0, 0, vec![]))), "pool_wrapper_close_works_from_getting_catchup_target", PoolHandle(1), 0, 0); - let cmd_id: CommandHandle = CommandHandle(sequence::get_next_id()); + PoolSM::new(Rc::new(RefCell::new(MockNetworker::new(0, 0, vec![]))), "pool_wrapper_close_works_from_getting_catchup_target", next_pool_handle(), 0, 0); + let cmd_id: CommandHandle = next_command_handle(); let p = p.handle_event(PoolEvent::CheckCache(cmd_id)); - let cmd_id: CommandHandle = CommandHandle(sequence::get_next_id()); + let cmd_id: CommandHandle = next_command_handle(); let p = p.handle_event(PoolEvent::Close(cmd_id)); assert_match!(PoolState::Closed(_), p.state); @@ -911,8 +914,8 @@ mod tests { _write_genesis_txns("pool_wrapper_catchup_target_not_found_works"); let p: PoolSM = - PoolSM::new(Rc::new(RefCell::new(MockNetworker::new(0, 0, vec![]))), "pool_wrapper_catchup_target_not_found_works", PoolHandle(1), 0, 0); - let cmd_id: CommandHandle = CommandHandle(sequence::get_next_id()); + PoolSM::new(Rc::new(RefCell::new(MockNetworker::new(0, 0, vec![]))), "pool_wrapper_catchup_target_not_found_works", next_pool_handle(), 0, 0); + let cmd_id: CommandHandle = next_command_handle(); let p = p.handle_event(PoolEvent::CheckCache(cmd_id)); let p = p.handle_event(PoolEvent::CatchupTargetNotFound(err_msg(IndyErrorKind::PoolTimeout, "Pool timeout"))); assert_match!(PoolState::Terminated(_), p.state); @@ -928,8 +931,8 @@ mod tests { _write_genesis_txns("pool_wrapper_getting_catchup_target_synced_works"); let p: PoolSM = - PoolSM::new(Rc::new(RefCell::new(MockNetworker::new(0, 0, vec![]))), "pool_wrapper_getting_catchup_target_synced_works", PoolHandle(1), 0, 0); - let cmd_id: CommandHandle = CommandHandle(sequence::get_next_id()); + PoolSM::new(Rc::new(RefCell::new(MockNetworker::new(0, 0, vec![]))), "pool_wrapper_getting_catchup_target_synced_works", next_pool_handle(), 0, 0); + let cmd_id: CommandHandle = next_command_handle(); let p = p.handle_event(PoolEvent::CheckCache(cmd_id)); let p = p.handle_event(PoolEvent::Synced(MerkleTree::from_vec(vec![]).unwrap())); assert_match!(PoolState::Active(_), p.state); @@ -949,10 +952,10 @@ mod tests { MockNetworker::new(0, 0, vec![]))), "pool_wrapper_getting_catchup_target_synced_works_for_node_state_error", - PoolHandle(1), + next_pool_handle(), 0, 0); - let cmd_id: CommandHandle = CommandHandle(sequence::get_next_id()); + let cmd_id: CommandHandle = next_command_handle(); let p = p.handle_event(PoolEvent::CheckCache(cmd_id)); ProtocolVersion::set(1); let p = p.handle_event(PoolEvent::Synced(merkle_tree_factory::create("pool_wrapper_getting_catchup_target_synced_works_for_node_state_error").unwrap())); @@ -976,10 +979,10 @@ mod tests { 0, vec![]))), "pool_wrapper_getting_catchup_target_catchup_target_found_works", - PoolHandle(1), + next_pool_handle(), 0, 0); - let cmd_id: CommandHandle = CommandHandle(sequence::get_next_id()); + let cmd_id: CommandHandle = next_command_handle(); let p = p.handle_event(PoolEvent::CheckCache(cmd_id)); let p = p.handle_event(PoolEvent::CatchupTargetFound(mt.root_hash().to_vec(), mt.count, mt)); assert_match!(PoolState::SyncCatchup(_), p.state); @@ -1000,10 +1003,10 @@ mod tests { PoolSM::new(Rc::new(RefCell::new( MockNetworker::new(0, 0, vec![]))), "pool_wrapper_getting_catchup_target_catchup_target_found_works_for_node_state_error", - PoolHandle(1), + next_pool_handle(), 0, 0); - let cmd_id: CommandHandle = CommandHandle(sequence::get_next_id()); + let cmd_id: CommandHandle = next_command_handle(); let p = p.handle_event(PoolEvent::CheckCache(cmd_id)); ProtocolVersion::set(1); let p = p.handle_event(PoolEvent::CatchupTargetFound(mt.root_hash().to_vec(), mt.count, mt)); @@ -1028,13 +1031,13 @@ mod tests { 0, vec![]))), "pool_wrapper_sync_catchup_close_works", - PoolHandle(1), + next_pool_handle(), 0, 0); - let cmd_id: CommandHandle = CommandHandle(sequence::get_next_id()); + let cmd_id: CommandHandle = next_command_handle(); let p = p.handle_event(PoolEvent::CheckCache(cmd_id)); let p = p.handle_event(PoolEvent::CatchupTargetFound(mt.root_hash().to_vec(), mt.count, mt)); - let cmd_id: CommandHandle = CommandHandle(sequence::get_next_id()); + let cmd_id: CommandHandle = next_command_handle(); let p = p.handle_event(PoolEvent::Close(cmd_id)); assert_match!(PoolState::Closed(_), p.state); @@ -1056,10 +1059,10 @@ mod tests { 0, vec![]))), "pool_wrapper_sync_catchup_synced_works", - PoolHandle(1), + next_pool_handle(), 0, 0); - let cmd_id: CommandHandle = CommandHandle(sequence::get_next_id()); + let cmd_id: CommandHandle = next_command_handle(); let p = p.handle_event(PoolEvent::CheckCache(cmd_id)); let p = p.handle_event(PoolEvent::CatchupTargetFound(mt.root_hash().to_vec(), mt.count, mt)); let p = p.handle_event(PoolEvent::Synced(merkle_tree_factory::create("pool_wrapper_sync_catchup_synced_works").unwrap())); @@ -1083,10 +1086,10 @@ mod tests { 0, vec![]))), "pool_wrapper_sync_catchup_synced_works_for_node_state_error", - PoolHandle(1), + next_pool_handle(), 0, 0); - let cmd_id: CommandHandle = CommandHandle(sequence::get_next_id()); + let cmd_id: CommandHandle = next_command_handle(); let p = p.handle_event(PoolEvent::CheckCache(cmd_id)); let p = p.handle_event(PoolEvent::CatchupTargetFound(mt.root_hash().to_vec(), mt.count, mt)); ProtocolVersion::set(1); @@ -1115,13 +1118,13 @@ mod tests { 0, vec![]))), "pool_wrapper_active_send_request_works", - PoolHandle(1), + next_pool_handle(), 0, 0); - let cmd_id: CommandHandle = CommandHandle(sequence::get_next_id()); + let cmd_id: CommandHandle = next_command_handle(); let p = p.handle_event(PoolEvent::CheckCache(cmd_id)); let p = p.handle_event(PoolEvent::Synced(MerkleTree::from_vec(vec![]).unwrap())); - let cmd_id: CommandHandle = CommandHandle(sequence::get_next_id()); + let cmd_id: CommandHandle = next_command_handle(); let p = p.handle_event(PoolEvent::SendRequest(cmd_id, req, None, None)); assert_match!(PoolState::Active(_), p.state); match p.state { @@ -1155,13 +1158,13 @@ mod tests { 0, vec![]))), "pool_wrapper_active_send_request_works_for_no_req_id", - PoolHandle(1), + next_pool_handle(), 0, 0); - let cmd_id: CommandHandle = CommandHandle(sequence::get_next_id()); + let cmd_id: CommandHandle = next_command_handle(); let p = p.handle_event(PoolEvent::CheckCache(cmd_id)); let p = p.handle_event(PoolEvent::Synced(MerkleTree::from_vec(vec![]).unwrap())); - let cmd_id: CommandHandle = CommandHandle(sequence::get_next_id()); + let cmd_id: CommandHandle = next_command_handle(); let p = p.handle_event(PoolEvent::SendRequest(cmd_id, req, None, None)); assert_match!(PoolState::Active(_), p.state); match p.state { @@ -1208,13 +1211,13 @@ mod tests { 0, vec![]))), "pool_wrapper_active_node_reply_works", - PoolHandle(1), + next_pool_handle(), 0, 0); - let cmd_id: CommandHandle = CommandHandle(sequence::get_next_id()); + let cmd_id: CommandHandle = next_command_handle(); let p = p.handle_event(PoolEvent::CheckCache(cmd_id)); let p = p.handle_event(PoolEvent::Synced(MerkleTree::from_vec(vec![]).unwrap())); - let cmd_id: CommandHandle = CommandHandle(sequence::get_next_id()); + let cmd_id: CommandHandle = next_command_handle(); let p = p.handle_event(PoolEvent::SendRequest(cmd_id, req, None, None)); let p = p.handle_event(PoolEvent::NodeReply(rep, "node".to_string())); assert_match!(PoolState::Active(_), p.state); @@ -1248,11 +1251,11 @@ mod tests { 0, vec![]))), "pool_wrapper_sends_requests_to_two_nodes", - PoolHandle(1), 0, 0); - let cmd_id: CommandHandle = CommandHandle(sequence::get_next_id()); + next_pool_handle(), 0, 0); + let cmd_id: CommandHandle = next_command_handle(); let p = p.handle_event(PoolEvent::CheckCache(cmd_id)); let p = p.handle_event(PoolEvent::Synced(MerkleTree::from_vec(vec![]).unwrap())); - let cmd_id: CommandHandle = CommandHandle(sequence::get_next_id()); + let cmd_id: CommandHandle = next_command_handle(); let p = p.handle_event(PoolEvent::SendRequest(cmd_id, req, None, None)); assert_match!(PoolState::Active(_), p.state); match p.state { @@ -1298,13 +1301,13 @@ mod tests { 0, vec![]))), "pool_wrapper_active_node_reply_works_for_no_request", - PoolHandle(1), + next_pool_handle(), 0, 0); - let cmd_id: CommandHandle = CommandHandle(sequence::get_next_id()); + let cmd_id: CommandHandle = next_command_handle(); let p = p.handle_event(PoolEvent::CheckCache(cmd_id)); let p = p.handle_event(PoolEvent::Synced(MerkleTree::from_vec(vec![]).unwrap())); - let cmd_id: CommandHandle = CommandHandle(sequence::get_next_id()); + let cmd_id: CommandHandle = next_command_handle(); let p = p.handle_event(PoolEvent::SendRequest(cmd_id, req, None, None)); let p = p.handle_event(PoolEvent::NodeReply(rep, "node".to_string())); assert_match!(PoolState::Active(_), p.state); @@ -1341,13 +1344,13 @@ mod tests { 0, vec![]))), "pool_wrapper_active_node_reply_works_for_invalid_reply", - PoolHandle(1), + next_pool_handle(), 0, 0); - let cmd_id: CommandHandle = CommandHandle(sequence::get_next_id()); + let cmd_id: CommandHandle = next_command_handle(); let p = p.handle_event(PoolEvent::CheckCache(cmd_id)); let p = p.handle_event(PoolEvent::Synced(MerkleTree::from_vec(vec![]).unwrap())); - let cmd_id: CommandHandle = CommandHandle(sequence::get_next_id()); + let cmd_id: CommandHandle = next_command_handle(); let p = p.handle_event(PoolEvent::SendRequest(cmd_id, req, None, None)); let p = p.handle_event(PoolEvent::NodeReply(rep.to_string(), "node".to_string())); assert_match!(PoolState::Active(_), p.state); diff --git a/libindy/src/services/wallet/mod.rs b/libindy/src/services/wallet/mod.rs index 27b28f97d7..db5ecc6974 100644 --- a/libindy/src/services/wallet/mod.rs +++ b/libindy/src/services/wallet/mod.rs @@ -33,6 +33,10 @@ pub mod language; mod export_import; mod wallet; +fn next_wallet_handle() -> WalletHandle { + WalletHandle(sequence::get_next_id()) +} + pub struct WalletService { storage_types: RefCell>>, wallets: RefCell>>, @@ -187,7 +191,7 @@ impl WalletService { let (storage, metadata, key_derivation_data) = self._open_storage_and_fetch_metadata(config, credentials)?; - let wallet_handle = WalletHandle(sequence::get_next_id()); + let wallet_handle = next_wallet_handle(); let rekey_data: Option = credentials.rekey.as_ref().map(|ref rekey| KeyDerivationData::from_passphrase_with_new_salt(rekey, &credentials.rekey_derivation_method)); @@ -462,7 +466,7 @@ impl WalletService { let (reader, import_key_derivation_data, nonce, chunk_size, header_bytes) = preparse_file_to_import(exported_file_to_import, &export_config.key)?; let key_data = KeyDerivationData::from_passphrase_with_new_salt(&credentials.key, &credentials.key_derivation_method); - let wallet_handle = WalletHandle(sequence::get_next_id()); + let wallet_handle = next_wallet_handle(); let stashed_key_data = key_data.clone(); @@ -760,7 +764,7 @@ mod tests { let (storage, metadata, key_derivation_data) = self._open_storage_and_fetch_metadata(config, credentials)?; - let wallet_handle = WalletHandle(sequence::get_next_id()); + let wallet_handle = next_wallet_handle(); let rekey_data: Option = credentials.rekey.as_ref().map(|ref rekey| KeyDerivationData::from_passphrase_with_new_salt(rekey, &credentials.rekey_derivation_method)); @@ -794,7 +798,7 @@ mod tests { let (reader, import_key_derivation_data, nonce, chunk_size, header_bytes) = preparse_file_to_import(exported_file_to_import, &export_config.key)?; let key_data = KeyDerivationData::from_passphrase_with_new_salt(&credentials.key, &credentials.key_derivation_method); - let wallet_handle = WalletHandle(sequence::get_next_id()); + let wallet_handle = next_wallet_handle(); let import_key = import_key_derivation_data.calc_master_key()?; let master_key = key_data.calc_master_key()?; diff --git a/libindy/tests/demo.rs b/libindy/tests/demo.rs index f9a65c26c1..0b2f93605a 100644 --- a/libindy/tests/demo.rs +++ b/libindy/tests/demo.rs @@ -24,7 +24,6 @@ extern crate rmp_serde; extern crate rust_base58; extern crate time; extern crate serde; -extern crate indy; #[macro_use] mod utils; diff --git a/libindy/tests/interaction.rs b/libindy/tests/interaction.rs index 7703ad3ade..e5f582e38b 100644 --- a/libindy/tests/interaction.rs +++ b/libindy/tests/interaction.rs @@ -24,7 +24,6 @@ extern crate rust_base58; extern crate time; extern crate serde; extern crate core; -extern crate indy; #[macro_use] mod utils; diff --git a/libindy/tests/ledger.rs b/libindy/tests/ledger.rs index 6945e2a8b8..ceef5e617d 100644 --- a/libindy/tests/ledger.rs +++ b/libindy/tests/ledger.rs @@ -27,7 +27,6 @@ extern crate time; extern crate serde; extern crate sodiumoxide; extern crate rand; -extern crate indy; #[macro_use] mod utils; diff --git a/libindy/tests/logger.rs b/libindy/tests/logger.rs index 997b7dff71..c93ce3a1e1 100644 --- a/libindy/tests/logger.rs +++ b/libindy/tests/logger.rs @@ -24,7 +24,6 @@ extern crate rust_base58; extern crate time; extern crate serde; extern crate log; -extern crate indy; #[macro_use] mod utils; diff --git a/libindy/tests/utils/cache.rs b/libindy/tests/utils/cache.rs index 013f8f5ff7..6b33b6d3eb 100644 --- a/libindy/tests/utils/cache.rs +++ b/libindy/tests/utils/cache.rs @@ -6,18 +6,18 @@ use self::futures::Future; use indy::cache; -pub fn get_schema_cache(pool_handle: PoolHandle, wallet_handle: i32, submitter_did: &str, id: &str, options_json: &str) -> Result { +pub fn get_schema_cache(pool_handle: i32, wallet_handle: i32, submitter_did: &str, id: &str, options_json: &str) -> Result { cache::get_schema(pool_handle, wallet_handle, submitter_did, id, options_json).wait() } -pub fn get_cred_def_cache(pool_handle: PoolHandle, wallet_handle: i32, submitter_did: &str, id: &str, options_json: &str) -> Result { +pub fn get_cred_def_cache(pool_handle: i32, wallet_handle: i32, submitter_did: &str, id: &str, options_json: &str) -> Result { cache::get_cred_def(pool_handle, wallet_handle, submitter_did, id, options_json).wait() } -pub fn purge_schema_cache(wallet_handle: PoolHandle, options_json: &str) -> Result<(), IndyError> { +pub fn purge_schema_cache(wallet_handle: i32, options_json: &str) -> Result<(), IndyError> { cache::purge_schema_cache(wallet_handle, options_json).wait() } -pub fn purge_cred_def_cache(wallet_handle: PoolHandle, options_json: &str) -> Result<(), IndyError> { +pub fn purge_cred_def_cache(wallet_handle: i32, options_json: &str) -> Result<(), IndyError> { cache::purge_cred_def_cache(wallet_handle, options_json).wait() } \ No newline at end of file diff --git a/libindy/tests/utils/did.rs b/libindy/tests/utils/did.rs index db163066bb..28097e8b11 100644 --- a/libindy/tests/utils/did.rs +++ b/libindy/tests/utils/did.rs @@ -6,7 +6,7 @@ use self::futures::Future; use utils::{ledger, pool}; use utils::types::ResponseType; -use indy::api::PoolHandle; +use api::PoolHandle; pub fn create_store_and_publish_my_did_from_trustee(wallet_handle: i32, pool_handle: PoolHandle) -> Result<(String, String), IndyError> { diff --git a/libindy/tests/utils/ledger.rs b/libindy/tests/utils/ledger.rs index a2c74ae6da..3327a707d8 100644 --- a/libindy/tests/utils/ledger.rs +++ b/libindy/tests/utils/ledger.rs @@ -20,21 +20,21 @@ pub const SCHEMA_DATA: &'static str = r#"{"id":"id","name":"gvt","version":"1.0" const SUBMIT_RETRY_CNT: usize = 3; -pub fn sign_and_submit_request(pool_handle: PoolHandle, wallet_handle: i32, submitter_did: &str, request_json: &str) -> Result { +pub fn sign_and_submit_request(pool_handle: i32, wallet_handle: i32, submitter_did: &str, request_json: &str) -> Result { ledger::sign_and_submit_request(pool_handle, wallet_handle, submitter_did, request_json).wait() } -pub fn submit_request_with_retries(pool_handle: PoolHandle, request_json: &str, previous_response: &str) -> Result { +pub fn submit_request_with_retries(pool_handle: i32, request_json: &str, previous_response: &str) -> Result { _submit_retry(extract_seq_no_from_reply(previous_response).unwrap(), || { submit_request(pool_handle, request_json) }) } -pub fn submit_request(pool_handle: PoolHandle, request_json: &str) -> Result { +pub fn submit_request(pool_handle: i32, request_json: &str) -> Result { ledger::submit_request(pool_handle, request_json).wait() } -pub fn submit_action(pool_handle: PoolHandle, request_json: &str, nodes: Option<&str>, timeout: Option) -> Result { +pub fn submit_action(pool_handle: i32, request_json: &str, nodes: Option<&str>, timeout: Option) -> Result { ledger::submit_action(pool_handle, request_json, nodes, timeout).wait() } diff --git a/libindy/tests/utils/mod.rs b/libindy/tests/utils/mod.rs index 98dc919626..a8bd631508 100644 --- a/libindy/tests/utils/mod.rs +++ b/libindy/tests/utils/mod.rs @@ -85,7 +85,7 @@ pub fn setup_with_pool(name: &str) -> i32 { pool::create_and_open_pool_ledger(name).unwrap() } -pub fn tear_down_with_pool(pool_handle: PoolHandle, name: &str) { +pub fn tear_down_with_pool(pool_handle: i32, name: &str) { pool::close(pool_handle).unwrap(); tear_down(name); } @@ -96,7 +96,7 @@ pub fn setup_with_wallet_and_pool(name: &str) -> (i32, i32, String) { (wallet_handle, pool_handle, config) } -pub fn tear_down_with_wallet_and_pool(wallet_handle: i32, pool_handle: PoolHandle, name: &str, wallet_config: &str) { +pub fn tear_down_with_wallet_and_pool(wallet_handle: i32, pool_handle: i32, name: &str, wallet_config: &str) { pool::close(pool_handle).unwrap(); tear_down_with_wallet(wallet_handle, name, wallet_config); } diff --git a/libindy/tests/utils/payments.rs b/libindy/tests/utils/payments.rs index b52face379..cd60b06626 100644 --- a/libindy/tests/utils/payments.rs +++ b/libindy/tests/utils/payments.rs @@ -22,7 +22,7 @@ macro_rules! mocked_handler { static ref INJECTIONS: Mutex> = Default::default(); } - pub extern fn handle(cmd_handle: CommandHandle, + pub extern fn handle(cmd_handle: i32, $first_param_name: $first_param_type, $($param_name: $param_type,)* cb: Option) -> i32 { diff --git a/libindy/tests/utils/pool.rs b/libindy/tests/utils/pool.rs index 96fff2e3ea..0895e68f99 100644 --- a/libindy/tests/utils/pool.rs +++ b/libindy/tests/utils/pool.rs @@ -17,7 +17,7 @@ use time; use utils::types::{Response, ResponseType}; use utils::constants::PROTOCOL_VERSION; use utils::{environment, test}; -use indy::api::PoolHandle; +use api::PoolHandle; #[derive(Serialize, Deserialize)] struct PoolConfig { diff --git a/libindy/tests/utils/wallet.rs b/libindy/tests/utils/wallet.rs index 02ab9da6a2..ae02bf3ba0 100644 --- a/libindy/tests/utils/wallet.rs +++ b/libindy/tests/utils/wallet.rs @@ -18,7 +18,7 @@ use super::libc::c_char; use utils::constants::{TYPE, INMEM_TYPE, WALLET_CREDENTIALS}; use std::path::{Path, PathBuf}; -use indy::api::{WalletHandle, CommandHandle}; +use api::{WalletHandle, CommandHandle}; pub fn register_wallet_storage(xtype: &str, force_create: bool) -> Result<(), ErrorCode> { lazy_static! { From c34244c9956ca4ea75a95a21d5d845ae26f1053c Mon Sep 17 00:00:00 2001 From: Axel Nennker Date: Fri, 26 Jul 2019 13:47:49 +0200 Subject: [PATCH 027/320] fixed compiler errors Signed-off-by: Axel Nennker --- libindy/src/services/pool/mod.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libindy/src/services/pool/mod.rs b/libindy/src/services/pool/mod.rs index c64652ebc1..757a15ad8c 100644 --- a/libindy/src/services/pool/mod.rs +++ b/libindy/src/services/pool/mod.rs @@ -50,12 +50,12 @@ lazy_static! { static ref REGISTERED_SP_PARSERS: Mutex> = Mutex::new(HashMap::new()); } -fn next_pool_handle() -> PoolHandle { - PoolHandle(sequence::get_next_id()) -} //fn next_pool_handle() -> PoolHandle { -// sequence::get_next_id() +// PoolHandle(sequence::get_next_id()) //} +fn next_pool_handle() -> PoolHandle { + sequence::get_next_id() +} pub struct PoolService { open_pools: RefCell>, From 75acf008d4efd2a01b44d39521fee98ab210df6e Mon Sep 17 00:00:00 2001 From: Axel Nennker Date: Fri, 26 Jul 2019 14:56:59 +0200 Subject: [PATCH 028/320] fix merge errors Signed-off-by: Axel Nennker --- libindy/src/commands/did.rs | 2 +- libindy/src/services/pool/request_handler.rs | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/libindy/src/commands/did.rs b/libindy/src/commands/did.rs index a3f93aa4d2..36c3e308d1 100644 --- a/libindy/src/commands/did.rs +++ b/libindy/src/commands/did.rs @@ -16,8 +16,8 @@ use errors::prelude::*; use services::crypto::CryptoService; use services::ledger::LedgerService; use services::wallet::{RecordOptions, SearchOptions, WalletService}; -use utils::crypto::base58; use api::{WalletHandle, PoolHandle, CommandHandle, next_command_handle}; +use rust_base58::{FromBase58, ToBase58}; pub enum DidCommand { CreateAndStoreMyDid( diff --git a/libindy/src/services/pool/request_handler.rs b/libindy/src/services/pool/request_handler.rs index 9e9ea9b3e1..6be32ac377 100644 --- a/libindy/src/services/pool/request_handler.rs +++ b/libindy/src/services/pool/request_handler.rs @@ -33,6 +33,7 @@ use super::ursa::bls::VerKey; use std::hash::{Hash, Hasher}; use log_derive::logfn; use api::CommandHandle; +use rust_base58::FromBase58; struct RequestSM { f: usize, @@ -600,7 +601,7 @@ impl RequestSM { } pub trait RequestHandler { - fn new(networker: Rc>, f: usize, cmd_ids: &Vec, nodes: &HashMap>, generator: Option, pool_name: &str, timeout: i64, extended_timeout: i64) -> Self; + fn new(networker: Rc>, f: usize, cmd_ids: &Vec, nodes: &HashMap>, pool_name: &str, timeout: i64, extended_timeout: i64) -> Self; fn process_event(&mut self, ore: Option) -> Option; fn is_terminal(&self) -> bool; } @@ -610,7 +611,7 @@ pub struct RequestHandlerImpl { } impl RequestHandler for RequestHandlerImpl { - fn new(networker: Rc>, f: usize, cmd_ids: &Vec, nodes: &HashMap>, generator: Option, pool_name: &str, timeout: i64, extended_timeout: i64) -> Self { + fn new(networker: Rc>, f: usize, cmd_ids: &Vec, nodes: &HashMap>, pool_name: &str, timeout: i64, extended_timeout: i64) -> Self { RequestHandlerImpl { request_wrapper: Some(RequestSM::new(networker, f, cmd_ids, nodes, pool_name, timeout, extended_timeout)), } @@ -849,7 +850,7 @@ pub mod tests { pub struct MockRequestHandler {} impl RequestHandler for MockRequestHandler { - fn new(_networker: Rc>, _f: usize, _cmd_ids: &Vec, _nodes: &HashMap>, _generator: Option, _pool_name: &str, _timeout: i64, _extended_timeout: i64) -> Self { + fn new(_networker: Rc>, _f: usize, _cmd_ids: &Vec, _nodes: &HashMap>, _pool_name: &str, _timeout: i64, _extended_timeout: i64) -> Self { MockRequestHandler {} } From d14bf702aa7eca2a4b102ab6443443d04d1aaa0b Mon Sep 17 00:00:00 2001 From: Axel Nennker Date: Sat, 27 Jul 2019 09:34:11 +0200 Subject: [PATCH 029/320] command constants Signed-off-by: Axel Nennker --- libindy/src/services/pool/events.rs | 6 +++++- libindy/src/services/pool/mod.rs | 11 ++++++----- libindy/src/services/pool/pool.rs | 2 +- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/libindy/src/services/pool/events.rs b/libindy/src/services/pool/events.rs index ee53d94075..896b409ddb 100644 --- a/libindy/src/services/pool/events.rs +++ b/libindy/src/services/pool/events.rs @@ -66,6 +66,10 @@ pub enum NetworkerEvent { Timeout, } +pub const COMMAND_EXIT : &str = "exit"; +pub const COMMAND_CONNECT : &str = "connect"; +pub const COMMAND_REFRESH : &str = "refresh"; + #[derive(Clone, Debug)] pub enum PoolEvent { CheckCache(i32), @@ -293,4 +297,4 @@ fn _parse_req_id_and_op(msg: &str) -> IndyResult<(SJsonValue, String, String)> { fn _get_req_json(msg: &str) -> IndyResult { serde_json::from_str(msg) .to_indy(IndyErrorKind::InvalidStructure, "Invalid request json") // FIXME: Review kind -} \ No newline at end of file +} diff --git a/libindy/src/services/pool/mod.rs b/libindy/src/services/pool/mod.rs index cb168cd7f8..40dcb2d986 100644 --- a/libindy/src/services/pool/mod.rs +++ b/libindy/src/services/pool/mod.rs @@ -30,6 +30,7 @@ use errors::*; use services::pool::pool::{Pool, ZMQPool}; use utils::environment; use utils::sequence; +use services::pool::events::{COMMAND_EXIT, COMMAND_CONNECT, COMMAND_REFRESH}; mod catchup; mod commander; @@ -161,7 +162,7 @@ impl PoolService { send_cmd_sock.connect(inproc_sock_name.as_str())?; new_pool.work(recv_cmd_sock); - self._send_msg(pool_handle, "connect", &send_cmd_sock, None, None)?; + self._send_msg(pool_handle, COMMAND_CONNECT, &send_cmd_sock, None, None)?; self.pending_pools.try_borrow_mut()? .insert(new_pool.get_id(), ZMQPool::new(new_pool, send_cmd_sock)); @@ -222,7 +223,7 @@ impl PoolService { let mut pools = self.open_pools.try_borrow_mut()?; match pools.remove(&handle) { - Some(ref pool) => self._send_msg(cmd_id, "exit", &pool.cmd_socket, None, None)?, + Some(ref pool) => self._send_msg(cmd_id, COMMAND_EXIT, &pool.cmd_socket, None, None)?, None => return Err(err_msg(IndyErrorKind::InvalidPoolHandle, format!("No pool with requested handle {}", handle))) } @@ -230,7 +231,7 @@ impl PoolService { } pub fn refresh(&self, handle: i32) -> IndyResult { - self.send_action(handle, "refresh", None, None) + self.send_action(handle, COMMAND_REFRESH, None, None) } fn _send_msg(&self, cmd_id: i32, msg: &str, socket: &Socket, nodes: Option<&str>, timeout: Option) -> IndyResult<()> { @@ -383,7 +384,7 @@ mod tests { let cmd_id = ps.close(pool_id).unwrap(); let recv = recv_soc.recv_multipart(zmq::DONTWAIT).unwrap(); assert_eq!(recv.len(), 3); - assert_eq!("exit", String::from_utf8(recv[0].clone()).unwrap()); + assert_eq!(COMMAND_EXIT, String::from_utf8(recv[0].clone()).unwrap()); assert_eq!(cmd_id, LittleEndian::read_i32(recv[1].as_slice())); } @@ -402,7 +403,7 @@ mod tests { let cmd_id = ps.refresh(pool_id).unwrap(); let recv = recv_soc.recv_multipart(zmq::DONTWAIT).unwrap(); assert_eq!(recv.len(), 3); - assert_eq!("refresh", String::from_utf8(recv[0].clone()).unwrap()); + assert_eq!(COMMAND_REFRESH, String::from_utf8(recv[0].clone()).unwrap()); assert_eq!(cmd_id, LittleEndian::read_i32(recv[1].as_slice())); } diff --git a/libindy/src/services/pool/pool.rs b/libindy/src/services/pool/pool.rs index a6da2a6509..c906a96197 100644 --- a/libindy/src/services/pool/pool.rs +++ b/libindy/src/services/pool/pool.rs @@ -741,7 +741,7 @@ impl Drop for ZMQPool { fn drop(&mut self) { info!("Drop started"); - if let Err(err) = self.cmd_socket.send("exit".as_bytes(), zmq::DONTWAIT) { + if let Err(err) = self.cmd_socket.send("COMMAND_EXIT".as_bytes(), zmq::DONTWAIT) { warn!("Can't send exit command to pool worker thread (may be already finished) {}", err); } From 0af751a49d0f4de39ad56c5b31871a904d13196e Mon Sep 17 00:00:00 2001 From: "artem.ivanov" Date: Fri, 26 Jul 2019 13:20:02 +0300 Subject: [PATCH 030/320] IS-1906: Ubuntu 18.04 - CI/CD pipeline initial version Signed-off-by: artem.ivanov --- Jenkinsfile.cd | 211 ++++++++++++++++++++------------- Jenkinsfile.ci | 86 ++++++++------ ci/deb-build-and-upload.sh | 6 +- libindy/ci/ubuntu18.dockerfile | 46 +++++++ 4 files changed, 226 insertions(+), 123 deletions(-) create mode 100644 libindy/ci/ubuntu18.dockerfile diff --git a/Jenkinsfile.cd b/Jenkinsfile.cd index cc03cc2d24..4b92495f2c 100644 --- a/Jenkinsfile.cd +++ b/Jenkinsfile.cd @@ -14,8 +14,9 @@ properties([ ]] ]); -libindyBuildFinished = ["Ubuntu": false, "RedHat": false] -libvcxBuildFinished = ["Ubuntu": false, "RedHat": false] +libindyBuildFinished = ["Ubuntu 16.04": false, "Ubuntu 18.04": false, "RedHat": false] +libvcxBuildFinished = ["Ubuntu 16.04": false, "Ubuntu 18.04": false, "RedHat": false] +ubuntuPakageTypes = ["Ubuntu 16.04": "", "Ubuntu 18.04": "--distro"] gitHubUserCredId = env.GITHUB_BOT_USER ?: 'sovbot-github' sovrinPackagingRepo = env.SOVRIN_PACKAGING_REPO ?: 'https://github.com/sovrin-foundation/sovrin-packaging' @@ -62,9 +63,9 @@ def publishing() { 'macos-files': { macOsPublishing() }, ]) - if (publishedVersions['windows-files'] != publishedVersions['ubuntu-files']) { // FIXME check rhel too, IS-307 - error "platforms artifacts have different versions" - } +// if (publishedVersions['windows-files'] != publishedVersions['ubuntu-files']) { // FIXME check rhel too, IS-307 +// error "platforms artifacts have different versions" +// } } } @@ -207,7 +208,7 @@ String getSrcVersion(folder) { } } -def linuxTesting(file, env_name, network_name, stashBuildResults) { +def linuxTesting(file, env_name, network_name, stashBuildResults, test_wrappers) { parallel([ failFast : true, "${env_name} Test: build and test libindy": { @@ -223,30 +224,30 @@ def linuxTesting(file, env_name, network_name, stashBuildResults) { "${env_name}-cli-test" : { linuxModuleTesting(file, env_name, network_name, this.&linuxCLITesting, stashBuildResults) }, - "${env_name}-rust-test" : { - linuxModuleTesting(file, env_name, network_name, this.&linuxRustTesting, stashBuildResults) - }, - "${env_name}-nodejs-test": { - linuxModuleTesting(file, env_name, network_name, this.&linuxNodejsTesting, stashBuildResults) - }, "${env_name}-vcx-test" : { - vcxTesting(file, env_name, network_name, stashBuildResults) + vcxTesting(file, env_name, network_name, stashBuildResults, test_wrappers) } ] - if (env_name == "Ubuntu") { + if (test_wrappers) { + jobs["${env_name}-rust-test"] = { + linuxModuleTesting(file, env_name, network_name, this.&linuxRustTesting, stashBuildResults) + } jobs["${env_name}-java-test"] = { linuxModuleTesting(file, env_name, network_name, this.&linuxJavaTesting, stashBuildResults) } jobs["${env_name}-python-test"] = { linuxModuleTesting(file, env_name, network_name, this.&linuxPythonTesting, stashBuildResults) } + jobs["${env_name}-nodejs-test"] = { + linuxModuleTesting(file, env_name, network_name, this.&linuxNodejsTesting, stashBuildResults) + } } parallel(jobs) }, ]) } -def vcxTesting(file, env_name, network_name, stashBuildResults) { +def vcxTesting(file, env_name, network_name, stashBuildResults, test_wrappers) { parallel([ failFast : true, "${env_name} Test: build and test libvcx" : { @@ -255,23 +256,24 @@ def vcxTesting(file, env_name, network_name, stashBuildResults) { } }, "${env_name} Test: test other vcx components": { - waitUntil { - libvcxBuildFinished[env_name] - } - def jobs = [ - "${env_name}-vcx-nodejs-test": { - linuxModuleTesting(file, env_name, network_name, this.&linuxVcxNodejsTesting, stashBuildResults) - } - ] - if (env_name == "Ubuntu") { - jobs["${env_name}-vcx-java-test"] = { - linuxModuleTesting(file, env_name, network_name, this.&linuxVcxJavaTesting, stashBuildResults) - } - jobs["${env_name}-vcx-python-test"] = { - linuxModuleTesting(file, env_name, network_name, this.&linuxVcxPythonTesting, stashBuildResults) + if (test_wrappers) { + waitUntil { + libvcxBuildFinished[env_name] } + + def jobs = [ + "${env_name}-vcx-nodejs-test": { + linuxModuleTesting(file, env_name, network_name, this.&linuxVcxNodejsTesting, stashBuildResults) + }, + "${env_name}-vcx-java-test": { + linuxModuleTesting(file, env_name, network_name, this.&linuxVcxJavaTesting, stashBuildResults) + }, + "${env_name}-vcx-python-test": { + linuxModuleTesting(file, env_name, network_name, this.&linuxVcxPythonTesting, stashBuildResults) + } + ] + parallel(jobs) } - parallel(jobs) }, ]) } @@ -294,7 +296,7 @@ def linuxLibindyBuild(file, env_name, network_name, stashBuildResults) { ''' if (stashBuildResults) { - stash includes: 'libindy/target/release/libindy.so,libindy/target/release/libindy.a', name: 'LibindyUbuntuBuildResult' + stash includes: 'libindy/target/release/libindy.so,libindy/target/release/libindy.a', name: "LibindyBuildResult${env_name}" } } @@ -318,7 +320,7 @@ def linuxLibindyBuild(file, env_name, network_name, stashBuildResults) { ''' if (stashBuildResults) { - stash includes: 'libnullpay/target/release/libnullpay.so', name: 'LibnullpayUbuntuBuildResult' + stash includes: 'libnullpay/target/release/libnullpay.so', name: "LibnullpayBuildResult${env_name}" } } @@ -385,7 +387,7 @@ def linuxVcxBuild(file, env_name, network_name, stashBuildResults) { LIBRARY_PATH=./ cargo build --release --features fatal_warnings ''' if (stashBuildResults) { - stash includes: 'vcx/libvcx/target/release/libvcx.so', name: 'LibvcxUbuntuBuildResult' + stash includes: 'vcx/libvcx/target/release/libvcx.so', name: "LibvcxBuildResult${env_name}" } } @@ -471,7 +473,7 @@ def linuxCLITesting(env_name, network_name, testEnv, stashBuildResults) { LD_LIBRARY_PATH=./:${LD_LIBRARY_PATH} RUST_BACKTRACE=1 RUST_LOG=indy::=debug RUST_TEST_THREADS=1 TEST_POOL_IP=10.0.0.2 cargo test --release --features "nullpay_plugin" ''' if (stashBuildResults) { - stash includes: 'cli/target/release/indy-cli', name: 'IndyCliUbuntuBuildResult' + stash includes: 'cli/target/release/indy-cli', name: "IndyCliBuildResult${env_name}" } } } @@ -695,10 +697,18 @@ def windowsTesting() { def ubuntuTesting() { stage('Ubuntu Test') { - linuxTesting("ci/ubuntu.dockerfile ci", "Ubuntu", "pool_network", true) + parallel([ + "ubuntu:16.04": { + linuxTesting("ci/ubuntu.dockerfile ci", "Ubuntu 16.04", "pool_network", true, true) + }, + "ubuntu:18.04": { + linuxTesting("ci/ubuntu18.dockerfile ci", "Ubuntu 18.04", "pool_network", true, false) + } + ]) } } + def linuxAndroidOnEmulatorTesting(env_name, network_name, testEnv, stashBuildResult) { sh 'chmod -R 777 libindy/ci/*.sh' sh 'chmod -R 777 libindy/*.sh' @@ -916,34 +926,50 @@ def rhelPublishing() { } def ubuntuPublishing() { + stage('Ubuntu Publishing') { + parallel([ + "ubuntu:16.04": { + linuxPublishing("ci/ubuntu.dockerfile ci", "Ubuntu 16.04", true) + }, + "ubuntu:18.04": { + linuxPublishing("ci/ubuntu18.dockerfile ci", "Ubuntu 18.04", false) + } + ]) + } +} + +def linuxPublishing(file, env_name, build_wrappers){ def libindyVersion node('ubuntu') { - stage('Publish Ubuntu Files') { + stage("Publish ${env_name} Files") { try { - echo 'Publish Ubuntu files: Checkout scm' + echo "Publish ${env_name} files: Checkout scm" checkout scm libindyVersion = getSrcVersion("libindy") - echo 'Publish Ubuntu files: Build docker image' - testEnv = dockerHelpers.build('indy-sdk', 'libindy/ci/ubuntu.dockerfile libindy/ci') + echo "Publish ${env_name} files: Build docker image" + testEnv = buildTestEnv(file, env_name) + + libindyDebPublishing(testEnv, libindyVersion, env_name) + libnullpayDebPublishing(testEnv, env_name) + libvcxDebPublishing(testEnv, env_name) + libindyCliDebPublishing(testEnv, libindyVersion, env_name) + + if (build_wrappers){ + pythonWrapperPublishing(testEnv, false, 'wrappers/python', 'libindy') + nodejsWrapperPublishing(testEnv, false, 'libindy') + javaWrapperPublishing(testEnv, false) + rustWrapperPublishing(testEnv, false) + vcxJavaWrapperPublishing(testEnv, false) + pythonWrapperPublishing(testEnv, false, 'vcx/wrappers/python3', 'vcx/libvcx') + nodejsWrapperPublishing(testEnv, false, 'vcx') + } - libindyDebPublishing(testEnv, libindyVersion) - - pythonWrapperPublishing(testEnv, false, 'wrappers/python', 'libindy') - nodejsWrapperPublishing(testEnv, false, 'libindy') - javaWrapperPublishing(testEnv, false) - rustWrapperPublishing(testEnv, false) - libindyCliDebPublishing(testEnv, libindyVersion) - libnullpayDebPublishing(testEnv) - libvcxDebPublishing(testEnv) - vcxJavaWrapperPublishing(testEnv, false) - pythonWrapperPublishing(testEnv, false, 'vcx/wrappers/python3', 'vcx/libvcx') - nodejsWrapperPublishing(testEnv, false, 'vcx') } finally { - echo 'Publish Ubuntu files: Cleanup' + echo "Publish ${env_name} files: Cleanup" step([$class: 'WsCleanup']) } } @@ -1157,38 +1183,38 @@ def getSuffix(isRelease, target) { return suffix } -def libindyDebPublishing(testEnv, version) { +def libindyDebPublishing(testEnv, version, env_name) { echo 'Publish Libindy deb files to Apt' - debPublishing(testEnv, "libindy", "libindy", version, "LibindyUbuntuBuildResult", "libindyDebs") + debPublishing(testEnv, "libindy", "libindy", version, "LibindyBuildResult${env_name}", "libindyDebs${env_name}", env_name) } -def libindyCliDebPublishing(testEnv, version) { +def libindyCliDebPublishing(testEnv, version, env_name) { echo 'Publish Indy Cli deb files to Apt' setLibindyDependencyVersion("cli/debian/control") - debPublishing(testEnv, "cli", "indy-cli", version, "IndyCliUbuntuBuildResult", "libindyCliDebs") + debPublishing(testEnv, "cli", "indy-cli", version, "IndyCliBuildResult${env_name}", "libindyCliDebs${env_name}", env_name) } -def libnullpayDebPublishing(testEnv) { +def libnullpayDebPublishing(testEnv, env_name) { echo 'Publish Libnullpay deb files to Apt' def libnullpayVersion = getSrcVersion("libnullpay") setLibindyDependencyVersion("libnullpay/debian/control") - debPublishing(testEnv, "libnullpay", "libnullpay", libnullpayVersion, "LibnullpayUbuntuBuildResult", "libnullpayDebs") + debPublishing(testEnv, "libnullpay", "libnullpay", libnullpayVersion, "LibnullpayBuildResult${env_name}", "libnullpayDebs${env_name}", env_name) } -def libvcxDebPublishing(testEnv) { +def libvcxDebPublishing(testEnv, env_name) { echo 'Publish Libvcx deb files to Apt' def libvcxVersion = getSrcVersion("vcx/libvcx") setLibindyDependencyVersion("vcx/libvcx/debian/control") - debPublishing(testEnv, "vcx/libvcx", "libvcx", libvcxVersion, "LibvcxUbuntuBuildResult", "libvcxDebs") + debPublishing(testEnv, "vcx/libvcx", "libvcx", libvcxVersion, "LibvcxBuildResult${env_name}", "libvcxDebs${env_name}", env_name) } def setLibindyDependencyVersion(file) { @@ -1198,7 +1224,7 @@ def setLibindyDependencyVersion(file) { sh "sed -i -e \"s/^\\(Depends: .*libindy\\)\\(\\s*[,]\\{,1\\}.*\\)/\\1 (= $replaceVersion)\\2/\" $file" } -def debPublishing(testEnv, directory, packageName, version, inStashName, outStashName) { +def debPublishing(testEnv, directory, packageName, version, inStashName, outStashName, env_name) { dir("$directory/sovrin-packaging") { downloadPackagingUtils() } @@ -1207,11 +1233,12 @@ def debPublishing(testEnv, directory, packageName, version, inStashName, outStas sh "cp ci/deb-build-and-upload.sh $directory && chmod -R 755 $directory/*.sh" def suffix = "~$env.BUILD_NUMBER" + def package_type = ubuntuPakageTypes[env_name] unstash name: inStashName withCredentials([file(credentialsId: 'SovrinRepoSSHKey', variable: 'sovrin_key')]) { - sh "cd $directory && ./deb-build-and-upload.sh $packageName $version $env.BRANCH_NAME $suffix $SOVRIN_SDK_REPO_NAME $SOVRIN_REPO_HOST $sovrin_key" + sh "cd $directory && ./deb-build-and-upload.sh $packageName $version $env.BRANCH_NAME $suffix $SOVRIN_SDK_REPO_NAME $SOVRIN_REPO_HOST $sovrin_key $package_type" if (env.BRANCH_NAME == 'rc') { stash includes: "$directory/debs/*", name: outStashName @@ -1330,14 +1357,16 @@ def publishingRCtoStable() { def libnullpayVersion = getSrcVersion("libnullpay") def libvcxVersion = getSrcVersion("vcx/libvcx") + def env_name = "Ubuntu 16.04" + echo 'Moving Windows RC artifacts to Stable: libindy' publishLibindyWindowsFilesRCtoStable(libindyVersion) echo 'Moving RC artifacts to Stable: Build docker image for wrappers publishing' testEnv = dockerHelpers.build('indy-sdk', 'libindy/ci/ubuntu.dockerfile libindy/ci') - echo 'Moving Ubuntu RC artifacts to Stable: libindy' - publishLibindyDebRCtoStable(testEnv, libindyVersion) + echo "Moving ${env_name} RC artifacts to Stable: libindy" + publishLibindyDebRCtoStable(testEnv, libindyVersion, env_name) echo 'Moving Ubuntu RC artifacts to Stable: python wrapper' pythonWrapperPublishing(testEnv, true, 'wrappers/python', 'libindy') @@ -1351,8 +1380,8 @@ def publishingRCtoStable() { echo 'Moving Ubuntu RC artifacts to Stable: rust wrapper' rustWrapperPublishing(testEnv, true) - echo 'Moving Ubuntu RC artifacts to Stable: indy-cli' - publishLibindyCliDebRCtoStable(testEnv, libindyVersion) + echo "Moving ${env_name} RC artifacts to Stable: indy-cli" + publishLibindyCliDebRCtoStable(testEnv, libindyVersion, env_name) echo 'Moving Windows RC artifacts to Stable: indy-cli' publishLibindyCliWindowsFilesRCtoStable(libindyVersion) @@ -1360,14 +1389,14 @@ def publishingRCtoStable() { echo 'Moving Windows RC artifacts to Stable: libnullpay' publishLibnullpayWindowsFilesRCtoStable(libnullpayVersion) - echo 'Moving Ubuntu RC artifacts to Stable: libnullpay' - publishLibnullpayDebRCtoStable(testEnv) + echo "Moving ${env_name} RC artifacts to Stable: libnullpay" + publishLibnullpayDebRCtoStable(testEnv, env_name) echo 'Moving Windows RC artifacts to Stable: libvcx' publishLibVCXWindowsFilesRCtoStable(libvcxVersion) - echo 'Moving Ubuntu RC artifacts to Stable: libvcx' - publishLibvcxDebRCtoStable(testEnv) + echo "Moving ${env_name} RC artifacts to Stable: libvcx" + publishLibvcxDebRCtoStable(testEnv, env_name) echo 'Moving Ubuntu RC artifacts to Stable: vcx java wrapper' vcxJavaWrapperPublishing(testEnv, true) @@ -1398,6 +1427,24 @@ def publishingRCtoStable() { echo 'Moving MacOS RC artifacts to Stable: libvcx' publishLibvcxMacOSFilesRCtoStable(libvcxVersion) + + echo 'Moving RC artifacts to Stable: Build docker image for wrappers publishing' + testEnv = dockerHelpers.build('indy-sdk', 'libindy/ci/ubuntu18.dockerfile libindy/ci') + + env_name = "Ubuntu 18.04" + + echo 'Moving Ubuntu 18.04 RC artifacts to Stable: libindy' + publishLibindyDebRCtoStable(testEnv, libindyVersion, env_name) + + echo 'Moving Ubuntu 18.04 RC artifacts to Stable: indy-cli' + publishLibindyCliDebRCtoStable(testEnv, libindyVersion, env_name) + + echo 'Moving Ubuntu 18.04 RC artifacts to Stable: libnullpay' + publishLibnullpayDebRCtoStable(testEnv, env_name) + + echo 'Moving Ubuntu 18.04 RC artifacts to Stable: libvcx' + publishLibvcxDebRCtoStable(testEnv, env_name) + } finally { echo 'Moving RC artifacts to Stable: Cleanup' step([$class: 'WsCleanup']) @@ -1504,30 +1551,30 @@ def copyFilesFromRcToStable(src, target) { } } -def publishLibindyDebRCtoStable(testEnv, version) { - publishDebRCtoStable(testEnv, "libindy", "libindy", version, "libindyDebs", true) +def publishLibindyDebRCtoStable(testEnv, version, env_name) { + publishDebRCtoStable(testEnv, "libindy", "libindy", version, "libindyDebs", true, env_name) } -def publishLibindyCliDebRCtoStable(testEnv, version) { - publishDebRCtoStable(testEnv, "indy-cli", "cli", version, "libindyCliDebs", false) +def publishLibindyCliDebRCtoStable(testEnv, version, env_name) { + publishDebRCtoStable(testEnv, "indy-cli", "cli", version, "libindyCliDebs", false, env_name) } -def publishLibnullpayDebRCtoStable(testEnv) { +def publishLibnullpayDebRCtoStable(testEnv, env_name) { def libnullpayVersion = getSrcVersion("libnullpay") - publishDebRCtoStable(testEnv, "libnullpay", "libnullpay", libnullpayVersion, "libnullpayDebs", false) + publishDebRCtoStable(testEnv, "libnullpay", "libnullpay", libnullpayVersion, "libnullpayDebs", false, env_name) } -def publishLibvcxDebRCtoStable(testEnv) { +def publishLibvcxDebRCtoStable(testEnv, env_name) { def libvcxVersion = getSrcVersion("vcx/libvcx") - - publishDebRCtoStable(testEnv, "libvcx", "vcx/libvcx", libvcxVersion, "libvcxDebs", false) + publishDebRCtoStable(testEnv, "libvcx", "vcx/libvcx", libvcxVersion, "libvcxDebs", false, env_name) } -def publishDebRCtoStable(testEnv, packageName, folder, version, stashName, moveDevArtifacts) { +def publishDebRCtoStable(testEnv, packageName, folder, version, stashName, moveDevArtifacts, env_name) { testEnv.inside { def rcFullVersion = "${version}~${env.BUILD_NUMBER}" + def build_type = ubuntuPakageTypes[env_name] - unstash name: stashName + unstash name: "${stashName}${env_name}" if (packageName != "libindy") { def libindyVersion = getSrcVersion("libindy") @@ -1543,7 +1590,7 @@ def publishDebRCtoStable(testEnv, packageName, folder, version, stashName, moveD withCredentials([file(credentialsId: 'SovrinRepoSSHKey', variable: 'sovrin_key')]) { path = sh(returnStdout: true, script: 'pwd').trim() - sh "./sovrin-packaging/upload_debs.py $path $SOVRIN_SDK_REPO_NAME stable --host $SOVRIN_REPO_HOST --ssh-key $sovrin_key" + sh "./sovrin-packaging/upload_debs.py $path $SOVRIN_SDK_REPO_NAME stable --host $SOVRIN_REPO_HOST --ssh-key $sovrin_key ${build_type}" } } } diff --git a/Jenkinsfile.ci b/Jenkinsfile.ci index f629ef574a..100dc56230 100644 --- a/Jenkinsfile.ci +++ b/Jenkinsfile.ci @@ -1,8 +1,8 @@ #!groovy -libindyBuildFinished = ["Ubuntu": false, "RedHat": false] -libvcxBuildFinished = ["Ubuntu": false, "RedHat": false] +libindyBuildFinished = ["Ubuntu 16.04": false, "Ubuntu 18.04": false, "RedHat": false] +libvcxBuildFinished = ["Ubuntu 16.04": false, "Ubuntu 18.04": false, "RedHat": false] testing() @@ -24,10 +24,10 @@ def testing() { def staticValidation() { parallel([ - 'libindy' : { runValdiationRust('libindy') }, - 'libnullpay' : { runValdiationRust('libnullpay') }, - 'libvcx' : { runValdiationRust('vcx/libvcx') }, - 'cli' : { runValdiationRust('cli') } + 'libindy' : { runValdiationRust('libindy') }, + 'libnullpay': { runValdiationRust('libnullpay') }, + 'libvcx' : { runValdiationRust('vcx/libvcx') }, + 'cli' : { runValdiationRust('cli') } ]) } @@ -248,7 +248,7 @@ def androidTesting() { def iosTesting() { - def setupRustIOS ={ + def setupRustIOS = { sh "rustup target add x86_64-apple-ios" } @@ -339,17 +339,25 @@ def iosTesting() { def ubuntuTesting() { stage('Ubuntu Test') { - linuxTesting("ci/ubuntu.dockerfile ci", "Ubuntu", "pool_network") + parallel([ + "ubuntu:16.04": { + linuxTesting("ci/ubuntu.dockerfile ci", "Ubuntu 16.04", true) + }, + "ubuntu:18.04": { + linuxTesting("ci/ubuntu18.dockerfile ci", "Ubuntu 18.04", false) + } + ]) } } def rhelTesting() { stage('RedHat Test') { - linuxTesting("ci/amazon.dockerfile ci", "RedHat", "pool_network") + linuxTesting("ci/amazon.dockerfile ci", "RedHat", false) } } -def linuxTesting(file, env_name, network_name) { +def linuxTesting(file, env_name, test_wrappers) { + def network_name = "pool_network" parallel([ failFast : true, "${env_name} Test: build and test libindy": { @@ -362,36 +370,36 @@ def linuxTesting(file, env_name, network_name) { libindyBuildFinished[env_name] } def jobs = [ - "${env_name}-nodejs-test" : { - linuxModuleTesting(file, env_name, network_name, this.&linuxNodejsTesting) - }, - "${env_name}-cli-test" : { + "${env_name}-cli-test": { linuxModuleTesting(file, env_name, network_name, this.&linuxCLITesting) }, - "${env_name}-rust-test" : { - linuxModuleTesting(file, env_name, network_name, this.&linuxRustTesting) - }, - "${env_name}-vcx-test" : { - vcxTesting(file, env_name, network_name) - }, - "${env_name}-cloud-agent-test": { - linuxModuleTesting(file, env_name, network_name, this.&linuxCloudAgentTesting) + "${env_name}-vcx-test": { + vcxTesting(file, env_name, network_name, test_wrappers) } ] - if (env_name == "Ubuntu") { + if (test_wrappers) { + jobs["${env_name}-nodejs-test"] = { + linuxModuleTesting(file, env_name, network_name, this.&linuxNodejsTesting) + } + jobs["${env_name}-rust-test"] = { + linuxModuleTesting(file, env_name, network_name, this.&linuxRustTesting) + } jobs["${env_name}-java-test"] = { linuxModuleTesting(file, env_name, network_name, this.&linuxJavaTesting) } jobs["${env_name}-python-test"] = { linuxModuleTesting(file, env_name, network_name, this.&linuxPythonTesting) } + jobs["${env_name}-cloud-agent-test"] = { + linuxModuleTesting(file, env_name, network_name, this.&linuxCloudAgentTesting) + } } parallel(jobs) }, ]) } -def vcxTesting(file, env_name, network_name) { +def vcxTesting(file, env_name, network_name, test_wrappers) { parallel([ failFast : true, "${env_name} Test: build and test libvcx" : { @@ -400,23 +408,23 @@ def vcxTesting(file, env_name, network_name) { } }, "${env_name} Test: test other vcx components": { - waitUntil { - libvcxBuildFinished[env_name] - } - def jobs = [ - "${env_name}-vcx-nodejs-test": { - linuxModuleTesting(file, env_name, network_name, this.&linuxVcxNodejsTesting) - } - ] - if (env_name == "Ubuntu") { - jobs["${env_name}-vcx-java-test"] = { - linuxModuleTesting(file, env_name, network_name, this.&linuxVcxJavaTesting) - } - jobs["${env_name}-vcx-python-test"] = { - linuxModuleTesting(file, env_name, network_name, this.&linuxVcxPythonTesting) + if (test_wrappers) { + waitUntil { + libvcxBuildFinished[env_name] } + def jobs = [ + "${env_name}-vcx-nodejs-test": { + linuxModuleTesting(file, env_name, network_name, this.&linuxVcxNodejsTesting) + }, + "${env_name}-vcx-java-test" : { + linuxModuleTesting(file, env_name, network_name, this.&linuxVcxJavaTesting) + }, + "${env_name}-vcx-python-test": { + linuxModuleTesting(file, env_name, network_name, this.&linuxVcxPythonTesting) + } + ] + parallel(jobs) } - parallel(jobs) }, ]) } diff --git a/ci/deb-build-and-upload.sh b/ci/deb-build-and-upload.sh index 4e9cef258a..94dcb0fe08 100644 --- a/ci/deb-build-and-upload.sh +++ b/ci/deb-build-and-upload.sh @@ -4,7 +4,7 @@ set -e set -x if [ "$1" = "--help" ] ; then - echo "Usage: " + echo "Usage: " return fi @@ -15,6 +15,7 @@ suffix="$4" repo="$5" host="$6" key="$7" +package_type="$8" [ -z $package ] && exit 1 [ -z $version ] && exit 2 @@ -23,6 +24,7 @@ key="$7" [ -z $repo ] && exit 5 [ -z $host ] && exit 6 [ -z $key ] && exit 7 +[ -z $package_type ] && exit 8 sed -i -E -e 'H;1h;$!d;x' -e "s/$package ([(,),0-9,.]+)/$package ($version$suffix)/" debian/changelog @@ -30,4 +32,4 @@ dpkg-buildpackage -tc mkdir debs && mv ../*.deb ./debs/ -./sovrin-packaging/upload_debs.py ./debs $repo $type --host $host --ssh-key $key +./sovrin-packaging/upload_debs.py ./debs $repo $type --host $host --ssh-key $key $package_type diff --git a/libindy/ci/ubuntu18.dockerfile b/libindy/ci/ubuntu18.dockerfile new file mode 100644 index 0000000000..f38de918d5 --- /dev/null +++ b/libindy/ci/ubuntu18.dockerfile @@ -0,0 +1,46 @@ +FROM ubuntu:18.04 + +ARG uid=1000 + +RUN apt-get update && \ + apt-get install -y \ + pkg-config \ + libssl-dev \ + curl \ + build-essential \ + libsqlite3-dev \ + cmake \ + python3.5 \ + python3-pip \ + python-setuptools \ + apt-transport-https \ + ca-certificates \ + debhelper \ + wget \ + devscripts \ + libncursesw5-dev \ + libzmq3-dev + +RUN pip3 install -U \ + pip \ + setuptools \ + virtualenv \ + twine \ + plumbum \ + deb-pkg-tools + +RUN cd /tmp && \ + curl https://download.libsodium.org/libsodium/releases/old/libsodium-1.0.14.tar.gz | tar -xz && \ + cd /tmp/libsodium-1.0.14 && \ + ./configure --disable-shared && \ + make && \ + make install && \ + rm -rf /tmp/libsodium-1.0.14 + +RUN useradd -ms /bin/bash -u $uid indy +USER indy + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain 1.36.0 +ENV PATH /home/indy/.cargo/bin:$PATH + +WORKDIR /home/indy \ No newline at end of file From 9a81b74798e0e6b4fb52eb5a87e1b3c1d99261c9 Mon Sep 17 00:00:00 2001 From: "artem.ivanov" Date: Tue, 30 Jul 2019 16:46:58 +0300 Subject: [PATCH 031/320] IS-1324: Release Indy SDK 1.11.0 - release preparation Signed-off-by: artem.ivanov --- CHANGELOG.md | 32 +++ README.md | 1 + Specs/libindy/1.11.0/libindy.podspec.json | 23 ++ cli/Cargo.lock | 10 +- cli/Cargo.toml | 4 +- cli/debian/changelog | 13 +- .../migration-guide-1.1.0-1.11.0.md | 239 ++++++++++++++++++ libindy/Cargo.lock | 12 +- libindy/Cargo.toml | 2 +- libindy/debian/changelog | 20 +- libnullpay/Cargo.lock | 10 +- libnullpay/Cargo.toml | 4 +- libnullpay/debian/changelog | 2 +- vcx/README.md | 3 +- vcx/docs/migration-guide-0.2.x-0.3.0.md | 2 +- vcx/docs/migration-guide-0.3.x-0.4.0.md | 57 +++++ vcx/libvcx/Cargo.lock | 12 +- vcx/libvcx/Cargo.toml | 8 +- vcx/libvcx/debian/changelog | 15 +- vcx/wrappers/java/build.gradle | 2 +- vcx/wrappers/node/package.json | 2 +- vcx/wrappers/python3/setup.py | 2 +- wrappers/java/pom.xml | 2 +- wrappers/nodejs/package.json | 2 +- wrappers/python/setup.py | 2 +- wrappers/rust/Cargo.toml | 4 +- wrappers/rust/indy-sys/Cargo.toml | 2 +- 27 files changed, 441 insertions(+), 46 deletions(-) create mode 100644 Specs/libindy/1.11.0/libindy.podspec.json create mode 100644 docs/migration-guides/migration-guide-1.1.0-1.11.0.md create mode 100644 vcx/docs/migration-guide-0.3.x-0.4.0.md diff --git a/CHANGELOG.md b/CHANGELOG.md index 0bacf20861..695363f98d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,37 @@ # Changelog +## 1.11.0 - 2019-08-2 +* Added new Libindy Payment API functions (`indy_build_get_payment_sources_with_from_request` and `indy_parse_get_payment_sources_with_from_response`) to get payment sources with pagination support. +Old `indy_build_get_payment_sources_request` and `indy_parse_get_payment_sources_response` were marked as *Deprecated*. +*NOTE* that `indy_register_payment_method` API function was updated to accept correspondent callbacks of the new function signatures. +* Added new Libindy Payment API functions (`indy_sign_with_address` and `indy_verify_with_address`) to sign/verify a message with a payment address. +*NOTE* that `indy_register_payment_method` API function was updated to accept correspondent callbacks. +Added correspondent `payment-address sign/verify` commands to Indy CLI. +* Added new *EXPEREMENTAL* functions to get requirements and price for a ledger request. + * Libindy `indy_get_request_info` - returns request requirements (with minimal price) correspondent to specific auth rule in case the requester can perform this action. + * Libvcx `vcx_get_request_price` - returns request minimal request price for performing an action in case the requester can do it. +* Added a set of new Libvcx APIs around credentials and proofs that work with messages that should be exchanged without handling the transport of those messages. +This removes the dependency on an agency/cloud-agent and allows the user of the SDK to transport those messages themselves. +There are two types of functions: + * `vcx_*_get_request_msg` - gets a message that can be sent to the specified connection. + * `vcx_*_update_state_with_message` - checks for any state change from the given message and updates the the state attribute. +* Added new Libindy API function `indy_append_request_endorser` to append Endorser to an existing request. +It allows writing transactions to the ledger with preserving an original author but by different Endorser. +An example flow can be found here: https://github.com/hyperledger/indy-sdk/blob/master/docs/configuration.md +* Updated Indy CLI behavior to complete values for the following parameters: wallet names, pool names, dids, payment addresses. +* Updated Indy CLI behavior to work with payment addresses for `ledger payment` command and commands providing the ability to set fees for a request. +* Added new Libindy API function `indy_generate_nonce` to generate a nonce of the size recommended for usage within a proof request. +* Updated behavior of `indy_prover_create_proof` to create revocation proof based on `non_revoked` timestamps within a proof request. Now only `primary` proof can be built if `non_revoked` intervals were not requested by a verifier. +* Updated `constraint` parameter of `indy_build_auth_rule_request` Libindy Ledger API function to accept new optional `off_ledger_signature` field that specifies if a signature of unknown ledger `DID` is allowed for an action performing (false by default). +* Updated Indy-SDK CI/CD pipelines to test, to build and to publish Android artifacts for Libvcx. +* Improved state proof verification to support pagination. +* Bugfixes: + * CLI to build transactions without adding a signature. + * CLI to handle exit signals proper way. + * CLI to persist both successes and failed commands. + * Android Crash upon logging + * others minor bugfixes + ## 1.10.1 - 2019-07-15 * Updated Indy CLI to persist command history between sessions. * Bugfixes: diff --git a/README.md b/README.md index f1816d38a2..93798301c8 100644 --- a/README.md +++ b/README.md @@ -319,6 +319,7 @@ The documents that provide necessary information for Libindy migrations. * [v1.7.0 → v1.8.x](docs/migration-guides/migration-guide-1.7.0-1.8.0.md) * [v1.8.0 → v1.9.x](docs/migration-guides/migration-guide-1.8.0-1.9.0.md) * [v1.9.0 → v1.10.x](docs/migration-guides/migration-guide-1.9.0-1.10.0.md) +* [v1.10.0 → v1.11.x](docs/migration-guides/migration-guide-1.10.0-1.11.0.md) ## How to Contribute * We'd love your help; see these [instructions on how to contribute](http://bit.ly/2ugd0bq). diff --git a/Specs/libindy/1.11.0/libindy.podspec.json b/Specs/libindy/1.11.0/libindy.podspec.json new file mode 100644 index 0000000000..b5cef28d2d --- /dev/null +++ b/Specs/libindy/1.11.0/libindy.podspec.json @@ -0,0 +1,23 @@ +{ + "name": "libindy", + "version": "1.11.0", + "summary": "Summary TODO.", + "description": "Description TODO.", + "homepage": "TODO", + "license": { + "type": "Apache License 2.0", + "file": "LICENSE" + }, + "authors": { + "Daniel Hardman": "daniel.hardman@evernym.com" + }, + "platforms": { + "ios": "10.0" + }, + "source": { + "http": "https://repo.sovrin.org/ios/libindy/stable/libindy-core/1.11.0/libindy.tar.gz" + }, + "source_files": "*.h", + "vendored_libraries": "*.a", + "requires_arc": false +} diff --git a/cli/Cargo.lock b/cli/Cargo.lock index cb69e19e14..f2894356a3 100644 --- a/cli/Cargo.lock +++ b/cli/Cargo.lock @@ -244,11 +244,11 @@ dependencies = [ [[package]] name = "indy" -version = "1.10.1" +version = "1.11.0" dependencies = [ "failure 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", - "indy-sys 1.10.1", + "indy-sys 1.11.0", "lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -261,13 +261,13 @@ dependencies = [ [[package]] name = "indy-cli" -version = "1.10.1" +version = "1.11.0" dependencies = [ "ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "dirs 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "indy 1.10.1", + "indy 1.11.0", "lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", "libloading 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -286,7 +286,7 @@ dependencies = [ [[package]] name = "indy-sys" -version = "1.10.1" +version = "1.11.0" dependencies = [ "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/cli/Cargo.toml b/cli/Cargo.toml index 350c9b76c8..0b6a6cffad 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "indy-cli" -version = "1.10.1" +version = "1.11.0" authors = ["Vyacheslav Gudkov "] [features] @@ -28,4 +28,4 @@ serde_json = "1.0.40" serde_derive = "1.0.97" term = "0.4.6" rpassword = "1.0.0" -indy = { version = "1.10.0", path = "../wrappers/rust/" } +indy = { version = "1.11.0", path = "../wrappers/rust/" } diff --git a/cli/debian/changelog b/cli/debian/changelog index 6802309083..bb05b563fc 100644 --- a/cli/debian/changelog +++ b/cli/debian/changelog @@ -1,7 +1,18 @@ -indy-cli (1.10.1) unstable; urgency=medium +indy-cli (1.11.0) unstable; urgency=medium [ Hyperledger ] +## 1.11.0 +* Added new `payment-address sign/verify` commands to sign/verify a message with a payment address. +* Updated Indy CLI behavior to complete values for the following parameters: wallet names, pool names, dids, payment addresses. +* Updated behavior to work with payment addresses for `ledger payment` command and commands providing the ability to set fees for a request. +* Updated `constraint` parameter of `ledger auth-rule` command to accept optional `off_ledger_signature` field that specifies if a signature of unknown `DID` is allowed for an action performing (false by default). +* Bugfixes: + * CLI to build transactions without adding a signature. + * CLI to handle exit signals proper way. + * CLI to persist both successes and failed commands. + * others minor bugfixes + ## 1.10.1 * Updated behavior to persist command history between sessions. * Bugfixes: diff --git a/docs/migration-guides/migration-guide-1.1.0-1.11.0.md b/docs/migration-guides/migration-guide-1.1.0-1.11.0.md new file mode 100644 index 0000000000..f0c4f8e6ec --- /dev/null +++ b/docs/migration-guides/migration-guide-1.1.0-1.11.0.md @@ -0,0 +1,239 @@ + + +# Libindy 1.10 to 1.11 migration Guide + +This document is written for developers using Libindy to provide necessary information and +to simplify their transition to Libindy 1.11 from Libindy 1.10. If you are using older Libindy +version you can check migration guides history: + +* [Libindy 1.3 to 1.4 migration](https://github.com/hyperledger/indy-sdk/blob/v1.4.0/doc/migration-guide.md) +* [Libindy 1.4 to 1.5 migration](https://github.com/hyperledger/indy-sdk/blob/v1.5.0/doc/migration-guide-1.4.0-1.5.0.md) +* [Libindy 1.5 to 1.6 migration](https://github.com/hyperledger/indy-sdk/blob/v1.6.0/doc/migration-guide-1.5.0-1.6.0.md) +* [Libindy 1.6 to 1.7 migration](https://github.com/hyperledger/indy-sdk/blob/v1.7.0/doc/migration-guide-1.6.0-1.7.0.md) +* [Libindy 1.7 to 1.8 migration](https://github.com/hyperledger/indy-sdk/blob/v1.8.0/doc/migration-guide-1.7.0-1.8.0.md) +* [Libindy 1.8 to 1.9 migration](https://github.com/hyperledger/indy-sdk/blob/v1.9.0/doc/migration-guide-1.8.0-1.9.0.md) +* [Libindy 1.9 to 1.10 migration](https://github.com/hyperledger/indy-sdk/blob/v1.10.0/doc/migration-guide-1.9.0-1.10.0.md) + +## Table of contents + +* [Notes](#notes) +* [Libindy 1.10 to 1.11 migration](#libindy-110-to-111-migration-guide) + * [Payment API](#payment-api) + * [Anoncreds API](#anoncreds-api) + * [Ledger API](#ledger-api) + +## Notes + +Migration information is organized in tables, there are mappings for each Libindy API part of how older version functionality maps to a newer one. +Functions from older version are listed in the left column, and the equivalent newer version function is placed in the right column: + +* If some function had been added, the word 'NEW' would be placed in the left column. +* If some function had been deleted, the word 'DELETED' would be placed in the right column. +* If some function had been deprecated, the word 'DEPRECATED' would be placed in the right column. +* If some function had been changed, the current format would be placed in the right column. +* If some function had not been changed, the symbol '=' would be placed in the right column. +* To get more details about current format of a function click on the description above it. +* Bellow are signatures of functions in Libindy C API. + The params of ```cb``` (except command_handle and err) will be result values of the similar function in any Libindy wrapper. + +## Libindy 1.10 to 1.11 migration Guide + +### Payment API + +#### Changes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
v1.10.0 - Payment APIv1.11.0 - Payment API
+ + Signs a message with a payment address. + +
+ NEW + +
+indy_sign_with_address(command_handle: CommandHandle,
+                       wallet_handle: WalletHandle,
+                       address: *const c_char,
+                       message_raw: *const u8,
+                       message_len: u32,
+                       cb: fn(command_handle_: CommandHandle,
+                              err: ErrorCode,
+                              signature_raw: *const u8,
+                              signature_len: u32))
+      
+
+ + Verify a signature with a payment address. + +
+ NEW + +
+indy_verify_with_address(command_handle: CommandHandle,
+                         address: *const c_char,
+                         message_raw: *const u8,
+                         message_len: u32,
+                         signature_raw: *const u8,
+                         signature_len: u32,
+                         cb: fn(command_handle_: CommandHandle,
+                                err: ErrorCode,
+                                result: bool))
+      
+
+ + Builds Indy request for getting sources list for payment address according to this payment method. + +
+ NEW + +
+indy_build_get_payment_sources_with_from_request(command_handle: CommandHandle,
+                                                 wallet_handle: WalletHandle,
+                                                 submitter_did: *const c_char,
+                                                 payment_address: *const c_char,
+                                                 from: i64,
+                                                 cb: fn(command_handle_: CommandHandle,
+                                                        err: ErrorCode,
+                                                        get_sources_txn_json: *const c_char,
+                                                        payment_method: *const c_char))
+      
+
+ + Parses response for Indy request for getting sources list. + +
+ NEW + +
+indy_parse_get_payment_sources_with_from_response(command_handle: CommandHandle,
+                                                  payment_method: *const c_char,
+                                                  resp_json: *const c_char,
+                                                  cb: fn(command_handle_: CommandHandle,
+                                                         err: ErrorCode,
+                                                         sources_json: *const c_char,
+                                                         next: i64))
+      
+
+ + Builds Indy request for getting sources list for payment address according to this payment method. + +
+
+indy_build_get_payment_sources_request(command_handle: CommandHandle,
+                                       wallet_handle: WalletHandle,
+                                       submitter_did: *const c_char,
+                                       payment_address: *const c_char,
+                                       cb: fn(command_handle_: CommandHandle,
+                                              err: ErrorCode,
+                                              get_sources_txn_json: *const c_char,
+                                              payment_method: *const c_char))
+      
+
+ DEPRECATED +
+ + Parses response for Indy request for getting sources list. + +
+
+indy_parse_get_payment_sources_response(command_handle: CommandHandle,
+                                       payment_method: *const c_char,
+                                       resp_json: *const c_char,
+                                       cb: fn(command_handle_: CommandHandle,
+                                              err: ErrorCode,
+                                              sources_json: *const c_char))
+      
+
+ DEPRECATED +
+ + Gets request requirements (with minimal price) correspondent to specific auth rule in case the requester can perform this action. + +
+ NEW + +
+indy_get_request_info(command_handle: CommandHandle,
+                      get_auth_rule_response_json: *const c_char,
+                      requester_info_json: *const c_char,
+                      fees_json: *const c_char,
+                      cb: fn(command_handle_: CommandHandle,
+                             err: ErrorCode,
+                             request_info_json: *const c_char))
+      
+
+ +**Note** that `indy_register_payment_method` Payment API function was updated to accept: +* an additional callbacks correspondent to new functions to sign/verify a message with a payment address. +* callbacks of new format for functions to get payment sources with pagination support. + +### Anoncreds API + +* Updated behavior of `indy_prover_create_proof` to create revocation proof based on `non_revoked` timestamps within a proof request. +Now only `primary` proof can be built if `non_revoked` intervals were not requested by a verifier. +An example test can be found here: `indy-sdk/libindy/tests/anoncreds_demos.rs/anoncreds_works_for_requested_proof_with_revocation_but_provided_primary_only` + +* Added new Libindy API function `indy_generate_nonce` to generate a nonce of the size recommended for usage within a proof request. +An example test can be found here: `indy-sdk/libindy/tests/anoncreds_demos.rs/anoncreds_works_for_single_issuer_single_prover` + +### Ledger API + +* Updated `constraint` parameter of `indy_build_auth_rule_request` Libindy Ledger API function to accept new optional `off_ledger_signature` field that specifies if a signature of unknown ledger `DID` is allowed for an action performing (false by default). + +* Added new function `indy_append_request_endorser` to append Endorser to an existing request. +It allows writing transactions to the ledger with preserving an original author but by different Endorser. +An example flow can be found [here](../configuration.md) +An example test can be found here: `indy-sdk/libindy/tests/ledger.rs/indy_send_request_by_endorser_works` diff --git a/libindy/Cargo.lock b/libindy/Cargo.lock index aa5ee24973..f77e68fc01 100644 --- a/libindy/Cargo.lock +++ b/libindy/Cargo.lock @@ -556,11 +556,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "indy" -version = "1.10.1" +version = "1.11.0" dependencies = [ "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", - "indy-sys 1.10.1", + "indy-sys 1.11.0", "lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", @@ -573,7 +573,7 @@ dependencies = [ [[package]] name = "indy-sys" -version = "1.10.1" +version = "1.11.0" dependencies = [ "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", @@ -621,7 +621,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "libindy" -version = "1.10.1" +version = "1.11.0" dependencies = [ "android_logger 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", "backtrace 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)", @@ -636,8 +636,8 @@ dependencies = [ "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", "hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "indy 1.10.1", - "indy-sys 1.10.1", + "indy 1.11.0", + "indy-sys 1.11.0", "int_traits 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/libindy/Cargo.toml b/libindy/Cargo.toml index 5f7ac559e8..76d85ec09b 100644 --- a/libindy/Cargo.toml +++ b/libindy/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "libindy" -version = "1.10.1" +version = "1.11.0" authors = [ "Sergej Pupykin ", "Vyacheslav Gudkov ", diff --git a/libindy/debian/changelog b/libindy/debian/changelog index 229bbf9e6e..02cfd74710 100644 --- a/libindy/debian/changelog +++ b/libindy/debian/changelog @@ -1,7 +1,25 @@ -libindy (1.10.1) unstable; urgency=medium +libindy (1.11.0) unstable; urgency=medium [ Hyperledger ] +## 1.11.0 +* Added new Payment API functions (`indy_build_get_payment_sources_with_from_request` and `indy_parse_get_payment_sources_with_from_response`) to get payment sources with pagination support. +Old `indy_build_get_payment_sources_request` and `indy_parse_get_payment_sources_response` were marked as *Deprecated*. +*NOTE* that `indy_register_payment_method` API function was updated to accept correspondent callbacks of the new function signatures. +* Added new Payment API functions (`indy_sign_with_address` and `indy_verify_with_address`) to sign/verify a message with a payment address. +*NOTE* that `indy_register_payment_method` API function was updated to accept correspondent callbacks. +* Added new *EXPEREMENTAL* functions to get requirements and price for a ledger request. + * `indy_get_request_info` - returns request requirements (with minimal price) correspondent to specific auth rule in case the requester can perform this action. +* Added new API function `indy_append_request_endorser` to append Endorser to an existing request. +It allows writing transactions to the ledger with preserving an original author but by different Endorser. +An example flow can be found here: https://github.com/hyperledger/indy-sdk/blob/master/docs/configuration.md +* Added new API function `indy_generate_nonce` to generate a nonce of the size recommended for usage within a proof request. +* Updated behavior of `indy_prover_create_proof` to create revocation proof based on `non_revoked` timestamps in a proof request. Now only `primary` proof can be built if `non_revoked` intervals were not requested by a verifier. +* Updated `constraint` parameter of `indy_build_auth_rule_request` Libindy Ledger API function to accept new optional `off_ledger_signature` field that specifies if a signature of unknown `DID` is allowed for an action performing (false by default). +* Improved state proof verification to support pagination. +* Bugfixes: + * others minor bugfixes + ## 1.10.1 * Bugfixes * Fixed `State Proof` verification for GET_REVOC_REG_DELTA requests in case of from and to are before first entry. diff --git a/libnullpay/Cargo.lock b/libnullpay/Cargo.lock index 2236718d40..d575d51112 100644 --- a/libnullpay/Cargo.lock +++ b/libnullpay/Cargo.lock @@ -171,11 +171,11 @@ dependencies = [ [[package]] name = "indy" -version = "1.10.1" +version = "1.11.0" dependencies = [ "failure 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", - "indy-sys 1.10.1", + "indy-sys 1.11.0", "lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -188,7 +188,7 @@ dependencies = [ [[package]] name = "indy-sys" -version = "1.10.1" +version = "1.11.0" dependencies = [ "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", @@ -249,12 +249,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "null-payment-method" -version = "1.10.1" +version = "1.11.0" dependencies = [ "android_logger 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", "dirs 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.5.13 (registry+https://github.com/rust-lang/crates.io-index)", - "indy 1.10.1", + "indy 1.11.0", "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/libnullpay/Cargo.toml b/libnullpay/Cargo.toml index dfb3ccb847..6a3d31d89c 100644 --- a/libnullpay/Cargo.toml +++ b/libnullpay/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "null-payment-method" -version = "1.10.1" +version = "1.11.0" authors = ["Nikita Khateev "] build = "build.rs" @@ -25,7 +25,7 @@ serde_derive = "1.0.97" [dev-dependencies] dirs = "1.0.4" -indy = { version="1.10.1", path="../wrappers/rust" } +indy = { version="1.11.0", path="../wrappers/rust" } [target.'cfg(target_os = "android")'.dependencies] android_logger = "0.5" diff --git a/libnullpay/debian/changelog b/libnullpay/debian/changelog index 952993f125..4da4ca9bdd 100644 --- a/libnullpay/debian/changelog +++ b/libnullpay/debian/changelog @@ -1,4 +1,4 @@ -libnullpay (1.10.1) unstable; urgency=medium +libnullpay (1.11.0) unstable; urgency=medium [ Hyperledger ] * Initial release diff --git a/vcx/README.md b/vcx/README.md index cf0a540a6c..f6372f64a1 100644 --- a/vcx/README.md +++ b/vcx/README.md @@ -176,4 +176,5 @@ For the main workflow example check [demo](https://github.com/hyperledger/indy-s The documents that provide necessary information for Libvcx migrations. * [v0.1.x → v0.2.0](docs/migration-guide-0.1.x-0.2.0.md) -* [v0.2.x → v0.3.0](docs/migration-guide-0.2.x-0.3.0.md) \ No newline at end of file +* [v0.2.x → v0.3.0](docs/migration-guide-0.2.x-0.3.0.md) +* [v0.3.x → v0.4.0](docs/migration-guide-0.3.x-0.4.0.md) \ No newline at end of file diff --git a/vcx/docs/migration-guide-0.2.x-0.3.0.md b/vcx/docs/migration-guide-0.2.x-0.3.0.md index e951c4886f..cf1f59d39d 100644 --- a/vcx/docs/migration-guide-0.2.x-0.3.0.md +++ b/vcx/docs/migration-guide-0.2.x-0.3.0.md @@ -1,4 +1,4 @@ -# LibVCX migration guide from 0.1.x to 0.2.0 +# LibVCX migration guide from 0.2.x to 0.3.0 ## A Developer Guide for LibVCX migration diff --git a/vcx/docs/migration-guide-0.3.x-0.4.0.md b/vcx/docs/migration-guide-0.3.x-0.4.0.md new file mode 100644 index 0000000000..7c37f74862 --- /dev/null +++ b/vcx/docs/migration-guide-0.3.x-0.4.0.md @@ -0,0 +1,57 @@ +# LibVCX migration guide from 0.3.x to 0.4.0 + +## A Developer Guide for LibVCX migration + +This document is written for developers using LibVCX to provide necessary information and +to simplify their transition to LibVCX 0.4 from LibVCX 0.3.x. + +* [API]() + * [Vcx API](#vcx-api) + * [Utils API](#utils-api) + * [Wallet API](#wallet-api) + * [Credential API](#credential-api) + * [Disclosed Proof API](#disclosed-proof-api) + * [Issuer Credential API](#issuer-credential-api) + * [Proof API](#proof-api) + +### API + +Added a set of new APIs around credentials and proofs that work with messages that should be exchanged without handling the transport of those messages. +This removes the dependency on an agency/cloud-agent and allows the user of the SDK to transport those messages themselves. + + +#### Vcx API + +`vcx_init_minimal` - Initialize vcx with the minimal configuration (wallet, pool must already be set with vcx_wallet_set_handle() and vcx_pool_set_handle()) and without any agency configuration + + +#### Utils API + +`vcx_pool_set_handle` - Set the pool handle before calling vcx_init_minimal + + +#### Wallet API + +`vcx_wallet_set_handle` - Set the wallet handle before calling vcx_init_minimal + +#### Credential API + +`vcx_credential_get_request_msg` - Get the credential request message that can be sent to the specified connection. +`vcx_credential_update_state_with_message` - Checks for any state change from the given message and updates the the state attribute. + + +#### Disclosed Proof API + +`vcx_disclosed_proof_get_proof_msg` - Get the proof message for sending. +`vcx_disclosed_proof_update_state_with_message` - Checks for any state change from the given message and updates the the state attribute. + + +#### Issuer Credential API + +`vcx_issuer_get_credential_offer_msg` - Send a credential offer to user showing what will be included in the actual credential. +`vcx_issuer_get_credential_msg` - Send Credential that was requested by user. + + +#### Proof API + +`vcx_proof_get_request_msg` - Get the proof request message. \ No newline at end of file diff --git a/vcx/libvcx/Cargo.lock b/vcx/libvcx/Cargo.lock index 7f0f4fc620..8e14215a39 100644 --- a/vcx/libvcx/Cargo.lock +++ b/vcx/libvcx/Cargo.lock @@ -504,11 +504,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "indy" -version = "1.10.1" +version = "1.11.0" dependencies = [ "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)", - "indy-sys 1.10.1", + "indy-sys 1.11.0", "lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -521,7 +521,7 @@ dependencies = [ [[package]] name = "indy-sys" -version = "1.10.1" +version = "1.11.0" dependencies = [ "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", @@ -583,7 +583,7 @@ dependencies = [ [[package]] name = "libvcx" -version = "0.3.2" +version = "0.4.0" dependencies = [ "android_logger 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", "base64 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -592,8 +592,8 @@ dependencies = [ "env_logger 0.5.13 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)", - "indy 1.10.1", - "indy-sys 1.10.1", + "indy 1.11.0", + "indy-sys 1.11.0", "json 0.11.13 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/vcx/libvcx/Cargo.toml b/vcx/libvcx/Cargo.toml index efa1cb59b7..e0a33f9f2b 100644 --- a/vcx/libvcx/Cargo.toml +++ b/vcx/libvcx/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "libvcx" -version = "0.3.2" +version = "0.4.0" authors = [ "Evernym Inc." ] publish = false description = "This is the official SDK for Evernym's VCX" @@ -46,8 +46,8 @@ rmp-serde = "0.13.7" base64 = "0.8.0" openssl = "0.10" num-traits = "0.2.0" -indy = { version = "1.10.1", path = "../../wrappers/rust/" } -indy-sys = { version = "1.10.1", path = "../../wrappers/rust/indy-sys/" } +indy = { version = "1.11.0", path = "../../wrappers/rust/" } +indy-sys = { version = "1.11.0", path = "../../wrappers/rust/indy-sys/" } log-panics = "2.0.0" tokio-threadpool = "0.1.6" futures = "0.1.23" @@ -72,7 +72,7 @@ dirs = "1.0.4" [package.metadata.deb] maintainer = "Evernym, Inc." copyright = "2018, Evernym Inc." -depends = "$auto, libindy (=1.8.1)" +depends = "$auto, libindy (=1.11.0)" extended-description = """\ This is Evernym's SDK for managing Verifiable Credential eXchange against an Indy network. For specific instructions on building see the README in the corresponding github repo https://github.com/evernym/sdk""" section = "admin" diff --git a/vcx/libvcx/debian/changelog b/vcx/libvcx/debian/changelog index 72752c3695..41f009c37c 100644 --- a/vcx/libvcx/debian/changelog +++ b/vcx/libvcx/debian/changelog @@ -1,7 +1,20 @@ -libvcx (0.3.2) unstable; urgency=medium +libvcx (0.4.0) unstable; urgency=medium [ Hyperledger ] +* 0.4.0 +* Added a set of new APIs around credentials and proofs that work with messages that should be exchanged without handling the transport of those messages. +This removes the dependency on an agency/cloud-agent and allows the user of the SDK to transport those messages themselves. +There are two types of functions: + * `vcx_*_get_request_msg` - gets a message that can be sent to the specified connection. + * `vcx_*_update_state_with_message` - checks for any state change from the given message and updates the the state attribute. +* Added new *EXPEREMENTAL* functions to get requirements and price for a ledger request. + * `vcx_get_request_price` - returns request minimal request price for performing an action in case the requester can do it. +* Updated Indy-SDK CI/CD pipelines to test, to build and to publish Android artifacts for Libvcx. +* Bugfixes: + * Android Crash upon logging + * others minor bugfixes + * 0.3.2 * Bugfixes diff --git a/vcx/wrappers/java/build.gradle b/vcx/wrappers/java/build.gradle index b4dc365dba..96d4f48f3a 100755 --- a/vcx/wrappers/java/build.gradle +++ b/vcx/wrappers/java/build.gradle @@ -25,7 +25,7 @@ test { } static def versionMajor() { - return '0.3.2' + return '0.4.0' } static def version() { diff --git a/vcx/wrappers/node/package.json b/vcx/wrappers/node/package.json index d9b8a48d39..5d790a6502 100644 --- a/vcx/wrappers/node/package.json +++ b/vcx/wrappers/node/package.json @@ -20,7 +20,7 @@ "url": "git+https://github.com/evernym/vcx.git", "type": "git" }, - "version": "0.3.2", + "version": "0.4.0", "dependencies": { "@types/ffi": "0.0.19", "@types/node": "^8.0.47", diff --git a/vcx/wrappers/python3/setup.py b/vcx/wrappers/python3/setup.py index 8257eecc92..4b095f0416 100755 --- a/vcx/wrappers/python3/setup.py +++ b/vcx/wrappers/python3/setup.py @@ -1,7 +1,7 @@ from setuptools import setup, find_packages import os -PKG_VERSION = os.environ.get('PACKAGE_VERSION') or '0.3.2' +PKG_VERSION = os.environ.get('PACKAGE_VERSION') or '0.4.0' PKG_NAME = os.environ.get('PACKAGE_NAME') or 'python3-wrapper-vcx' setup( diff --git a/wrappers/java/pom.xml b/wrappers/java/pom.xml index 84332c3726..4e1bdd4bc9 100644 --- a/wrappers/java/pom.xml +++ b/wrappers/java/pom.xml @@ -5,7 +5,7 @@ org.hyperledger indy jar - 1.10.1 + 1.11.0 indy This is the official SDK for Hyperledger Indy (https://www.hyperledger.org/projects), which provides a distributed-ledger-based foundation for self-sovereign identity (https://sovrin.org). diff --git a/wrappers/nodejs/package.json b/wrappers/nodejs/package.json index 29076e3ebb..d3d2b86698 100644 --- a/wrappers/nodejs/package.json +++ b/wrappers/nodejs/package.json @@ -1,6 +1,6 @@ { "name": "indy-sdk", - "version": "1.10.1", + "version": "1.11.0", "description": "Native bindings for hyperledger indy", "author": "hyperledger", "license": "Apache-2.0", diff --git a/wrappers/python/setup.py b/wrappers/python/setup.py index 598339f932..4b96e44d44 100644 --- a/wrappers/python/setup.py +++ b/wrappers/python/setup.py @@ -1,7 +1,7 @@ from distutils.core import setup import os -PKG_VERSION = os.environ.get('PACKAGE_VERSION') or '1.10.1' +PKG_VERSION = os.environ.get('PACKAGE_VERSION') or '1.11.0' TEST_DEPS = [ 'pytest<3.7', 'pytest-asyncio', 'base58' diff --git a/wrappers/rust/Cargo.toml b/wrappers/rust/Cargo.toml index 98e96a4088..cc54afef09 100644 --- a/wrappers/rust/Cargo.toml +++ b/wrappers/rust/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "indy" -version = "1.10.1" +version = "1.11.0" description = "A library for assisting developers using LibIndy API" authors = ["Mike Lodder ", "Matt Raffel ", @@ -29,7 +29,7 @@ lazy_static = "0.2" log = { version = "0.4.1", features = ["std"] } num-traits = "0.2" num-derive = "0.2" -indy-sys = { path ="indy-sys", version = "=1.10.1" } +indy-sys = { path ="indy-sys", version = "=1.11.0" } libc = "=0.2.60" serde_json = "1.0.40" serde_derive = "1.0.97" diff --git a/wrappers/rust/indy-sys/Cargo.toml b/wrappers/rust/indy-sys/Cargo.toml index 056caca68a..41143a8b8e 100644 --- a/wrappers/rust/indy-sys/Cargo.toml +++ b/wrappers/rust/indy-sys/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "indy-sys" description = "FFI bindings to Libindy C API" -version = "1.10.1" +version = "1.11.0" authors = ["Mike Lodder "] build = "build.rs" links = "indy" From 6de43239cbfb94be2e546f06ff484e5f702754d6 Mon Sep 17 00:00:00 2001 From: Nikita Khateev Date: Tue, 30 Jul 2019 20:20:17 +0300 Subject: [PATCH 032/320] Some samples Signed-off-by: Nikita Khateev --- samples/java/pom.xml | 2 +- samples/java/src/main/java/Endorser.java | 99 ++++++++++++++++++++++++ samples/java/src/main/java/Main.java | 1 + samples/python/src/endorser.py | 92 ++++++++++++++++++++++ samples/python/src/main.py | 3 +- 5 files changed, 195 insertions(+), 2 deletions(-) create mode 100644 samples/java/src/main/java/Endorser.java create mode 100644 samples/python/src/endorser.py diff --git a/samples/java/pom.xml b/samples/java/pom.xml index 9e1bfed75a..6834bbb61c 100644 --- a/samples/java/pom.xml +++ b/samples/java/pom.xml @@ -109,7 +109,7 @@ org.hyperledger indy - 1.8.1-dev-1039 + 1.10.1-dev-1219 diff --git a/samples/java/src/main/java/Endorser.java b/samples/java/src/main/java/Endorser.java new file mode 100644 index 0000000000..7ce372d6b3 --- /dev/null +++ b/samples/java/src/main/java/Endorser.java @@ -0,0 +1,99 @@ +import org.hyperledger.indy.sdk.anoncreds.AnoncredsResults; +import org.hyperledger.indy.sdk.pool.Pool; +import org.hyperledger.indy.sdk.wallet.Wallet; +import org.hyperledger.indy.sdk.did.Did; +import org.hyperledger.indy.sdk.did.DidJSONParameters; +import org.hyperledger.indy.sdk.did.DidResults.CreateAndStoreMyDidResult; +import org.json.JSONObject; +import utils.PoolUtils; + +import static org.hyperledger.indy.sdk.ledger.Ledger.buildNymRequest; +import static org.hyperledger.indy.sdk.ledger.Ledger.buildSchemaRequest; +import static org.hyperledger.indy.sdk.ledger.Ledger.signAndSubmitRequest; +import static org.hyperledger.indy.sdk.ledger.Ledger.submitRequest; +import static org.hyperledger.indy.sdk.ledger.Ledger.multiSignRequest; +import static org.hyperledger.indy.sdk.ledger.Ledger.appendRequestEndorser; +import static org.hyperledger.indy.sdk.anoncreds.Anoncreds.issuerCreateSchema; +import static org.junit.Assert.assertEquals; + +class Endorser { + static void demo() throws Exception { + + System.out.println("Crypto sample -> started"); + String trusteeSeed = "000000000000000000000000Trustee1"; + + // Set protocol version 2 to work with Indy Node 1.4 + Pool.setProtocolVersion(PoolUtils.PROTOCOL_VERSION).get(); + + // 1. Create and Open Pool + String poolName = PoolUtils.createPoolLedgerConfig(); + Pool pool = Pool.openPoolLedger(poolName, "{}").get(); + + // 2. Create and Open Author Wallet + String authorWalletConfig = "{\"id\":\"authorWallet\"}"; + String authorWalletCredentials = "{\"key\":\"author_wallet_key\"}"; + Wallet.createWallet(authorWalletConfig, authorWalletCredentials).get(); + Wallet authorWallet = Wallet.openWallet(authorWalletConfig, authorWalletCredentials).get(); + + // 3. Create and Open Endorser Wallet + String endorserWalletConfig = "{\"id\":\"endorserWallet\"}"; + String endorserWalletCredentials = "{\"key\":\"endorser_wallet_key\"}"; + Wallet.createWallet(endorserWalletConfig, endorserWalletCredentials).get(); + Wallet endorserWallet = Wallet.openWallet(endorserWalletConfig, endorserWalletCredentials).get(); + + // 3. Create and Open Trustee Wallet + String trusteeWalletConfig = "{\"id\":\"trusteeWallet\"}"; + String trusteeWalletCredentials = "{\"key\":\"trustee_wallet_key\"}"; + Wallet.createWallet(trusteeWalletConfig, trusteeWalletCredentials).get(); + Wallet trusteeWallet = Wallet.openWallet(trusteeWalletConfig, trusteeWalletCredentials).get(); + + // 4. Create Trustee DID + DidJSONParameters.CreateAndStoreMyDidJSONParameter theirDidJson = + new DidJSONParameters.CreateAndStoreMyDidJSONParameter(null, trusteeSeed, null, null); + CreateAndStoreMyDidResult createTheirDidResult = Did.createAndStoreMyDid(trusteeWallet, theirDidJson.toJson()).get(); + String trusteeDid = createTheirDidResult.getDid(); + + // 5. Create Author DID + CreateAndStoreMyDidResult createMyDidResult = Did.createAndStoreMyDid(authorWallet, "{}").get(); + String authorDid = createMyDidResult.getDid(); + String authorVerkey = createMyDidResult.getVerkey(); + + // 6. Create Endorser DID + createMyDidResult = Did.createAndStoreMyDid(endorserWallet, "{}").get(); + String endorserDid = createMyDidResult.getDid(); + String endorserVerkey = createMyDidResult.getVerkey(); + + // 7. Build Author Nym Request + String nymRequest = buildNymRequest(trusteeDid, authorDid, authorVerkey, null, null).get(); + + // 8. Trustee Sign Author Nym Request + String nymResponseJson = signAndSubmitRequest(pool, trusteeWallet, trusteeDid, nymRequest).get(); + + // 9. Build Endorser Nym Request + nymRequest = buildNymRequest(trusteeDid, endorserDid, endorserVerkey, null, "ENDORSER").get(); + + // 10. Trustee Sign Endorser Nym Request + nymResponseJson = signAndSubmitRequest(pool, trusteeWallet, trusteeDid, nymRequest).get(); + + // 11. Create schema with endorser + + String schemaName = "gvt"; + String schemaVersion = "1.0"; + String schemaAttributes = "[\"name\", \"age\", \"sex\", \"height\"]"; + AnoncredsResults.IssuerCreateSchemaResult createSchemaResult = + issuerCreateSchema(authorDid, schemaName, schemaVersion, schemaAttributes).get(); + String schemaId = createSchemaResult.getSchemaId(); + String schemaJson = createSchemaResult.getSchemaJson(); + + String schemaRequest = buildSchemaRequest(authorDid, schemaJson).get(); + String schemaRequestWithEndorser = appendRequestEndorser(schemaRequest, endorserDid).get(); + String schemaRequestWithEndorserAuthorSigned = + multiSignRequest(authorWallet, authorDid, schemaRequestWithEndorser).get(); + String schemaRequestWithEndorserSigned = + multiSignRequest(endorserWallet, endorserDid, schemaRequestWithEndorserAuthorSigned).get(); + String response = submitRequest(pool, schemaRequestWithEndorserSigned).get(); + JSONObject responseJson = new JSONObject(response); + + assertEquals("REPLY", responseJson.getJSONObject("op")); + } +} \ No newline at end of file diff --git a/samples/java/src/main/java/Main.java b/samples/java/src/main/java/Main.java index c885456a69..d2a6a4e6c4 100644 --- a/samples/java/src/main/java/Main.java +++ b/samples/java/src/main/java/Main.java @@ -5,5 +5,6 @@ public static void main(String[] args) throws Exception { AnoncredsRevocation.demo(); Ledger.demo(); Crypto.demo(); + Endorser.demo(); } } diff --git a/samples/python/src/endorser.py b/samples/python/src/endorser.py new file mode 100644 index 0000000000..e2e1128367 --- /dev/null +++ b/samples/python/src/endorser.py @@ -0,0 +1,92 @@ +import time +import json +import logging + +from src.utils import get_pool_genesis_txn_path, run_coroutine, PROTOCOL_VERSION + +logger = logging.getLogger(__name__) + +from indy import ledger, did, wallet, pool, anoncreds + +async def demo(): + logger.info("endorser sample -> started") + + author = { + 'wallet_config': json.dumps({'id': 'author_wallet'}), + 'wallet_credentials': json.dumps({'key': 'author_wallet_key'}) + } + endorser = { + 'wallet_config': json.dumps({"id": "endorser_wallet"}), + 'wallet_credentials': json.dumps({"key": "endorser_wallet_key"}) + } + trustee = { + 'seed': '000000000000000000000000Trustee1', + 'wallet_config': json.dumps({'id': 'trustee_wallet'}), + 'wallet_credentials': json.dumps({'key': 'trustee_wallet_key'}), + } + + # Set protocol version 2 to work with Indy Node 1.4 + await pool.set_protocol_version(PROTOCOL_VERSION) + + await wallet.create_wallet(author['wallet_config'], author['wallet_credentials']) + author['wallet'] = await wallet.open_wallet(author['wallet_config'], author['wallet_credentials']) + + await wallet.create_wallet(endorser['wallet_config'], endorser['wallet_credentials']) + endorser['wallet'] = await wallet.open_wallet(endorser['wallet_config'], endorser['wallet_credentials']) + + await wallet.create_wallet(trustee['wallet_config'], trustee['wallet_credentials']) + trustee['wallet'] = await wallet.open_wallet(trustee['wallet_config'], trustee['wallet_credentials']) + + # 2. Signer Create DID + (author['did'], author['verkey']) = await did.create_and_store_my_did(author['wallet'], "{}") + + # 3. Verifier Create DID + (endorser['did'], endorser['verkey']) = await did.create_and_store_my_did(endorser['wallet'], "{}") + + # 4. Trustee Create DID + (trustee['did'], trustee['verkey']) = \ + await did.create_and_store_my_did(trustee['wallet'], json.dumps({"seed": trustee['seed']})) + + # 5. Open pool + target_pool = { + 'pool_name': 'trustee_pool' + } + + target_pool['genesis_txn_path'] = get_pool_genesis_txn_path(target_pool['pool_name']) + target_pool['pool_config'] = json.dumps({"genesis_txn": str(target_pool['genesis_txn_path'])}) + await pool.create_pool_ledger_config(target_pool['pool_name'], target_pool['pool_config']) + target_pool['pool'] = await pool.open_pool_ledger(target_pool['pool_name'], None) + + # 5. Write DIDs to the ledger + author_nym_req = await ledger.build_nym_request(trustee['did'], author['did'], author['verkey'], None, None) + resp = await ledger.sign_and_submit_request(target_pool['pool'], trustee['wallet'], trustee['did'], author_nym_req) + + endorser_nym_req = \ + await ledger.build_nym_request(trustee['did'], endorser['did'], endorser['verkey'], None, "ENDORSER") + resp = await ledger.sign_and_submit_request(target_pool['pool'], trustee['wallet'], trustee['did'], endorser_nym_req) + + # 6. Write SCHEMA from author with endorser + schema = { + 'name': 'gvt', + 'version': '1.0', + 'attributes': '["age", "sex", "height", "name"]' + } + author['schema_id'], author['schema'] = await anoncreds.issuer_create_schema(author['did'], schema['name'], + schema['version'], + schema['attributes']) + + author_schema_req = await ledger.build_schema_request(author['did'], author['schema']) + author_schema_req_with_endorser = await ledger.append_request_endorser(author_schema_req, endorser['did']) + author_schema_req_with_endorser_signed_author = \ + await ledger.multi_sign_request(author['wallet'], author['did'], author_schema_req_with_endorser) + author_schema_req_with_endorser_signed = \ + await ledger.multi_sign_request(endorser['wallet'], endorser['did'], author_schema_req_with_endorser_signed_author) + + resp = await ledger.submit_request(target_pool['pool'], author_schema_req_with_endorser_signed) + assert json.loads(resp)['op'] == 'REPLY' + + logger.info("Crypto sample -> completed") + +if __name__ == '__main__': + run_coroutine(demo) + time.sleep(1) # FIXME waiting for libindy thread complete diff --git a/samples/python/src/main.py b/samples/python/src/main.py index 5b978fd46d..2b55a88907 100644 --- a/samples/python/src/main.py +++ b/samples/python/src/main.py @@ -1,6 +1,6 @@ import time -from src import anoncreds, anoncreds_revocation, crypto, ledger, getting_started, txn_author_agreement +from src import anoncreds, anoncreds_revocation, crypto, ledger, getting_started, txn_author_agreement, endorser from src.utils import run_coroutine @@ -12,6 +12,7 @@ async def main(): await crypto.demo() await ledger.demo() await txn_author_agreement.demo() + await endorser() if __name__ == '__main__': run_coroutine(main) From 65200acf7586ce33c9fb47d8d21cf828ff3782de Mon Sep 17 00:00:00 2001 From: Nikita Khateev Date: Wed, 31 Jul 2019 11:22:58 +0300 Subject: [PATCH 033/320] Add cleanup Signed-off-by: Nikita Khateev --- samples/java/src/main/java/Endorser.java | 12 ++++++++++++ samples/python/src/endorser.py | 12 ++++++++++++ 2 files changed, 24 insertions(+) diff --git a/samples/java/src/main/java/Endorser.java b/samples/java/src/main/java/Endorser.java index 7ce372d6b3..d811561eba 100644 --- a/samples/java/src/main/java/Endorser.java +++ b/samples/java/src/main/java/Endorser.java @@ -95,5 +95,17 @@ static void demo() throws Exception { JSONObject responseJson = new JSONObject(response); assertEquals("REPLY", responseJson.getJSONObject("op")); + + pool.closePoolLedger().get(); + Pool.deletePoolLedgerConfig(poolName).get(); + + trusteeWallet.closeWallet().get(); + Wallet.deleteWallet(trusteeWalletConfig, trusteeWalletCredentials).get(); + + authorWallet.closeWallet().get(); + Wallet.deleteWallet(authorWalletConfig, authorWalletCredentials).get(); + + endorserWallet.closeWallet().get(); + Wallet.deleteWallet(endorserWalletConfig, endorserWalletCredentials).get(); } } \ No newline at end of file diff --git a/samples/python/src/endorser.py b/samples/python/src/endorser.py index e2e1128367..a67ad5cfb2 100644 --- a/samples/python/src/endorser.py +++ b/samples/python/src/endorser.py @@ -85,6 +85,18 @@ async def demo(): resp = await ledger.submit_request(target_pool['pool'], author_schema_req_with_endorser_signed) assert json.loads(resp)['op'] == 'REPLY' + await pool.close_pool_ledger(target_pool['pool']) + await pool.delete_pool_ledger_config(target_pool['pool_name']) + + await wallet.close_wallet(trustee['wallet']) + await wallet.delete_wallet(trustee['wallet_config'], trustee['wallet_credentials']) + + await wallet.close_wallet(author['wallet']) + await wallet.delete_wallet(author['wallet_config'], author['wallet_credentials']) + + await wallet.close_wallet(endorser['wallet']) + await wallet.delete_wallet(endorser['wallet_config'], endorser['wallet_credentials']) + logger.info("Crypto sample -> completed") if __name__ == '__main__': From d0b19fa120ffc12328e493805ef5546310a7b46e Mon Sep 17 00:00:00 2001 From: Ian Costanzo Date: Wed, 31 Jul 2019 07:30:35 -0700 Subject: [PATCH 034/320] Updated lock file Signed-off-by: Ian Costanzo --- .../plugins/postgres_storage/Cargo.lock | 48 +++++++++---------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/experimental/plugins/postgres_storage/Cargo.lock b/experimental/plugins/postgres_storage/Cargo.lock index 6b60e69902..8276265db4 100644 --- a/experimental/plugins/postgres_storage/Cargo.lock +++ b/experimental/plugins/postgres_storage/Cargo.lock @@ -45,7 +45,7 @@ name = "atty" version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", "termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -63,7 +63,7 @@ dependencies = [ "autocfg 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "backtrace-sys 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-demangle 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -74,7 +74,7 @@ version = "0.1.26" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -165,7 +165,7 @@ name = "dirs" version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", "redox_users 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -193,7 +193,7 @@ version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "errno-dragonfly 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -203,7 +203,7 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "gcc 0.3.55 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -329,7 +329,7 @@ dependencies = [ "failure 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "int_traits 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "openssl 0.10.12 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)", @@ -351,7 +351,7 @@ name = "iovec" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -377,7 +377,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "libc" -version = "0.2.45" +version = "0.2.60" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -385,7 +385,7 @@ name = "libsodium-sys" version = "0.0.16" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -428,7 +428,7 @@ name = "memchr" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -437,7 +437,7 @@ version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", "version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -561,7 +561,7 @@ dependencies = [ "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", "openssl-sys 0.9.39 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -571,7 +571,7 @@ version = "0.9.39" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", "vcpkg 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -699,7 +699,7 @@ version = "0.3.22" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -709,7 +709,7 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -883,7 +883,7 @@ version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", "redox_syscall 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -893,7 +893,7 @@ name = "sodiumoxide" version = "0.0.16" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", "libsodium-sys 0.0.16 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -919,7 +919,7 @@ dependencies = [ "indy-crypto 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "int_traits 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "log-panics 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "named_type 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1005,7 +1005,7 @@ name = "termion" version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", "redox_syscall 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", "redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1023,7 +1023,7 @@ name = "time" version = "0.1.40" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", "redox_syscall 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1135,7 +1135,7 @@ name = "zmq" version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", "zmq-sys 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1145,7 +1145,7 @@ name = "zmq-sys" version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", "metadeps 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1200,7 +1200,7 @@ dependencies = [ "checksum keccak 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "67c21572b4949434e4fc1e1978b99c5f77064153c59d998bf13ecd96fb5ecba7" "checksum lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "76f033c7ad61445c5b347c7382dd1237847eb1bce590fe50365dcb33d546be73" "checksum lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a374c89b9db55895453a74c1e38861d9deec0b01b405a82516e9d5de4820dea1" -"checksum libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)" = "2d2857ec59fadc0773853c664d2d18e7198e83883e7060b63c924cb077bd5c74" +"checksum libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)" = "d44e80633f007889c7eff624b709ab43c92d708caad982295768a7b13ca3b5eb" "checksum libsodium-sys 0.0.16 (registry+https://github.com/rust-lang/crates.io-index)" = "fcbd1beeed8d44caa8a669ebaa697c313976e242c03cc9fb23d88bf1656f5542" "checksum log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "e19e8d5c34a3e0e2223db8e060f9e8264aeeb5c5fc64a4ee9965c062211c024b" "checksum log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c84ec4b527950aa83a329754b01dbe3f58361d1c5efacd1f6d68c494d08a17c6" From bf094170c512da2a8f933b56fcc518f65585eebb Mon Sep 17 00:00:00 2001 From: Axel Nennker Date: Wed, 31 Jul 2019 16:10:55 +0200 Subject: [PATCH 035/320] make clippy happy Signed-off-by: Axel Nennker --- cli/src/command_executor.rs | 38 ++--- cli/src/commands/common.rs | 17 ++- cli/src/commands/did.rs | 97 +++++++++---- cli/src/commands/ledger.rs | 218 ++++++++++++++++++---------- cli/src/commands/mod.rs | 56 +++++-- cli/src/commands/payment_address.rs | 19 ++- cli/src/commands/pool.rs | 119 +++++++++++---- cli/src/commands/wallet.rs | 201 ++++++++++++++++--------- cli/src/main.rs | 12 +- cli/src/utils/file.rs | 4 +- cli/src/utils/logger.rs | 2 +- cli/src/utils/table.rs | 2 +- 12 files changed, 532 insertions(+), 253 deletions(-) diff --git a/cli/src/command_executor.rs b/cli/src/command_executor.rs index bdd7e731a1..1c2c25a3ac 100644 --- a/cli/src/command_executor.rs +++ b/cli/src/command_executor.rs @@ -457,7 +457,7 @@ impl CommandExecutor { fn get_active_param<'a>(line: &str, cursor: usize, params: &'a [ParamMetadata]) -> Option<&'a ParamMetadata> { let line = &line[..cursor]; - let last_space_index = line.rfind(" ").unwrap_or(0); + let last_space_index = line.rfind(' ').unwrap_or(0); let line = &line[last_space_index..]; params @@ -472,10 +472,10 @@ impl CommandExecutor { }).1 } - fn command_params(&self, command: &Command, params: &Vec<&str>, line: &str, word: &str, cursor: usize) -> Vec<(String, char)> { + fn command_params(&self, command: &Command, params: &[&str], line: &str, word: &str, cursor: usize) -> Vec<(String, char)> { let mut completes: Vec<(String, char)> = Vec::new(); - if command.metadata().main_param.is_some() && (params.len() == 0 && word.is_empty() || params.len() == 1 && !word.is_empty()) { + if command.metadata().main_param.is_some() && (params.is_empty() && word.is_empty() || params.len() == 1 && !word.is_empty()) { return self._get_main_param_dynamic_completions(command, word); } @@ -541,7 +541,7 @@ impl CommandExecutor { (Some(command), None, None) => { if self.commands.contains_key(command) { let command = &self.commands[command]; - completes.extend(self.command_params(command, &vec![], line, word, cursor)); + completes.extend(self.command_params(command, &[], line, word, cursor)); return completes; } @@ -571,7 +571,7 @@ impl CommandExecutor { } if self.commands.contains_key(command) { - completes.extend(self.command_params(&self.commands[command], &vec![sub_command], line, word, cursor)); + completes.extend(self.command_params(&self.commands[command], &[sub_command], line, word, cursor)); return completes; } @@ -583,7 +583,7 @@ impl CommandExecutor { completes.push((word.to_owned(), ' ')); } - completes.extend(self.command_params(sub_command, &vec![], line, word, cursor)); + completes.extend(self.command_params(sub_command, &[], line, word, cursor)); return completes; } @@ -696,14 +696,14 @@ impl CommandExecutor { println!(); println_acc!("Command groups are:"); - for (_, &(ref group, _)) in &self.grouped_commands { + for &(ref group, _) in self.grouped_commands.values() { println!("\t{} - {}", group.metadata().name(), group.metadata().help()) } println!(); println_acc!("Top level commands are:"); - for (_, ref command) in &self.commands { + for command in self.commands.values() { println!("\t{} - {}", command.metadata().name(), command.metadata().help()) } @@ -722,7 +722,7 @@ impl CommandExecutor { println!(); println_acc!("Group commands are:"); - for (_, ref command) in commands { + for command in commands.values() { println!("\t{} - {}", command.metadata().name(), command.metadata().help()) } @@ -762,7 +762,7 @@ impl CommandExecutor { println!(); - if command.metadata().main_param().is_some() || command.metadata().params().len() > 0 { + if command.metadata().main_param().is_some() || !command.metadata().params().is_empty() { println!(); println_acc!("Parameters are:"); @@ -785,7 +785,7 @@ impl CommandExecutor { } } - if command.metadata().examples().len() > 0 { + if !command.metadata().examples().is_empty() { println!(); println_acc!("Examples:"); @@ -905,12 +905,12 @@ impl CommandExecutor { let first_word = parts.next(); let mut second_word = parts.next(); let mut params = parts - .map(|s| s.split("=").collect::>()[0]) + .map(|s| s.split('=').collect::>()[0]) .collect::>(); if let Some(s_word) = second_word { - if s_word.contains("=") { - params.insert(0, s_word.split("=").collect::>()[0]); + if s_word.contains('=') { + params.insert(0, s_word.split('=').collect::>()[0]); second_word = None; } } @@ -919,7 +919,7 @@ impl CommandExecutor { } fn _trim_quotes(s: &str) -> &str { - if s.len() > 1 && s.starts_with("\"") && s.ends_with("\"") { + if s.len() > 1 && s.starts_with('\"') && s.ends_with('\"') { &s[1..s.len() - 1] } else { s @@ -929,12 +929,12 @@ impl CommandExecutor { impl Drop for CommandExecutor { fn drop(&mut self) { - for (_, command) in &self.commands { + for command in self.commands.values() { command.cleanup(&self.ctx); } - for (_, commands) in &self.grouped_commands { - for (_, command) in &commands.1 { + for commands in self.grouped_commands.values() { + for command in commands.1.values() { command.cleanup(&self.ctx); } } @@ -1016,7 +1016,7 @@ pub fn wait_for_user_reply(ctx: &CommandContext) -> bool { continue } } - return false; + false } #[cfg(test)] diff --git a/cli/src/commands/common.rs b/cli/src/commands/common.rs index b1964f2479..1ecc3aab4b 100644 --- a/cli/src/commands/common.rs +++ b/cli/src/commands/common.rs @@ -95,11 +95,11 @@ pub mod load_plugin_command { let library = get_str_param("library", params).map_err(error_err!())?; let initializer = get_str_param("initializer", params).map_err(error_err!())?; - let res = load_plugin(_ctx, library, initializer)?; + load_plugin(_ctx, library, initializer)?; - trace!("execute << {:?}", res); + trace!("execute << "); - Ok(res) + Ok(()) } } @@ -116,14 +116,14 @@ pub mod init_logger_command { let file = get_str_param("file", params).map_err(error_err!())?; - let res = match logger::IndyCliLogger::init(&file){ + match logger::IndyCliLogger::init(&file){ Ok(()) => println_succ!("Logger has been initialized according to the config file: \"{}\"", file), Err(err) => println_err!("{}", err) }; - trace!("execute << {:?}", res); + trace!("execute << "); - Ok(res) + Ok(()) } } @@ -137,7 +137,10 @@ pub fn load_plugin(ctx: &CommandContext, library: &str, initializer: &str) -> Re match init_func() { ErrorCode::Success => println_succ!("Plugin has been loaded: \"{}\"", library), - _ => return Err(println_err!("Plugin has not been loaded: \"{}\"", library)) + _ => { + println_err!("Plugin has not been loaded: \"{}\"", library); + return Err(()) + } } } diff --git a/cli/src/commands/did.rs b/cli/src/commands/did.rs index 5fa0a7c201..f9e4b09b7b 100644 --- a/cli/src/commands/did.rs +++ b/cli/src/commands/did.rs @@ -72,15 +72,24 @@ pub mod new_command { println_succ!("Did \"{}\" has been created with \"{}\" verkey", did, vk); Ok(did) } - Err(err) => Err(handle_indy_error(err, None, None, None)) + Err(err) => { + handle_indy_error(err, None, None, None); + Err(()) + } }; let res = if let Some(metadata) = metadata { res.and_then(|did| { let res = Did::set_metadata(wallet_handle, &did, metadata); match res { - Ok(()) => Ok(println_succ!("Metadata has been saved for DID \"{}\"", did)), - Err(err) => Err(handle_indy_error(err, None, None, None)) + Ok(()) => { + println_succ!("Metadata has been saved for DID \"{}\"", did); + Ok(()) + }, + Err(err) => { + handle_indy_error(err, None, None, None); + Err(()) + } } }) } else { @@ -150,14 +159,16 @@ pub mod import_command { }) }); - let res = if let Err(err) = res { - Err(println_err!("{}", err)) + if let Err(err) = res { + println_err!("{}", err); + Err(()) } else { - Ok(println_succ!("DIDs import finished")) + println_succ!("DIDs import finished"); + Ok(()) }; - trace!("execute << {:?}", res); - res + trace!("execute << "); + Ok(()) } } @@ -179,12 +190,19 @@ pub mod use_command { let res = match Did::get_did_with_meta(wallet_handle, did) { Ok(_) => { set_active_did(ctx, Some(did.to_owned())); - Ok(println_succ!("Did \"{}\" has been set as active", did)) + println_succ!("Did \"{}\" has been set as active", did); + Ok(()) } Err(err) => { match err.error_code { - ErrorCode::WalletItemNotFound => Err(println_err!("Requested DID not found")), - _ => Err(handle_indy_error(err, Some(&did), None, None)), + ErrorCode::WalletItemNotFound => { + println_err!("Requested DID not found"); + Err(()) + }, + _ => { + handle_indy_error(err, Some(&did), None, None); + Err(()) + }, } } }; @@ -231,11 +249,17 @@ pub mod rotate_key_command { .and_then(|did_info| { let temp_verkey = match did_info["tempVerkey"].as_str() { Some(temp_verkey) => Ok(temp_verkey.to_owned()), - None => Err(println_err!("Unable to resume, have you already run rotate-key?")) + None => { + println_err!("Unable to resume, have you already run rotate-key?"); + Err(()) + } }?; let verkey = match did_info["verkey"].as_str() { Some(verkey) => Ok(verkey.to_owned()), - None => Err(println_err!("Fatal error, no verkey in wallet")) + None => { + println_err!("Fatal error, no verkey in wallet"); + Err(()) + } }?; Ok((temp_verkey, verkey)) }) @@ -269,10 +293,14 @@ pub mod rotate_key_command { Ok((temp_verkey, true)) } else { // some invalid state - Err(println_err!("Unable to resume, verkey on ledger is completely different from verkey in wallet")) + println_err!("Unable to resume, verkey on ledger is completely different from verkey in wallet"); + Err(()) } } - None => Err(println_err!("No verkey on ledger for did: {}", did)) + None => { + println_err!("No verkey on ledger for did: {}", did); + Err(()) + } }? } else { let identity_json = { @@ -285,8 +313,14 @@ pub mod rotate_key_command { Ok(request) => Ok(request), Err(err) => { match err.error_code { - ErrorCode::WalletItemNotFound => Err(println_err!("Active DID: \"{}\" not found", did)), - _ => Err(handle_indy_error(err, Some(&did), Some(&pool_name), Some(&wallet_name))), + ErrorCode::WalletItemNotFound => { + println_err!("Active DID: \"{}\" not found", did); + Err(()) + }, + _ => { + handle_indy_error(err, Some(&did), Some(&pool_name), Some(&wallet_name)); + Err(()) + }, } } }?; @@ -323,14 +357,21 @@ pub mod rotate_key_command { match Did::replace_keys_apply(wallet_handle, &did) .and_then(|_| Did::abbreviate_verkey(&did, &new_verkey)) { - Ok(vk) => Ok({ + Ok(vk) => { println_succ!("Verkey for did \"{}\" has been updated", did); - println_succ!("New verkey is \"{}\"", vk) - }), + println_succ!("New verkey is \"{}\"", vk); + Ok(()) + }, Err(err) => { match err.error_code { - ErrorCode::WalletItemNotFound => Err(println_err!("Active DID: \"{}\" not found", did)), - _ => Err(handle_indy_error(err, Some(&did), Some(&pool_name), Some(&wallet_name))), + ErrorCode::WalletItemNotFound => { + println_err!("Active DID: \"{}\" not found", did); + Err(()) + }, + _ => { + handle_indy_error(err, Some(&did), Some(&pool_name), Some(&wallet_name)); + Err(()) + }, } } }?; @@ -376,12 +417,15 @@ pub mod list_command { match Did::abbreviate_verkey(did_info["did"].as_str().unwrap_or(""), did_info["verkey"].as_str().unwrap_or("")) { Ok(vk) => did_info["verkey"] = serde_json::Value::String(vk), - Err(err) => return Err(handle_indy_error(err, None, None, None)) + Err(err) => { + handle_indy_error(err, None, None, None); + return Err(()) + } } } print_list_table(&dids, - &vec![("did", "Did"), + &[("did", "Did"), ("verkey", "Verkey"), ("metadata", "Metadata")], "There are no dids"); @@ -390,7 +434,10 @@ pub mod list_command { } Ok(()) } - Err(err) => Err(handle_indy_error(err, None, None, None)), + Err(err) => { + handle_indy_error(err, None, None, None); + Err(()) + }, }; trace!("execute << {:?}", res); diff --git a/cli/src/commands/ledger.rs b/cli/src/commands/ledger.rs index cd61b08765..c946771199 100644 --- a/cli/src/commands/ledger.rs +++ b/cli/src/commands/ledger.rs @@ -20,9 +20,9 @@ use utils::file::{read_file, write_file}; use self::regex::Regex; use self::chrono::prelude::*; -pub const DELIMITER: &'static str = ":"; -pub const SCHEMA_MARKER: &'static str = "2"; -pub const CRED_DEF_MARKER: &'static str = "3"; +pub const DELIMITER: &str = ":"; +pub const SCHEMA_MARKER: &str = "2"; +pub const CRED_DEF_MARKER: &str = "3"; pub const SIGN_REQUEST: bool = true; pub const SEND_REQUEST: bool = true; @@ -128,7 +128,8 @@ pub mod nym_command { let change_nym = ::command_executor::wait_for_user_reply(ctx); if !change_nym { - return Ok(println!("The transaction has not been sent.")); + println!("The transaction has not been sent."); + return Ok(()); } } } @@ -153,7 +154,7 @@ pub mod nym_command { .map(|result| print_transaction_response(result, "Nym request has been sent to Ledger.", None, - &mut vec![("dest", "Did"), + &[("dest", "Did"), ("verkey", "Verkey"), ("role", "Role")], true))?; @@ -196,7 +197,10 @@ pub mod get_nym_command { data["role"] = get_role_title(&data["role"]); result["data"] = data; } - Err(_) => return Err(println_err!("NYM not found")) + Err(_) => { + println_err!("NYM not found"); + return Err(()) + } }; }; @@ -318,7 +322,10 @@ pub mod get_attrib_command { let data = result["data"].as_str().map(|data| serde_json::Value::String(data.to_string())); match data { Some(data) => { result["data"] = data; } - None => return Err(println_err!("Attribute not found")) + None => { + println_err!("Attribute not found"); + return Err(()) + } }; }; @@ -511,7 +518,8 @@ pub mod get_schema_command { if let Some(result) = response.result.as_ref() { if !result["seqNo"].is_i64() { - return Err(println_err!("Schema not found")); + println_err!("Schema not found"); + return Err(()); } }; @@ -579,7 +587,7 @@ pub mod cred_def_command { json.insert("schemaId".to_string(), JSONValue::from(schema_id)); json.insert("type".to_string(), JSONValue::from(signature_type)); json.insert("tag".to_string(), JSONValue::from(tag)); - json.insert("value".to_string(), JSONValue::from(cred_def_value)); + json.insert("value".to_string(), cred_def_value); JSONValue::from(json).to_string() }; @@ -642,7 +650,8 @@ pub mod get_cred_def_command { if let Some(result) = response.result.as_ref() { if !result["seqNo"].is_i64() { - return Err(println_err!("Credential Definition not found")); + println_err!("Credential Definition not found"); + return Err(()); } }; @@ -978,7 +987,8 @@ pub mod custom_command { let use_transaction = ::command_executor::wait_for_user_reply(ctx); if !use_transaction { - return Ok(println!("No transaction has been send.")); + println!("No transaction has been send."); + return Ok(()); } transaction = txn_.to_string(); @@ -1013,11 +1023,20 @@ pub mod custom_command { let res = match response { Response { op: ResponseType::REPLY, result: Some(_), reason: None } => - Ok(println!("Response: \n{}", response_json)), + { + println!("Response: \n{}", response_json); + Ok(()) + }, Response { op: ResponseType::REQNACK, result: None, reason: Some(reason) } | Response { op: ResponseType::REJECT, result: None, reason: Some(reason) } => - Err(println_err!("Transaction has been rejected: {}", extract_error_message(&reason))), - _ => Err(println_err!("Invalid data has been received")) + { + println_err!("Transaction has been rejected: {}", extract_error_message(&reason)); + Err(()) + }, + _ => { + println_err!("Invalid data has been received"); + Err(()) + } }; trace!("execute << {:?}", res); @@ -1054,14 +1073,17 @@ pub mod get_payment_sources_command { .map_err(|_| println_err!("Wrong data has been received"))?; print_list_table(&sources, - &vec![("source", "Source"), + &[("source", "Source"), ("paymentAddress", "Payment Address"), ("amount", "Amount"), ("extra", "Extra")], "There are no source's"); Ok(()) } - Err(err) => Err(println_err!("Invalid data has been received: {:?}", err)), + Err(err) => { + println_err!("Invalid data has been received: {:?}", err); + Err(()) + }, }; trace!("execute << {:?}", res); @@ -1129,14 +1151,17 @@ pub mod payment_command { .map_err(|_| println_err!("Wrong data has been received"))?; print_list_table(&receipts, - &vec![("receipt", "Receipt"), + &[("receipt", "Receipt"), ("recipient", "Recipient Payment Address"), ("amount", "Amount"), ("extra", "Extra")], "There are no receipts's"); Ok(()) } - Err(err) => Err(handle_payment_error(err, None)), + Err(err) => { + handle_payment_error(err, None); + Err(()) + }, }; trace!("execute << {:?}", res); @@ -1183,13 +1208,16 @@ pub mod get_fees_command { .collect::>(); print_list_table(&fees, - &vec![("type", "Transaction"), + &[("type", "Transaction"), ("amount", "Amount")], "There are no fees"); Ok(()) } - Err(err) => Err(handle_payment_error(err, None)), + Err(err) => { + handle_payment_error(err, None); + Err(()) + }, }; trace!("execute << {:?}", res); @@ -1301,7 +1329,10 @@ pub mod verify_payment_receipt_command { println!("{}", info_json); Ok(()) } - Err(err) => Err(handle_payment_error(err, None)), + Err(err) => { + handle_payment_error(err, None); + Err(()) + }, }; trace!("execute << {:?}", res); @@ -1335,7 +1366,8 @@ pub mod sign_multi_command { let use_transaction = ::command_executor::wait_for_user_reply(ctx); if !use_transaction { - return Ok(println!("No transaction has been signed.")); + println!("No transaction has been signed."); + return Ok(()); } txn_.to_string() @@ -1356,8 +1388,14 @@ pub mod sign_multi_command { } Err(err) => { match err.error_code { - ErrorCode::WalletItemNotFound => Err(println_err!("Signer DID: \"{}\" not found", submitter_did)), - _ => Err(handle_indy_error(err, Some(&submitter_did), None, None)), + ErrorCode::WalletItemNotFound => { + println_err!("Signer DID: \"{}\" not found", submitter_did); + Err(()) + }, + _ => { + handle_indy_error(err, Some(&submitter_did), None, None); + Err(()) + }, } } }; @@ -1424,11 +1462,11 @@ pub mod auth_rule_command { result["txn"]["data"]["constraint"] = serde_json::Value::String(::serde_json::to_string_pretty(&result["txn"]["data"]["constraint"]).unwrap()); } - let res = handle_transaction_response(response) + handle_transaction_response(response) .map(|result| print_transaction_response(result, "Auth Rule request has been sent to Ledger.", None, - &mut vec![("auth_type", "Txn Type"), + &[("auth_type", "Txn Type"), ("auth_action", "Action"), ("field", "Field"), ("old_value", "Old Value"), @@ -1436,8 +1474,8 @@ pub mod auth_rule_command { ("constraint", "Constraint")], false))?; - trace!("execute << {:?}", res); - Ok(res) + trace!("execute << "); + Ok(()) } } @@ -1471,10 +1509,10 @@ pub mod auth_rules_command { let rules: AuthRulesData = serde_json::from_value(result["txn"]["data"]["rules"].clone()) .map_err(|_| println_err!("Wrong data has been received"))?; - let res = print_auth_rules(rules); + print_auth_rules(rules); - trace!("execute << {:?}", res); - Ok(res) + trace!("execute << "); + Ok(()) } } @@ -1528,10 +1566,10 @@ pub mod get_auth_rule_command { let rules: AuthRulesData = serde_json::from_value(result["data"].clone()) .map_err(|_| println_err!("Wrong data has been received"))?; - let res = print_auth_rules(rules); + print_auth_rules(rules); - trace!("execute << {:?}", res); - Ok(res) + trace!("execute << "); + Ok(()) } } @@ -1557,7 +1595,7 @@ fn print_auth_rules(rules: AuthRulesData) { .collect::>(); print_list_table(&constraints, - &vec![("auth_type", "Type"), + &[("auth_type", "Type"), ("auth_action", "Action"), ("field", "Field"), ("old_value", "Old Value"), @@ -1588,7 +1626,8 @@ pub mod save_transaction_command { let save_transaction = ::command_executor::wait_for_user_reply(ctx); if !save_transaction { - return Ok(println!("The transaction has not been saved.")); + println!("The transaction has not been saved."); + return Ok(()); } write_file(file, &transaction) @@ -1682,8 +1721,14 @@ pub mod taa_command { read_file(file_) .map_err(|err| println_err!("{}", err))? } - (Some(_), Some(_)) => return Err(println_err!("Only one of the parameters `text` and `file` can be specified")), - (None, None) => return Err(println_err!("Either `text` or `file` parameter must be specified")) + (Some(_), Some(_)) => { + println_err!("Only one of the parameters `text` and `file` can be specified"); + return Err(()) + }, + (None, None) => { + println_err!("Either `text` or `file` parameter must be specified"); + return Err(()) + } }; let mut request = Ledger::build_txn_author_agreement_request(&submitter_did, &text, &version) @@ -1761,8 +1806,14 @@ pub mod aml_command { read_file(file_) .map_err(|err| println_err!("{}", err))? } - (Some(_), Some(_)) => return Err(println_err!("Only one of the parameters `aml` and `file` can be specified")), - (None, None) => return Err(println_err!("Either `aml` or `file` parameter must be specified")) + (Some(_), Some(_)) => { + println_err!("Only one of the parameters `aml` and `file` can be specified"); + return Err(()) + }, + (None, None) => { + println_err!("Either `aml` or `file` parameter must be specified"); + return Err(()) + } }; let mut request = Ledger::build_acceptance_mechanisms_request(&submitter_did, &aml, &version, context) @@ -1794,7 +1845,8 @@ pub mod aml_command { pub fn set_author_agreement(ctx: &CommandContext, request: &mut String) -> Result<(), ()> { if let Some((text, version, acc_mech_type, time_of_acceptance)) = get_transaction_author_info(&ctx) { if acc_mech_type.is_empty() { - return Err(println_err!("Transaction author agreement Acceptance Mechanism isn't set.")); + println_err!("Transaction author agreement Acceptance Mechanism isn't set."); + return Err(()); } *request = Ledger::append_txn_author_agreement_acceptance_to_request(&request, Some(&text), Some(&version), None, &acc_mech_type, time_of_acceptance) @@ -1807,11 +1859,12 @@ fn serialize(obj: &T) -> Result where T: ::serde::Serialize { serde_json::to_string(obj).map_err(|err| println_err!("Invalid data: {:?}", err)) } -fn parse_payment_outputs(outputs: &Vec) -> Result, ()> { - const OUTPUTS_DELIMITER: &'static str = ","; +fn parse_payment_outputs(outputs: &[String]) -> Result, ()> { + const OUTPUTS_DELIMITER: &str = ","; if outputs.is_empty() { - return Err(println_err!("Outputs list is empty")); + println_err!("Outputs list is empty"); + return Err(()); } let mut output_objects: Vec = Vec::new(); @@ -1849,7 +1902,7 @@ pub fn print_response_receipts(receipts: Option>) -> Resu if !receipt.is_empty() { println_succ!("Following Receipts has been received."); print_list_table(&receipt, - &vec![("receipt", "Receipt"), + &[("receipt", "Receipt"), ("recipient", "Payment Address of recipient"), ("amount", "Amount"), ("extra", "Extra")], @@ -1859,11 +1912,11 @@ pub fn print_response_receipts(receipts: Option>) -> Resu Ok(()) } -fn parse_payment_fees(fees: &Vec<&str>) -> Result { +fn parse_payment_fees(fees: &[&str]) -> Result { let mut fees_map: HashMap = HashMap::new(); for fee in fees { - let parts = fee.split(":").collect::>(); + let parts = fee.split(':').collect::>(); let type_ = parts.get(0) .ok_or(()) @@ -1891,7 +1944,7 @@ fn print_transaction_response(mut result: serde_json::Value, title: &str, let (metadata_headers, metadata, data) = match result["ver"].clone().as_str() { None => parse_transaction_response_v0(&mut result), Some("1") => parse_transaction_response_v1(&mut result), - ver @ _ => return println_err!("Unsupported transaction response format: {:?}", ver) + ver=> return println_err!("Unsupported transaction response format: {:?}", ver) }; println_succ!("Metadata:"); @@ -1948,8 +2001,14 @@ pub fn handle_transaction_response(response: Response) -> Res Response { op: ResponseType::REPLY, result: Some(result), reason: None } => Ok(result), Response { op: ResponseType::REQNACK, result: None, reason: Some(reason) } | Response { op: ResponseType::REJECT, result: None, reason: Some(reason) } => - Err(println_err!("Transaction has been rejected: {}", extract_error_message(&reason))), - _ => Err(println_err!("Invalid data has been received")) + { + println_err!("Transaction has been rejected: {}", extract_error_message(&reason)); + Err(()) + }, + _ => { + println_err!("Invalid data has been received"); + Err(()) + } } } @@ -2072,14 +2131,17 @@ pub fn set_request_fees(ctx: &CommandContext, } if source_payment_address.is_some() && fees_inputs.is_some() { - return Err(println_err!("Only one of `source_payment_address`, `fees_inputs` can be specified.")); + println_err!("Only one of `source_payment_address`, `fees_inputs` can be specified."); + return Err(()); } let (inputs, outputs) = match (source_payment_address, fee) { (Some(source_), Some(fee_)) => { build_payment_sources_for_addresses(ctx, source_, None, None, Some(fee_))? } - (Some(_), None) => { return Err(println_err!("Fee value must be specified together with `source_payment_address`.")); } + (Some(_), None) => { + println_err!("Fee value must be specified together with `source_payment_address`."); + return Err(()); } (None, None) => { match fees_inputs { Some(inputs_) => { @@ -2096,7 +2158,8 @@ pub fn set_request_fees(ctx: &CommandContext, } } _ => { - return Err(println_err!("(source_payment_address, fee) - all or none parameters must be specified")); + println_err!("(source_payment_address, fee) - all or none parameters must be specified"); + return Err(()); } }; @@ -2121,7 +2184,8 @@ fn prepare_sources_for_payment_cmd(ctx: &CommandContext, let (inputs, outputs) = match (source_payment_address, target_payment_address, amount) { (Some(source_address), Some(target_address), Some(amount_)) => { if amount_ <= 0{ - return Err(println_err!("Payment amount must be greater than 0")) + println_err!("Payment amount must be greater than 0"); + return Err(()) } build_payment_sources_for_addresses(&ctx, &source_address, Some(&target_address), Some(amount_), fee)? @@ -2133,16 +2197,21 @@ fn prepare_sources_for_payment_cmd(ctx: &CommandContext, let outputs = parse_payment_outputs(&outputs_).map_err(error_err!())?; (inputs, outputs) } - (None, None) => return Err(println_err!("One of the next parameter combinations must be specified:\n\ + (None, None) => { + println_err!("One of the next parameter combinations must be specified:\n\ (source_payment_address, target_payment_address, amount, Optional(fee)) - CLI builds payment data according to payment addresses\n\ - (inputs, outputs) - explicit specification of payment sources")), + (inputs, outputs) - explicit specification of payment sources"); + return Err(()) + }, _ => { - return Err(println_err!("(inputs, outputs) - all or none parameters must be specified")); + println_err!("(inputs, outputs) - all or none parameters must be specified"); + return Err(()); } } } _ => { - return Err(println_err!("(source_payment_address, target_payment_address, amount) - all or none parameters must be specified")); + println_err!("(source_payment_address, target_payment_address, amount) - all or none parameters must be specified"); + return Err(()); } }; @@ -2178,7 +2247,8 @@ fn inputs(sources: Vec, amount: Option, fee: Option) -> Result } if balance < required { - return Err(println_err!("Not enough payment sources: balance: {}, required: {}", balance, required)); + println_err!("Not enough payment sources: balance: {}, required: {}", balance, required); + return Err(()); } let refund = balance - required; @@ -2241,32 +2311,32 @@ pub mod tests { const TRANSACTION: &str = r#"{"reqId":1,"identifier":"V4SGRU86Z58d6TV7PBUe6f","operation":{"type":"105","dest":"V4SGRU86Z58d6TV7PBUe6f"},"protocolVersion":2}"#; - pub const ATTRIB_RAW_DATA: &'static str = r#"{"endpoint":{"ha":"127.0.0.1:5555"}}"#; - pub const ATTRIB_HASH_DATA: &'static str = r#"83d907821df1c87db829e96569a11f6fc2e7880acba5e43d07ab786959e13bd3"#; - pub const ATTRIB_ENC_DATA: &'static str = r#"aa3f41f619aa7e5e6b6d0d"#; + pub const ATTRIB_RAW_DATA: &str = r#"{"endpoint":{"ha":"127.0.0.1:5555"}}"#; + pub const ATTRIB_HASH_DATA: &str = r#"83d907821df1c87db829e96569a11f6fc2e7880acba5e43d07ab786959e13bd3"#; + pub const ATTRIB_ENC_DATA: &str = r#"aa3f41f619aa7e5e6b6d0d"#; - pub const CRED_DEF_DATA: &'static str = r#"{"n":"1","s":"1","rms":"1","r":{"age":"1","name":"1"},"rctxt":"1","z":"1"}"#; + pub const CRED_DEF_DATA: &str = r#"{"n":"1","s":"1","rms":"1","r":{"age":"1","name":"1"},"rctxt":"1","z":"1"}"#; #[cfg(feature = "nullpay_plugin")] - pub const UNKNOWN_PAYMENT_METHOD: &'static str = "UNKNOWN_PAYMENT_METHOD"; + pub const UNKNOWN_PAYMENT_METHOD: &str = "UNKNOWN_PAYMENT_METHOD"; #[cfg(feature = "nullpay_plugin")] - pub const PAYMENT_ADDRESS: &'static str = "pay:null:BBQr7K6CP1tslXd"; + pub const PAYMENT_ADDRESS: &str = "pay:null:BBQr7K6CP1tslXd"; #[cfg(feature = "nullpay_plugin")] - pub const INVALID_PAYMENT_ADDRESS: &'static str = "null"; + pub const INVALID_PAYMENT_ADDRESS: &str = "null"; #[cfg(feature = "nullpay_plugin")] - pub const INPUT: &'static str = "pay:null:111_rBuQo2A1sc9jrJg"; + pub const INPUT: &str = "pay:null:111_rBuQo2A1sc9jrJg"; #[cfg(feature = "nullpay_plugin")] - pub const OUTPUT: &'static str = "(pay:null:CnEDk9HrMnmiHXEV1WFgbVCRteYnPqsJwrTdcZaNhFVW,10)"; + pub const OUTPUT: &str = "(pay:null:CnEDk9HrMnmiHXEV1WFgbVCRteYnPqsJwrTdcZaNhFVW,10)"; #[cfg(feature = "nullpay_plugin")] - pub const OUTPUT_2: &'static str = "(pay:null:GjZWsBLgZCR18aL468JAT7w9CZRiBnpxUPPgyQxh4voa,25)"; + pub const OUTPUT_2: &str = "(pay:null:GjZWsBLgZCR18aL468JAT7w9CZRiBnpxUPPgyQxh4voa,25)"; #[cfg(feature = "nullpay_plugin")] - pub const INVALID_INPUT: &'static str = "pay:null"; + pub const INVALID_INPUT: &str = "pay:null"; #[cfg(feature = "nullpay_plugin")] - pub const INVALID_OUTPUT: &'static str = "pay:null:CnEDk9HrMnmiHXEV1WFgbVCRteYnPqsJwrTdcZaNhFVW,100"; + pub const INVALID_OUTPUT: &str = "pay:null:CnEDk9HrMnmiHXEV1WFgbVCRteYnPqsJwrTdcZaNhFVW,100"; #[cfg(feature = "nullpay_plugin")] - pub const FEES: &'static str = "1:1,100:1,101:1"; + pub const FEES: &str = "1:1,100:1,101:1"; #[cfg(feature = "nullpay_plugin")] - pub const EXTRA: &'static str = "extra"; + pub const EXTRA: &str = "extra"; #[cfg(feature = "nullpay_plugin")] pub const AMOUNT: i32 = 100; @@ -3494,7 +3564,7 @@ pub mod tests { mod custom { use super::*; - pub const TXN_FOR_SIGN: &'static str = r#"{ + pub const TXN_FOR_SIGN: &str = r#"{ "reqId":1513241300414292814, "identifier":"V4SGRU86Z58d6TV7PBUe6f", "operation":{ diff --git a/cli/src/commands/mod.rs b/cli/src/commands/mod.rs index 9e768695b4..2a05c2f884 100644 --- a/cli/src/commands/mod.rs +++ b/cli/src/commands/mod.rs @@ -89,9 +89,15 @@ pub fn get_opt_bool_param(key: &str, params: &CommandParams) -> Result(name: &'a str, params: &'a CommandParams) -> Result, ()> { match params.get(name) { - None => Err(println_err!("No required \"{}\" parameter present", name)), - Some(v) if v.is_empty() => Err(println_err!("No required \"{}\" parameter present", name)), - Some(v) => Ok(v.split(",").collect::>()) + None => { + println_err!("No required \"{}\" parameter present", name); + Err(()) + }, + Some(v) if v.is_empty() => { + println_err!("No required \"{}\" parameter present", name); + Err(()) + }, + Some(v) => Ok(v.split(',').collect::>()) } } @@ -101,7 +107,7 @@ pub fn get_opt_str_array_param<'a>(name: &'a str, params: &'a CommandParams) -> if v.is_empty() { Ok(Some(Vec::<&'a str>::new())) } else { - Ok(Some(v.split(",").collect::>())) + Ok(Some(v.split(',').collect::>())) }, None => Ok(None) } @@ -125,7 +131,7 @@ pub fn get_opt_object_param<'a>(name: &'a str, params: &'a CommandParams) -> Res } } -fn extract_array_tuples<'a>(param: &'a str) -> Vec { +fn extract_array_tuples(param: &str) -> Vec { let re = Regex::new(r#"\(([^\(\)]+)\),?"#).unwrap(); re.captures_iter(param).map(|c| c[1].to_string()).collect::>() } @@ -134,13 +140,17 @@ pub fn get_str_tuple_array_param<'a>(name: &'a str, params: &'a CommandParams) - match params.get(name) { Some(v) if !v.is_empty() => { let tuples = extract_array_tuples(v); - if tuples.len() == 0 { - Err(println_err!("Parameter \"{}\" has invalid format", name)) + if tuples.is_empty() { + println_err!("Parameter \"{}\" has invalid format", name); + Err(()) } else { Ok(tuples) } } - _ => Err(println_err!("No required \"{}\" parameter present", name)) + _ => { + println_err!("No required \"{}\" parameter present", name); + Err(()) + } } } @@ -159,7 +169,10 @@ pub fn get_opt_str_tuple_array_param<'a>(name: &'a str, params: &'a CommandParam pub fn ensure_active_did(ctx: &CommandContext) -> Result { match ctx.get_string_value("ACTIVE_DID") { Some(did) => Ok(did), - None => Err(println_err!("There is no active did")) + None => { + println_err!("There is no active did"); + Err(()) + } } } @@ -175,7 +188,10 @@ pub fn set_active_did(ctx: &CommandContext, did: Option) { pub fn ensure_opened_wallet_handle(ctx: &CommandContext) -> Result { match ctx.get_int_value("OPENED_WALLET_HANDLE") { Some(wallet_handle) => Ok(wallet_handle), - None => Err(println_err!("There is no opened wallet now")) + None => { + println_err!("There is no opened wallet now"); + Err(()) + } } } @@ -185,7 +201,10 @@ pub fn ensure_opened_wallet(ctx: &CommandContext) -> Result<(i32, String), ()> { match (handle, name) { (Some(handle), Some(name)) => Ok((handle, name)), - _ => Err(println_err!("There is no opened wallet now")) + _ => { + println_err!("There is no opened wallet now"); + Err(()) + } } } @@ -213,7 +232,10 @@ pub fn set_opened_wallet(ctx: &CommandContext, value: Option<(i32, String)>) { pub fn ensure_connected_pool_handle(ctx: &CommandContext) -> Result { match ctx.get_int_value("CONNECTED_POOL_HANDLE") { Some(pool_handle) => Ok(pool_handle), - None => Err(println_err!("There is no opened pool now")) + None => { + println_err!("There is no opened pool now"); + Err(()) + } } } @@ -223,7 +245,10 @@ pub fn ensure_connected_pool(ctx: &CommandContext) -> Result<(i32, String), ()> match (handle, name) { (Some(handle), Some(name)) => Ok((handle, name)), - _ => Err(println_err!("There is no opened pool now")) + _ => { + println_err!("There is no opened pool now"); + Err(()) + } } } @@ -256,7 +281,10 @@ pub fn get_transaction(ctx: &CommandContext) -> Option { pub fn ensure_set_transaction(ctx: &CommandContext) -> Result { match ctx.get_string_value("LEDGER_TRANSACTION") { Some(transaction) => Ok(transaction), - None => Err(println_err!("There is no transaction stored into context")) + None => { + println_err!("There is no transaction stored into context"); + Err(()) + } } } diff --git a/cli/src/commands/payment_address.rs b/cli/src/commands/payment_address.rs index b36866b6d7..2610d1e73b 100644 --- a/cli/src/commands/payment_address.rs +++ b/cli/src/commands/payment_address.rs @@ -45,8 +45,14 @@ pub mod create_command { }; let res = match Payment::create_payment_address(wallet_handle, payment_method, &config) { - Ok(payment_address) => Ok(println_succ!("Payment Address has been created \"{}\"", payment_address)), - Err(err) => Err(handle_payment_error(err, Some(payment_method))), + Ok(payment_address) => { + println_succ!("Payment Address has been created \"{}\"", payment_address); + Ok(()) + }, + Err(err) => { + handle_payment_error(err, Some(payment_method)); + Err(()) + }, }; trace!("execute << {:?}", res); @@ -73,7 +79,7 @@ pub mod list_command { let list_addresses = payment_addresses.iter() .map(|payment_address| { - let parts = payment_address.split(":").collect::>(); + let parts = payment_address.split(':').collect::>(); json!({ "address": payment_address, "method": parts.get(1).unwrap_or(&"Unknown payment method") @@ -82,12 +88,15 @@ pub mod list_command { .collect::>(); print_list_table(&list_addresses, - &vec![("address", "Payment Address"), + &[("address", "Payment Address"), ("method", "Payment Method")], "There are no payment addresses"); Ok(()) } - Err(err) => Err(handle_indy_error(err, None, None, None)), + Err(err) => { + handle_indy_error(err, None, None, None); + Err(()) + }, }; trace!("execute << {:?}", res); diff --git a/cli/src/commands/pool.rs b/cli/src/commands/pool.rs index 4f596812cd..6bbdfa30a8 100644 --- a/cli/src/commands/pool.rs +++ b/cli/src/commands/pool.rs @@ -46,12 +46,24 @@ pub mod create_command { trace!(r#"Pool::create_pool_ledger_config return: {:?}"#, res); let res = match res { - Ok(()) => Ok(println_succ!("Pool config \"{}\" has been created", name)), + Ok(()) => { + println_succ!("Pool config \"{}\" has been created", name); + Ok(()) + }, Err(err) => { match err.error_code { - ErrorCode::CommonIOError => Err(println_err!("Pool genesis file is invalid or does not exist.")), - ErrorCode::PoolLedgerConfigAlreadyExistsError => Err(println_err!("Pool config \"{}\" already exists", name)), - _ => Err(handle_indy_error(err, None, Some(&name), None)), + ErrorCode::CommonIOError => { + println_err!("Pool genesis file is invalid or does not exist."); + Err(()) + }, + ErrorCode::PoolLedgerConfigAlreadyExistsError => { + println_err!("Pool config \"{}\" already exists", name); + Err(()) + }, + _ => { + handle_indy_error(err, None, Some(&name), None); + Err(()) + }, } } }; @@ -101,9 +113,13 @@ pub mod connect_command { Ok(()) => { set_connected_pool(ctx, None); set_transaction_author_info(ctx, None); - Ok(println_succ!("Pool \"{}\" has been disconnected", name)) + println_succ!("Pool \"{}\" has been disconnected", name); + Ok(()) + } + Err(err) => { + handle_indy_error(err, None, None, Some(name.as_ref())); + Err(()) } - Err(err) => Err(handle_indy_error(err, None, None, Some(name.as_ref()))) } } else { Ok(()) @@ -113,8 +129,14 @@ pub mod connect_command { match Pool::set_protocol_version(protocol_version) { Ok(_) => Ok(()), Err(IndyError { error_code: ErrorCode::PoolIncompatibleProtocolVersion, .. }) => - Err(println_err!("Unsupported Protocol Version has been specified \"{}\".", protocol_version)), - Err(err) => Err(handle_indy_error(err, None, Some(&name), None)), + { + println_err!("Unsupported Protocol Version has been specified \"{}\".", protocol_version); + Err(()) + }, + Err(err) => { + handle_indy_error(err, None, Some(&name), None); + Err(()) + }, } }) .and_then(|_| { @@ -126,12 +148,27 @@ pub mod connect_command { } Err(err) => { match err.error_code { - ErrorCode::PoolLedgerNotCreatedError => Err(println_err!("Pool \"{}\" does not exist.", name)), - ErrorCode::PoolLedgerTimeout => Err(println_err!("Pool \"{}\" has not been connected.", name)), + ErrorCode::PoolLedgerNotCreatedError => { + println_err!("Pool \"{}\" does not exist.", name); + Err(()) + }, + ErrorCode::PoolLedgerTimeout => { + println_err!("Pool \"{}\" has not been connected.", name); + Err(()) + }, ErrorCode::PoolIncompatibleProtocolVersion => - Err(println_err!("Pool \"{}\" is not compatible with Protocol Version \"{}\".", name, protocol_version)), - ErrorCode::LedgerNotFound => Err(println_err!("Item not found in pool \"{}\"", name)), - _ => Err(handle_indy_error(err, None, Some(&name), None)), + { + println_err!("Pool \"{}\" is not compatible with Protocol Version \"{}\".", name, protocol_version); + Err(()) + }, + ErrorCode::LedgerNotFound => { + println_err!("Item not found in pool \"{}\"", name); + Err(()) + }, + _ => { + handle_indy_error(err, None, Some(&name), None); + Err(()) + }, } } } @@ -175,7 +212,7 @@ pub mod list_command { let pools: Vec = serde_json::from_str(&pools) .map_err(|_| println_err!("Wrong data has been received"))?; - print_list_table(&pools, &vec![("pool", "Pool")], "There are no pools defined"); + print_list_table(&pools, &[("pool", "Pool")], "There are no pools defined"); if let Some((_, cur_pool)) = get_connected_pool(ctx) { println_succ!("Current pool \"{}\"", cur_pool); @@ -183,7 +220,10 @@ pub mod list_command { Ok(()) } - Err(err) => Err(handle_indy_error(err, None, None, None)) + Err(err) => { + handle_indy_error(err, None, None, None); + Err(()) + } }; trace!("execute << {:?}", res); @@ -203,16 +243,19 @@ pub mod show_taa_command { let pool_handle = ensure_connected_pool_handle(&ctx)?; - let res = match set_transaction_author_agreement(ctx, pool_handle, false) { + match set_transaction_author_agreement(ctx, pool_handle, false) { Ok(Some(_)) => { Ok(()) } Ok(None) => { - Ok(println!("There is no transaction agreement set on the Pool.")) + { + println!("There is no transaction agreement set on the Pool."); + Ok(()) + } } - Err(err) => Err(err) + Err(_) => Err(()) }; - trace!("execute << {:?}", res); - res + trace!("execute << "); + Ok(()) } } @@ -229,8 +272,14 @@ pub mod refresh_command { let (pool_handle, pool_name) = ensure_connected_pool(&ctx)?; let res = match Pool::refresh(pool_handle) { - Ok(_) => Ok(println_succ!("Pool \"{}\" has been refreshed", pool_name)), - Err(err) => Err(handle_indy_error(err, None, None, None)) + Ok(_) => { + println_succ!("Pool \"{}\" has been refreshed", pool_name); + Ok(()) + }, + Err(err) => { + handle_indy_error(err, None, None, None); + Err(()) + } }; trace!("execute << {:?}", res); @@ -251,16 +300,21 @@ pub mod disconnect_command { let (handle, name) = if let Some(pool) = get_connected_pool(ctx) { pool } else { - return Err(println_err!("There is no connected pool now")); + println_err!("There is no connected pool now"); + return Err(()); }; let res = match Pool::close(handle) { Ok(()) => { set_connected_pool(ctx, None); set_transaction_author_info(ctx, None); - Ok(println_succ!("Pool \"{}\" has been disconnected", name)) + println_succ!("Pool \"{}\" has been disconnected", name); + Ok(()) + } + Err(err) => { + handle_indy_error(err, None, Some(&name), None); + Err(()) } - Err(err) => Err(handle_indy_error(err, None, Some(&name), None)) }; trace!("execute << {:?}", res); @@ -289,11 +343,20 @@ pub mod delete_command { trace!(r#"Pool::delete return: {:?}"#, res); let res = match res { - Ok(()) => Ok(println_succ!("Pool \"{}\" has been deleted.", name)), + Ok(()) => { + println_succ!("Pool \"{}\" has been deleted.", name); + Ok(()) + }, Err(err) => { match err.error_code { - ErrorCode::CommonIOError => Err(println_err!("Pool \"{}\" does not exist.", name)), - _ => Err(handle_indy_error(err, None, Some(&name), None)) + ErrorCode::CommonIOError => { + println_err!("Pool \"{}\" does not exist.", name); + Err(()) + }, + _ => { + handle_indy_error(err, None, Some(&name), None); + Err(()) + } } } }; diff --git a/cli/src/commands/wallet.rs b/cli/src/commands/wallet.rs index dbde77a28d..a692b2f724 100644 --- a/cli/src/commands/wallet.rs +++ b/cli/src/commands/wallet.rs @@ -14,6 +14,16 @@ use utils::environment::EnvironmentUtils; use std::io::{Read, Write}; use std::path::PathBuf; +fn build_credentials(key: &str, key_derivation_method: &str, storage_credentials: Option) -> String { + let mut json = JSONMap::new(); + + json.insert("key".to_string(), serde_json::Value::String(key.to_string())); + json.insert("key_derivation_method".to_string(), serde_json::Value::String(key_derivation_method.to_string())); + update_json_map_opt_key!(json, "storage_credentials", storage_credentials); + + JSONValue::from(json).to_string() +} + pub mod group { use super::*; @@ -50,20 +60,16 @@ pub mod create_command { let storage_config = get_opt_object_param("storage_config", params).map_err(error_err!())?; let storage_credentials = get_opt_object_param("storage_credentials", params).map_err(error_err!())?; - let config: String = json!({ "id": id.clone(), "storage_type": storage_type, "storage_config": storage_config }).to_string(); - - let credentials = { - let mut json = JSONMap::new(); + let config: String = json!({ "id": id, "storage_type": storage_type, "storage_config": storage_config }).to_string(); - json.insert("key".to_string(), serde_json::Value::String(key.to_string())); - json.insert("key_derivation_method".to_string(), serde_json::Value::String(map_key_derivation_method(key_derivation_method)?.to_string())); - update_json_map_opt_key!(json, "storage_credentials", storage_credentials); - - JSONValue::from(json).to_string() - }; + let credentials = build_credentials( + key, + &map_key_derivation_method(key_derivation_method)?.to_string(), + storage_credentials); if _wallet_config_path(id).exists() { - return Err(println_err!("Wallet \"{}\" is already attached to CLI", id)); + println_err!("Wallet \"{}\" is already attached to CLI", id); + return Err(()); } trace!("Wallet::create_wallet try: config {}", config); @@ -79,13 +85,23 @@ pub mod create_command { _store_wallet_config(id, &config) .map_err(|err| println_err!("Cannot store wallet \"{}\" config file: {:?}", id, err))?; - Ok(println_succ!("Wallet \"{}\" has been created", id)) + println_succ!("Wallet \"{}\" has been created", id); + Ok(()) } Err(err) => { match err.error_code { - ErrorCode::WalletAlreadyExistsError => Err(println_err!("Wallet \"{}\" already exists", id)), - ErrorCode::CommonIOError => Err(println_err!("Invalid wallet name \"{}\"", id)), - _ => Err(handle_indy_error(err, None, None, Some(&id))) + ErrorCode::WalletAlreadyExistsError => { + println_err!("Wallet \"{}\" already exists", id); + Err(()) + }, + ErrorCode::CommonIOError => { + println_err!("Invalid wallet name \"{}\"", id); + Err(()) + }, + _ => { + handle_indy_error(err, None, None, Some(&id)); + Err(()) + } } } }; @@ -116,17 +132,18 @@ pub mod attach_command { let storage_config = get_opt_object_param("storage_config", params).map_err(error_err!())?; if _wallet_config_path(id).exists() { - return Err(println_err!("Wallet \"{}\" is already attached to CLI", id)); + println_err!("Wallet \"{}\" is already attached to CLI", id); + return Err(()); } - let config: String = json!({ "id": id.clone(), "storage_type": storage_type, "storage_config": storage_config }).to_string(); + let config: String = json!({ "id": id, "storage_type": storage_type, "storage_config": storage_config }).to_string(); _store_wallet_config(id, &config) .map_err(|err| println_err!("Cannot store wallet \"{}\" config file: {:?}", id, err))?; - let res = Ok(println_succ!("Wallet \"{}\" has been attached", id)); - trace!("execute << {:?}", res); - res + println_succ!("Wallet \"{}\" has been attached", id); + trace!("execute << "); + Ok(()) } } @@ -182,8 +199,14 @@ pub mod open_command { set_active_did(ctx, None); if let Some((handle, id)) = get_opened_wallet(ctx) { match Wallet::close_wallet(handle) { - Ok(()) => Ok(println_succ!("Wallet \"{}\" has been closed", id)), - Err(err) => Err(handle_indy_error(err, None, None, None)) + Ok(()) => { + println_succ!("Wallet \"{}\" has been closed", id); + Ok(()) + }, + Err(err) => { + handle_indy_error(err, None, None, Some(&id)); + Err(()) + } } } else { Ok(()) @@ -193,15 +216,28 @@ pub mod open_command { match Wallet::open_wallet(config.as_str(), &credentials.as_str()) { Ok(handle) => { set_opened_wallet(ctx, Some((handle, id.to_owned()))); - Ok(println_succ!("Wallet \"{}\" has been opened", id)) + println_succ!("Wallet \"{}\" has been opened", id); + Ok(()) } Err(err) => { set_opened_wallet(ctx, None); match err.error_code { - ErrorCode::WalletAlreadyOpenedError => Err(println_err!("Wallet \"{}\" already opened", id)), - ErrorCode::WalletAccessFailed => Err(println_err!("Cannot open wallet \"{}\". Invalid key has been provided", id)), - ErrorCode::WalletNotFoundError => Err(println_err!("Wallet \"{}\" not found or unavailable", id)), - _ => Err(handle_indy_error(err, None, None, Some(&id))), + ErrorCode::WalletAlreadyOpenedError => { + println_err!("Wallet \"{}\" already opened", id); + Err(()) + }, + ErrorCode::WalletAccessFailed => { + println_err!("Cannot open wallet \"{}\". Invalid key has been provided", id); + Err(()) + }, + ErrorCode::WalletNotFoundError => { + println_err!("Wallet \"{}\" not found or unavailable", id); + Err(()) + }, + _ => { + handle_indy_error(err, None, None, Some(&id)); + Err(()) + }, } } } @@ -241,7 +277,7 @@ pub mod list_command { let wallets: Vec = _list_wallets(); print_list_table(&wallets, - &vec![("id", "Name"), + &[("id", "Name"), ("storage_type", "Type")], "There are no wallets"); @@ -270,7 +306,8 @@ pub mod close_command { if let Some(wallet) = get_opened_wallet(ctx) { Ok(wallet) } else { - Err(println_err!("There is no opened wallet now")) + println_err!("There is no opened wallet now"); + Err(()) } }) .and_then(|wallet| { @@ -279,9 +316,13 @@ pub mod close_command { Ok(()) => { set_opened_wallet(ctx, None); set_active_did(ctx, None); - Ok(println_succ!("Wallet \"{}\" has been closed", name)) + println_succ!("Wallet \"{}\" has been closed", name); + Ok(()) + } + Err(err) => { + handle_indy_error(err, None, None, None); + Err(()) } - Err(err) => Err(handle_indy_error(err, None, None, None)) } }); @@ -317,28 +358,33 @@ pub mod delete_command { let config = _read_wallet_config(id) .map_err(|_| println_err!("Wallet \"{}\" isn't attached to CLI", id))?; - let credentials = { - let mut json = JSONMap::new(); - - json.insert("key".to_string(), serde_json::Value::String(key.to_string())); - json.insert("key_derivation_method".to_string(), serde_json::Value::String(map_key_derivation_method(key_derivation_method)?.to_string())); - update_json_map_opt_key!(json, "storage_credentials", storage_credentials); - - JSONValue::from(json).to_string() - }; + let credentials = build_credentials( + key, + &map_key_derivation_method(key_derivation_method)?.to_string(), + storage_credentials); let res = match Wallet::delete_wallet(config.as_str(), credentials.as_str()) { Ok(()) => { _delete_wallet_config(id) .map_err(|err| println_err!("Cannot delete \"{}\" config file: {:?}", id, err))?; - Ok(println_succ!("Wallet \"{}\" has been deleted", id)) + println_succ!("Wallet \"{}\" has been deleted", id); + Ok(()) } Err(err) => { match err.error_code { - ErrorCode::WalletNotFoundError => Err(println_err!("Wallet \"{}\" not found or unavailable", id)), - ErrorCode::WalletAccessFailed => Err(println_err!("Cannot delete wallet \"{}\". Invalid key has been provided ", id)), - _ => Err(handle_indy_error(err, None, None, Some(&id))) + ErrorCode::WalletNotFoundError => { + println_err!("Wallet \"{}\" not found or unavailable", id); + Err(()) + }, + ErrorCode::WalletAccessFailed => { + println_err!("Cannot delete wallet \"{}\". Invalid key has been provided ", id); + Err(()) + }, + _ => { + handle_indy_error(err, None, None, Some(&id)); + Err(()) + } } } }; @@ -363,19 +409,23 @@ pub mod detach_command { let id = get_str_param("name", params).map_err(error_err!())?; if !_wallet_config_path(id).exists() { - return Err(println_err!("Wallet \"{}\" isn't attached to CLI", id)); + println_err!("Wallet \"{}\" isn't attached to CLI", id); + return Err(()); } if let Some((_, name)) = get_opened_wallet(ctx) { - if id == name { return Err(println_err!("Wallet \"{}\" is opened", id)); } + if id == name { + println_err!("Wallet \"{}\" is opened", id); + return Err(()); + } } _delete_wallet_config(id) .map_err(|err| println_err!("Cannot delete \"{}\" config file: {:?}", id, err))?; - let res = Ok(println_succ!("Wallet \"{}\" has been detached", id)); - trace!("execute << {:?}", res); - res + println_succ!("Wallet \"{}\" has been detached", id); + trace!("execute << "); + Ok(()) } } @@ -402,7 +452,7 @@ pub mod export_command { let export_path = get_str_param("export_path", params).map_err(error_err!())?; let export_key = get_str_param("export_key", params).map_err(error_err!())?; let export_key_derivation_method = get_opt_str_param("export_key_derivation_method", params).map_err(error_err!())?; - let export_config: String = json!({ "path": export_path.clone(), "key": export_key.clone(), "key_derivation_method": map_key_derivation_method(export_key_derivation_method)? }).to_string(); + let export_config: String = json!({ "path": export_path, "key": export_key, "key_derivation_method": map_key_derivation_method(export_key_derivation_method)? }).to_string(); trace!("Wallet::export_wallet try: wallet_name {}, export_path {}", wallet_name, export_path); @@ -412,8 +462,14 @@ pub mod export_command { trace!("Wallet::export_wallet return: {:?}", res); let res = match res { - Ok(()) => Ok(println_succ!("Wallet \"{}\" has been exported to the file \"{}\"", wallet_name, export_path)), - Err(err) => Err(handle_indy_error(err, None, None, Some(wallet_name.as_ref()))) + Ok(()) => { + println_succ!("Wallet \"{}\" has been exported to the file \"{}\"", wallet_name, export_path); + Ok(()) + }, + Err(err) => { + handle_indy_error(err, None, None, Some(wallet_name.as_ref())); + Err(()) + } }; trace!("execute << {:?}", res); @@ -454,21 +510,17 @@ pub mod import_command { let storage_config = get_opt_object_param("storage_config", params).map_err(error_err!())?; let storage_credentials = get_opt_object_param("storage_credentials", params).map_err(error_err!())?; - let config: String = json!({ "id": id.clone(), "storage_type": storage_type, "storage_config": storage_config }).to_string(); - let import_config: String = json!({ "path": export_path.clone(), "key": export_key.clone()}).to_string(); + let config: String = json!({ "id": id, "storage_type": storage_type, "storage_config": storage_config }).to_string(); + let import_config: String = json!({ "path": export_path, "key": export_key}).to_string(); - let credentials = { - let mut json = JSONMap::new(); - - json.insert("key".to_string(), serde_json::Value::String(key.to_string())); - json.insert("key_derivation_method".to_string(), serde_json::Value::String(map_key_derivation_method(key_derivation_method)?.to_string())); - update_json_map_opt_key!(json, "storage_credentials", storage_credentials); - - JSONValue::from(json).to_string() - }; + let credentials = build_credentials( + key, + &map_key_derivation_method(key_derivation_method)?.to_string(), + storage_credentials); if _wallet_config_path(id).exists() { - return Err(println_err!("Wallet \"{}\" is already attached to CLI", id)); + println_err!("Wallet \"{}\" is already attached to CLI", id); + return Err(()); } trace!("Wallet::import_wallet try: config {}, import_config {}", config, secret!(&import_config)); @@ -484,9 +536,13 @@ pub mod import_command { Ok(()) => { _store_wallet_config(id, &config) .map_err(|err| println_err!("Cannot store \"{}\" config file: {:?}", id, err))?; - Ok(println_succ!("Wallet \"{}\" has been created", id)) + println_succ!("Wallet \"{}\" has been created", id); + Ok(()) + } + Err(err) => { + handle_indy_error(err, None, None, Some(id)); + Err(()) } - Err(err) => Err(handle_indy_error(err, None, None, Some(id))) }; trace!("execute << {:?}", res); @@ -573,7 +629,10 @@ fn map_key_derivation_method(key: Option<&str>) -> Result<&'static str, ()> { None | Some("argon2m") => Ok("ARGON2I_MOD"), Some("argon2i") => Ok("ARGON2I_INT"), Some("raw") => Ok("RAW"), - val @ _ => Err(println_err!("Unsupported Wallet Key type has been specified \"{}\"", val.unwrap())), + val=> { + println_err!("Unsupported Wallet Key type has been specified \"{}\"", val.unwrap()); + Err(()) + }, } } @@ -583,10 +642,10 @@ pub mod tests { use utils::environment::EnvironmentUtils; use std::path::PathBuf; - const WALLET: &'static str = "wallet"; - const WALLET_KEY: &'static str = "wallet_key"; - const WALLET_KEY_RAW: &'static str = "6nxtSiXFvBd593Y2DCed2dYvRY1PGK9WMtxCBjLzKgbw"; - const EXPORT_KEY: &'static str = "export_key"; + const WALLET: &str = "wallet"; + const WALLET_KEY: &str = "wallet_key"; + const WALLET_KEY_RAW: &str = "6nxtSiXFvBd593Y2DCed2dYvRY1PGK9WMtxCBjLzKgbw"; + const EXPORT_KEY: &str = "export_key"; mod create { use super::*; diff --git a/cli/src/main.rs b/cli/src/main.rs index adbb466e0b..29c66d681b 100644 --- a/cli/src/main.rs +++ b/cli/src/main.rs @@ -220,12 +220,12 @@ fn execute_interactive(command_executor: CommandExecutor, mut reader: Reader< reader.set_prompt(&command_executor.ctx().get_prompt()); if command_executor.ctx().is_exit() { - history::persist(&mut reader).ok(); + history::persist(&reader).ok(); break; } }, ReadResult::Eof | ReadResult::Signal(Signal::Quit) | ReadResult::Signal(Signal::Break)| ReadResult::Signal(Signal::Interrupt) => { - history::persist(&mut reader).ok(); + history::persist(&reader).ok(); break; }, _ => {break} @@ -249,8 +249,8 @@ fn execute_batch(command_executor: &CommandExecutor, script_path: Option<&str>) } fn _load_plugins(command_executor: &CommandExecutor, plugins_str: &str) { - for plugin in plugins_str.split(",") { - let parts: Vec<&str> = plugin.split(":").collect::>(); + for plugin in plugins_str.split(',') { + let parts: Vec<&str> = plugin.split(':').collect::>(); let name = unwrap_or_return!(parts.get(0), println_err!("Plugin Name not found in {}", plugin)); let init_func = unwrap_or_return!(parts.get(1), println_err!("Plugin Init function not found in {}", plugin)); @@ -291,13 +291,13 @@ fn _iter_batch(command_executor: &CommandExecutor, reader: T) where T: std::i return println_err!("Can't parse line #{}", line_num); }; - if line.starts_with("#") || line.is_empty() { + if line.starts_with('#') || line.is_empty() { // Skip blank lines and lines starting with # continue; } println!("{}", line); - let (line, force) = if line.starts_with("-") { + let (line, force) = if line.starts_with('-') { (line[1..].as_ref(), true) } else { (line[0..].as_ref(), false) diff --git a/cli/src/utils/file.rs b/cli/src/utils/file.rs index aad953d43c..f0c426e105 100644 --- a/cli/src/utils/file.rs +++ b/cli/src/utils/file.rs @@ -7,7 +7,7 @@ use std::fs::{File, DirBuilder, OpenOptions}; pub fn read_file>(file: P) -> Result { let mut file = File::open(file) .map_err(error_err!()) - .map_err(|_| format!("Can't read the file"))?; + .map_err(|_| "Can't read the file".to_string())?; let content = { let mut s = String::new(); @@ -23,7 +23,7 @@ pub fn read_file>(file: P) -> Result { pub fn read_lines_from_file>(file: P) -> Result>, String> { let file = File::open(file) .map_err(error_err!()) - .map_err(|_| format!("Can't read the file"))?; + .map_err(|_| "Can't read the file".to_string())?; let lines = BufReader::new(file).lines(); Ok(lines) diff --git a/cli/src/utils/logger.rs b/cli/src/utils/logger.rs index 722708a485..abea13a26f 100644 --- a/cli/src/utils/logger.rs +++ b/cli/src/utils/logger.rs @@ -13,7 +13,7 @@ impl IndyCliLogger { .map_err(|err| format!("Cannot init Indy CLI logger: {}", err.description()))?; indy::logger::set_logger(log::logger()) - .map_err(|_| format!("Cannot init Libindy logger")) + .map_err(|_| "Cannot init Libindy logger".to_string()) } } diff --git a/cli/src/utils/table.rs b/cli/src/utils/table.rs index 56e72e28e8..33790eab9e 100644 --- a/cli/src/utils/table.rs +++ b/cli/src/utils/table.rs @@ -6,7 +6,7 @@ use prettytable::Table; use prettytable::row::Row; use prettytable::cell::Cell; -pub fn print_list_table(rows: &Vec, headers: &[(&str, &str)], empty_msg: &str) { +pub fn print_list_table(rows: &[serde_json::Value], headers: &[(&str, &str)], empty_msg: &str) { if rows.is_empty() { return println_succ!("{}", empty_msg); } From 42573d539ddaf1d92d12b4e89bd827a16b1ce3ef Mon Sep 17 00:00:00 2001 From: Axel Nennker Date: Wed, 31 Jul 2019 16:55:17 +0200 Subject: [PATCH 036/320] fix warnings Signed-off-by: Axel Nennker --- cli/src/commands/did.rs | 11 +++++------ cli/src/commands/pool.rs | 16 +++++++--------- 2 files changed, 12 insertions(+), 15 deletions(-) diff --git a/cli/src/commands/did.rs b/cli/src/commands/did.rs index f9e4b09b7b..bdfae1def8 100644 --- a/cli/src/commands/did.rs +++ b/cli/src/commands/did.rs @@ -159,12 +159,11 @@ pub mod import_command { }) }); - if let Err(err) = res { - println_err!("{}", err); - Err(()) - } else { - println_succ!("DIDs import finished"); - Ok(()) + match res { + Err(err) => + println_err!("{}", err), + Ok(_) => + println_succ!("DIDs import finished") }; trace!("execute << "); diff --git a/cli/src/commands/pool.rs b/cli/src/commands/pool.rs index 6bbdfa30a8..505bc2bd0c 100644 --- a/cli/src/commands/pool.rs +++ b/cli/src/commands/pool.rs @@ -243,19 +243,17 @@ pub mod show_taa_command { let pool_handle = ensure_connected_pool_handle(&ctx)?; - match set_transaction_author_agreement(ctx, pool_handle, false) { - Ok(Some(_)) => { Ok(()) } + let res = match set_transaction_author_agreement(ctx, pool_handle, false) { + Err(_) => Err(()), + Ok(Some(_)) => Ok(()), Ok(None) => { - { - println!("There is no transaction agreement set on the Pool."); - Ok(()) - } + println!("There is no transaction agreement set on the Pool."); + Ok(()) } - Err(_) => Err(()) }; - trace!("execute << "); - Ok(()) + trace!("execute << {:?}", res); + res } } From eda35c6e79fea899f7086f8e739f09d25022981f Mon Sep 17 00:00:00 2001 From: Theo Turner Date: Wed, 31 Jul 2019 18:20:38 +0100 Subject: [PATCH 037/320] Fix mac installer formula failures Signed-off-by: Theo Turner --- libindy/mac.build.sh | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/libindy/mac.build.sh b/libindy/mac.build.sh index f69abd038b..3611fb3fda 100755 --- a/libindy/mac.build.sh +++ b/libindy/mac.build.sh @@ -14,19 +14,29 @@ trap 'error_report $LINENO' ERR echo -e "${onyellow}Installing libindy...$endcolor" +function brew_install { + if brew ls --versions $1 >/dev/null; then + if [[ $(brew outdated $1) ]]; then + HOMEBREW_NO_AUTO_UPDATE=1 brew upgrade $1 + fi + else + HOMEBREW_NO_AUTO_UPDATE=1 brew install $1 + fi +} + if [[ "$OSTYPE" == "darwin"* ]]; then xcode-select --version || xcode-select --install brew --version || yes | /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" cmake --version || brew install cmake # brew install cmake throws error, not warning if already installed curl https://sh.rustup.rs -sSf | sh -s -- -y export PATH="$HOME/.cargo/bin:$PATH" # so can use cargo without relog - brew install pkg-config \ - https://raw.githubusercontent.com/Homebrew/homebrew-core/6fc62ce98a65b474d3a67441b5e82b7b8e51ffd1/Formula/libsodium.rb \ - automake \ - autoconf \ - openssl \ - zeromq \ - zmq + brew_install pkg-config + brew_install libsodium + brew_install automake + brew_install autoconf + brew_install openssl + brew_install zeromq + brew_install zmq export PKG_CONFIG_ALLOW_CROSS=1 export CARGO_INCREMENTAL=1 export RUST_LOG=indy=trace @@ -45,3 +55,5 @@ export LD_LIBRARY_PATH='$LIBRARY_PATH >> ~/.bash_profile else echo -e "${onred}You are not running MacOS. This is a MacOS installer.$endcolor" fi + + From 2079739268141edeb49800a2f10899e478006113 Mon Sep 17 00:00:00 2001 From: "artem.ivanov" Date: Mon, 29 Jul 2019 11:19:12 +0300 Subject: [PATCH 038/320] IS-1906: Ubuntu 18.04 - updated debian build script Signed-off-by: artem.ivanov --- Jenkinsfile.cd | 33 ++++++++++++++------------------- Jenkinsfile.ci | 23 +++++++++++------------ ci/deb-build-and-upload.sh | 2 +- libindy/ci/ubuntu18.dockerfile | 18 ++++++++++-------- 4 files changed, 36 insertions(+), 40 deletions(-) diff --git a/Jenkinsfile.cd b/Jenkinsfile.cd index 669cfc09af..958e3a19a7 100644 --- a/Jenkinsfile.cd +++ b/Jenkinsfile.cd @@ -16,7 +16,7 @@ properties([ libindyBuildFinished = ["Ubuntu 16.04": false, "Ubuntu 18.04": false, "RedHat": false] libvcxBuildFinished = ["Ubuntu 16.04": false, "Ubuntu 18.04": false, "RedHat": false] -ubuntuPakageTypes = ["Ubuntu 16.04": "", "Ubuntu 18.04": "--distro"] +ubuntuPakageTypes = ["Ubuntu 16.04": "xenial", "Ubuntu 18.04": "bionic"] gitHubUserCredId = env.GITHUB_BOT_USER ?: 'sovbot-github' sovrinPackagingRepo = env.SOVRIN_PACKAGING_REPO ?: 'https://github.com/sovrin-foundation/sovrin-packaging' @@ -60,12 +60,12 @@ def publishing() { 'windows-files': { windowsPublishing() }, 'android-files': { androidPublishing() }, 'ios-files' : { iosPublishing() }, - 'macos-files': { macOsPublishing() }, + 'macos-files' : { macOsPublishing() }, ]) -// if (publishedVersions['windows-files'] != publishedVersions['ubuntu-files']) { // FIXME check rhel too, IS-307 -// error "platforms artifacts have different versions" -// } + if (publishedVersions['windows-files'] != publishedVersions['ubuntu-files']) { // FIXME check rhel too, IS-307 + error "platforms artifacts have different versions" + } } } @@ -221,10 +221,10 @@ def linuxTesting(file, env_name, network_name, stashBuildResults, test_wrappers) libindyBuildFinished[env_name] } def jobs = [ - "${env_name}-cli-test" : { + "${env_name}-cli-test": { linuxModuleTesting(file, env_name, network_name, this.&linuxCLITesting, stashBuildResults) }, - "${env_name}-vcx-test" : { + "${env_name}-vcx-test": { vcxTesting(file, env_name, network_name, stashBuildResults, test_wrappers) } ] @@ -927,18 +927,13 @@ def rhelPublishing() { def ubuntuPublishing() { stage('Ubuntu Publishing') { - parallel([ - "ubuntu:16.04": { - linuxPublishing("ci/ubuntu.dockerfile ci", "Ubuntu 16.04", true) - }, - "ubuntu:18.04": { - linuxPublishing("ci/ubuntu18.dockerfile ci", "Ubuntu 18.04", false) - } - ]) + def libindyVersion = linuxPublishing("ci/ubuntu.dockerfile ci", "Ubuntu 16.04", true) + linuxPublishing("ci/ubuntu18.dockerfile ci", "Ubuntu 18.04", false) + return libindyVersion } } -def linuxPublishing(file, env_name, build_wrappers){ +def linuxPublishing(file, env_name, build_wrappers) { def libindyVersion node('ubuntu') { @@ -957,7 +952,7 @@ def linuxPublishing(file, env_name, build_wrappers){ libvcxDebPublishing(testEnv, env_name) libindyCliDebPublishing(testEnv, libindyVersion, env_name) - if (build_wrappers){ + if (build_wrappers) { pythonWrapperPublishing(testEnv, false, 'wrappers/python', 'libindy') nodejsWrapperPublishing(testEnv, false, 'libindy') javaWrapperPublishing(testEnv, false) @@ -1580,7 +1575,7 @@ def publishLibvcxDebRCtoStable(testEnv, env_name) { def publishDebRCtoStable(testEnv, packageName, folder, version, stashName, moveDevArtifacts, env_name) { testEnv.inside { def rcFullVersion = "${version}~${env.BUILD_NUMBER}" - def build_type = ubuntuPakageTypes[env_name] + def package_type = ubuntuPakageTypes[env_name] unstash name: "${stashName}${env_name}" @@ -1598,7 +1593,7 @@ def publishDebRCtoStable(testEnv, packageName, folder, version, stashName, moveD withCredentials([file(credentialsId: 'SovrinRepoSSHKey', variable: 'sovrin_key')]) { path = sh(returnStdout: true, script: 'pwd').trim() - sh "./sovrin-packaging/upload_debs.py $path $SOVRIN_SDK_REPO_NAME stable --host $SOVRIN_REPO_HOST --ssh-key $sovrin_key ${build_type}" + sh "./sovrin-packaging/upload_debs.py $path $SOVRIN_SDK_REPO_NAME stable --distro=${package_type} --host $SOVRIN_REPO_HOST --ssh-key $sovrin_key" } } } diff --git a/Jenkinsfile.ci b/Jenkinsfile.ci index 662f0d436a..c96faafb9f 100644 --- a/Jenkinsfile.ci +++ b/Jenkinsfile.ci @@ -24,10 +24,10 @@ def testing() { def staticValidation() { parallel([ - 'libindy' : { runValdiationRust('libindy') }, - 'libnullpay': { runValdiationRust('libnullpay') }, - 'libvcx' : { runValdiationRust('vcx/libvcx') }, - 'cli' : { runValdiationRust('cli') } + 'libindy' : { runValdiationRust('libindy') }, + 'libnullpay' : { runValdiationRust('libnullpay') }, + 'libvcx' : { runValdiationRust('vcx/libvcx') }, + 'cli' : { runValdiationRust('cli') } ]) } @@ -248,7 +248,7 @@ def androidTesting() { def iosTesting() { - def setupRustIOS = { + def setupRustIOS ={ sh "rustup target add x86_64-apple-ios" } @@ -341,10 +341,10 @@ def ubuntuTesting() { stage('Ubuntu Test') { parallel([ "ubuntu:16.04": { - linuxTesting("ci/ubuntu.dockerfile ci", "Ubuntu 16.04", true) + linuxTesting("ci/ubuntu.dockerfile ci", "Ubuntu 16.04", "pool_network", true) }, "ubuntu:18.04": { - linuxTesting("ci/ubuntu18.dockerfile ci", "Ubuntu 18.04", false) + linuxTesting("ci/ubuntu18.dockerfile ci", "Ubuntu 18.04", "pool_network", false) } ]) } @@ -352,12 +352,11 @@ def ubuntuTesting() { def rhelTesting() { stage('RedHat Test') { - linuxTesting("ci/amazon.dockerfile ci", "RedHat", false) + linuxTesting("ci/amazon.dockerfile ci", "RedHat", "pool_network", false) } } -def linuxTesting(file, env_name, test_wrappers) { - def network_name = "pool_network" +def linuxTesting(file, env_name, network_name, test_wrappers) { parallel([ failFast : true, "${env_name} Test: build and test libindy": { @@ -370,10 +369,10 @@ def linuxTesting(file, env_name, test_wrappers) { libindyBuildFinished[env_name] } def jobs = [ - "${env_name}-cli-test": { + "${env_name}-cli-test" : { linuxModuleTesting(file, env_name, network_name, this.&linuxCLITesting) }, - "${env_name}-vcx-test": { + "${env_name}-vcx-test" : { vcxTesting(file, env_name, network_name, test_wrappers) } ] diff --git a/ci/deb-build-and-upload.sh b/ci/deb-build-and-upload.sh index 94dcb0fe08..c88eb7b35c 100644 --- a/ci/deb-build-and-upload.sh +++ b/ci/deb-build-and-upload.sh @@ -32,4 +32,4 @@ dpkg-buildpackage -tc mkdir debs && mv ../*.deb ./debs/ -./sovrin-packaging/upload_debs.py ./debs $repo $type --host $host --ssh-key $key $package_type +./sovrin-packaging/upload_debs.py ./debs $repo $type --distro=$package_type --host $host --ssh-key $key diff --git a/libindy/ci/ubuntu18.dockerfile b/libindy/ci/ubuntu18.dockerfile index f38de918d5..3c20c9150f 100644 --- a/libindy/ci/ubuntu18.dockerfile +++ b/libindy/ci/ubuntu18.dockerfile @@ -6,10 +6,12 @@ RUN apt-get update && \ apt-get install -y \ pkg-config \ libssl-dev \ + libgmp3-dev \ curl \ build-essential \ libsqlite3-dev \ cmake \ + git \ python3.5 \ python3-pip \ python-setuptools \ @@ -19,7 +21,8 @@ RUN apt-get update && \ wget \ devscripts \ libncursesw5-dev \ - libzmq3-dev + libzmq3-dev \ + libsodium-dev RUN pip3 install -U \ pip \ @@ -29,13 +32,12 @@ RUN pip3 install -U \ plumbum \ deb-pkg-tools -RUN cd /tmp && \ - curl https://download.libsodium.org/libsodium/releases/old/libsodium-1.0.14.tar.gz | tar -xz && \ - cd /tmp/libsodium-1.0.14 && \ - ./configure --disable-shared && \ - make && \ - make install && \ - rm -rf /tmp/libsodium-1.0.14 +RUN apt-get update && apt-get install -y --no-install-recommends \ + ruby \ + ruby-dev \ + rubygems \ + && gem install --no-ri --no-rdoc rake fpm \ + && rm -rf /var/lib/apt/lists/* RUN useradd -ms /bin/bash -u $uid indy USER indy From 4311bebd0a21cf2614c5c31cbb4ae9ddf0c288a9 Mon Sep 17 00:00:00 2001 From: Axel Nennker Date: Thu, 1 Aug 2019 17:28:45 +0200 Subject: [PATCH 039/320] fix unneeded calls to clone Signed-off-by: Axel Nennker --- libindy/src/commands/anoncreds/issuer.rs | 4 ++-- libindy/src/domain/ledger/author_agreement.rs | 2 +- libindy/src/services/anoncreds/prover.rs | 6 +++--- libindy/src/services/pool/networker.rs | 2 +- libindy/src/services/pool/pool.rs | 12 ++++++------ libindy/src/services/pool/request_handler.rs | 4 ++-- 6 files changed, 15 insertions(+), 15 deletions(-) diff --git a/libindy/src/commands/anoncreds/issuer.rs b/libindy/src/commands/anoncreds/issuer.rs index 8b1dd06a7f..121925075a 100644 --- a/libindy/src/commands/anoncreds/issuer.rs +++ b/libindy/src/commands/anoncreds/issuer.rs @@ -326,7 +326,7 @@ impl IssuerCommandExecutor { SignatureType::CL }; - let schema_id = schema.seq_no.map(|n| n.to_string()).unwrap_or(schema.id.clone()); + let schema_id = schema.seq_no.map(|n| n.to_string()).unwrap_or_else(|| schema.id.clone()); let cred_def_id = CredentialDefinition::cred_def_id(issuer_did, &schema_id, &signature_type.to_str(), tag); @@ -535,7 +535,7 @@ impl IssuerCommandExecutor { } if rev_reg_def.value.issuance_type == IssuanceType::ISSUANCE_ON_DEMAND { - rev_reg_info.used_ids.insert(rev_reg_info.curr_id.clone()); + rev_reg_info.used_ids.insert(rev_reg_info.curr_id); } // TODO: FIXME: Review error kind! diff --git a/libindy/src/domain/ledger/author_agreement.rs b/libindy/src/domain/ledger/author_agreement.rs index eaa9724e4d..8f4124438f 100644 --- a/libindy/src/domain/ledger/author_agreement.rs +++ b/libindy/src/domain/ledger/author_agreement.rs @@ -45,7 +45,7 @@ impl GetTxnAuthorAgreementOperation { _type: GET_TXN_AUTHR_AGRMT.to_string(), digest: data.as_ref().and_then(|d| d.digest.clone()), version: data.as_ref().and_then(|d| d.version.clone()), - timestamp: data.as_ref().and_then(|d| d.timestamp.clone()), + timestamp: data.as_ref().and_then(|d| d.timestamp), } } } diff --git a/libindy/src/services/anoncreds/prover.rs b/libindy/src/services/anoncreds/prover.rs index 9088d9dfc0..84e11ca20a 100644 --- a/libindy/src/services/anoncreds/prover.rs +++ b/libindy/src/services/anoncreds/prover.rs @@ -176,7 +176,7 @@ impl Prover { schema_id: credential.schema_id.clone(), cred_def_id: credential.cred_def_id.clone(), rev_reg_id: credential.rev_reg_id.clone(), - timestamp: cred_key.timestamp.clone(), + timestamp: cred_key.timestamp, }); self._update_requested_proof(req_attrs_for_cred, @@ -215,10 +215,10 @@ impl Prover { let req_attr_info = RequestedAttributeInfo { attr_referent: attr_referent.clone(), attr_info: attr_info.clone(), - revealed: requested_attr.revealed.clone(), + revealed: requested_attr.revealed, }; - match credentials_for_proving.entry(ProvingCredentialKey { cred_id: requested_attr.cred_id.clone(), timestamp: requested_attr.timestamp.clone() }) { + match credentials_for_proving.entry(ProvingCredentialKey { cred_id: requested_attr.cred_id.clone(), timestamp: requested_attr.timestamp }) { Entry::Occupied(cred_for_proving) => { let &mut (ref mut attributes_for_credential, _) = cred_for_proving.into_mut(); attributes_for_credential.push(req_attr_info); diff --git a/libindy/src/services/pool/networker.rs b/libindy/src/services/pool/networker.rs index 3ca31d4cc4..eccb0a223b 100644 --- a/libindy/src/services/pool/networker.rs +++ b/libindy/src/services/pool/networker.rs @@ -56,7 +56,7 @@ impl Networker for ZMQNetworker { fn process_event(&mut self, pe: Option) -> Option { match pe.clone() { Some(NetworkerEvent::SendAllRequest(_, req_id, _, _)) | Some(NetworkerEvent::SendOneRequest(_, req_id, _)) | Some(NetworkerEvent::Resend(req_id, _)) => { - let num = self.req_id_mappings.get(&req_id).map(|i| i.clone()).or_else(|| { + let num = self.req_id_mappings.get(&req_id).map(|i| *i).or_else(|| { trace!("sending new request"); self.pool_connections.iter().next_back().and_then(|(pc_idx, pc)| { if pc.is_active() && pc.req_cnt < self.conn_limit diff --git a/libindy/src/services/pool/pool.rs b/libindy/src/services/pool/pool.rs index a6da2a6509..6bfd932009 100644 --- a/libindy/src/services/pool/pool.rs +++ b/libindy/src/services/pool/pool.rs @@ -280,7 +280,7 @@ impl> PoolSM { Err(err) => { CommandExecutor::instance().send( Command::Pool( - PoolCommand::OpenAck(cmd_id, id.clone(), Err(err))) + PoolCommand::OpenAck(cmd_id, id, Err(err))) ).unwrap(); PoolState::Terminated(state.into()) } @@ -492,7 +492,7 @@ impl> Pool { pub fn work(&mut self, cmd_socket: zmq::Socket) { let name = self.name.as_str().to_string(); - let id = self.id.clone(); + let id = self.id; let timeout = self.timeout; let extended_timeout = self.extended_timeout; let active_timeout = self.active_timeout; @@ -709,16 +709,16 @@ fn _close_pool_ack(cmd_id: i32) { } fn _send_submit_ack(cmd_id: i32, res: IndyResult) { - let lc = LedgerCommand::SubmitAck(cmd_id.clone(), res); + let lc = LedgerCommand::SubmitAck(cmd_id, res); CommandExecutor::instance().send(Command::Ledger(lc)).unwrap(); } fn _send_open_refresh_ack(cmd_id: i32, id: i32, is_refresh: bool) { trace!("PoolSM: from getting catchup target to active"); let pc = if is_refresh { - PoolCommand::RefreshAck(cmd_id.clone(), Ok(())) + PoolCommand::RefreshAck(cmd_id, Ok(())) } else { - PoolCommand::OpenAck(cmd_id.clone(), id, Ok(())) + PoolCommand::OpenAck(cmd_id, id, Ok(())) }; CommandExecutor::instance().send(Command::Pool(pc)).unwrap(); } @@ -741,7 +741,7 @@ impl Drop for ZMQPool { fn drop(&mut self) { info!("Drop started"); - if let Err(err) = self.cmd_socket.send("exit".as_bytes(), zmq::DONTWAIT) { + if let Err(err) = self.cmd_socket.send(b"exit", zmq::DONTWAIT) { warn!("Can't send exit command to pool worker thread (may be already finished) {}", err); } diff --git a/libindy/src/services/pool/request_handler.rs b/libindy/src/services/pool/request_handler.rs index de8eb9c83c..a6aadf2002 100644 --- a/libindy/src/services/pool/request_handler.rs +++ b/libindy/src/services/pool/request_handler.rs @@ -707,7 +707,7 @@ fn _send_replies(cmd_ids: &Vec, msg: IndyResult) { cmd_ids.into_iter().for_each(|id| { CommandExecutor::instance().send( Command::Ledger( - LedgerCommand::SubmitAck(id.clone(), msg.clone())) + LedgerCommand::SubmitAck(*id, msg.clone())) ).unwrap(); }); } @@ -814,7 +814,7 @@ fn _extract_left_last_write_time(msg_result: &SJsonValue) -> Option { } fn _get_freshness_threshold() -> u64 { - THRESHOLD.lock().unwrap().clone() + *THRESHOLD.lock().unwrap() } fn _get_cur_time() -> u64 { From 4069008038c22b714860d9f3321c36f9aa95bf24 Mon Sep 17 00:00:00 2001 From: Axel Nennker Date: Thu, 1 Aug 2019 17:29:25 +0200 Subject: [PATCH 040/320] fix as_bytes calls on &str const Signed-off-by: Axel Nennker --- libindy/src/services/pool/state_proof/mod.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libindy/src/services/pool/state_proof/mod.rs b/libindy/src/services/pool/state_proof/mod.rs index 30aed9305a..cbcc99c2b6 100644 --- a/libindy/src/services/pool/state_proof/mod.rs +++ b/libindy/src/services/pool/state_proof/mod.rs @@ -701,11 +701,11 @@ fn _calculate_taa_digest(text: &str, version: &str) -> IndyResult> { } fn _is_full_taa_state_value_expected(expected_state_key: &[u8]) -> bool { - expected_state_key.starts_with("2:d:".as_bytes()) + expected_state_key.starts_with(b"2:d:") } fn _if_rev_delta_multi_state_proof_expected(sp_key: &[u8]) -> bool { - sp_key.starts_with("\x06:".as_bytes()) || sp_key.starts_with("6:".as_bytes()) + sp_key.starts_with(b"\x06:") || sp_key.starts_with(b"6:") } #[cfg(test)] From 87989e7510d18ddb34ef6a30a33b0d13886bb940 Mon Sep 17 00:00:00 2001 From: Axel Nennker Date: Thu, 1 Aug 2019 17:31:53 +0200 Subject: [PATCH 041/320] fix redundant field names in struct initialization Signed-off-by: Axel Nennker --- libindy/src/services/ledger/merkletree/merkletree.rs | 8 ++++---- libindy/src/services/ledger/merkletree/proof.rs | 8 ++++---- libindy/src/services/ledger/merkletree/tree.rs | 2 +- libindy/src/services/pool/catchup.rs | 4 ++-- libindy/src/utils/crypto/hash/openssl.rs | 2 +- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/libindy/src/services/ledger/merkletree/merkletree.rs b/libindy/src/services/ledger/merkletree/merkletree.rs index a46c8ad368..588c712c6b 100644 --- a/libindy/src/services/ledger/merkletree/merkletree.rs +++ b/libindy/src/services/ledger/merkletree/merkletree.rs @@ -82,10 +82,10 @@ impl MerkleTree { let root = cur.remove(0); Ok(MerkleTree { - root: root, - height: height, - count: count, - nodes_count: nodes_count + root, + height, + count, + nodes_count }) } diff --git a/libindy/src/services/ledger/merkletree/proof.rs b/libindy/src/services/ledger/merkletree/proof.rs index 2e160ba15f..584ba025a8 100644 --- a/libindy/src/services/ledger/merkletree/proof.rs +++ b/libindy/src/services/ledger/merkletree/proof.rs @@ -21,9 +21,9 @@ impl Proof { /// Constructs a new `Proof` pub fn new(root_hash: Vec, lemma: Lemma, value: TreeLeafData) -> Self { Proof { - root_hash: root_hash, - lemma: lemma, - value: value + root_hash, + lemma, + value } } @@ -123,7 +123,7 @@ impl Lemma { .map(|(sub_lemma, sibling_hash)| { Lemma { node_hash: hash.into(), - sibling_hash: sibling_hash, + sibling_hash, sub_lemma: Some(Box::new(sub_lemma)) } }) diff --git a/libindy/src/services/ledger/merkletree/tree.rs b/libindy/src/services/ledger/merkletree/tree.rs index aee6857446..30d3e57012 100644 --- a/libindy/src/services/ledger/merkletree/tree.rs +++ b/libindy/src/services/ledger/merkletree/tree.rs @@ -41,7 +41,7 @@ impl Tree { pub fn new(hash: Digest, value: TreeLeafData) -> Self { Tree::Leaf { hash: hash.to_vec(), - value: value + value } } diff --git a/libindy/src/services/pool/catchup.rs b/libindy/src/services/pool/catchup.rs index a5a671db1e..8efdc124de 100644 --- a/libindy/src/services/pool/catchup.rs +++ b/libindy/src/services/pool/catchup.rs @@ -31,8 +31,8 @@ pub fn build_catchup_req(merkle: &MerkleTree, target_mt_size: usize) -> IndyResu let cr = CatchupReq { ledgerId: 0, - seqNoStart: seq_no_start.clone(), - seqNoEnd: seq_no_end.clone(), + seqNoStart: seq_no_start, + seqNoEnd: seq_no_end, catchupTill: target_mt_size, }; diff --git a/libindy/src/utils/crypto/hash/openssl.rs b/libindy/src/utils/crypto/hash/openssl.rs index 727efe8f48..e3a764c9d7 100644 --- a/libindy/src/utils/crypto/hash/openssl.rs +++ b/libindy/src/utils/crypto/hash/openssl.rs @@ -19,7 +19,7 @@ pub struct Digest { impl Digest { fn new(data: DigestBytes) -> Digest { Digest { - data: data + data } } From 8010b55f0a9a2311ec22cab57a0578302dfd26fa Mon Sep 17 00:00:00 2001 From: Axel Nennker Date: Thu, 1 Aug 2019 17:36:21 +0200 Subject: [PATCH 042/320] fix redundant field names in struct initialization Signed-off-by: Axel Nennker --- libindy/src/services/wallet/iterator.rs | 2 +- libindy/src/services/wallet/storage/plugged/mod.rs | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/libindy/src/services/wallet/iterator.rs b/libindy/src/services/wallet/iterator.rs index 1436e49853..b512492393 100644 --- a/libindy/src/services/wallet/iterator.rs +++ b/libindy/src/services/wallet/iterator.rs @@ -17,7 +17,7 @@ impl WalletIterator { pub fn new(storage_iter: Box, keys: Rc) -> Self { WalletIterator { storage_iterator: storage_iter, - keys: keys, + keys, } } diff --git a/libindy/src/services/wallet/storage/plugged/mod.rs b/libindy/src/services/wallet/storage/plugged/mod.rs index 4baa612836..3ba1388655 100644 --- a/libindy/src/services/wallet/storage/plugged/mod.rs +++ b/libindy/src/services/wallet/storage/plugged/mod.rs @@ -73,8 +73,8 @@ impl PluggedStorageIterator { fn new(storage: &PluggedStorage, search_handle: i32, options: SearchOptions) -> Self { Self { storage_handle: storage.handle, - search_handle: search_handle, - options: options, + search_handle, + options, fetch_search_next_record_handler: storage.fetch_search_next_record_handler, get_search_total_count_handler: storage.get_search_total_count_handler, get_record_type_handler: storage.get_record_type_handler, @@ -179,10 +179,10 @@ impl StorageIterator for PluggedStorageIterator { } else { None }; Ok(Some(StorageRecord { - type_: type_, - id: id, - value: value, - tags: tags, + type_, + id, + value, + tags, })) } From 122292701a5ed1c7d6418cb338934636747a5b4a Mon Sep 17 00:00:00 2001 From: Axel Nennker Date: Thu, 1 Aug 2019 17:39:19 +0200 Subject: [PATCH 043/320] remove unneeded return statements Signed-off-by: Axel Nennker --- libindy/src/services/payments.rs | 2 +- libindy/src/services/pool/state_proof/node.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libindy/src/services/payments.rs b/libindy/src/services/payments.rs index 623606fe09..5f328c897e 100644 --- a/libindy/src/services/payments.rs +++ b/libindy/src/services/payments.rs @@ -553,7 +553,7 @@ impl PaymentsService { format!("The requester must be an owner of the transaction that already present on the ledger."))); } - return Ok(()); + Ok(()) } fn _get_req_info(constraint: &RoleConstraint, fees: &Fees) -> IndyResult { diff --git a/libindy/src/services/pool/state_proof/node.rs b/libindy/src/services/pool/state_proof/node.rs index ca72831afc..5bf4a582ce 100644 --- a/libindy/src/services/pool/state_proof/node.rs +++ b/libindy/src/services/pool/state_proof/node.rs @@ -182,7 +182,7 @@ impl Node { trace!("Node::get_node >> path: {:?}", path); let nibble_path = Node::path_to_nibbles(path); trace!("Node::get_node >> made some nibbles >> nibbles: {:?}", nibble_path); - return self._get_node(db, nibble_path.as_slice(), vec![].as_slice()) + self._get_node(db, nibble_path.as_slice(), vec![].as_slice()) } fn _get_node<'a, 'b>(&'a self, db: &'a TrieDB, path: &'b [u8], seen_path: &'b [u8]) -> IndyResult)>> { From 320d32ca26f7fe0a021e1cb582d2fb00cba9a09c Mon Sep 17 00:00:00 2001 From: Axel Nennker Date: Thu, 1 Aug 2019 17:54:08 +0200 Subject: [PATCH 044/320] use empty() Signed-off-by: Axel Nennker --- libindy/src/services/wallet/language.rs | 4 ++-- libindy/src/utils/crypto/chacha20poly1305_ietf/sodium.rs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libindy/src/services/wallet/language.rs b/libindy/src/services/wallet/language.rs index 4b2e696f42..a7600db7b2 100644 --- a/libindy/src/services/wallet/language.rs +++ b/libindy/src/services/wallet/language.rs @@ -159,14 +159,14 @@ impl string::ToString for Operator { ) } Operator::And(ref operators) => { - if operators.len() > 0 { + if !operators.is_empty() { format!( r#"{{"$and":[{}]}}"#, operators.iter().map(|o: &Operator| { o.to_string() }).collect::>().join(",")) } else { "{}".to_string() } }, Operator::Or(ref operators) => { - if operators.len() > 0 { + if !operators.is_empty() { format!( r#"{{"$or":[{}]}}"#, operators.iter().map(|o: &Operator| { o.to_string() }).collect::>().join(",")) diff --git a/libindy/src/utils/crypto/chacha20poly1305_ietf/sodium.rs b/libindy/src/utils/crypto/chacha20poly1305_ietf/sodium.rs index 72d207a551..b44dc71745 100644 --- a/libindy/src/utils/crypto/chacha20poly1305_ietf/sodium.rs +++ b/libindy/src/utils/crypto/chacha20poly1305_ietf/sodium.rs @@ -146,7 +146,7 @@ impl Write for Writer { } fn flush(&mut self) -> io::Result<()> { - if self.buffer.len() > 0 { + if !self.buffer.is_empty() { self.inner.write_all(&encrypt(&self.buffer, &self.key, &self.nonce))?; self.nonce.increment(); } @@ -204,7 +204,7 @@ impl Read for Reader { let mut pos = 0; // Consume from rest buffer - if self.rest_buffer.len() > 0 { + if !self.rest_buffer.is_empty() { let to_copy = cmp::min(self.rest_buffer.len(), buf.len() - pos); buf[pos..pos + to_copy].copy_from_slice(&self.rest_buffer[..to_copy]); pos += to_copy; From 6bcefa5e9f9a674a524a2b0806feb1fa2f438838 Mon Sep 17 00:00:00 2001 From: Axel Nennker Date: Thu, 1 Aug 2019 18:25:40 +0200 Subject: [PATCH 045/320] remove identical conversion Signed-off-by: Axel Nennker --- libindy/src/commands/payments.rs | 32 ++++++++++---------- libindy/src/services/payments.rs | 1 - libindy/src/services/pool/request_handler.rs | 4 +-- 3 files changed, 18 insertions(+), 19 deletions(-) diff --git a/libindy/src/commands/payments.rs b/libindy/src/commands/payments.rs index e682bf4b88..38714b604d 100644 --- a/libindy/src/commands/payments.rs +++ b/libindy/src/commands/payments.rs @@ -349,7 +349,7 @@ impl PaymentsCommandExecutor { trace!("create_address >>> wallet_handle: {:?}, type_: {:?}, config: {:?}", wallet_handle, type_, config); match self.wallet_service.check(wallet_handle).map_err(map_err_err!()) { - Err(err) => return cb(Err(IndyError::from(err))), + Err(err) => return cb(Err(err)), _ => () }; self._process_method_str(cb, &|i| self.payments_service.create_address(i, wallet_handle, type_, config)); @@ -365,7 +365,7 @@ impl PaymentsCommandExecutor { self.wallet_service.add_record(wallet_handle, &self.wallet_service.add_prefix("PaymentAddress"), &res, &res, &HashMap::new()).map(|_| res) .map_err(IndyError::from) } - Err(err) => Err(IndyError::from(err)) + Err(err) => Err(err) }; self._common_ack_str(handle, total_result, "CreateAddressAck"); trace!("create_address_ack <<<"); @@ -451,7 +451,7 @@ impl PaymentsCommandExecutor { trace!("build_get_payment_sources_request >>> wallet_handle: {:?}, submitter_did: {:?}, payment_address: {:?}", wallet_handle, submitter_did, payment_address); if let Some(did) = submitter_did { match self.crypto_service.validate_did(did).map_err(map_err_err!()) { - Err(err) => return cb(Err(IndyError::from(err))), + Err(err) => return cb(Err(err)), _ => () } } @@ -494,7 +494,7 @@ impl PaymentsCommandExecutor { trace!("build_payment_req >>> wallet_handle: {:?}, submitter_did: {:?}, inputs: {:?}, outputs: {:?}, extra: {:?}", wallet_handle, submitter_did, inputs, outputs, extra); if let Some(did) = submitter_did { match self.crypto_service.validate_did(did).map_err(map_err_err!()) { - Err(err) => return cb(Err(IndyError::from(err))), + Err(err) => return cb(Err(err)), _ => () } } @@ -512,7 +512,7 @@ impl PaymentsCommandExecutor { ); } Err(error) => { - cb(Err(IndyError::from(error))) + cb(Err(error)) } } trace!("build_payment_req <<<"); @@ -565,7 +565,7 @@ impl PaymentsCommandExecutor { trace!("build_mint_req >>> wallet_handle: {:?}, submitter_did: {:?}, outputs: {:?}, extra: {:?}", wallet_handle, submitter_did, outputs, extra); if let Some(did) = submitter_did { match self.crypto_service.validate_did(did).map_err(map_err_err!()) { - Err(err) => return cb(Err(IndyError::from(err))), + Err(err) => return cb(Err(err)), _ => () } } @@ -578,7 +578,7 @@ impl PaymentsCommandExecutor { &|i| self.payments_service.build_mint_req(i, &type_copy, wallet_handle, submitter_did, outputs, extra), ); } - Err(error) => cb(Err(IndyError::from(error))) + Err(error) => cb(Err(error)) } trace!("build_mint_req <<<"); } @@ -593,7 +593,7 @@ impl PaymentsCommandExecutor { trace!("build_set_txn_fees_req >>> wallet_handle: {:?}, submitter_did: {:?}, type_: {:?}, fees: {:?}", wallet_handle, submitter_did, type_, fees); if let Some(did) = submitter_did { match self.crypto_service.validate_did(did).map_err(map_err_err!()) { - Err(err) => return cb(Err(IndyError::from(err))), + Err(err) => return cb(Err(err)), _ => () } } @@ -649,7 +649,7 @@ impl PaymentsCommandExecutor { trace!("build_verify_payment_request >>> wallet_handle: {:?}, submitter_did: {:?}, receipt: {:?}", wallet_handle, submitter_did, receipt); if let Some(did) = submitter_did { match self.crypto_service.validate_did(did).map_err(map_err_err!()) { - Err(err) => return cb(Err(IndyError::from(err))), + Err(err) => return cb(Err(err)), _ => () } } @@ -657,7 +657,7 @@ impl PaymentsCommandExecutor { let method = match self.payments_service.parse_method_from_payment_address(receipt) { Ok(method) => method, Err(err) => { - cb(Err(IndyError::from(err))); + cb(Err(err)); return; } }; @@ -692,14 +692,14 @@ impl PaymentsCommandExecutor { let method = match self.payments_service.parse_method_from_payment_address(address) { Ok(method) => method, Err(err) => { - cb(Err(IndyError::from(err))); + cb(Err(err)); return; } }; let cmd_handle = ::utils::sequence::get_next_id(); if let Err(err) = self.payments_service.sign_with_address(cmd_handle, &method, wallet_handle, address, message) { - cb(Err(IndyError::from(err))); + cb(Err(err)); } else { self.pending_array_callbacks.borrow_mut().insert(cmd_handle, cb); } @@ -720,7 +720,7 @@ impl PaymentsCommandExecutor { let method = match self.payments_service.parse_method_from_payment_address(address) { Ok(method) => method, Err(err) => { - cb(Err(IndyError::from(err))); + cb(Err(err)); return; } }; @@ -728,7 +728,7 @@ impl PaymentsCommandExecutor { let cmd_handle = ::utils::sequence::get_next_id(); if let Err(err) = self.payments_service.verify_with_address(cmd_handle, &method, address, message, signature) { - cb(Err(IndyError::from(err))) + cb(Err(err)) } else { self.pending_bool_callbacks.borrow_mut().insert(cmd_handle, cb); } @@ -752,7 +752,7 @@ impl PaymentsCommandExecutor { Ok(()) => { self.pending_callbacks_str.borrow_mut().insert(cmd_handle, cb); } - Err(err) => cb(Err(IndyError::from(err))) + Err(err) => cb(Err(err)) } } @@ -763,7 +763,7 @@ impl PaymentsCommandExecutor { Ok(()) => { self.pending_callbacks_str_i64.borrow_mut().insert(cmd_handle, cb); } - Err(err) => cb(Err(IndyError::from(err))) + Err(err) => cb(Err(err)) } } diff --git a/libindy/src/services/payments.rs b/libindy/src/services/payments.rs index 5f328c897e..cadeb06574 100644 --- a/libindy/src/services/payments.rs +++ b/libindy/src/services/payments.rs @@ -503,7 +503,6 @@ impl PaymentsService { let prices: Vec = constraint.auth_constraints .iter() .flat_map(|constraint| PaymentsService::_handle_constraint(&constraint, requester_info, fees)) - .into_iter() .flatten() .collect(); diff --git a/libindy/src/services/pool/request_handler.rs b/libindy/src/services/pool/request_handler.rs index a6aadf2002..fd4079d511 100644 --- a/libindy/src/services/pool/request_handler.rs +++ b/libindy/src/services/pool/request_handler.rs @@ -358,7 +358,7 @@ impl RequestSM { state.timeout_nodes.insert(node_alias.clone()); if state.is_consensus_reachable(f, nodes.len()) { state.networker.borrow_mut().process_event(Some(NetworkerEvent::CleanTimeout(req_id, Some(node_alias)))); - (RequestState::Consensus(state.into()), None) + (RequestState::Consensus(state), None) } else { //TODO: maybe we should change the error, but it was made to escape changing of ErrorCode returned to client _send_replies(&cmd_ids, Err(err_msg(IndyErrorKind::PoolTimeout, "Consensus is impossible"))); @@ -370,7 +370,7 @@ impl RequestSM { _finish_request(&cmd_ids); (RequestState::finish(), None) } - _ => (RequestState::Consensus(state.into()), None) + _ => (RequestState::Consensus(state), None) } } RequestState::Single(mut state) => { From 9515d86bf683ca5096772723a840ea482d58aee1 Mon Sep 17 00:00:00 2001 From: Axel Nennker Date: Thu, 1 Aug 2019 18:28:17 +0200 Subject: [PATCH 046/320] remove useless format! Signed-off-by: Axel Nennker --- libindy/src/errors/mod.rs | 2 +- libindy/src/services/payments.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libindy/src/errors/mod.rs b/libindy/src/errors/mod.rs index b89e56ea90..e91f4a30c8 100644 --- a/libindy/src/errors/mod.rs +++ b/libindy/src/errors/mod.rs @@ -347,7 +347,7 @@ impl From for IndyResult<()> { impl From for IndyError { fn from(err: ErrorCode) -> IndyError { - err_msg(err.into(), format!("Plugin returned error")) + err_msg(err.into(), "Plugin returned error".to_string()) } } diff --git a/libindy/src/services/payments.rs b/libindy/src/services/payments.rs index cadeb06574..24b8a3ddef 100644 --- a/libindy/src/services/payments.rs +++ b/libindy/src/services/payments.rs @@ -544,12 +544,12 @@ impl PaymentsService { if !constraint.off_ledger_signature && requester_info.is_off_ledger_signature { return Err(IndyError::from_msg(IndyErrorKind::TransactionNotAllowed, - format!("The requester must be published on the ledger."))); + "The requester must be published on the ledger.".to_string())); } if constraint.need_to_be_owner && !requester_info.is_owner { return Err(IndyError::from_msg(IndyErrorKind::TransactionNotAllowed, - format!("The requester must be an owner of the transaction that already present on the ledger."))); + "The requester must be an owner of the transaction that already present on the ledger.".to_string())); } Ok(()) From 18c67a76be818c1037b7efd08ff6d47a6c77eaf2 Mon Sep 17 00:00:00 2001 From: Axel Nennker Date: Thu, 1 Aug 2019 19:41:41 +0200 Subject: [PATCH 047/320] remove unneeded assignment Signed-off-by: Axel Nennker --- libindy/src/commands/anoncreds/prover.rs | 18 +++++----- libindy/src/commands/anoncreds/tails.rs | 5 ++- libindy/src/commands/cache.rs | 12 +++---- libindy/src/commands/non_secrets.rs | 42 ++++++++++++------------ libindy/src/commands/pool.rs | 12 +++---- libindy/src/commands/wallet.rs | 12 +++---- libindy/src/services/crypto/mod.rs | 6 ++-- 7 files changed, 50 insertions(+), 57 deletions(-) diff --git a/libindy/src/commands/anoncreds/prover.rs b/libindy/src/commands/anoncreds/prover.rs index 0476583e4c..9437d2d4de 100644 --- a/libindy/src/commands/anoncreds/prover.rs +++ b/libindy/src/commands/anoncreds/prover.rs @@ -330,7 +330,7 @@ impl ProverCommandExecutor { retroactive: bool) -> IndyResult<()> { debug!("set_credential_attr_tag_policy >>> wallet_handle: {:?}, cred_def_id: {:?}, catpol: {:?}, retroactive: {:?}", wallet_handle, cred_def_id, catpol, retroactive); - let res = match catpol { + match catpol { Some(pol) => { self.wallet_service.upsert_indy_object(wallet_handle, cred_def_id, pol)?; }, @@ -353,9 +353,9 @@ impl ProverCommandExecutor { } } - debug!("set_credential_attr_tag_policy <<< res: {:?}", res); + debug!("set_credential_attr_tag_policy <<< res: ()"); - Ok(res) + Ok(()) } fn get_credential_attr_tag_policy(&self, @@ -508,14 +508,14 @@ impl ProverCommandExecutor { fn close_credentials_search(&self, search_handle: i32) -> IndyResult<()> { trace!("close_credentials_search >>> search_handle: {:?}", search_handle); - let res = match self.searches.borrow_mut().remove(&search_handle) { + match self.searches.borrow_mut().remove(&search_handle) { Some(_) => Ok(()), None => Err(err_msg(IndyErrorKind::InvalidWalletHandle, format!("Unknown CredentialsSearch handle: {}", search_handle))) }?; - trace!("close_credentials_search <<< res: {:?}", res); + trace!("close_credentials_search <<< res: ()"); - Ok(res) + Ok(()) } fn get_credentials_for_proof_req(&self, @@ -629,14 +629,14 @@ impl ProverCommandExecutor { fn close_credentials_search_for_proof_req(&self, search_handle: i32) -> IndyResult<()> { trace!("close_credentials_search_for_proof_req >>> search_handle: {:?}", search_handle); - let res = match self.searches_for_proof_requests.borrow_mut().remove(&search_handle) { + match self.searches_for_proof_requests.borrow_mut().remove(&search_handle) { Some(_) => Ok(()), None => Err(err_msg(IndyErrorKind::InvalidWalletHandle, format!("Unknown CredentialsSearch handle: {}", search_handle))) }?; - trace!("close_credentials_search_for_proof_req <<< res: {:?}", res); + trace!("close_credentials_search_for_proof_req <<< res: ()"); - Ok(res) + Ok(()) } fn delete_credential(&self, diff --git a/libindy/src/commands/anoncreds/tails.rs b/libindy/src/commands/anoncreds/tails.rs index a52ad69938..b9e4416bd9 100644 --- a/libindy/src/commands/anoncreds/tails.rs +++ b/libindy/src/commands/anoncreds/tails.rs @@ -59,9 +59,8 @@ impl RevocationTailsAccessor for SDKTailsAccessor { let tail = Tail::from_bytes(tail_bytes.as_slice())?; accessor(&tail); - let res = (); - debug!("access_tail <<< res: {:?}", res); - Ok(res) + debug!("access_tail <<< res: ()"); + Ok(()) } } diff --git a/libindy/src/commands/cache.rs b/libindy/src/commands/cache.rs index 8e5afa11f2..d79ffd9c45 100644 --- a/libindy/src/commands/cache.rs +++ b/libindy/src/commands/cache.rs @@ -318,11 +318,9 @@ impl CacheCommandExecutor { self.wallet_service.delete_record(wallet_handle, SCHEMA_CACHE, record.get_id())?; } - let res = (); + trace!("purge_schema_cache <<< res: ()"); - trace!("purge_schema_cache <<< res: {:?}", res); - - Ok(res) + Ok(()) } fn purge_cred_def_cache(&self, @@ -364,11 +362,9 @@ impl CacheCommandExecutor { self.wallet_service.delete_record(wallet_handle, CRED_DEF_CACHE, record.get_id())?; } - let res = (); - - trace!("purge_cred_def_cache <<< res: {:?}", res); + trace!("purge_cred_def_cache <<< res: ()"); - Ok(res) + Ok(()) } } diff --git a/libindy/src/commands/non_secrets.rs b/libindy/src/commands/non_secrets.rs index 28ca6aebdd..2c3f854a76 100644 --- a/libindy/src/commands/non_secrets.rs +++ b/libindy/src/commands/non_secrets.rs @@ -126,11 +126,11 @@ impl NonSecretsCommandExecutor { self._check_type(type_)?; - let res = self.wallet_service.add_record(wallet_handle, type_, id, value, tags.unwrap_or(&Tags::new()))?; + self.wallet_service.add_record(wallet_handle, type_, id, value, tags.unwrap_or(&Tags::new()))?; - trace!("add_record <<< res: {:?}", res); + trace!("add_record <<< res: ()"); - Ok(res) + Ok(()) } fn update_record_value(&self, @@ -142,11 +142,11 @@ impl NonSecretsCommandExecutor { self._check_type(type_)?; - let res = self.wallet_service.update_record_value(wallet_handle, type_, id, value)?; + self.wallet_service.update_record_value(wallet_handle, type_, id, value)?; - trace!("update_record_value <<< res: {:?}", res); + trace!("update_record_value <<< res: ()"); - Ok(res) + Ok(()) } fn update_record_tags(&self, @@ -158,11 +158,11 @@ impl NonSecretsCommandExecutor { self._check_type(type_)?; - let res = self.wallet_service.update_record_tags(wallet_handle, type_, id, &tags)?; + self.wallet_service.update_record_tags(wallet_handle, type_, id, &tags)?; - trace!("update_record_tags <<< res: {:?}", res); + trace!("update_record_tags <<< res: ()"); - Ok(res) + Ok(()) } fn add_record_tags(&self, @@ -174,11 +174,11 @@ impl NonSecretsCommandExecutor { self._check_type(type_)?; - let res = self.wallet_service.add_record_tags(wallet_handle, type_, id, &tags)?; + self.wallet_service.add_record_tags(wallet_handle, type_, id, &tags)?; - trace!("add_record_tags <<< res: {:?}", res); + trace!("add_record_tags <<< res: ()"); - Ok(res) + Ok(()) } fn delete_record_tags(&self, @@ -193,11 +193,11 @@ impl NonSecretsCommandExecutor { let tag_names: Vec<&str> = serde_json::from_str(tag_names_json) .to_indy(IndyErrorKind::InvalidStructure, "Cannot deserialize tag names")?; - let res = self.wallet_service.delete_record_tags(wallet_handle, type_, id, &tag_names)?; + self.wallet_service.delete_record_tags(wallet_handle, type_, id, &tag_names)?; - trace!("delete_record_tags <<< res: {:?}", res); + trace!("delete_record_tags <<< res: ()"); - Ok(res) + Ok(()) } fn delete_record(&self, @@ -208,11 +208,11 @@ impl NonSecretsCommandExecutor { self._check_type(type_)?; - let res = self.wallet_service.delete_record(wallet_handle, type_, id)?; + self.wallet_service.delete_record(wallet_handle, type_, id)?; - trace!("delete_record <<< res: {:?}", res); + trace!("delete_record <<< res: ()"); - Ok(res) + Ok(()) } fn get_record(&self, @@ -294,14 +294,14 @@ impl NonSecretsCommandExecutor { wallet_search_handle: i32) -> IndyResult<()> { trace!("close_search >>> wallet_search_handle: {:?}", wallet_search_handle); - let res = match self.searches.borrow_mut().remove(&wallet_search_handle) { + match self.searches.borrow_mut().remove(&wallet_search_handle) { Some(_) => Ok(()), None => Err(err_msg(IndyErrorKind::InvalidWalletHandle, format!("Wallet Search Handle is invalid: {}", wallet_search_handle))) }?; - trace!("close_search <<< res: {:?}", res); + trace!("close_search <<< res: ()"); - Ok(res) + Ok(()) } fn _check_type(&self, type_: &str) -> IndyResult<()> { diff --git a/libindy/src/commands/pool.rs b/libindy/src/commands/pool.rs index fa433a4335..5adc1e6d64 100644 --- a/libindy/src/commands/pool.rs +++ b/libindy/src/commands/pool.rs @@ -137,21 +137,21 @@ impl PoolCommandExecutor { fn create(&self, name: &str, config: Option) -> IndyResult<()> { debug!("create >>> name: {:?}, config: {:?}", name, config); - let res = self.pool_service.create(name, config)?; + self.pool_service.create(name, config)?; - debug!("create << res: {:?}", res); + debug!("create << res: ()"); - Ok(res) + Ok(()) } fn delete(&self, name: &str) -> IndyResult<()> { debug!("delete >>> name: {:?}", name); - let res = self.pool_service.delete(name)?; + self.pool_service.delete(name)?; - debug!("delete << res: {:?}", res); + debug!("delete << res: ()"); - Ok(res) + Ok(()) } fn open(&self, name: &str, config: Option, cb: Box) + Send>) { diff --git a/libindy/src/commands/wallet.rs b/libindy/src/commands/wallet.rs index 460091cfd0..4152b77ad7 100644 --- a/libindy/src/commands/wallet.rs +++ b/libindy/src/commands/wallet.rs @@ -213,7 +213,7 @@ impl WalletCommandExecutor { free_search: WalletFreeSearch) -> IndyResult<()> { trace!("_register_type >>> type_: {:?}", type_); - let res = self + self .wallet_service .register_wallet_storage( type_, create, open, close, delete, add_record, update_record_value, update_record_tags, @@ -222,8 +222,8 @@ impl WalletCommandExecutor { free_storage_metadata, search_records, search_all_records, get_search_total_count, fetch_search_next_record, free_search)?; - trace!("_register_type <<< res: {:?}", res); - Ok(res) + trace!("_register_type <<< res: ()"); + Ok(()) } fn _create(&self, @@ -336,10 +336,10 @@ impl WalletCommandExecutor { wallet_handle: WalletHandle) -> IndyResult<()> { trace!("_close >>> handle: {:?}", wallet_handle); - let res = self.wallet_service.close_wallet(wallet_handle)?; + self.wallet_service.close_wallet(wallet_handle)?; - trace!("_close <<< res: {:?}", res); - Ok(res) + trace!("_close <<< res: ()"); + Ok(()) } fn _delete(&self, diff --git a/libindy/src/services/crypto/mod.rs b/libindy/src/services/crypto/mod.rs index 524f4da3a2..ee0ae48757 100644 --- a/libindy/src/services/crypto/mod.rs +++ b/libindy/src/services/crypto/mod.rs @@ -416,11 +416,9 @@ impl CryptoService { The 16- or 32-byte number upon which a DID is based should be 22/23 or 44/45 bytes when encoded as base58.", did.len()))); } - let res = (); + trace!("validate_did <<< res: ()"); - trace!("validate_did <<< res: {:?}", res); - - Ok(res) + Ok(()) } pub fn encrypt_plaintext(&self, From 933844e170b12b91e95847e1675d448c95748efe Mon Sep 17 00:00:00 2001 From: Axel Nennker Date: Thu, 1 Aug 2019 19:51:56 +0200 Subject: [PATCH 048/320] replace unwrap_or(function_call) by unwrap_or_else(|| Signed-off-by: Axel Nennker --- libindy/src/commands/anoncreds/prover.rs | 4 ++-- libindy/src/services/anoncreds/prover.rs | 2 +- libindy/src/services/pool/mod.rs | 2 +- libindy/src/services/pool/request_handler.rs | 2 +- libindy/src/services/pool/state_proof/mod.rs | 2 +- libindy/src/services/pool/state_proof/node.rs | 2 +- libindy/src/utils/environment.rs | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/libindy/src/commands/anoncreds/prover.rs b/libindy/src/commands/anoncreds/prover.rs index 9437d2d4de..75b90aafec 100644 --- a/libindy/src/commands/anoncreds/prover.rs +++ b/libindy/src/commands/anoncreds/prover.rs @@ -259,7 +259,7 @@ impl ProverCommandExecutor { master_secret_id: Option<&str>) -> IndyResult { debug!("create_master_secret >>> wallet_handle: {:?}, master_secret_id: {:?}", wallet_handle, master_secret_id); - let master_secret_id = master_secret_id.map(String::from).unwrap_or(uuid::Uuid::new_v4().to_string()); + let master_secret_id = master_secret_id.map(String::from).unwrap_or_else(|| uuid::Uuid::new_v4().to_string()); if self.wallet_service.record_exists::(wallet_handle, &master_secret_id)? { return Err(err_msg(IndyErrorKind::MasterSecretDuplicateName, format!("MasterSecret already exists {}", master_secret_id))); @@ -397,7 +397,7 @@ impl ProverCommandExecutor { credential.rev_reg = None; credential.witness = None; - let out_cred_id = cred_id.map(String::from).unwrap_or(uuid::Uuid::new_v4().to_string()); + let out_cred_id = cred_id.map(String::from).unwrap_or_else(|| uuid::Uuid::new_v4().to_string()); let catpol_json = self.get_credential_attr_tag_policy(wallet_handle, credential.cred_def_id.as_str())?; let catpol: Option = if catpol_json.ne("null") { diff --git a/libindy/src/services/anoncreds/prover.rs b/libindy/src/services/anoncreds/prover.rs index 84e11ca20a..a15f017749 100644 --- a/libindy/src/services/anoncreds/prover.rs +++ b/libindy/src/services/anoncreds/prover.rs @@ -278,7 +278,7 @@ impl Prover { res.insert("schema_version".to_string(), credential.schema_version()); res.insert("issuer_did".to_string(), credential.issuer_did()); res.insert("cred_def_id".to_string(), credential.cred_def_id()); - res.insert("rev_reg_id".to_string(), credential.rev_reg_id.clone().unwrap_or("None".to_string())); + res.insert("rev_reg_id".to_string(), credential.rev_reg_id.clone().unwrap_or_else(|| "None".to_string())); credential.values .iter() diff --git a/libindy/src/services/pool/mod.rs b/libindy/src/services/pool/mod.rs index cb168cd7f8..b56eafabe0 100644 --- a/libindy/src/services/pool/mod.rs +++ b/libindy/src/services/pool/mod.rs @@ -63,7 +63,7 @@ impl PoolService { trace!("PoolService::create {} with config {:?}", name, config); let mut path = environment::pool_path(name); - let pool_config = config.unwrap_or(PoolConfig::default_for_name(name)); + let pool_config = config.unwrap_or_else( || PoolConfig::default_for_name(name)); if path.as_path().exists() { return Err(err_msg(IndyErrorKind::PoolConfigAlreadyExists, format!("Pool ledger config file with name \"{}\" already exists", name))); diff --git a/libindy/src/services/pool/request_handler.rs b/libindy/src/services/pool/request_handler.rs index fd4079d511..903ed3f5d9 100644 --- a/libindy/src/services/pool/request_handler.rs +++ b/libindy/src/services/pool/request_handler.rs @@ -527,7 +527,7 @@ impl RequestSM { .insert(node_alias.clone(), SJsonValue::from(node_result)); } - let required_reply_cnt = state.nodes_to_send.as_ref().map(Vec::len).unwrap_or(nodes.len()); + let required_reply_cnt = state.nodes_to_send.as_ref().map(Vec::len).unwrap_or_else(|| nodes.len()); let reply_cnt = state.accum_reply.as_ref().unwrap() .inner.as_object().unwrap().len(); diff --git a/libindy/src/services/pool/state_proof/mod.rs b/libindy/src/services/pool/state_proof/mod.rs index cbcc99c2b6..96d27eda9f 100644 --- a/libindy/src/services/pool/state_proof/mod.rs +++ b/libindy/src/services/pool/state_proof/mod.rs @@ -159,7 +159,7 @@ pub fn parse_key_from_request_for_builtin_sp(json_msg: &SJsonValue) -> Option(&'a self, db: &'a TrieDB, prefix: Option<&[u8]>) -> IndyResult> { - let node_and_prefix = prefix.map(|prf| self.get_node(db, &prf)).unwrap_or(Ok(Some((self, vec![]))))?; + let node_and_prefix = prefix.map(|prf| self.get_node(db, &prf)).unwrap_or_else(|| Ok(Some((self, vec![]))))?; if let Some((node, prf)) = node_and_prefix { let vals = node._get_all_values(db, prf)?; let mut res: Vec<(String, String)> = vec![]; diff --git a/libindy/src/utils/environment.rs b/libindy/src/utils/environment.rs index 2eef49e166..4cf9512d3a 100755 --- a/libindy/src/utils/environment.rs +++ b/libindy/src/utils/environment.rs @@ -5,7 +5,7 @@ use std::path::PathBuf; pub fn indy_home_path() -> PathBuf { // TODO: FIXME: Provide better handling for the unknown home path case!!! - let mut path = dirs::home_dir().unwrap_or(PathBuf::from("/home/indy")); + let mut path = dirs::home_dir().unwrap_or_else(|| PathBuf::from("/home/indy")); let mut indy_client_dir = ".indy_client"; if cfg!(target_os = "ios") { indy_client_dir = "Documents/.indy_client"; From 932a2ad7029f2e2dac3395cf613ae0b26207f5bb Mon Sep 17 00:00:00 2001 From: Axel Nennker Date: Thu, 1 Aug 2019 19:57:10 +0200 Subject: [PATCH 049/320] fix or_insert Signed-off-by: Axel Nennker --- libindy/src/services/pool/request_handler.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libindy/src/services/pool/request_handler.rs b/libindy/src/services/pool/request_handler.rs index 903ed3f5d9..f297501941 100644 --- a/libindy/src/services/pool/request_handler.rs +++ b/libindy/src/services/pool/request_handler.rs @@ -322,7 +322,7 @@ impl RequestSM { let hashable = HashableValue { inner: result_without_proof }; let cnt = { - let set = state.replies.entry(hashable).or_insert(HashSet::new()); + let set = state.replies.entry(hashable).or_insert_with(HashSet::new); set.insert(node_alias.clone()); set.len() }; @@ -386,7 +386,7 @@ impl RequestSM { let last_write_time = get_last_signed_time(&raw_msg).unwrap_or(0); let (cnt, soonest) = { - let set = state.replies.entry(hashable).or_insert(HashSet::new()); + let set = state.replies.entry(hashable).or_insert_with(HashSet::new); set.insert(NodeResponse { node_alias: node_alias.clone(), timestamp: last_write_time, raw_msg: raw_msg.clone() }); ( set.len(), From ac58de4f9df20cfd75db16993c1f7aca7576082a Mon Sep 17 00:00:00 2001 From: Axel Nennker Date: Thu, 1 Aug 2019 21:58:22 +0200 Subject: [PATCH 050/320] replace single char str by single char char Signed-off-by: Axel Nennker --- libindy/src/domain/anoncreds/credential_definition.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libindy/src/domain/anoncreds/credential_definition.rs b/libindy/src/domain/anoncreds/credential_definition.rs index e594043264..23621b63f3 100644 --- a/libindy/src/domain/anoncreds/credential_definition.rs +++ b/libindy/src/domain/anoncreds/credential_definition.rs @@ -78,7 +78,7 @@ impl CredentialDefinition { } pub fn issuer_did(cred_def_id: &str) -> Option { - cred_def_id.split(":").collect::>().get(0).and_then(|s| Some(s.to_string())) + cred_def_id.split(':').collect::>().get(0).and_then(|s| Some(s.to_string())) } } From 47b87cb234f0f584c8daffdeebb746f37e0e13ab Mon Sep 17 00:00:00 2001 From: Axel Nennker Date: Thu, 1 Aug 2019 21:59:04 +0200 Subject: [PATCH 051/320] replace unneeded into_iter by iter Signed-off-by: Axel Nennker --- libindy/src/services/anoncreds/verifier.rs | 2 +- libindy/src/services/pool/request_handler.rs | 2 +- libindy/src/services/pool/state_proof/mod.rs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libindy/src/services/anoncreds/verifier.rs b/libindy/src/services/anoncreds/verifier.rs index 311b19d6bd..47f67decd8 100644 --- a/libindy/src/services/anoncreds/verifier.rs +++ b/libindy/src/services/anoncreds/verifier.rs @@ -306,7 +306,7 @@ impl Verifier { received_predicates: &HashMap, self_attested_attrs: &HashSet) -> IndyResult<()> { let proof_attr_identifiers: HashMap = received_revealed_attrs - .into_iter() + .iter() .chain(received_unrevealed_attrs) .map(|(r, id)| (r.to_string(), id.clone())) .collect(); diff --git a/libindy/src/services/pool/request_handler.rs b/libindy/src/services/pool/request_handler.rs index f297501941..f8187b5005 100644 --- a/libindy/src/services/pool/request_handler.rs +++ b/libindy/src/services/pool/request_handler.rs @@ -704,7 +704,7 @@ fn _finish_request(cmd_ids: &Vec) { } fn _send_replies(cmd_ids: &Vec, msg: IndyResult) { - cmd_ids.into_iter().for_each(|id| { + cmd_ids.iter().for_each(|id| { CommandExecutor::instance().send( Command::Ledger( LedgerCommand::SubmitAck(*id, msg.clone())) diff --git a/libindy/src/services/pool/state_proof/mod.rs b/libindy/src/services/pool/state_proof/mod.rs index 96d27eda9f..119fc4b47c 100644 --- a/libindy/src/services/pool/state_proof/mod.rs +++ b/libindy/src/services/pool/state_proof/mod.rs @@ -550,7 +550,7 @@ fn _verify_proof_range(proofs_rlp: &[u8], } else { vals_with_from.as_slice() }; - let vals_prepared: Vec<(String, Option)> = vals_slice.into_iter().map(|&(_, ref pair)| pair.clone()).collect(); + let vals_prepared: Vec<(String, Option)> = vals_slice.iter().map(|&(_, ref pair)| pair.clone()).collect(); vals_prepared[..] == kvs[..] }).unwrap_or(false) } From 04a196e7b57a51267380eb1627f03ab31fedd73c Mon Sep 17 00:00:00 2001 From: Axel Nennker Date: Thu, 1 Aug 2019 22:02:52 +0200 Subject: [PATCH 052/320] remove unneeded mut Signed-off-by: Axel Nennker --- libindy/src/services/pool/request_handler.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libindy/src/services/pool/request_handler.rs b/libindy/src/services/pool/request_handler.rs index f8187b5005..e9b181b4f1 100644 --- a/libindy/src/services/pool/request_handler.rs +++ b/libindy/src/services/pool/request_handler.rs @@ -450,10 +450,10 @@ impl RequestSM { _ => (RequestState::CatchupConsensus(state), None) } } - RequestState::CatchupSingle(mut state) => { + RequestState::CatchupSingle(state) => { match re { RequestEvent::CatchupRep(mut cr, node_alias) => { - match _process_catchup_reply(&mut cr, &mut state.merkle_tree, &state.target_mt_root, state.target_mt_size, &pool_name) { + match _process_catchup_reply(&mut cr, &state.merkle_tree, &state.target_mt_root, state.target_mt_size, &pool_name) { Ok(merkle) => { state.networker.borrow_mut().process_event(Some(NetworkerEvent::CleanTimeout(state.req_id.clone(), None))); (RequestState::finish(), Some(PoolEvent::Synced(merkle))) From 7df0201d6d297b5d49dbac4d918a28a72b31fb24 Mon Sep 17 00:00:00 2001 From: Axel Nennker Date: Thu, 1 Aug 2019 22:13:47 +0200 Subject: [PATCH 053/320] do not pass Option by reference Signed-off-by: Axel Nennker --- libindy/src/commands/anoncreds/prover.rs | 12 +++++----- libindy/src/services/anoncreds/helpers.rs | 2 +- libindy/src/services/anoncreds/prover.rs | 28 +++++++++++----------- libindy/src/services/anoncreds/verifier.rs | 4 ++-- 4 files changed, 23 insertions(+), 23 deletions(-) diff --git a/libindy/src/commands/anoncreds/prover.rs b/libindy/src/commands/anoncreds/prover.rs index 75b90aafec..24b7e9fc4c 100644 --- a/libindy/src/commands/anoncreds/prover.rs +++ b/libindy/src/commands/anoncreds/prover.rs @@ -348,7 +348,7 @@ impl ProverCommandExecutor { while let Some(credential_record) = credentials_search.fetch_next_record()? { let (_, credential) = self._get_credential(&credential_record)?; - let cred_tags = self.anoncreds_service.prover.build_credential_tags(&credential, &catpol); + let cred_tags = self.anoncreds_service.prover.build_credential_tags(&credential, catpol); self.wallet_service.update_record_tags(wallet_handle, self.wallet_service.add_prefix("Credential").as_str(), credential_record.get_id(), &cred_tags)?; } } @@ -406,7 +406,7 @@ impl ProverCommandExecutor { None }; - let cred_tags = self.anoncreds_service.prover.build_credential_tags(&credential, &catpol.as_ref()); + let cred_tags = self.anoncreds_service.prover.build_credential_tags(&credential, catpol.as_ref()); self.wallet_service.add_indy_object(wallet_handle, &out_cred_id, credential, &cred_tags)?; debug!("store_credential <<< out_cred_id: {:?}", out_cred_id); @@ -529,7 +529,7 @@ impl ProverCommandExecutor { let query_json = self.anoncreds_service.prover.build_query(&requested_attr.name, &attr_id, &requested_attr.restrictions, - &None)?; + None)?; let interval = get_non_revoc_interval(&proof_request.non_revoked, &requested_attr.non_revoked); @@ -542,7 +542,7 @@ impl ProverCommandExecutor { let query_json = self.anoncreds_service.prover.build_query(&requested_predicate.name, &predicate_id, &requested_predicate.restrictions, - &None)?; + None)?; let interval = get_non_revoc_interval(&proof_request.non_revoked, &requested_predicate.non_revoked); @@ -572,7 +572,7 @@ impl ProverCommandExecutor { let query_json = self.anoncreds_service.prover.build_query(&requested_attr.name, &attr_id, &requested_attr.restrictions, - &extra_query)?; + extra_query)?; let credentials_search = self.wallet_service.search_indy_records::(wallet_handle, &query_json, &SearchOptions::id_value())?; @@ -587,7 +587,7 @@ impl ProverCommandExecutor { let query_json = self.anoncreds_service.prover.build_query(&requested_predicate.name, &predicate_id, &requested_predicate.restrictions, - &extra_query)?; + extra_query)?; let credentials_search = self.wallet_service.search_indy_records::(wallet_handle, &query_json, &SearchOptions::id_value())?; diff --git a/libindy/src/services/anoncreds/helpers.rs b/libindy/src/services/anoncreds/helpers.rs index f3d34c34f3..38ac239acb 100644 --- a/libindy/src/services/anoncreds/helpers.rs +++ b/libindy/src/services/anoncreds/helpers.rs @@ -93,7 +93,7 @@ pub fn parse_cred_rev_id(cred_rev_id: &str) -> IndyResult { pub fn build_wql_query(name: &str, referent: &str, restrictions: &Option, - extra_query: &Option<&ProofRequestExtraQuery>) -> IndyResult { + extra_query: Option<&ProofRequestExtraQuery>) -> IndyResult { trace!("build_wql_query >>> name: {:?}, referent: {:?}, restrictions: {:?}, extra_query: {:?}", name, referent, restrictions, extra_query); diff --git a/libindy/src/services/anoncreds/prover.rs b/libindy/src/services/anoncreds/prover.rs index a15f017749..0532e23c69 100644 --- a/libindy/src/services/anoncreds/prover.rs +++ b/libindy/src/services/anoncreds/prover.rs @@ -268,7 +268,7 @@ impl Prover { res } - pub fn build_credential_tags(&self, credential: &Credential, catpol: &Option<&CredentialAttrTagPolicy>) -> HashMap { + pub fn build_credential_tags(&self, credential: &Credential, catpol: Option<&CredentialAttrTagPolicy>) -> HashMap { trace!("build_credential_tags >>> credential: {:?}, catpol: {:?}", credential, catpol); let mut res: HashMap = HashMap::new(); @@ -299,7 +299,7 @@ impl Prover { name: &str, referent: &str, restrictions: &Option, - extra_query: &Option<&ProofRequestExtraQuery>) -> IndyResult { + extra_query: Option<&ProofRequestExtraQuery>) -> IndyResult { trace!("build_query >>> name: {:?}, referent: {:?}, restrictions: {:?}, extra_query: {:?}", name, referent, restrictions, extra_query); let mut sub_queries: Vec = vec![]; @@ -501,7 +501,7 @@ mod tests { #[test] fn build_credential_tags_works() { let ps = Prover::new(); - let tags = ps.build_credential_tags(&_credential(), &None); + let tags = ps.build_credential_tags(&_credential(), None); let expected_tags: HashMap = hashmap!( "schema_id".to_string() => SCHEMA_ID.to_string(), @@ -524,7 +524,7 @@ mod tests { fn build_credential_tags_works_for_catpol() { let ps = Prover::new(); let catpol = CredentialAttrTagPolicy::from(vec!(String::from("name"))); - let tags = ps.build_credential_tags(&_credential(), &Some(catpol).as_ref()); + let tags = ps.build_credential_tags(&_credential(), Some(catpol).as_ref()); let expected_tags: HashMap = hashmap!( "schema_id".to_string() => SCHEMA_ID.to_string(), @@ -546,7 +546,7 @@ mod tests { let ps = Prover::new(); let mut credential = _credential(); credential.rev_reg_id = Some(REV_REG_ID.to_string()); - let tags = ps.build_credential_tags(&credential, &None); + let tags = ps.build_credential_tags(&credential, None); let expected_tags: HashMap = hashmap!( "schema_id".to_string() => SCHEMA_ID.to_string(), @@ -579,7 +579,7 @@ mod tests { #[test] fn build_query_works() { let ps = Prover::new(); - let query = ps.build_query(ATTR_NAME, ATTR_REFERENT, &None, &None).unwrap(); + let query = ps.build_query(ATTR_NAME, ATTR_REFERENT, &None, None).unwrap(); let expected_query = json!({ "$and": vec![ json!({ @@ -595,7 +595,7 @@ mod tests { let ps = Prover::new(); let restriction = json!({"schema_id": SCHEMA_ID, "cred_def_id": CRED_DEF_ID}); - let query = ps.build_query(ATTR_NAME, ATTR_REFERENT, &Some(restriction), &None).unwrap(); + let query = ps.build_query(ATTR_NAME, ATTR_REFERENT, &Some(restriction), None).unwrap(); let expected_query = json!({ "$and": vec![ @@ -615,7 +615,7 @@ mod tests { #[test] fn build_query_works_for_empty_restrictions() { let ps = Prover::new(); - let query = ps.build_query(ATTR_NAME, ATTR_REFERENT, &Some(json!([])), &None).unwrap(); + let query = ps.build_query(ATTR_NAME, ATTR_REFERENT, &Some(json!([])), None).unwrap(); let expected_query = json!({ "$and": vec![ json!({ @@ -637,7 +637,7 @@ mod tests { ) ); - let query = ps.build_query(ATTR_NAME, ATTR_REFERENT, &None, &Some(&extra_query)).unwrap(); + let query = ps.build_query(ATTR_NAME, ATTR_REFERENT, &None, Some(&extra_query)).unwrap(); let expected_query = json!({ "$and": vec![ @@ -666,7 +666,7 @@ mod tests { ) ); - let query = ps.build_query(ATTR_NAME, ATTR_REFERENT, &Some(restriction), &Some(&extra_query)).unwrap(); + let query = ps.build_query(ATTR_NAME, ATTR_REFERENT, &Some(restriction), Some(&extra_query)).unwrap(); let expected_query = json!({ "$and": vec![ @@ -694,7 +694,7 @@ mod tests { let restriction_2 = json!({"cred_def_id": CRED_DEF_ID}); let restirctions = serde_json::Value::Array(vec![restriction_1, restriction_2]); - let query = ps.build_query(ATTR_NAME, ATTR_REFERENT, &Some(restirctions), &None).unwrap(); + let query = ps.build_query(ATTR_NAME, ATTR_REFERENT, &Some(restirctions), None).unwrap(); let expected_query = json!({ "$and": vec![ @@ -726,7 +726,7 @@ mod tests { let restriction_2 = json!({"schema_id": serde_json::Value::Null, "cred_def_id": CRED_DEF_ID}); let restirctions = serde_json::Value::Array(vec![restriction_1, restriction_2]); - let query = ps.build_query(ATTR_NAME, ATTR_REFERENT, &Some(restirctions), &None).unwrap(); + let query = ps.build_query(ATTR_NAME, ATTR_REFERENT, &Some(restirctions), None).unwrap(); let expected_query = json!({ "$and": vec![ @@ -760,7 +760,7 @@ mod tests { ) ); - let query = ps.build_query(ATTR_NAME, ATTR_REFERENT, &None, &Some(&extra_query)).unwrap(); + let query = ps.build_query(ATTR_NAME, ATTR_REFERENT, &None, Some(&extra_query)).unwrap(); let expected_query = json!({ "$and": vec![ @@ -795,7 +795,7 @@ mod tests { ) ); - let query = ps.build_query(ATTR_NAME, ATTR_REFERENT, &Some(restriction), &Some(&extra_query)).unwrap(); + let query = ps.build_query(ATTR_NAME, ATTR_REFERENT, &Some(restriction), Some(&extra_query)).unwrap(); let expected_query = json!({ "$and": [ diff --git a/libindy/src/services/anoncreds/verifier.rs b/libindy/src/services/anoncreds/verifier.rs index 47f67decd8..b9de03247a 100644 --- a/libindy/src/services/anoncreds/verifier.rs +++ b/libindy/src/services/anoncreds/verifier.rs @@ -319,7 +319,7 @@ impl Verifier { for (referent, info) in requested_attrs { let op = parse_from_json( - &build_wql_query(&info.name, &referent, &info.restrictions, &None)? + &build_wql_query(&info.name, &referent, &info.restrictions, None)? )?; let filter = Verifier::_gather_filter_info(&referent, &proof_attr_identifiers, schemas, cred_defs)?; @@ -330,7 +330,7 @@ impl Verifier { for (referent, info) in proof_req.requested_predicates.iter() { let op = parse_from_json( - &build_wql_query(&info.name, &referent, &info.restrictions, &None)? + &build_wql_query(&info.name, &referent, &info.restrictions, None)? )?; let filter = Verifier::_gather_filter_info(&referent, received_predicates, schemas, cred_defs)?; From 405f2979029eccb0c627865a32ae5c88ca566bbc Mon Sep 17 00:00:00 2001 From: Axel Nennker Date: Thu, 1 Aug 2019 22:19:38 +0200 Subject: [PATCH 054/320] simpler syntax Signed-off-by: Axel Nennker --- libindy/src/services/ledger/mod.rs | 2 +- libindy/src/services/pool/mod.rs | 2 +- libindy/src/services/pool/state_proof/mod.rs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libindy/src/services/ledger/mod.rs b/libindy/src/services/ledger/mod.rs index e17e4b78b6..b1a20fe81e 100644 --- a/libindy/src/services/ledger/mod.rs +++ b/libindy/src/services/ledger/mod.rs @@ -75,7 +75,7 @@ impl LedgerService { "TRUST_ANCHOR" | "ENDORSER" => ENDORSER, "NETWORK_MONITOR" => NETWORK_MONITOR, role if ROLES.contains(&role) => role, - role @ _ => return Err(err_msg(IndyErrorKind::InvalidStructure, format!("Invalid role: {}", role))) + role => return Err(err_msg(IndyErrorKind::InvalidStructure, format!("Invalid role: {}", role))) }.to_string()) } } diff --git a/libindy/src/services/pool/mod.rs b/libindy/src/services/pool/mod.rs index b56eafabe0..6d4c174c83 100644 --- a/libindy/src/services/pool/mod.rs +++ b/libindy/src/services/pool/mod.rs @@ -285,7 +285,7 @@ pub fn parse_response_metadata(response: &str) -> IndyResult { let response_metadata = match response_result["ver"].as_str() { None => _parse_transaction_metadata_v0(&response_result), Some("1") => _parse_transaction_metadata_v1(&response_result), - ver @ _ => return Err(err_msg(IndyErrorKind::InvalidTransaction, format!("Unsupported transaction response version: {:?}", ver))) + ver=> return Err(err_msg(IndyErrorKind::InvalidTransaction, format!("Unsupported transaction response version: {:?}", ver))) }; trace!("indy::services::pool::parse_response_metadata >> response_metadata: {:?}", response_metadata); diff --git a/libindy/src/services/pool/state_proof/mod.rs b/libindy/src/services/pool/state_proof/mod.rs index 119fc4b47c..b51faf9916 100644 --- a/libindy/src/services/pool/state_proof/mod.rs +++ b/libindy/src/services/pool/state_proof/mod.rs @@ -122,7 +122,7 @@ pub fn verify_parsed_sp(parsed_sps: Vec, } } //TODO IS-713 support KeyValuesInSP::SubTrie - kvs @ _ => { + kvs => { warn!("Unsupported parsed state proof format for key-values {:?} ", kvs); return false; } From 5892b95776683e2c55d36450d6139d8a702592b5 Mon Sep 17 00:00:00 2001 From: Axel Nennker Date: Thu, 1 Aug 2019 22:33:44 +0200 Subject: [PATCH 055/320] unwrap_or default Signed-off-by: Axel Nennker --- libindy/src/services/pool/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libindy/src/services/pool/mod.rs b/libindy/src/services/pool/mod.rs index 6d4c174c83..8bc970ef79 100644 --- a/libindy/src/services/pool/mod.rs +++ b/libindy/src/services/pool/mod.rs @@ -146,7 +146,7 @@ impl PoolService { } } - let config = config.unwrap_or(PoolOpenConfig::default()); + let config = config.unwrap_or_default(); let pool_handle: i32 = sequence::get_next_id(); let mut new_pool = Pool::new(name, pool_handle, config); From 694110c49b4d79030293a51874d57e4b0fbca1b0 Mon Sep 17 00:00:00 2001 From: Axel Nennker Date: Thu, 1 Aug 2019 22:41:23 +0200 Subject: [PATCH 056/320] unwrap_or_default Signed-off-by: Axel Nennker --- libindy/src/domain/anoncreds/credential.rs | 6 +++--- libindy/src/services/ledger/mod.rs | 8 ++++++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/libindy/src/domain/anoncreds/credential.rs b/libindy/src/domain/anoncreds/credential.rs index ee1be88fff..d422695f42 100644 --- a/libindy/src/domain/anoncreds/credential.rs +++ b/libindy/src/domain/anoncreds/credential.rs @@ -30,15 +30,15 @@ impl Credential { pub fn schema_id(&self) -> String { self.schema_id.to_string() } pub fn schema_issuer_did(&self) -> String { - self.schema_parts().get(0).map(|s| s.to_string()).unwrap_or(String::new()) + self.schema_parts().get(0).map(|s| s.to_string()).unwrap_or_default() } pub fn schema_name(&self) -> String { - self.schema_parts().get(2).map(|s| s.to_string()).unwrap_or(String::new()) + self.schema_parts().get(2).map(|s| s.to_string()).unwrap_or_default() } pub fn schema_version(&self) -> String { - self.schema_parts().get(3).map(|s| s.to_string()).unwrap_or(String::new()) + self.schema_parts().get(3).map(|s| s.to_string()).unwrap_or_default() } pub fn issuer_did(&self) -> String { diff --git a/libindy/src/services/ledger/mod.rs b/libindy/src/services/ledger/mod.rs index b1a20fe81e..6afe2d4590 100644 --- a/libindy/src/services/ledger/mod.rs +++ b/libindy/src/services/ledger/mod.rs @@ -313,10 +313,14 @@ impl LedgerService { let cred_def = match reply.result() { GetCredDefReplyResult::GetCredDefReplyResultV0(res) => CredentialDefinitionV1 { - id: CredentialDefinition::cred_def_id(&res.origin, &res.ref_.to_string(), &res.signature_type.to_str(), &res.tag.clone().unwrap_or(String::new())), + id: CredentialDefinition::cred_def_id( + &res.origin, + &res.ref_.to_string(), + &res.signature_type.to_str(), + &res.tag.clone().unwrap_or_default()), schema_id: res.ref_.to_string(), signature_type: res.signature_type, - tag: res.tag.unwrap_or(String::new()), + tag: res.tag.unwrap_or_default(), value: res.data, }, GetCredDefReplyResult::GetCredDefReplyResultV1(res) => CredentialDefinitionV1 { From 751093439964e1ef4b5a0e296695fa99098ce47a Mon Sep 17 00:00:00 2001 From: Axel Nennker Date: Thu, 1 Aug 2019 22:51:31 +0200 Subject: [PATCH 057/320] or_else Signed-off-by: Axel Nennker --- libindy/src/services/anoncreds/helpers.rs | 2 +- libindy/src/services/anoncreds/verifier.rs | 4 ++-- libindy/src/services/pool/state_proof/mod.rs | 6 +++--- libindy/src/utils/logger.rs | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/libindy/src/services/anoncreds/helpers.rs b/libindy/src/services/anoncreds/helpers.rs index 38ac239acb..a5dada2e17 100644 --- a/libindy/src/services/anoncreds/helpers.rs +++ b/libindy/src/services/anoncreds/helpers.rs @@ -106,7 +106,7 @@ pub fn build_wql_query(name: &str, pub fn get_non_revoc_interval(global_interval: &Option, local_interval: &Option) -> Option { trace!("get_non_revoc_interval >>> global_interval: {:?}, local_interval: {:?}", global_interval, local_interval); - let interval = local_interval.clone().or(global_interval.clone().or(None)); + let interval = local_interval.clone().or_else(|| global_interval.clone().or(None)); trace!("get_non_revoc_interval <<< interval: {:?}", interval); diff --git a/libindy/src/services/anoncreds/verifier.rs b/libindy/src/services/anoncreds/verifier.rs index b9de03247a..5f4714130d 100644 --- a/libindy/src/services/anoncreds/verifier.rs +++ b/libindy/src/services/anoncreds/verifier.rs @@ -218,8 +218,8 @@ impl Verifier { .iter() .map(|(referent, info)| Verifier::_validate_timestamp(&received_revealed_attrs, referent, &proof_req.non_revoked, &info.non_revoked) - .or(Verifier::_validate_timestamp(&received_unrevealed_attrs, referent, &proof_req.non_revoked, &info.non_revoked)) - .or(received_self_attested_attrs.get(referent).map(|_| ()).ok_or(IndyError::from(IndyErrorKind::InvalidStructure))) + .or_else(|_|Verifier::_validate_timestamp(&received_unrevealed_attrs, referent, &proof_req.non_revoked, &info.non_revoked)) + .or_else(|_|received_self_attested_attrs.get(referent).map(|_| ()).ok_or(IndyError::from(IndyErrorKind::InvalidStructure))) ) .collect::>>()?; diff --git a/libindy/src/services/pool/state_proof/mod.rs b/libindy/src/services/pool/state_proof/mod.rs index b51faf9916..ef9890c9a9 100644 --- a/libindy/src/services/pool/state_proof/mod.rs +++ b/libindy/src/services/pool/state_proof/mod.rs @@ -140,8 +140,8 @@ pub fn parse_key_from_request_for_builtin_sp(json_msg: &SJsonValue) -> Option { if let Some(attr_name) = json_msg["raw"].as_str() - .or(json_msg["enc"].as_str()) - .or(json_msg["hash"].as_str()) { + .or_else(|| json_msg["enc"].as_str()) + .or_else(|| json_msg["hash"].as_str()) { trace!("TransactionHandler::parse_reply_for_builtin_sp: GET_ATTR attr_name {:?}", attr_name); let mut hasher = sha2::Sha256::default(); @@ -254,7 +254,7 @@ pub fn parse_key_from_request_for_builtin_sp(json_msg: &SJsonValue) -> Option { if let Some(dest) = dest { diff --git a/libindy/src/utils/logger.rs b/libindy/src/utils/logger.rs index 00443a9e7f..b1718e57af 100644 --- a/libindy/src/utils/logger.rs +++ b/libindy/src/utils/logger.rs @@ -136,7 +136,7 @@ pub struct LibindyDefaultLogger; impl LibindyDefaultLogger { pub fn init(pattern: Option) -> Result<(), IndyError> { - let pattern = pattern.or(env::var("RUST_LOG").ok()); + let pattern = pattern.or_else(|| env::var("RUST_LOG").ok()); log_panics::init(); //Logging of panics is essential for android. As android does not log to stdout for native code From a35a13cf9cda5581a3af03f87147b29e7a810909 Mon Sep 17 00:00:00 2001 From: Axel Nennker Date: Fri, 2 Aug 2019 07:47:00 +0200 Subject: [PATCH 058/320] remove redundant closure Signed-off-by: Axel Nennker --- libindy/src/utils/crypto/sodium_type.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libindy/src/utils/crypto/sodium_type.rs b/libindy/src/utils/crypto/sodium_type.rs index fcbae87149..6671e89669 100644 --- a/libindy/src/utils/crypto/sodium_type.rs +++ b/libindy/src/utils/crypto/sodium_type.rs @@ -48,7 +48,7 @@ macro_rules! sodium_type (($newtype:ident, $sodiumtype:path, $len:ident) => ( impl<'de> ::serde::Deserialize<'de> for $newtype { fn deserialize(deserializer: D) -> Result<$newtype, D::Error> where D: ::serde::Deserializer<'de> { - <$sodiumtype>::deserialize(deserializer).map(|inner| $newtype (inner)) + <$sodiumtype>::deserialize(deserializer).map($newtype) } } From 7eded3a962635609f51a90976c3b6ad10ae6a55d Mon Sep 17 00:00:00 2001 From: Axel Nennker Date: Fri, 2 Aug 2019 07:57:14 +0200 Subject: [PATCH 059/320] payments remove redundant closure Signed-off-by: Axel Nennker --- libindy/src/services/payments.rs | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/libindy/src/services/payments.rs b/libindy/src/services/payments.rs index 24b8a3ddef..ffb58d301f 100644 --- a/libindy/src/services/payments.rs +++ b/libindy/src/services/payments.rs @@ -635,82 +635,82 @@ mod cbs { pub fn add_request_fees_cb(cmd_handle: i32) -> Option ErrorCode> { - send_ack_str(cmd_handle, Box::new(move |cmd_handle, result| PaymentsCommand::AddRequestFeesAck(cmd_handle, result))) + send_ack_str(cmd_handle, Box::new(PaymentsCommand::AddRequestFeesAck)) } pub fn parse_response_with_fees_cb(cmd_handle: i32) -> Option ErrorCode> { - send_ack_str(cmd_handle, Box::new(move |cmd_handle, result| PaymentsCommand::ParseResponseWithFeesAck(cmd_handle, result))) + send_ack_str(cmd_handle, Box::new(PaymentsCommand::ParseResponseWithFeesAck)) } pub fn build_get_payment_sources_request_cb(cmd_handle: i32) -> Option ErrorCode> { - send_ack_str(cmd_handle, Box::new(move |cmd_handle, result| PaymentsCommand::BuildGetPaymentSourcesRequestAck(cmd_handle, result))) + send_ack_str(cmd_handle, Box::new(PaymentsCommand::BuildGetPaymentSourcesRequestAck)) } pub fn parse_get_payment_sources_response_cb(cmd_handle: i32) -> Option ErrorCode> { - send_ack_str_i64(cmd_handle, Box::new(move |cmd_handle, result| PaymentsCommand::ParseGetPaymentSourcesResponseAck(cmd_handle, result))) + send_ack_str_i64(cmd_handle, Box::new(PaymentsCommand::ParseGetPaymentSourcesResponseAck)) } pub fn build_payment_req_cb(cmd_handle: i32) -> Option ErrorCode> { - send_ack_str(cmd_handle, Box::new(move |cmd_handle, result| PaymentsCommand::BuildPaymentReqAck(cmd_handle, result))) + send_ack_str(cmd_handle, Box::new( PaymentsCommand::BuildPaymentReqAck)) } pub fn parse_payment_response_cb(cmd_handle: i32) -> Option ErrorCode> { - send_ack_str(cmd_handle, Box::new(move |cmd_handle, result| PaymentsCommand::ParsePaymentResponseAck(cmd_handle, result))) + send_ack_str(cmd_handle, Box::new(PaymentsCommand::ParsePaymentResponseAck)) } pub fn build_mint_req_cb(cmd_handle: i32) -> Option ErrorCode> { - send_ack_str(cmd_handle, Box::new(move |cmd_handle, result| PaymentsCommand::BuildMintReqAck(cmd_handle, result))) + send_ack_str(cmd_handle, Box::new(PaymentsCommand::BuildMintReqAck)) } pub fn build_set_txn_fees_req_cb(cmd_handle: i32) -> Option ErrorCode> { - send_ack_str(cmd_handle, Box::new(move |cmd_handle, result| PaymentsCommand::BuildSetTxnFeesReqAck(cmd_handle, result))) + send_ack_str(cmd_handle, Box::new(PaymentsCommand::BuildSetTxnFeesReqAck)) } pub fn build_get_txn_fees_req(cmd_handle: i32) -> Option ErrorCode> { - send_ack_str(cmd_handle, Box::new(move |cmd_handle, result| PaymentsCommand::BuildGetTxnFeesReqAck(cmd_handle, result))) + send_ack_str(cmd_handle, Box::new(PaymentsCommand::BuildGetTxnFeesReqAck)) } pub fn parse_get_txn_fees_response(cmd_handle: i32) -> Option ErrorCode> { - send_ack_str(cmd_handle, Box::new(move |cmd_handle, result| PaymentsCommand::ParseGetTxnFeesResponseAck(cmd_handle, result))) + send_ack_str(cmd_handle, Box::new(PaymentsCommand::ParseGetTxnFeesResponseAck)) } pub fn build_verify_payment_req(cmd_handle: i32) -> Option ErrorCode> { - send_ack_str(cmd_handle, Box::new(move |cmd_handle, result| PaymentsCommand::BuildVerifyPaymentReqAck(cmd_handle, result))) + send_ack_str(cmd_handle, Box::new(PaymentsCommand::BuildVerifyPaymentReqAck)) } pub fn parse_verify_payment_response(cmd_handle: i32) -> Option ErrorCode> { - send_ack_str(cmd_handle, Box::new(move |cmd_handle, result| PaymentsCommand::ParseVerifyPaymentResponseAck(cmd_handle, result))) + send_ack_str(cmd_handle, Box::new(PaymentsCommand::ParseVerifyPaymentResponseAck)) } pub fn sign_with_address_cb(cmd_handle: i32) -> Option ErrorCode> { - send_array_ack(cmd_handle, Box::new(move |cmd_handle, result| PaymentsCommand::SignWithAddressAck(cmd_handle, result))) + send_array_ack(cmd_handle, Box::new(PaymentsCommand::SignWithAddressAck)) } pub fn verify_with_address_cb(cmd_handle: i32) -> Option ErrorCode> { - send_bool_ack(cmd_handle, Box::new(move |cmd_handle, result| PaymentsCommand::VerifyWithAddressAck(cmd_handle, result))) + send_bool_ack(cmd_handle, Box::new(PaymentsCommand::VerifyWithAddressAck)) } fn send_ack_str(cmd_handle: i32, builder: Box) -> PaymentsCommand + Send>) -> Option Date: Fri, 2 Aug 2019 08:01:04 +0200 Subject: [PATCH 060/320] remove redundant closure Signed-off-by: Axel Nennker --- libindy/src/services/pool/catchup.rs | 4 ++-- libindy/src/services/pool/pool.rs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libindy/src/services/pool/catchup.rs b/libindy/src/services/pool/catchup.rs index 8efdc124de..47177360d2 100644 --- a/libindy/src/services/pool/catchup.rs +++ b/libindy/src/services/pool/catchup.rs @@ -127,7 +127,7 @@ fn _try_to_catch_up(ledger_status: &(String, usize, Option>), merkle } else if target_mt_size > cur_mt_size { let target_mt_root = target_mt_root .from_base58() - .map_err(|err| Context::new(err)) + .map_err(Context::new) .to_indy(IndyErrorKind::InvalidStructure, "Can't parse target MerkleTree hash from nodes responses")?; // FIXME: review kind match *hashes { @@ -150,7 +150,7 @@ pub fn check_cons_proofs(mt: &MerkleTree, cons_proofs: &Vec, target_mt_r bytes_proofs.push( cons_proof .from_base58() - .map_err(|err| Context::new(err)) + .map_err(Context::new) .to_indy(IndyErrorKind::InvalidStructure, "Can't decode node consistency proof")? // FIXME: review kind ); } diff --git a/libindy/src/services/pool/pool.rs b/libindy/src/services/pool/pool.rs index 6bfd932009..2f368e28ef 100644 --- a/libindy/src/services/pool/pool.rs +++ b/libindy/src/services/pool/pool.rs @@ -648,7 +648,7 @@ fn _get_nodes_and_remotes(merkle: &MerkleTree) -> IndyResult<(HashMap IndyResult<(HashMap Date: Fri, 2 Aug 2019 08:04:35 +0200 Subject: [PATCH 061/320] remove explicit closure Signed-off-by: Axel Nennker --- libindy/src/services/pool/networker.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libindy/src/services/pool/networker.rs b/libindy/src/services/pool/networker.rs index eccb0a223b..3a40b9d969 100644 --- a/libindy/src/services/pool/networker.rs +++ b/libindy/src/services/pool/networker.rs @@ -56,7 +56,7 @@ impl Networker for ZMQNetworker { fn process_event(&mut self, pe: Option) -> Option { match pe.clone() { Some(NetworkerEvent::SendAllRequest(_, req_id, _, _)) | Some(NetworkerEvent::SendOneRequest(_, req_id, _)) | Some(NetworkerEvent::Resend(req_id, _)) => { - let num = self.req_id_mappings.get(&req_id).map(|i| *i).or_else(|| { + let num = self.req_id_mappings.get(&req_id).copied().or_else(|| { trace!("sending new request"); self.pool_connections.iter().next_back().and_then(|(pc_idx, pc)| { if pc.is_active() && pc.req_cnt < self.conn_limit From 217a1c1ae081410f405370b13a60b959fd5ac4b4 Mon Sep 17 00:00:00 2001 From: Axel Nennker Date: Fri, 2 Aug 2019 08:36:44 +0200 Subject: [PATCH 062/320] writing instead of involves one more reference and cannot be used with non-Vec-based slices Signed-off-by: Axel Nennker --- libindy/src/services/anoncreds/helpers.rs | 4 ++-- libindy/src/services/anoncreds/prover.rs | 4 ++-- .../src/services/pool/merkle_tree_factory.rs | 4 ++-- libindy/src/services/pool/request_handler.rs | 22 +++++++++---------- libindy/src/services/pool/state_proof/mod.rs | 2 +- 5 files changed, 18 insertions(+), 18 deletions(-) diff --git a/libindy/src/services/anoncreds/helpers.rs b/libindy/src/services/anoncreds/helpers.rs index a5dada2e17..e297d2f581 100644 --- a/libindy/src/services/anoncreds/helpers.rs +++ b/libindy/src/services/anoncreds/helpers.rs @@ -56,8 +56,8 @@ pub fn build_credential_values(credential_values: &HashMap, - predicates_for_credential: &Vec) -> IndyResult { +pub fn build_sub_proof_request(attrs_for_credential: &[AttributeInfo], + predicates_for_credential: &[PredicateInfo]) -> IndyResult { trace!("build_sub_proof_request >>> attrs_for_credential: {:?}, predicates_for_credential: {:?}", attrs_for_credential, predicates_for_credential); let mut sub_proof_request_builder = verifier::Verifier::new_sub_proof_request_builder()?; diff --git a/libindy/src/services/anoncreds/prover.rs b/libindy/src/services/anoncreds/prover.rs index 0532e23c69..045048f83d 100644 --- a/libindy/src/services/anoncreds/prover.rs +++ b/libindy/src/services/anoncreds/prover.rs @@ -422,8 +422,8 @@ impl Prover { Ok(()) } - fn _build_sub_proof_request(req_attrs_for_credential: &Vec, - req_predicates_for_credential: &Vec) -> IndyResult { + fn _build_sub_proof_request(req_attrs_for_credential: &[RequestedAttributeInfo], + req_predicates_for_credential: &[RequestedPredicateInfo]) -> IndyResult { trace!("_build_sub_proof_request <<< req_attrs_for_credential: {:?}, req_predicates_for_credential: {:?}", req_attrs_for_credential, req_predicates_for_credential); diff --git a/libindy/src/services/pool/merkle_tree_factory.rs b/libindy/src/services/pool/merkle_tree_factory.rs index 2cb0a51121..4d05ff96b0 100644 --- a/libindy/src/services/pool/merkle_tree_factory.rs +++ b/libindy/src/services/pool/merkle_tree_factory.rs @@ -117,7 +117,7 @@ fn get_pool_stored_path_base(pool_name: &str, create_dir: bool, filename: &str, path } -pub fn dump_new_txns(pool_name: &str, txns: &Vec>) -> IndyResult<()> { +pub fn dump_new_txns(pool_name: &str, txns: &[Vec]) -> IndyResult<()> { let p = get_pool_stored_path( pool_name, false); if !p.exists() { _dump_genesis_to_stored(&p, pool_name)?; @@ -146,7 +146,7 @@ fn _dump_genesis_to_stored(p: &PathBuf, pool_name: &str) -> IndyResult<()> { _dump_vec_to_file(&genesis_vec, &mut file) } -fn _dump_vec_to_file(v: &Vec>, file: &mut fs::File) -> IndyResult<()> { +fn _dump_vec_to_file(v: &[Vec], file: &mut fs::File) -> IndyResult<()> { for ref line in v { file.write_u64::(line.len() as u64) .to_indy(IndyErrorKind::IOError, "Can't write to pool ledger cache file")?; diff --git a/libindy/src/services/pool/request_handler.rs b/libindy/src/services/pool/request_handler.rs index e9b181b4f1..bf9743d4b3 100644 --- a/libindy/src/services/pool/request_handler.rs +++ b/libindy/src/services/pool/request_handler.rs @@ -68,13 +68,13 @@ pub const DEFAULT_GENERATOR: &str = "3LHpUjiyFC2q2hD7MnwwNmVXiuaFbQx2XkAFJWzswCj impl RequestSM { pub fn new(networker: Rc>, f: usize, - cmd_ids: &Vec, + cmd_ids: &[i32], nodes: &HashMap>, pool_name: &str, timeout: i64, extended_timeout: i64) -> Self { let generator : Generator = Generator::from_bytes(&DEFAULT_GENERATOR.from_base58().unwrap()).unwrap(); RequestSM { f, - cmd_ids: cmd_ids.clone(), + cmd_ids: cmd_ids.to_owned(), nodes: nodes.clone(), generator, pool_name: pool_name.to_string(), @@ -514,7 +514,7 @@ impl RequestSM { fn _full_request_handle_consensus_state(mut state: FullState, req_id: String, node_alias: String, node_result: String, - cmd_ids: &Vec, + cmd_ids: &[i32], nodes: &HashMap>) -> RequestState { let is_first_resp = state.accum_reply.is_none(); if is_first_resp { @@ -600,7 +600,7 @@ impl RequestSM { } pub trait RequestHandler { - fn new(networker: Rc>, f: usize, cmd_ids: &Vec, nodes: &HashMap>, pool_name: &str, timeout: i64, extended_timeout: i64) -> Self; + fn new(networker: Rc>, f: usize, cmd_ids: &[i32], nodes: &HashMap>, pool_name: &str, timeout: i64, extended_timeout: i64) -> Self; fn process_event(&mut self, ore: Option) -> Option; fn is_terminal(&self) -> bool; } @@ -610,7 +610,7 @@ pub struct RequestHandlerImpl { } impl RequestHandler for RequestHandlerImpl { - fn new(networker: Rc>, f: usize, cmd_ids: &Vec, nodes: &HashMap>, pool_name: &str, timeout: i64, extended_timeout: i64) -> Self { + fn new(networker: Rc>, f: usize, cmd_ids: &[i32], nodes: &HashMap>, pool_name: &str, timeout: i64, extended_timeout: i64) -> Self { RequestHandlerImpl { request_wrapper: Some(RequestSM::new(networker, f, cmd_ids, nodes, pool_name, timeout, extended_timeout)), } @@ -642,7 +642,7 @@ impl SingleState { < total_nodes_cnt } - fn try_to_continue(self, req_id: String, node_alias: String, cmd_ids: &Vec, nodes_cnt: usize, timeout: i64) -> RequestState { + fn try_to_continue(self, req_id: String, node_alias: String, cmd_ids: &[i32], nodes_cnt: usize, timeout: i64) -> RequestState { if self.is_consensus_reachable(nodes_cnt) { self.networker.borrow_mut().process_event(Some(NetworkerEvent::Resend(req_id.clone(), timeout))); self.networker.borrow_mut().process_event(Some(NetworkerEvent::Resend(req_id.clone(), timeout))); @@ -665,7 +665,7 @@ impl ConsensusState { } } -fn _parse_nack(denied_nodes: &mut HashSet, f: usize, raw_msg: &str, cmd_ids: &Vec, node_alias: &str) -> bool { +fn _parse_nack(denied_nodes: &mut HashSet, f: usize, raw_msg: &str, cmd_ids: &[i32], node_alias: &str) -> bool { if denied_nodes.len() == f { _send_ok_replies(cmd_ids, raw_msg); true @@ -695,15 +695,15 @@ fn _process_catchup_reply(rep: &mut CatchupRep, merkle: &MerkleTree, target_mt_r Ok(merkle) } -fn _send_ok_replies(cmd_ids: &Vec, msg: &str) { +fn _send_ok_replies(cmd_ids: &[i32], msg: &str) { _send_replies(cmd_ids, Ok(msg.to_string())) } -fn _finish_request(cmd_ids: &Vec) { +fn _finish_request(cmd_ids: &[i32]) { _send_replies(cmd_ids, Err(err_msg(IndyErrorKind::PoolTerminated, "Pool is terminated"))) } -fn _send_replies(cmd_ids: &Vec, msg: IndyResult) { +fn _send_replies(cmd_ids: &[i32], msg: IndyResult) { cmd_ids.iter().for_each(|id| { CommandExecutor::instance().send( Command::Ledger( @@ -849,7 +849,7 @@ pub mod tests { pub struct MockRequestHandler {} impl RequestHandler for MockRequestHandler { - fn new(_networker: Rc>, _f: usize, _cmd_ids: &Vec, _nodes: &HashMap>, _pool_name: &str, _timeout: i64, _extended_timeout: i64) -> Self { + fn new(_networker: Rc>, _f: usize, _cmd_ids: &[i32], _nodes: &HashMap>, _pool_name: &str, _timeout: i64, _extended_timeout: i64) -> Self { MockRequestHandler {} } diff --git a/libindy/src/services/pool/state_proof/mod.rs b/libindy/src/services/pool/state_proof/mod.rs index ef9890c9a9..b8e30d1c8a 100644 --- a/libindy/src/services/pool/state_proof/mod.rs +++ b/libindy/src/services/pool/state_proof/mod.rs @@ -496,7 +496,7 @@ fn _verify_proof_range(proofs_rlp: &[u8], prefix: &str, from: Option, next: Option, - kvs: &Vec<(String, Option)>) -> bool { + kvs: &[(String, Option)]) -> bool { debug!("verify_proof_range >> from {:?}, prefix {:?}, kvs {:?}", from, prefix, kvs); let nodes: Vec = UntrustedRlp::new(proofs_rlp).as_list().unwrap_or_default(); //default will cause error below let mut map: TrieDB = HashMap::new(); From 13f47e7d3465dfddd2322e2fa2a0cab97d119312 Mon Sep 17 00:00:00 2001 From: "artem.ivanov" Date: Fri, 2 Aug 2019 10:02:04 +0300 Subject: [PATCH 063/320] IS-1341 and IS-1342 fixes Signed-off-by: artem.ivanov --- cli/src/commands/ledger.rs | 1 - cli/src/commands/payment_address.rs | 6 +++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/cli/src/commands/ledger.rs b/cli/src/commands/ledger.rs index cd61b08765..b827e072c8 100644 --- a/cli/src/commands/ledger.rs +++ b/cli/src/commands/ledger.rs @@ -1085,7 +1085,6 @@ pub mod payment_command { recipient - payment address of recipient amount- payment amount"#) .add_optional_param("extra","Optional information for payment operation") - .add_optional_param("sign","Sign the request (True by default)") .add_optional_param("send","Send the request to the Ledger (True by default). If false then created request will be printed and stored into CLI context.") .add_example("ledger payment source_payment_address=pay:null:GjZWsBLgZCR18aL468JAT7w9CZRiBnpxUPPgyQxh4voa target_payment_address=pay:null:FYmoFw55GeQH7SRFa37dkx1d2dZ3zUF8ckg7wmL7ofN4 amount=100") .add_example("ledger payment source_payment_address=pay:null:GjZWsBLgZCR18aL468JAT7w9CZRiBnpxUPPgyQxh4voa target_payment_address=pay:null:FYmoFw55GeQH7SRFa37dkx1d2dZ3zUF8ckg7wmL7ofN4 amount=100 fee=2") diff --git a/cli/src/commands/payment_address.rs b/cli/src/commands/payment_address.rs index b36866b6d7..2f243cc11a 100644 --- a/cli/src/commands/payment_address.rs +++ b/cli/src/commands/payment_address.rs @@ -1,7 +1,7 @@ extern crate regex; extern crate chrono; -use command_executor::{Command, CommandContext, CommandMetadata, CommandParams, CommandGroup, CommandGroupMetadata}; +use command_executor::{Command, CommandContext, CommandMetadata, CommandParams, CommandGroup, CommandGroupMetadata, DynamicCompletionType}; use commands::*; use indy::{ErrorCode, IndyError}; @@ -99,7 +99,7 @@ pub mod sign_command { use super::*; command!(CommandMetadata::build("sign", "Create a proof of payment address control by signing an input and producing a signature.") - .add_required_param("address", "Payment address to use") + .add_required_param_with_dynamic_completion("address","Payment address to use", DynamicCompletionType::PaymentAddress) .add_required_param("input", "The input data to be signed") .add_example("payment-address sign address=pay:null:lUdSMj9AmoUbmRQ input=123456789") .finalize()); @@ -133,7 +133,7 @@ pub mod verify_command { use super::*; command!(CommandMetadata::build("verify", "Verify a proof of payment address control by verifying a signature.") - .add_required_param("address", "Payment address to use") + .add_required_param_with_dynamic_completion("address","Payment address to use", DynamicCompletionType::PaymentAddress) .add_required_param("input", "The input data that was signed") .add_required_param("signature", "The signature generated from sign-with-address") .add_example("payment-address verify address=pay:null:lUdSMj9AmoUbmRQ input=123456789 signature=0x0006e83221cdaf70b3c01a613675274dd2064ea376bf35656cff8436e62cdf89") From 51d8725419d0cb0571164985eea39090e05ce3cb Mon Sep 17 00:00:00 2001 From: "artem.ivanov" Date: Thu, 1 Aug 2019 17:49:11 +0300 Subject: [PATCH 064/320] IS-1906: Ubuntu 18.04 - try to simplify dockerfile Signed-off-by: artem.ivanov --- Jenkinsfile.cd | 34 +++++++++++++++++++--------------- Jenkinsfile.ci | 12 ++++++++---- libindy/ci/ubuntu18.dockerfile | 10 ---------- 3 files changed, 27 insertions(+), 29 deletions(-) diff --git a/Jenkinsfile.cd b/Jenkinsfile.cd index 958e3a19a7..173fef10a9 100644 --- a/Jenkinsfile.cd +++ b/Jenkinsfile.cd @@ -14,9 +14,13 @@ properties([ ]] ]); -libindyBuildFinished = ["Ubuntu 16.04": false, "Ubuntu 18.04": false, "RedHat": false] -libvcxBuildFinished = ["Ubuntu 16.04": false, "Ubuntu 18.04": false, "RedHat": false] -ubuntuPakageTypes = ["Ubuntu 16.04": "xenial", "Ubuntu 18.04": "bionic"] +Ununtu16 = "Ubuntu 16.04" +Ununtu18 = "Ubuntu 18.04" +RedHat = "RedHat" + +libindyBuildFinished = [(Ununtu16): false, (Ununtu18): false, (RedHat): false] +libvcxBuildFinished = [(Ununtu16): false, (Ununtu18): false, (RedHat): false] +ubuntuPakageTypes = [(Ununtu16): "xenial", (Ununtu18): "bionic"] gitHubUserCredId = env.GITHUB_BOT_USER ?: 'sovbot-github' sovrinPackagingRepo = env.SOVRIN_PACKAGING_REPO ?: 'https://github.com/sovrin-foundation/sovrin-packaging' @@ -265,7 +269,7 @@ def vcxTesting(file, env_name, network_name, stashBuildResults, test_wrappers) { "${env_name}-vcx-nodejs-test": { linuxModuleTesting(file, env_name, network_name, this.&linuxVcxNodejsTesting, stashBuildResults) }, - "${env_name}-vcx-java-test": { + "${env_name}-vcx-java-test" : { linuxModuleTesting(file, env_name, network_name, this.&linuxVcxJavaTesting, stashBuildResults) }, "${env_name}-vcx-python-test": { @@ -699,10 +703,10 @@ def ubuntuTesting() { stage('Ubuntu Test') { parallel([ "ubuntu:16.04": { - linuxTesting("ci/ubuntu.dockerfile ci", "Ubuntu 16.04", "pool_network", true, true) + linuxTesting("ci/ubuntu.dockerfile ci", Ununtu16, "pool_network", true, true) }, "ubuntu:18.04": { - linuxTesting("ci/ubuntu18.dockerfile ci", "Ubuntu 18.04", "pool_network", true, false) + linuxTesting("ci/ubuntu18.dockerfile ci", Ununtu18, "pool_network", true, false) } ]) } @@ -835,7 +839,7 @@ def buildIOSPod(packageName, targets) { def rhelTesting() { stage('RedHat Test') { - linuxTesting("ci/amazon.dockerfile ci", "RedHat", "pool_network", false) + linuxTesting("ci/amazon.dockerfile ci", RedHat, "pool_network", false) } } @@ -927,8 +931,8 @@ def rhelPublishing() { def ubuntuPublishing() { stage('Ubuntu Publishing') { - def libindyVersion = linuxPublishing("ci/ubuntu.dockerfile ci", "Ubuntu 16.04", true) - linuxPublishing("ci/ubuntu18.dockerfile ci", "Ubuntu 18.04", false) + def libindyVersion = linuxPublishing("ci/ubuntu.dockerfile ci", Ununtu16, true) + linuxPublishing("ci/ubuntu18.dockerfile ci", Ununtu18, false) return libindyVersion } } @@ -1352,7 +1356,7 @@ def publishingRCtoStable() { def libnullpayVersion = getSrcVersion("libnullpay") def libvcxVersion = getSrcVersion("vcx/libvcx") - def env_name = "Ubuntu 16.04" + def env_name = Ununtu16 echo 'Moving Windows RC artifacts to Stable: libindy' publishLibindyWindowsFilesRCtoStable(libindyVersion) @@ -1429,18 +1433,18 @@ def publishingRCtoStable() { echo 'Moving RC artifacts to Stable: Build docker image for wrappers publishing' testEnv = dockerHelpers.build('indy-sdk', 'libindy/ci/ubuntu18.dockerfile libindy/ci') - env_name = "Ubuntu 18.04" + env_name = Ununtu18 - echo 'Moving Ubuntu 18.04 RC artifacts to Stable: libindy' + echo "Moving ${env_name} RC artifacts to Stable: libindy" publishLibindyDebRCtoStable(testEnv, libindyVersion, env_name) - echo 'Moving Ubuntu 18.04 RC artifacts to Stable: indy-cli' + echo "Moving ${env_name} RC artifacts to Stable: indy-cli" publishLibindyCliDebRCtoStable(testEnv, libindyVersion, env_name) - echo 'Moving Ubuntu 18.04 RC artifacts to Stable: libnullpay' + echo "Moving ${env_name} RC artifacts to Stable: libnullpay" publishLibnullpayDebRCtoStable(testEnv, env_name) - echo 'Moving Ubuntu 18.04 RC artifacts to Stable: libvcx' + echo "Moving ${env_name} RC artifacts to Stable: libvcx" publishLibvcxDebRCtoStable(testEnv, env_name) } finally { diff --git a/Jenkinsfile.ci b/Jenkinsfile.ci index c96faafb9f..f44c5aa6e1 100644 --- a/Jenkinsfile.ci +++ b/Jenkinsfile.ci @@ -1,8 +1,12 @@ #!groovy -libindyBuildFinished = ["Ubuntu 16.04": false, "Ubuntu 18.04": false, "RedHat": false] -libvcxBuildFinished = ["Ubuntu 16.04": false, "Ubuntu 18.04": false, "RedHat": false] +Ununtu16 = "Ubuntu 16.04" +Ununtu18 = "Ubuntu 18.04" +RedHat = "RedHat" + +libindyBuildFinished = [(Ununtu16): false, (Ununtu18): false, (RedHat): false] +libvcxBuildFinished = [(Ununtu16): false, (Ununtu18): false, (RedHat): false] testing() @@ -341,10 +345,10 @@ def ubuntuTesting() { stage('Ubuntu Test') { parallel([ "ubuntu:16.04": { - linuxTesting("ci/ubuntu.dockerfile ci", "Ubuntu 16.04", "pool_network", true) + linuxTesting("ci/ubuntu.dockerfile ci", Ununtu16, "pool_network", true) }, "ubuntu:18.04": { - linuxTesting("ci/ubuntu18.dockerfile ci", "Ubuntu 18.04", "pool_network", false) + linuxTesting("ci/ubuntu18.dockerfile ci", Ununtu18, "pool_network", false) } ]) } diff --git a/libindy/ci/ubuntu18.dockerfile b/libindy/ci/ubuntu18.dockerfile index 3c20c9150f..27dca95c0f 100644 --- a/libindy/ci/ubuntu18.dockerfile +++ b/libindy/ci/ubuntu18.dockerfile @@ -6,19 +6,11 @@ RUN apt-get update && \ apt-get install -y \ pkg-config \ libssl-dev \ - libgmp3-dev \ curl \ - build-essential \ libsqlite3-dev \ cmake \ - git \ - python3.5 \ python3-pip \ - python-setuptools \ - apt-transport-https \ - ca-certificates \ debhelper \ - wget \ devscripts \ libncursesw5-dev \ libzmq3-dev \ @@ -26,8 +18,6 @@ RUN apt-get update && \ RUN pip3 install -U \ pip \ - setuptools \ - virtualenv \ twine \ plumbum \ deb-pkg-tools From b8dbae9297bc2e9edaba980e8c71cc1dc3a64c42 Mon Sep 17 00:00:00 2001 From: "artem.ivanov" Date: Fri, 2 Aug 2019 09:48:05 +0300 Subject: [PATCH 065/320] Updated CLI debian package to depends on libncursesw5-dev library Signed-off-by: artem.ivanov --- cli/README.md | 9 +++++++++ cli/debian/control | 2 +- cli/src/commands/ledger.rs | 6 ++++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/cli/README.md b/cli/README.md index 5fd03847d1..5b29e636d3 100644 --- a/cli/README.md +++ b/cli/README.md @@ -63,3 +63,12 @@ By default, this file creates in current folder and has the following name: ``` did import ``` + + +### Notes +Indy-CLI depends on `term` rust library that has a system dependency on terminfo database. +That is why CLI Debian package additionally installs `libncursesw5-dev` library. +More about it read [here](https://crates.io/crates/term) at `Packaging and Distributing` section. + + + diff --git a/cli/debian/control b/cli/debian/control index 724ed51bdb..1aafd53fff 100644 --- a/cli/debian/control +++ b/cli/debian/control @@ -8,7 +8,7 @@ Vcs-Browser: https://github.com/hyperledger/indy-sdk/ Package: indy-cli Architecture: amd64 -Depends: libindy +Depends: libindy, libncursesw5-dev Suggests: build-essential Description: This is the official command line interface for Indy SDK, which provides a distributed-ledger-based foundation for self-sovereign diff --git a/cli/src/commands/ledger.rs b/cli/src/commands/ledger.rs index cd61b08765..64dbd8f0c1 100644 --- a/cli/src/commands/ledger.rs +++ b/cli/src/commands/ledger.rs @@ -1976,6 +1976,10 @@ fn get_txn_title(role: &serde_json::Value) -> serde_json::Value { Some("0") => "NODE", Some("1") => "NYM", Some("3") => "GET_TXN", + Some("4") => "TXN_AUTHR_AGRMT", + Some("5") => "TXN_AUTHR_AGRMT_AML", + Some("6") => "GET_TXN_AUTHR_AGRMT", + Some("7") => "GET_TXN_AUTHR_AGRMT_AML", Some("100") => "ATTRIB", Some("101") => "SCHEMA", Some("104") => "GET_ATTR", @@ -1993,6 +1997,8 @@ fn get_txn_title(role: &serde_json::Value) -> serde_json::Value { Some("118") => "POOL_RESTART", Some("119") => "GET_VALIDATOR_INFO", Some("120") => "AUTH_RULE", + Some("121") => "GET_AUTH_RULE", + Some("122") => "AUTH_RULES", Some(val) => val, _ => "-" }.to_string()) From 7f6b0a34844202e2b52654cba35852ebfc504552 Mon Sep 17 00:00:00 2001 From: "artem.ivanov" Date: Fri, 2 Aug 2019 12:18:15 +0300 Subject: [PATCH 066/320] IS-1212: CI is broken for amazon linux Signed-off-by: artem.ivanov --- Jenkinsfile.ci | 52 +++++++++++++++++++++++++------------------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/Jenkinsfile.ci b/Jenkinsfile.ci index e8e4a9fe2e..2b66f09244 100644 --- a/Jenkinsfile.ci +++ b/Jenkinsfile.ci @@ -12,12 +12,12 @@ def testing() { } stage('Testing') { parallel([ - 'ubuntu-test' : { ubuntuTesting() }, - 'android-test': { androidTesting() }, - 'macos-test' : { macosTesting() }, - 'ios-test' : { iosTesting() }, - // FIXME 'redhat-test' : { rhelTesting() }, https://jira.hyperledger.org/browse/IS-1212 - 'windows-test': { windowsTesting() } +// 'ubuntu-test' : { ubuntuTesting() }, +// 'android-test': { androidTesting() }, +// 'macos-test' : { macosTesting() }, +// 'ios-test' : { iosTesting() }, + 'redhat-test' : { rhelTesting() }, +// 'windows-test': { windowsTesting() } ]) } } @@ -346,6 +346,9 @@ def ubuntuTesting() { def rhelTesting() { stage('RedHat Test') { linuxTesting("ci/amazon.dockerfile ci", "RedHat", "pool_network") + linuxTesting("ci/amazon.dockerfile ci", "RedHat", "pool_network") + linuxTesting("ci/amazon.dockerfile ci", "RedHat", "pool_network") + linuxTesting("ci/amazon.dockerfile ci", "RedHat", "pool_network") } } @@ -362,30 +365,30 @@ def linuxTesting(file, env_name, network_name) { libindyBuildFinished[env_name] } def jobs = [ - "${env_name}-nodejs-test" : { - linuxModuleTesting(file, env_name, network_name, this.&linuxNodejsTesting) - }, +// "${env_name}-nodejs-test" : { +// linuxModuleTesting(file, env_name, network_name, this.&linuxNodejsTesting) +// }, "${env_name}-cli-test" : { linuxModuleTesting(file, env_name, network_name, this.&linuxCLITesting) }, "${env_name}-rust-test" : { linuxModuleTesting(file, env_name, network_name, this.&linuxRustTesting) }, - "${env_name}-vcx-test" : { - vcxTesting(file, env_name, network_name) - }, - "${env_name}-cloud-agent-test": { - linuxModuleTesting(file, env_name, network_name, this.&linuxCloudAgentTesting) - } +// "${env_name}-vcx-test" : { +// vcxTesting(file, env_name, network_name) +// }, +// "${env_name}-cloud-agent-test": { +// linuxModuleTesting(file, env_name, network_name, this.&linuxCloudAgentTesting) +// } ] - if (env_name == "Ubuntu") { - jobs["${env_name}-java-test"] = { - linuxModuleTesting(file, env_name, network_name, this.&linuxJavaTesting) - } - jobs["${env_name}-python-test"] = { - linuxModuleTesting(file, env_name, network_name, this.&linuxPythonTesting) - } - } +// if (env_name == "Ubuntu") { +// jobs["${env_name}-java-test"] = { +// linuxModuleTesting(file, env_name, network_name, this.&linuxJavaTesting) +// } +// jobs["${env_name}-python-test"] = { +// linuxModuleTesting(file, env_name, network_name, this.&linuxPythonTesting) +// } +// } parallel(jobs) }, ]) @@ -484,7 +487,6 @@ def linuxLibindyBuild(file, env_name, network_name) { sh ''' cd libindy RUST_BACKTRACE=1 cargo test -j 1 --no-run --features sodium_static - RUST_BACKTRACE=1 RUST_LOG=indy::=debug,zmq=trace RUST_TEST_THREADS=1 TEST_POOL_IP=10.0.0.2 cargo test --features sodium_static ''' } @@ -493,7 +495,6 @@ def linuxLibindyBuild(file, env_name, network_name) { sh ''' cd libnullpay LIBRARY_PATH=./ RUST_BACKTRACE=1 cargo test --no-run - LD_LIBRARY_PATH=./:${LD_LIBRARY_PATH} RUST_BACKTRACE=1 RUST_LOG=indy::=debug,zmq=trace RUST_TEST_THREADS=1 TEST_POOL_IP=10.0.0.2 cargo test ''' } } @@ -696,7 +697,6 @@ def linuxCLITesting(env_name, network_name, testEnv) { cd cli LIBRARY_PATH=./ RUST_BACKTRACE=1 cargo build --features fatal_warnings LIBRARY_PATH=./ RUST_BACKTRACE=1 cargo test --features "nullpay_plugin" --no-run - LD_LIBRARY_PATH=./:${LD_LIBRARY_PATH} RUST_BACKTRACE=1 RUST_LOG=indy::=debug,zmq=trace RUST_TEST_THREADS=1 TEST_POOL_IP=10.0.0.2 cargo test --features "nullpay_plugin" ''' } } From ae2ebccb33f10fcd32f6a30036aceecc480b3301 Mon Sep 17 00:00:00 2001 From: Axel Nennker Date: Fri, 2 Aug 2019 18:34:25 +0200 Subject: [PATCH 067/320] cleanup test custom storage directory Signed-off-by: Axel Nennker --- .../src/services/wallet/storage/default/mod.rs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/libindy/src/services/wallet/storage/default/mod.rs b/libindy/src/services/wallet/storage/default/mod.rs index 3bdb7d7604..90904d3bfa 100644 --- a/libindy/src/services/wallet/storage/default/mod.rs +++ b/libindy/src/services/wallet/storage/default/mod.rs @@ -813,19 +813,24 @@ mod tests { "path": _custom_path("sqlite_storage_type_create_works_for_custom_path") }).to_string(); - let my_path = _custom_path("sqlite_storage_type_create_works_for_custom_path"); - let path = Path::new(&my_path); - if path.exists() { - fs::remove_dir_all(path).unwrap(); - } + _cleanup_custom_path("sqlite_storage_type_create_works_for_custom_path"); let storage_type = SQLiteStorageType::new(); storage_type.create_storage("sqlite_storage_type_create_works_for_custom_path", Some(&config), None, &_metadata()).unwrap(); storage_type.delete_storage("sqlite_storage_type_create_works_for_custom_path", Some(&config), None).unwrap(); + _cleanup_custom_path("sqlite_storage_type_create_works_for_custom_path"); _cleanup("sqlite_storage_type_create_works_for_custom_path"); } + fn _cleanup_custom_path(custom_path: &str) { + let my_path = _custom_path(custom_path); + let path = Path::new(&my_path); + if path.exists() { + fs::remove_dir_all(path).unwrap(); + } + } + #[test] fn sqlite_storage_type_create_works_for_twice() { _cleanup("sqlite_storage_type_create_works_for_twice"); From 849ed1e3e2900d740299f4bb92ec14e4c68d9310 Mon Sep 17 00:00:00 2001 From: Axel Nennker Date: Fri, 2 Aug 2019 20:09:37 +0200 Subject: [PATCH 068/320] cleanup test custom wallet directory Signed-off-by: Axel Nennker --- libindy/src/services/wallet/mod.rs | 8 +++++--- libindy/src/services/wallet/storage/default/mod.rs | 1 - 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/libindy/src/services/wallet/mod.rs b/libindy/src/services/wallet/mod.rs index 27b28f97d7..a2cbf4f37d 100644 --- a/libindy/src/services/wallet/mod.rs +++ b/libindy/src/services/wallet/mod.rs @@ -1095,7 +1095,7 @@ mod tests { id: String::from("same_id"), storage_type: None, storage_config: Some(json!({ - "path": _custom_path() + "path": _custom_path("wallet_service_open_wallet_works_for_two_wallets_with_same_ids_but_different_paths") })), }; @@ -1108,6 +1108,8 @@ mod tests { wallet_service.delete_wallet(&config_1, &RAW_CREDENTIAL).unwrap(); wallet_service.delete_wallet(&config_2, &RAW_CREDENTIAL).unwrap(); + + _cleanup("wallet_service_open_wallet_works_for_two_wallets_with_same_ids_but_different_paths"); } #[test] @@ -2394,9 +2396,9 @@ mod tests { .unwrap(); } - fn _custom_path() -> String { + fn _custom_path(name : &str) -> String { let mut path = environment::tmp_path(); - path.push("custom_wallet_path"); + path.push(name ); path.to_str().unwrap().to_owned() } } diff --git a/libindy/src/services/wallet/storage/default/mod.rs b/libindy/src/services/wallet/storage/default/mod.rs index 90904d3bfa..c24be8e1c3 100644 --- a/libindy/src/services/wallet/storage/default/mod.rs +++ b/libindy/src/services/wallet/storage/default/mod.rs @@ -1450,7 +1450,6 @@ mod tests { fn _custom_path(name: &str) -> String { let mut path = environment::tmp_path(); - path.push("custom_wallet_path"); path.push(name); path.to_str().unwrap().to_owned() } From 4d789cc99ce197abb72363369fdad4bb894ff838 Mon Sep 17 00:00:00 2001 From: Axel Nennker Date: Fri, 2 Aug 2019 21:13:42 +0200 Subject: [PATCH 069/320] cleanup exports_tests directory Signed-off-by: Axel Nennker --- libindy/src/services/wallet/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libindy/src/services/wallet/mod.rs b/libindy/src/services/wallet/mod.rs index a2cbf4f37d..6b72a43d5c 100644 --- a/libindy/src/services/wallet/mod.rs +++ b/libindy/src/services/wallet/mod.rs @@ -2312,7 +2312,7 @@ mod tests { } fn _export_file_path(name: &str) -> PathBuf { - let mut path = environment::tmp_file_path("export_tests"); + let mut path = environment::tmp_path(); path.push(name); path } From 21e98e903c4e787591567506b508bce7b851e6c3 Mon Sep 17 00:00:00 2001 From: Axel Nennker Date: Fri, 2 Aug 2019 21:43:25 +0200 Subject: [PATCH 070/320] remove test txn file Signed-off-by: Axel Nennker --- libindy/tests/pool.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libindy/tests/pool.rs b/libindy/tests/pool.rs index b6e8ffa702..e9aaba371c 100644 --- a/libindy/tests/pool.rs +++ b/libindy/tests/pool.rs @@ -38,6 +38,7 @@ mod high_cases { mod create { use super::*; + use std::fs; #[test] fn create_pool_ledger_config_works() { @@ -85,6 +86,7 @@ mod high_cases { pool::create_pool_ledger_config("create_pool_ledger_config_works_for_specific_config", Some(pool_config.as_str())).unwrap(); + fs::remove_file(txn_file_path); utils::tear_down("create_pool_ledger_config_works_for_specific_config"); } From 4015735454f94c59a83f6e3345418fb1f8183d32 Mon Sep 17 00:00:00 2001 From: Axel Nennker Date: Sat, 3 Aug 2019 18:44:31 +0200 Subject: [PATCH 071/320] Digest is confusing and unneeded Signed-off-by: Axel Nennker --- .../src/services/ledger/merkletree/tree.rs | 6 ++-- libindy/src/utils/crypto/hash/openssl.rs | 30 +++++-------------- 2 files changed, 10 insertions(+), 26 deletions(-) diff --git a/libindy/src/services/ledger/merkletree/tree.rs b/libindy/src/services/ledger/merkletree/tree.rs index aee6857446..909552fd4c 100644 --- a/libindy/src/services/ledger/merkletree/tree.rs +++ b/libindy/src/services/ledger/merkletree/tree.rs @@ -6,7 +6,7 @@ pub use services::ledger::merkletree::proof::{ Positioned, Proof }; -use utils::crypto::hash::{Digest, Hash}; +use utils::crypto::hash::{Hash}; pub type TreeLeafData = Vec; @@ -31,14 +31,14 @@ pub enum Tree { impl Tree { /// Create an empty tree - pub fn empty(hash: Digest) -> Self { + pub fn empty(hash: Vec) -> Self { Tree::Empty { hash: hash.to_vec() } } /// Create a new tree - pub fn new(hash: Digest, value: TreeLeafData) -> Self { + pub fn new(hash: Vec, value: TreeLeafData) -> Self { Tree::Leaf { hash: hash.to_vec(), value: value diff --git a/libindy/src/utils/crypto/hash/openssl.rs b/libindy/src/utils/crypto/hash/openssl.rs index 727efe8f48..587786986e 100644 --- a/libindy/src/utils/crypto/hash/openssl.rs +++ b/libindy/src/utils/crypto/hash/openssl.rs @@ -2,7 +2,7 @@ extern crate openssl; use errors::prelude::*; use self::openssl::error::ErrorStack; -use self::openssl::hash::{DigestBytes, hash as openssl_hash, Hasher, MessageDigest}; +use self::openssl::hash::{Hasher, MessageDigest}; pub const HASHBYTES: usize = 32; @@ -12,22 +12,6 @@ pub fn hash(input: &[u8]) -> Result, IndyError> { Ok(hasher.finish().map(|b| b.to_vec())?) } -pub struct Digest { - data: DigestBytes -} - -impl Digest { - fn new(data: DigestBytes) -> Digest { - Digest { - data: data - } - } - - pub fn to_vec(&self) -> Vec { - self.data.to_vec() - } -} - pub struct Hash {} impl Hash { @@ -35,23 +19,23 @@ impl Hash { Ok(Hasher::new(MessageDigest::sha256())?) } - pub fn hash_empty() -> Result { - Ok(Digest::new(openssl_hash(MessageDigest::sha256(), &[])?)) + pub fn hash_empty() -> Result, IndyError> { + Ok(hash( &[])?) } - pub fn hash_leaf(leaf: &T) -> Result where T: Hashable { + pub fn hash_leaf(leaf: &T) -> Result, IndyError> where T: Hashable { let mut ctx = Hash::new_context()?; ctx.update(&[0x00])?; leaf.update_context(&mut ctx)?; - Ok(Digest::new(ctx.finish()?)) + Ok(ctx.finish().map(|b| b.to_vec())?) } - pub fn hash_nodes(left: &T, right: &T) -> Result where T: Hashable { + pub fn hash_nodes(left: &T, right: &T) -> Result, IndyError> where T: Hashable { let mut ctx = Hash::new_context()?; ctx.update(&[0x01])?; left.update_context(&mut ctx)?; right.update_context(&mut ctx)?; - Ok(Digest::new(ctx.finish()?)) + Ok(ctx.finish().map(|b| b.to_vec())?) } } From d5b001ced6cc97c6779f29384e0c2a59e13e3c50 Mon Sep 17 00:00:00 2001 From: "artem.ivanov" Date: Mon, 5 Aug 2019 10:24:56 +0300 Subject: [PATCH 072/320] IS-1248: Allow user to modify claim_def Signed-off-by: artem.ivanov --- libindy/include/indy_anoncreds.h | 18 ++ libindy/src/api/anoncreds.rs | 113 ++++++++++ libindy/src/commands/anoncreds/issuer.rs | 193 +++++++++++++++++- .../domain/anoncreds/credential_definition.rs | 11 +- libindy/src/domain/anoncreds/schema.rs | 3 +- libindy/tests/anoncreds.rs | 46 ++++- libindy/tests/anoncreds_demos.rs | 115 +++++++++++ libindy/tests/utils/anoncreds.rs | 8 + wrappers/rust/indy-sys/src/anoncreds.rs | 13 ++ wrappers/rust/src/anoncreds.rs | 71 +++++++ 10 files changed, 575 insertions(+), 16 deletions(-) diff --git a/libindy/include/indy_anoncreds.h b/libindy/include/indy_anoncreds.h index d62c764522..222c247e1a 100644 --- a/libindy/include/indy_anoncreds.h +++ b/libindy/include/indy_anoncreds.h @@ -30,6 +30,24 @@ extern "C" { const char* cred_def_id, const char* cred_def_json) ); + + extern indy_error_t indy_issuer_rotate_credential_def_start(indy_handle_t command_handle, + indy_handle_t wallet_handle, + const char * cred_def_id, + const char * config_json, + + void (*cb)(indy_handle_t command_handle_, + indy_error_t err, + const char* cred_def_json) + ); + + extern indy_error_t indy_issuer_rotate_credential_def_apply(indy_handle_t command_handle, + indy_handle_t wallet_handle, + const char * cred_def_id, + + void (*cb)(indy_handle_t command_handle_, + indy_error_t err) + ); extern indy_error_t indy_issuer_create_and_store_revoc_reg(indy_handle_t command_handle, indy_handle_t wallet_handle, diff --git a/libindy/src/api/anoncreds.rs b/libindy/src/api/anoncreds.rs index c970eba9ca..75ee2c08fe 100644 --- a/libindy/src/api/anoncreds.rs +++ b/libindy/src/api/anoncreds.rs @@ -113,6 +113,9 @@ pub extern fn indy_issuer_create_schema(command_handle: CommandHandle, /// /// It is IMPORTANT for current version GET Schema from Ledger with correct seq_no to save compatibility with Ledger. /// +/// Note: Use combination of `indy_issuer_rotate_credential_def_start` and `indy_issuer_rotate_credential_def_apply` functions +/// to generate new keys for an existing credential definition. +/// /// #Params /// wallet_handle: wallet handle (created by open_wallet). /// command_handle: command handle to map callback to user context. @@ -202,6 +205,116 @@ pub extern fn indy_issuer_create_and_store_credential_def(command_handle: Comman res } +/// Generate temporary credential definitional keys for an existing one (owned by the caller of the library). +/// +/// Use `indy_issuer_rotate_credential_def_apply` function to set generated temporary keys as the main. +/// +/// #Params +/// command_handle: command handle to map callback to user context. +/// wallet_handle: wallet handle (created by open_wallet). +/// cred_def_id: an identifier of created credential definition stored in the wallet +/// config_json: (optional) type-specific configuration of credential definition as json: +/// - 'CL': +/// - support_revocation: whether to request non-revocation credential (optional, default false) +/// cb: Callback that takes command result as parameter. +/// +/// #Returns +/// cred_def_json: public part of temporary created credential definition +/// +/// Note: `primary` and `revocation` fields of credential definition are complex opaque types that contain data structures internal to Ursa. +/// They should not be parsed and are likely to change in future versions. +/// +/// #Errors +/// Common* +/// Wallet* +/// Anoncreds* +#[no_mangle] +pub extern fn indy_issuer_rotate_credential_def_start(command_handle: CommandHandle, + wallet_handle: WalletHandle, + cred_def_id: *const c_char, + config_json: *const c_char, + cb: Option) -> ErrorCode { + trace!("indy_issuer_rotate_credential_def_start: >>> wallet_handle: {:?}, cred_def_id: {:?}, config_json: {:?}", + wallet_handle, cred_def_id, config_json); + + check_useful_c_str!(cred_def_id, ErrorCode::CommonInvalidParam3); + check_useful_opt_json!(config_json, ErrorCode::CommonInvalidParam4, CredentialDefinitionConfig); + check_useful_c_callback!(cb, ErrorCode::CommonInvalidParam5); + + trace!("indy_issuer_rotate_credential_def_start: entities >>> wallet_handle: {:?}, cred_def_id: {:?}, config_json: {:?}", + wallet_handle, cred_def_id, config_json); + + let result = CommandExecutor::instance() + .send(Command::Anoncreds( + AnoncredsCommand::Issuer( + IssuerCommand::RotateCredentialDefinitionStart( + wallet_handle, + cred_def_id, + config_json, + Box::new(move |result| { + let (err, cred_def_json) = prepare_result_1!(result, String::new()); + trace!("indy_issuer_rotate_credential_def_start:cred_def_json: {:?}", cred_def_json); + let cred_def_json = ctypes::string_to_cstring(cred_def_json); + cb(command_handle, err, cred_def_json.as_ptr()) + }) + )))); + + let res = prepare_result!(result); + + trace!("indy_issuer_rotate_credential_def_start: <<< res: {:?}", res); + + res +} + +/// Apply temporary keys as main for an existing Credential Definition (owned by the caller of the library). +/// +/// #Params +/// wallet_handle: wallet handle (created by open_wallet). +/// command_handle: command handle to map callback to user context. +/// cred_def_id: an identifier of created credential definition stored in the wallet +/// cb: Callback that takes command result as parameter. +/// +/// #Returns +/// +/// #Errors +/// Common* +/// Wallet* +/// Anoncreds* +#[no_mangle] +pub extern fn indy_issuer_rotate_credential_def_apply(command_handle: CommandHandle, + wallet_handle: WalletHandle, + cred_def_id: *const c_char, + cb: Option) -> ErrorCode { + trace!("indy_issuer_rotate_credential_def_apply: >>> wallet_handle: {:?}, cred_def_id: {:?}", + wallet_handle, cred_def_id); + + check_useful_c_str!(cred_def_id, ErrorCode::CommonInvalidParam3); + check_useful_c_callback!(cb, ErrorCode::CommonInvalidParam4); + + trace!("indy_issuer_rotate_credential_def_apply: entities >>> wallet_handle: {:?}, cred_def_id: {:?}", + wallet_handle, cred_def_id); + + let result = CommandExecutor::instance() + .send(Command::Anoncreds( + AnoncredsCommand::Issuer( + IssuerCommand::RotateCredentialDefinitionApply( + wallet_handle, + cred_def_id, + Box::new(move |result| { + let err = prepare_result!(result); + trace!("indy_issuer_rotate_credential_def_apply:"); + cb(command_handle, err) + }) + )))); + + let res = prepare_result!(result); + + trace!("indy_issuer_rotate_credential_def_apply: <<< res: {:?}", res); + + res +} + /// Create a new revocation registry for the given credential definition as tuple of entities /// - Revocation registry definition that encapsulates credentials definition reference, revocation type specific configuration and /// secrets used for credentials revocation diff --git a/libindy/src/commands/anoncreds/issuer.rs b/libindy/src/commands/anoncreds/issuer.rs index 8b1dd06a7f..3aec63ed9d 100644 --- a/libindy/src/commands/anoncreds/issuer.rs +++ b/libindy/src/commands/anoncreds/issuer.rs @@ -20,6 +20,7 @@ use domain::anoncreds::credential_definition::{ CredentialDefinitionPrivateKey, CredentialDefinitionV1, SignatureType, + TemporaryCredentialDefinition, }; use domain::anoncreds::credential_offer::CredentialOffer; use domain::anoncreds::credential_request::CredentialRequest; @@ -85,6 +86,25 @@ pub enum IssuerCommand { CredentialPrivateKey, CredentialKeyCorrectnessProof)>, i32), + RotateCredentialDefinitionStart( + WalletHandle, + String, // cred def id + Option, // config + Box) + Send>), + RotateCredentialDefinitionStartComplete( + WalletHandle, + String, + String, + String, + SignatureType, + IndyResult<(CredentialDefinitionData, + CredentialPrivateKey, + CredentialKeyCorrectnessProof)>, + i32), + RotateCredentialDefinitionApply( + WalletHandle, + String, // cred def did + Box) + Send>), CreateAndStoreRevocationRegistry( WalletHandle, String, // issuer did @@ -130,7 +150,8 @@ pub struct IssuerCommandExecutor { pub pool_service: Rc, pub wallet_service: Rc, pub crypto_service: Rc, - pending_callbacks: RefCell) + Send>>>, + pending_str_str_callbacks: RefCell) + Send>>>, + pending_str_callbacks: RefCell) + Send>>>, } impl IssuerCommandExecutor { @@ -145,7 +166,8 @@ impl IssuerCommandExecutor { blob_storage_service, wallet_service, crypto_service, - pending_callbacks: RefCell::new(HashMap::new()), + pending_str_str_callbacks: RefCell::new(HashMap::new()), + pending_str_callbacks: RefCell::new(HashMap::new()), } } @@ -167,6 +189,18 @@ impl IssuerCommandExecutor { debug!(target: "wallet_command_executor", "CreateAndStoreCredentialDefinitionContinue command received"); self._create_and_store_credential_definition_continue(cb_id, wallet_handle, &schema, &schema_id, &cred_def_id, &tag, &signature_type, result) } + IssuerCommand::RotateCredentialDefinitionStart(wallet_handle, cred_def_id, cred_def_config, cb) => { + debug!(target: "wallet_command_executor", "RotateCredentialDefinitionStart command received"); + self.rotate_credential_definition_start(wallet_handle, &cred_def_id, cred_def_config.as_ref(), cb); + } + IssuerCommand::RotateCredentialDefinitionStartComplete(wallet_handle, schema_id, cred_def_id, tag, signature_type, result, cb_id) => { + debug!(target: "wallet_command_executor", "RotateCredentialDefinitionStartContinue command received"); + self.rotate_credential_definition_start_complete(cb_id, wallet_handle, &schema_id, &cred_def_id, &tag, &signature_type, result) + } + IssuerCommand::RotateCredentialDefinitionApply(wallet_handle, cred_def_id, cb) => { + debug!(target: "wallet_command_executor", "RotateCredentialDefinitionApply command received"); + cb(self.rotate_credential_definition_apply(wallet_handle, &cred_def_id)); + } IssuerCommand::CreateAndStoreRevocationRegistry(wallet_handle, issuer_did, type_, tag, cred_def_id, config, tails_writer_handle, cb) => { info!(target: "issuer_command_executor", "CreateAndStoreRevocationRegistryRegistry command received"); @@ -249,7 +283,7 @@ impl IssuerCommandExecutor { try_cb!(self._prepare_create_and_store_credential_definition(wallet_handle, issuer_did, schema, tag, type_, config), cb); let cb_id = ::utils::sequence::get_next_id(); - self.pending_callbacks.borrow_mut().insert(cb_id, cb); + self.pending_str_str_callbacks.borrow_mut().insert(cb_id, cb); let tag = tag.to_string(); let schema = schema.clone(); @@ -300,7 +334,7 @@ impl IssuerCommandExecutor { result: IndyResult<(CredentialDefinitionData, CredentialPrivateKey, CredentialKeyCorrectnessProof)>) { - let cb = self.pending_callbacks.borrow_mut().remove(&cb_id).expect("FIXME INVALID STATE"); + let cb = self.pending_str_str_callbacks.borrow_mut().remove(&cb_id).expect("FIXME INVALID STATE"); cb(result .and_then(|result| { self._complete_create_and_store_credential_definition(wallet_handle, schema, schema_id, cred_def_id, tag, signature_type.clone(), result) @@ -331,7 +365,8 @@ impl IssuerCommandExecutor { let cred_def_id = CredentialDefinition::cred_def_id(issuer_did, &schema_id, &signature_type.to_str(), tag); if self.wallet_service.record_exists::(wallet_handle, &cred_def_id)? { - return Err(err_msg(IndyErrorKind::CredDefAlreadyExists, format!("CredentialDefinition for cred_def_id: {:?} already exists", cred_def_id))); + return Err(err_msg(IndyErrorKind::CredDefAlreadyExists, format!("CredentialDefinition for cred_def_id: {:?} already exists, \ + Use combination of `indy_issuer_rotate_credential_def_start` and `indy_issuer_rotate_credential_def_apply` functions to generate new CredDef keys.", cred_def_id))); }; Ok((cred_def_config.clone(), schema_id, cred_def_id, signature_type)) @@ -367,16 +402,160 @@ impl IssuerCommandExecutor { value: cred_key_correctness_proof }; + let schema_ = Schema::SchemaV1(schema.clone()); + let cred_def_json = self.wallet_service.add_indy_object(wallet_handle, &cred_def_id, &cred_def, &HashMap::new())?; self.wallet_service.add_indy_object(wallet_handle, &cred_def_id, &cred_def_priv_key, &HashMap::new())?; self.wallet_service.add_indy_object(wallet_handle, &cred_def_id, &cred_def_correctness_proof, &HashMap::new())?; + self.wallet_service.add_indy_object(wallet_handle, &schema_id, &schema_, &HashMap::new())?; - self._wallet_set_schema_id(wallet_handle, &cred_def_id, &schema.id)?; // TODO: FIXME delete temporary storing of schema id + let schema_id = schema.id.clone(); + + self._wallet_set_schema_id(wallet_handle, &cred_def_id, &schema_id)?; // TODO: FIXME delete temporary storing of schema id debug!("create_and_store_credential_definition <<< cred_def_id: {:?}, cred_def_json: {:?}", cred_def_id, cred_def_json); Ok((cred_def_id.to_string(), cred_def_json)) } + fn rotate_credential_definition_start(&self, + wallet_handle: WalletHandle, + cred_def_id: &str, + cred_def_config: Option<&CredentialDefinitionConfig>, + cb: Box) + Send>) { + debug!("rotate_credential_definition_start >>> wallet_handle: {:?}, cred_def_id: {:?}, cred_def_config: {:?}", + wallet_handle, cred_def_id, cred_def_config); + + let cred_def: CredentialDefinitionV1 = match self.wallet_service.get_indy_object::(wallet_handle, &cred_def_id, &RecordOptions::id_value()) { + Ok(cred_def) => CredentialDefinitionV1::from(cred_def), + Err(err) => return cb(Err(err)) + }; + + if let Ok(temp_cred_def) = self.wallet_service.get_indy_object::(wallet_handle, &cred_def_id, &RecordOptions::id_value()) { + debug!("Temporary Credential Definition already exists. Return it: {:?}", temp_cred_def.cred_def); + + let cred_def_json = try_cb!(::serde_json::to_string(&temp_cred_def.cred_def) + .map_err(|err| IndyError::from_msg(IndyErrorKind::InvalidState, format!("Cannot serialize CredentialDefinition: {}", err))), cb); + + return cb(Ok(cred_def_json)); + } + + let schema: SchemaV1 = match self.wallet_service.get_indy_object::(wallet_handle, &cred_def.schema_id, &RecordOptions::id_value()) { + Ok(schema) => SchemaV1::from(schema), + Err(err) => return cb(Err(err)) + }; + + let cb_id = ::utils::sequence::get_next_id(); + self.pending_str_callbacks.borrow_mut().insert(cb_id, cb); + + let support_revocation = cred_def_config.map(|config| config.support_revocation).unwrap_or_default(); + + CommandExecutor::instance().send(Command::Anoncreds( + AnoncredsCommand::Issuer( + IssuerCommand::CreateCredentialDefinition( + schema.attr_names.clone(), + support_revocation, + Box::new(move |res| { + CommandExecutor::instance().send( + Command::Anoncreds( + AnoncredsCommand::Issuer( + IssuerCommand::RotateCredentialDefinitionStartComplete( + wallet_handle, + cred_def.schema_id.clone(), + cred_def.id.clone(), + cred_def.tag.clone(), + cred_def.signature_type.clone(), + res, + cb_id, + )) + )).unwrap(); + }), + )) + )).unwrap(); + } + + fn rotate_credential_definition_start_complete(&self, + cb_id: CallbackHandle, + wallet_handle: WalletHandle, + schema_id: &str, + cred_def_id: &str, + tag: &str, + signature_type: &SignatureType, + result: IndyResult<(CredentialDefinitionData, + CredentialPrivateKey, + CredentialKeyCorrectnessProof)>) { + let cb = self.pending_str_callbacks.borrow_mut().remove(&cb_id).expect("FIXME INVALID STATE"); + cb(result + .and_then(|result| { + self._rotate_credential_definition_start_complete(wallet_handle, schema_id, cred_def_id, tag, signature_type.clone(), result) + })) + } + + fn _rotate_credential_definition_start_complete(&self, + wallet_handle: WalletHandle, + schema_id: &str, + cred_def_id: &str, + tag: &str, + signature_type: SignatureType, + res: (CredentialDefinitionData, + CredentialPrivateKey, + CredentialKeyCorrectnessProof)) -> IndyResult { + debug!("_rotate_credential_definition_start_complete >>> wallet_handle: {:?}, schema_id: {:?}, cred_def_id: {:?}, tag: {:?}, signature_type: {:?}", + wallet_handle, schema_id, cred_def_id, tag, signature_type); + + let (credential_definition_value, cred_priv_key, cred_key_correctness_proof) = res; + + let cred_def = + CredentialDefinition::CredentialDefinitionV1( + CredentialDefinitionV1 { + id: cred_def_id.to_string(), + schema_id: schema_id.to_string(), + signature_type, + tag: tag.to_string(), + value: credential_definition_value, + }); + + let cred_def_priv_key = CredentialDefinitionPrivateKey { + value: cred_priv_key + }; + + let cred_def_correctness_proof = CredentialDefinitionCorrectnessProof { + value: cred_key_correctness_proof + }; + + let cred_def_json = ::serde_json::to_string(&cred_def) + .map_err(|err| IndyError::from_msg(IndyErrorKind::InvalidState, format!("Cannot serialize CredentialDefinition: {}", err)))?; + + let temp_cred_def = TemporaryCredentialDefinition { + cred_def, + cred_def_priv_key, + cred_def_correctness_proof, + }; + + self.wallet_service.add_indy_object(wallet_handle, &cred_def_id, &temp_cred_def, &HashMap::new())?; + + debug!("_rotate_credential_definition_start_complete <<< cred_def_id: {:?}, cred_def_json: {:?}", cred_def_id, cred_def_json); + Ok(cred_def_json) + } + + fn rotate_credential_definition_apply(&self, + wallet_handle: WalletHandle, + cred_def_id: &str) -> IndyResult<()> { + debug!("rotate_credential_definition_apply >>> wallet_handle: {:?}, cred_def_id: {:?}", wallet_handle, cred_def_id); + + let _cred_def: CredentialDefinition = self.wallet_service.get_indy_object(wallet_handle, &cred_def_id, &RecordOptions::id_value())?; + let temp_cred_def: TemporaryCredentialDefinition = self.wallet_service.get_indy_object(wallet_handle, &cred_def_id, &RecordOptions::id_value())?; + + self.wallet_service.update_indy_object(wallet_handle, &cred_def_id, &temp_cred_def.cred_def)?; + self.wallet_service.update_indy_object(wallet_handle, &cred_def_id, &temp_cred_def.cred_def_priv_key)?; + self.wallet_service.update_indy_object(wallet_handle, &cred_def_id, &temp_cred_def.cred_def_correctness_proof)?; + + self.wallet_service.delete_indy_record::(wallet_handle, &cred_def_id)?; + + debug!("rotate_credential_definition_apply <<<"); + + Ok(()) + } + fn create_and_store_revocation_registry(&self, wallet_handle: WalletHandle, issuer_did: &str, @@ -574,7 +753,7 @@ impl IssuerCommandExecutor { let rev_reg_delta = CryptoRevocationRegistryDelta::from_parts(None, &r_reg.value, &issued, &revoked); Some(Witness::new(rev_reg_info.curr_id, r_reg_def.value.max_cred_num, - r_reg_def.value.issuance_type.to_bool(), &rev_reg_delta, rev_tails_accessor)?) + r_reg_def.value.issuance_type.to_bool(), &rev_reg_delta, rev_tails_accessor)?) } else { None }; diff --git a/libindy/src/domain/anoncreds/credential_definition.rs b/libindy/src/domain/anoncreds/credential_definition.rs index e594043264..b15cf0b6f6 100644 --- a/libindy/src/domain/anoncreds/credential_definition.rs +++ b/libindy/src/domain/anoncreds/credential_definition.rs @@ -27,11 +27,9 @@ impl SignatureType { } } -fn default_false() -> bool { false } - #[derive(Debug, Serialize, Deserialize, Clone)] pub struct CredentialDefinitionConfig { - #[serde(default = "default_false")] + #[serde(default)] pub support_revocation: bool } @@ -68,6 +66,13 @@ pub enum CredentialDefinition { CredentialDefinitionV1(CredentialDefinitionV1) } +#[derive(Debug, Serialize, Deserialize, NamedType)] +pub struct TemporaryCredentialDefinition { + pub cred_def: CredentialDefinition, + pub cred_def_priv_key: CredentialDefinitionPrivateKey, + pub cred_def_correctness_proof: CredentialDefinitionCorrectnessProof +} + impl CredentialDefinition { pub fn cred_def_id(did: &str, schema_id: &str, signature_type: &str, tag: &str) -> String { if ProtocolVersion::is_node_1_3(){ diff --git a/libindy/src/domain/anoncreds/schema.rs b/libindy/src/domain/anoncreds/schema.rs index d194ad3d52..860bbad071 100644 --- a/libindy/src/domain/anoncreds/schema.rs +++ b/libindy/src/domain/anoncreds/schema.rs @@ -1,6 +1,7 @@ use super::DELIMITER; use std::collections::{HashMap, HashSet}; +use named_type::NamedType; pub const SCHEMA_MARKER: &str = "2"; pub const MAX_ATTRIBUTES_COUNT: usize = 125; @@ -16,7 +17,7 @@ pub struct SchemaV1 { pub seq_no: Option, } -#[derive(Debug, Serialize, Deserialize)] +#[derive(Debug, Serialize, Deserialize, NamedType)] #[serde(tag = "ver")] pub enum Schema { #[serde(rename = "1.0")] diff --git a/libindy/tests/anoncreds.rs b/libindy/tests/anoncreds.rs index 5f56ada40e..8ada6dbe83 100644 --- a/libindy/tests/anoncreds.rs +++ b/libindy/tests/anoncreds.rs @@ -3489,6 +3489,42 @@ mod high_cases { assert_code!(ErrorCode::CommonInvalidStructure, res); } } + + mod issuer_rotate_credential_def { + use super::*; + + #[test] + fn issuer_rotate_credential_def_works() { + let (wallet_handle, config) = utils::setup_with_wallet("issuer_rotate_credential_def_works"); + + let (cred_def_id, cred_def_json) = anoncreds::issuer_create_credential_definition(wallet_handle, + ISSUER_DID, + &anoncreds::gvt_schema_json(), + TAG_1, + Some(SIGNATURE_TYPE), + Some(&anoncreds::default_cred_def_config())) + .unwrap(); + + let temp_cred_def_json = anoncreds::issuer_rotate_credential_def_start(wallet_handle, &cred_def_id, None).unwrap(); + + assert_ne!(serde_json::from_str::(&cred_def_json).unwrap(), + serde_json::from_str::(&temp_cred_def_json).unwrap()); + + anoncreds::issuer_rotate_credential_def_apply(wallet_handle, &cred_def_id).unwrap(); + + utils::tear_down_with_wallet(wallet_handle, "issuer_rotate_credential_def_works", &config); + } + + #[test] + fn issuer_rotate_credential_def_apply_works_for_no_temporary_cred_def() { + let (wallet_handle, config) = utils::setup_with_wallet("issuer_rotate_credential_def_apply_works_for_no_temporary_cred_def"); + + let res = anoncreds::issuer_rotate_credential_def_apply(wallet_handle, &anoncreds::issuer_1_gvt_cred_def_id()); + assert_code!(ErrorCode::WalletItemNotFound, res); + + utils::tear_down_with_wallet(wallet_handle, "issuer_rotate_credential_def_apply_works_for_no_temporary_cred_def", &config); + } + } } mod medium_cases { @@ -4109,11 +4145,11 @@ mod medium_cases { } ); let res = anoncreds::verifier_verify_proof(&serde_json::to_string(&proof_req).unwrap(), - &anoncreds::proof_json_restrictions(), - &anoncreds::schemas_for_proof_restrictions(), - &anoncreds::cred_defs_for_proof_restrictions(), - "{}", - "{}"); + &anoncreds::proof_json_restrictions(), + &anoncreds::schemas_for_proof_restrictions(), + &anoncreds::cred_defs_for_proof_restrictions(), + "{}", + "{}"); assert!(res.is_ok()); } diff --git a/libindy/tests/anoncreds_demos.rs b/libindy/tests/anoncreds_demos.rs index 48da549e19..621c3794a1 100644 --- a/libindy/tests/anoncreds_demos.rs +++ b/libindy/tests/anoncreds_demos.rs @@ -2584,4 +2584,119 @@ mod demos { utils::tear_down("anoncreds_works_for_requested_proof_with_revocation_but_provided_primary_only"); } + + + #[test] + fn anoncreds_works_for_cred_def_rotation() { + utils::setup("anoncreds_works_for_cred_def_rotation"); + + //1. Create Issuer wallet, gets wallet handle + let (issuer_wallet_handle, issuer_wallet_config) = wallet::create_and_open_default_wallet("anoncreds_works_for_cred_def_rotation_issuer").unwrap(); + + //2. Create Prover wallet, gets wallet handle + let (prover_wallet_handle, prover_wallet_config) = wallet::create_and_open_default_wallet("anoncreds_works_for_cred_def_rotation_prover").unwrap(); + + //3. Issuer creates Schema and Credential Definition + let (schema_id, schema_json, cred_def_id, cred_def_json) = anoncreds::multi_steps_issuer_preparation(issuer_wallet_handle, + ISSUER_DID, + GVT_SCHEMA_NAME, + GVT_SCHEMA_ATTRIBUTES); + + //4. Prover creates Master Secret + anoncreds::prover_create_master_secret(prover_wallet_handle, COMMON_MASTER_SECRET).unwrap(); + + //5. Issuance credential for Prover + anoncreds::multi_steps_create_credential(COMMON_MASTER_SECRET, + prover_wallet_handle, + issuer_wallet_handle, + CREDENTIAL1_ID, + &anoncreds::gvt_credential_values_json(), + &cred_def_id, + &cred_def_json); + + //6. Proof request + let nonce = anoncreds::generate_nonce().unwrap(); + let proof_req_json = json!({ + "nonce": nonce, + "name":"proof_req_1", + "version":"0.1", + "requested_attributes":{ + "attr1_referent":{ + "name":"name" + } + }, + "requested_predicates":{ + "predicate1_referent":{"name":"age","p_type":">=","p_value":18} + } + }).to_string(); + + //7. Prover gets Credentials for Proof Request + let credentials_json = anoncreds::prover_get_credentials_for_proof_req(prover_wallet_handle, &proof_req_json).unwrap(); + let credential = anoncreds::get_credential_for_attr_referent(&credentials_json, "attr1_referent"); + + //8. Prover creates Proof + let requested_credentials_json = json!({ + "self_attested_attributes": {}, + "requested_attributes": { + "attr1_referent": { "cred_id": credential.referent, "revealed":true } + }, + "requested_predicates": { + "predicate1_referent": { "cred_id": credential.referent } + }, + }).to_string(); + + let schemas_json = json!({schema_id.as_str(): serde_json::from_str::(&schema_json).unwrap()}).to_string(); + let cred_defs_json = json!({cred_def_id.as_str(): serde_json::from_str::(&cred_def_json).unwrap()}).to_string(); + let rev_states_json = json!({}).to_string(); + + let proof_json = anoncreds::prover_create_proof(prover_wallet_handle, + &proof_req_json, + &requested_credentials_json, + COMMON_MASTER_SECRET, + &schemas_json, + &cred_defs_json, + &rev_states_json).unwrap(); + + //9. Verifier verifies proof + let rev_reg_defs_json = json!({}).to_string(); + let rev_regs_json = json!({}).to_string(); + + let valid = anoncreds::verifier_verify_proof(&proof_req_json, + &proof_json, + &schemas_json, + &cred_defs_json, + &rev_reg_defs_json, + &rev_regs_json).unwrap(); + assert!(valid); + + //10. Issuer rotate cred def + let new_cred_def_json = anoncreds::issuer_rotate_credential_def_start(issuer_wallet_handle, &cred_def_id, None).unwrap(); + anoncreds::issuer_rotate_credential_def_apply(issuer_wallet_handle, &cred_def_id).unwrap(); + + //11. Prover generate proof wit rotated cred def but old credential + let schemas_json = json!({schema_id.as_str(): serde_json::from_str::(&schema_json).unwrap()}).to_string(); + let cred_defs_json = json!({cred_def_id.as_str(): serde_json::from_str::(&new_cred_def_json).unwrap()}).to_string(); + + let proof_json = anoncreds::prover_create_proof(prover_wallet_handle, + &proof_req_json, + &requested_credentials_json, + COMMON_MASTER_SECRET, + &schemas_json, + &cred_defs_json, + &rev_states_json).unwrap(); + + //12. Verifier verifies proof + let valid = anoncreds::verifier_verify_proof(&proof_req_json, + &proof_json, + &schemas_json, + &cred_defs_json, + &rev_reg_defs_json, + &rev_regs_json).unwrap(); + assert!(!valid); + + wallet::close_and_delete_wallet(issuer_wallet_handle, &issuer_wallet_config).unwrap(); + wallet::close_and_delete_wallet(prover_wallet_handle, &prover_wallet_config).unwrap(); + + utils::tear_down("anoncreds_works_for_cred_def_rotation"); + } } diff --git a/libindy/tests/utils/anoncreds.rs b/libindy/tests/utils/anoncreds.rs index 4bf3a7cb54..0f2a05700b 100644 --- a/libindy/tests/utils/anoncreds.rs +++ b/libindy/tests/utils/anoncreds.rs @@ -54,6 +54,14 @@ pub fn issuer_create_credential_definition(wallet_handle: i32, issuer_did: &str, anoncreds::issuer_create_and_store_credential_def(wallet_handle, issuer_did, schema, tag, signature_type, config.unwrap_or("{}")).wait() // TODO: FIXME OPTIONAL CONFIG } +pub fn issuer_rotate_credential_def_start(wallet_handle: i32, cred_def_id: &str, config_json: Option<&str>) -> Result { + anoncreds::issuer_rotate_credential_def_start(wallet_handle, cred_def_id, config_json).wait() +} + +pub fn issuer_rotate_credential_def_apply(wallet_handle: i32, cred_def_id: &str) -> Result<(), IndyError> { + anoncreds::issuer_rotate_credential_def_apply(wallet_handle, cred_def_id).wait() +} + pub fn issuer_create_and_store_revoc_reg(wallet_handle: i32, issuer_did: &str, type_: Option<&str>, tag: &str, cred_def_id: &str, config_json: &str, tails_writer_handle: i32) -> Result<(String, String, String), IndyError> { diff --git a/wrappers/rust/indy-sys/src/anoncreds.rs b/wrappers/rust/indy-sys/src/anoncreds.rs index a6dcac1054..5f320cafad 100644 --- a/wrappers/rust/indy-sys/src/anoncreds.rs +++ b/wrappers/rust/indy-sys/src/anoncreds.rs @@ -22,6 +22,19 @@ extern { config_json: CString, cb: Option) -> Error; + #[no_mangle] + pub fn indy_issuer_rotate_credential_def_start(command_handle: CommandHandle, + wallet_handle: WalletHandle, + cred_def_id: CString, + config_json: CString, + cb: Option) -> Error; + + #[no_mangle] + pub fn indy_issuer_rotate_credential_def_apply(command_handle: CommandHandle, + wallet_handle: WalletHandle, + cred_def_id: CString, + cb: Option) -> Error; + #[no_mangle] pub fn indy_issuer_create_and_store_revoc_reg(command_handle: CommandHandle, wallet_handle: WalletHandle, diff --git a/wrappers/rust/src/anoncreds.rs b/wrappers/rust/src/anoncreds.rs index 07cdb1abad..98b4cbea67 100644 --- a/wrappers/rust/src/anoncreds.rs +++ b/wrappers/rust/src/anoncreds.rs @@ -75,6 +75,9 @@ fn _issuer_create_schema(command_handle: CommandHandle, issuer_did: &str, name: /// /// It is IMPORTANT for current version GET Schema from Ledger with correct seq_no to save compatibility with Ledger. /// +/// Note: Use combination of `issuer_rotate_credential_def_start` and `issuer_rotate_credential_def_apply` functions +/// to generate new keys for an existing credential definition. +/// /// # Arguments /// * `wallet_handle`: wallet handle (created by Wallet::open_wallet). /// * `issuer_did`: a DID of the issuer signing cred_def transaction to the Ledger @@ -103,6 +106,10 @@ fn _issuer_create_schema(command_handle: CommandHandle, issuer_did: &str, name: /// }, /// ver: Version of the CredDef json /// } +/// +/// Note: `primary` and `revocation` fields of credential definition are complex opaque types that contain data structures internal to Ursa. +/// They should not be parsed and are likely to change in future versions. +/// pub fn issuer_create_and_store_credential_def(wallet_handle: WalletHandle, issuer_did: &str, schema_json: &str, tag: &str, signature_type: Option<&str>, config_json: &str) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec_string_string(); @@ -132,6 +139,70 @@ fn _issuer_create_and_store_credential_def(command_handle: CommandHandle, wallet }) } +/// Generate temporary credential definitional keys for an existing one (owned by the caller of the library). +/// +/// Use `issuer_rotate_credential_def_apply` function to set generated temporary keys as the main. +/// +/// # Arguments +/// * `wallet_handle`: wallet handle (created by Wallet::open_wallet). +/// * `cred_def_id`: an identifier of created credential definition stored in the wallet +/// * `config_json`: (optional) type-specific configuration of credential definition as json: +/// - 'CL': +/// - support_revocation: whether to request non-revocation credential (optional, default false) +/// +/// # Returns +/// * `cred_def_json`: public part of temporary created credential definition +pub fn issuer_rotate_credential_def_start(wallet_handle: WalletHandle, cred_def_id: &str, config_json: Option<&str>) -> Box> { + let (receiver, command_handle, cb) = ClosureHandler::cb_ec_string(); + + let err = _issuer_rotate_credential_def_start(command_handle, wallet_handle, cred_def_id, config_json, cb); + + ResultHandler::str(command_handle, err, receiver) +} + +fn _issuer_rotate_credential_def_start(command_handle: CommandHandle, wallet_handle: WalletHandle, cred_def_id: &str, config: Option<&str>, cb: Option) -> ErrorCode { + let cred_def_id = c_str!(cred_def_id); + let config_str = opt_c_str!(config); + + ErrorCode::from(unsafe { + anoncreds::indy_issuer_rotate_credential_def_start( + command_handle, + wallet_handle, + cred_def_id.as_ptr(), + opt_c_ptr!(config, config_str), + cb + ) + }) +} + +/// Apply temporary keys as main for an existing Credential Definition (owned by the caller of the library). +/// +/// # Arguments +/// * `wallet_handle`: wallet handle (created by Wallet::open_wallet). +/// * `cred_def_id`: an identifier of created credential definition stored in the wallet +/// +/// # Returns +pub fn issuer_rotate_credential_def_apply(wallet_handle: WalletHandle, cred_def_id: &str) -> Box> { + let (receiver, command_handle, cb) = ClosureHandler::cb_ec(); + + let err = _issuer_rotate_credential_def_apply(command_handle, wallet_handle, cred_def_id, cb); + + ResultHandler::empty(command_handle, err, receiver) +} + +fn _issuer_rotate_credential_def_apply(command_handle: CommandHandle, wallet_handle: WalletHandle, cred_def_id: &str, cb: Option) -> ErrorCode { + let cred_def_id = c_str!(cred_def_id); + + ErrorCode::from(unsafe { + anoncreds::indy_issuer_rotate_credential_def_apply( + command_handle, + wallet_handle, + cred_def_id.as_ptr(), + cb + ) + }) +} + /// Create a new revocation registry for the given credential definition as tuple of entities /// - Revocation registry definition that encapsulates credentials definition reference, revocation type specific configuration and /// secrets used for credentials revocation From c69d9ac0d06df5d45fbad4d213a8531b6c58d5ce Mon Sep 17 00:00:00 2001 From: "artem.ivanov" Date: Mon, 5 Aug 2019 11:51:18 +0300 Subject: [PATCH 073/320] IS-1248: Allow user to modify claim_def - supported new functions in wrappers Signed-off-by: artem.ivanov --- libindy/src/api/anoncreds.rs | 5 +- libindy/src/commands/anoncreds/issuer.rs | 2 +- .../org/hyperledger/indy/sdk/LibIndy.java | 2 + .../indy/sdk/anoncreds/Anoncreds.java | 99 ++++++++++++++++++- .../IssuerRotateCredentialDefinitionTest.java | 40 ++++++++ wrappers/nodejs/README.md | 28 ++++++ wrappers/nodejs/src/index.js | 14 +++ wrappers/nodejs/src/indy.cc | 41 ++++++++ wrappers/nodejs/test/anoncreds.js | 6 ++ wrappers/python/indy/anoncreds.py | 74 ++++++++++++++ .../test_issuer_rotate_credential_def.py | 20 ++++ 11 files changed, 323 insertions(+), 8 deletions(-) create mode 100644 wrappers/java/src/test/java/org/hyperledger/indy/sdk/anoncreds/IssuerRotateCredentialDefinitionTest.java create mode 100644 wrappers/python/tests/anoncreds/test_issuer_rotate_credential_def.py diff --git a/libindy/src/api/anoncreds.rs b/libindy/src/api/anoncreds.rs index 75ee2c08fe..fb5946a46e 100644 --- a/libindy/src/api/anoncreds.rs +++ b/libindy/src/api/anoncreds.rs @@ -207,7 +207,7 @@ pub extern fn indy_issuer_create_and_store_credential_def(command_handle: Comman /// Generate temporary credential definitional keys for an existing one (owned by the caller of the library). /// -/// Use `indy_issuer_rotate_credential_def_apply` function to set generated temporary keys as the main. +/// Use `indy_issuer_rotate_credential_def_apply` function to set temporary keys as the main. /// /// #Params /// command_handle: command handle to map callback to user context. @@ -221,9 +221,6 @@ pub extern fn indy_issuer_create_and_store_credential_def(command_handle: Comman /// #Returns /// cred_def_json: public part of temporary created credential definition /// -/// Note: `primary` and `revocation` fields of credential definition are complex opaque types that contain data structures internal to Ursa. -/// They should not be parsed and are likely to change in future versions. -/// /// #Errors /// Common* /// Wallet* diff --git a/libindy/src/commands/anoncreds/issuer.rs b/libindy/src/commands/anoncreds/issuer.rs index 3aec63ed9d..36a7abb6b5 100644 --- a/libindy/src/commands/anoncreds/issuer.rs +++ b/libindy/src/commands/anoncreds/issuer.rs @@ -407,7 +407,7 @@ impl IssuerCommandExecutor { let cred_def_json = self.wallet_service.add_indy_object(wallet_handle, &cred_def_id, &cred_def, &HashMap::new())?; self.wallet_service.add_indy_object(wallet_handle, &cred_def_id, &cred_def_priv_key, &HashMap::new())?; self.wallet_service.add_indy_object(wallet_handle, &cred_def_id, &cred_def_correctness_proof, &HashMap::new())?; - self.wallet_service.add_indy_object(wallet_handle, &schema_id, &schema_, &HashMap::new())?; + let _ = self.wallet_service.add_indy_object(wallet_handle, &schema_id, &schema_, &HashMap::new()).ok(); let schema_id = schema.id.clone(); diff --git a/wrappers/java/src/main/java/org/hyperledger/indy/sdk/LibIndy.java b/wrappers/java/src/main/java/org/hyperledger/indy/sdk/LibIndy.java index 8f189c4025..9794a1d48b 100644 --- a/wrappers/java/src/main/java/org/hyperledger/indy/sdk/LibIndy.java +++ b/wrappers/java/src/main/java/org/hyperledger/indy/sdk/LibIndy.java @@ -116,6 +116,8 @@ public interface API extends Library { public int indy_issuer_create_schema(int command_handle, String issuer_did, String name, String version, String attr_names, Callback cb); public int indy_issuer_create_and_store_credential_def(int command_handle, int wallet_handle, String issuer_did, String schema_json, String tag, String signature_type, String config_json, Callback cb); + public int indy_issuer_rotate_credential_def_start(int command_handle, int wallet_handle, String cred_def_id, String config_json, Callback cb); + public int indy_issuer_rotate_credential_def_apply(int command_handle, int wallet_handle, String cred_def_id, Callback cb); public int indy_issuer_create_and_store_revoc_reg(int command_handle, int wallet_handle, String issuer_did, String revoc_def_type, String tag, String cred_def_id, String config_json, int blob_storage_writer_handle, Callback cb); public int indy_issuer_create_credential_offer(int command_handle, int wallet_handle, String cred_def_id, Callback cb); public int indy_issuer_create_credential(int command_handle, int wallet_handle, String cred_offer_json, String cred_req_json, String cred_values_json, String rev_reg_id, int blob_storage_reader_handle, Callback cb); diff --git a/wrappers/java/src/main/java/org/hyperledger/indy/sdk/anoncreds/Anoncreds.java b/wrappers/java/src/main/java/org/hyperledger/indy/sdk/anoncreds/Anoncreds.java index 946537ec2b..53b2eaa936 100644 --- a/wrappers/java/src/main/java/org/hyperledger/indy/sdk/anoncreds/Anoncreds.java +++ b/wrappers/java/src/main/java/org/hyperledger/indy/sdk/anoncreds/Anoncreds.java @@ -153,6 +153,22 @@ public void callback(int xcommand_handle, int err, Boolean valid) { } }; + /** + * Callback used when function with empty result completes. + */ + private static Callback voidCb = new Callback() { + + @SuppressWarnings({"unused", "unchecked"}) + public void callback(int xcommand_handle, int err) { + + CompletableFuture future = (CompletableFuture) removeFuture(xcommand_handle); + if (! checkResult(future, err)) return; + + Void result = null; + future.complete(result); + } + }; + /* * STATIC METHODS */ @@ -214,11 +230,14 @@ public static CompletableFuture issuerCreateSchema( * * It is IMPORTANT for current version GET Schema from Ledger with correct seq_no to save compatibility with Ledger. * + * Note: Use combination of `issuerRotateCredentialDefStart` and `issuerRotateCredentialDefApply` functions + * to generate new keys for an existing credential definition. + * * @param wallet The wallet. * @param issuerDid DID of the issuer signing cred_def transaction to the Ledger * @param schemaJson Сredential schema as a json * @param tag Allows to distinct between credential definitions for the same issuer and schema - * @param signature_type Credential definition signature_type (optional, 'CL' by default) that defines credentials signature and revocation math. + * @param signatureType Credential definition signatureType (optional, 'CL' by default) that defines credentials signature and revocation math. * Supported types are: * - 'CL': Camenisch-Lysyanskaya credential signature type that is implemented according to the algorithm in this paper: * https://github.com/hyperledger/ursa/blob/master/libursa/docs/AnonCred.pdf @@ -251,7 +270,7 @@ public static CompletableFuture issuerC String issuerDid, String schemaJson, String tag, - String signature_type, + String signatureType, String configJson) throws IndyException { ParamGuard.notNull(wallet, "wallet"); @@ -270,7 +289,7 @@ public static CompletableFuture issuerC issuerDid, schemaJson, tag, - signature_type, + signatureType, configJson, issuerCreateAndStoreCredentialDefCb); @@ -279,6 +298,80 @@ public static CompletableFuture issuerC return future; } + /** + * Generate temporary credential definitional keys for an existing one (owned by the caller of the library). + * + * Use `issuerRotateCredentialDefApply` function to set temporary keys as the main. + * + * @param wallet The wallet. + * @param credDefId An identifier of created credential definition stored in the wallet + * @param configJson (optional) Type-specific configuration of credential definition as json: + * - 'CL': + * - revocationSupport: whether to request non-revocation credential (optional, default false) + * + * @return A future resolving to IssuerCreateAndStoreCredentialDefResult containing:. + * credDefJson: public part of temporary created credential definition + * + * @throws IndyException Thrown if an error occurs when calling the underlying SDK. + */ + public static CompletableFutureissuerRotateCredentialDefStart( + Wallet wallet, + String credDefId, + String configJson) throws IndyException { + + ParamGuard.notNull(wallet, "wallet"); + ParamGuard.notNullOrWhiteSpace(credDefId, "credDefId"); + + CompletableFuture future = new CompletableFuture(); + int commandHandle = addFuture(future); + + int walletHandle = wallet.getWalletHandle(); + + int result = LibIndy.api.indy_issuer_rotate_credential_def_start( + commandHandle, + walletHandle, + credDefId, + configJson, + stringCb); + + checkResult(future, result); + + return future; + } + + /** + * Apply temporary keys as main for an existing Credential Definition (owned by the caller of the library). + * + * @param wallet The wallet. + * @param credDefId An identifier of created credential definition stored in the wallet + * + * @return A future resolving to no value + * + * @throws IndyException Thrown if an error occurs when calling the underlying SDK. + */ + public static CompletableFutureissuerRotateCredentialDefApply( + Wallet wallet, + String credDefId) throws IndyException { + + ParamGuard.notNull(wallet, "wallet"); + ParamGuard.notNullOrWhiteSpace(credDefId, "credDefId"); + + CompletableFuture future = new CompletableFuture(); + int commandHandle = addFuture(future); + + int walletHandle = wallet.getWalletHandle(); + + int result = LibIndy.api.indy_issuer_rotate_credential_def_apply( + commandHandle, + walletHandle, + credDefId, + voidCb); + + checkResult(future, result); + + return future; + } + /** * Create a new revocation registry for the given credential definition as tuple of entities: * - Revocation registry definition that encapsulates credentials definition reference, revocation revoc_def_type specific configuration and diff --git a/wrappers/java/src/test/java/org/hyperledger/indy/sdk/anoncreds/IssuerRotateCredentialDefinitionTest.java b/wrappers/java/src/test/java/org/hyperledger/indy/sdk/anoncreds/IssuerRotateCredentialDefinitionTest.java new file mode 100644 index 0000000000..f92e3c8f7e --- /dev/null +++ b/wrappers/java/src/test/java/org/hyperledger/indy/sdk/anoncreds/IssuerRotateCredentialDefinitionTest.java @@ -0,0 +1,40 @@ +package org.hyperledger.indy.sdk.anoncreds; + +import org.hyperledger.indy.sdk.JsonObjectSimilar; +import org.hyperledger.indy.sdk.wallet.Wallet; +import org.json.JSONObject; +import org.junit.Test; + +import static org.junit.Assert.assertFalse; + +public class IssuerRotateCredentialDefinitionTest extends AnoncredsIntegrationTest { + + @Test + public void testIssuerRotateCredentialDefinitionWorks() throws Exception { + String walletConfig = + new JSONObject() + .put("id", "testIssuerRotateCredentialDefinitionWorks") + .toString(); + + Wallet.createWallet(walletConfig, CREDENTIALS).get(); + Wallet localWallet = Wallet.openWallet(walletConfig, CREDENTIALS).get(); + + AnoncredsResults.IssuerCreateAndStoreCredentialDefResult credDefRes = + Anoncreds.issuerCreateAndStoreCredentialDef(localWallet, issuerDid, gvtSchema, tag, null, defaultCredentialDefinitionConfig).get(); + + String credDefId = credDefRes.getCredDefId(); + String credDef = credDefRes.getCredDefJson(); + + String tempCredDef = Anoncreds.issuerRotateCredentialDefStart(localWallet, credDefId, null).get(); + + System.out.println(credDef); + System.out.println(tempCredDef); + + assertFalse(JsonObjectSimilar.similar(new JSONObject(credDef), new JSONObject(tempCredDef))); + + Anoncreds.issuerRotateCredentialDefApply(localWallet, credDefId).get(); + + localWallet.closeWallet(); + Wallet.deleteWallet(walletConfig, CREDENTIALS).get(); + } +} diff --git a/wrappers/nodejs/README.md b/wrappers/nodejs/README.md index 30bb5a0a47..90277a59f6 100644 --- a/wrappers/nodejs/README.md +++ b/wrappers/nodejs/README.md @@ -137,6 +137,9 @@ to Indy distributed ledger. It is IMPORTANT for current version GET Schema from Ledger with correct seq\_no to save compatibility with Ledger. +Note: Use combination of `issuerRotateCredentialDefStart` and `indy_issuer_rotate_credential_def_apply` functions +to generate new keys for an existing credential definition. + * `wh`: Handle (Number) - wallet handle (created by openWallet) * `issuerDid`: String - a DID of the issuer signing cred\_def transaction to the Ledger * `schema`: Json - credential schema as a json @@ -155,6 +158,31 @@ cred\_def\_json: public part of created credential definition Errors: `Common*`, `Wallet*`, `Anoncreds*` +#### issuerRotateCredentialDefStart \( wh, credDefId, config \) -> credDef + + Generate temporary credential definitional keys for an existing one (owned by the caller of the library). + + Use `issuerRotateCredentialDefApply` function to set temporary keys as the main. + +* `wh`: Handle (Number) - wallet handle (created by openWallet) +* `credDefId`: String - an identifier of created credential definition stored in the wallet +* `config`: Json - \(optional\) type-specific configuration of credential definition as json: + * 'CL': + * support\_revocation: whether to request non-revocation credential \(optional, default false\) +* __->__ `credDef`: Json - public part of temporary created credential definition + +Errors: `Common*`, `Wallet*`, `Anoncreds*` + +#### issuerRotateCredentialDefApply \( wh, credDefId \) -> void + + Apply temporary keys as main for an existing Credential Definition (owned by the caller of the library). + +* `wh`: Handle (Number) - wallet handle (created by openWallet) +* `credDefId`: String - an identifier of created credential definition stored in the wallet +* __->__ void + +Errors: `Common*`, `Wallet*`, `Anoncreds*` + #### issuerCreateAndStoreRevocReg \( wh, issuerDid, revocDefType, tag, credDefId, config, tailsWriterHandle \) -> \[ revocRegId, revocRegDef, revocRegEntry \] Create a new revocation registry for the given credential definition as tuple of entities diff --git a/wrappers/nodejs/src/index.js b/wrappers/nodejs/src/index.js index 81de1219f7..a1ea5c41cd 100644 --- a/wrappers/nodejs/src/index.js +++ b/wrappers/nodejs/src/index.js @@ -63,6 +63,20 @@ indy.issuerCreateAndStoreCredentialDef = function issuerCreateAndStoreCredential return cb.promise } +indy.issuerRotateCredentialDefStart = function issuerRotateCredentialDefStart (wh, credDefId, config, cb) { + cb = wrapIndyCallback(cb, function (data) { + return fromJson(data[0]) + }) + capi.issuerRotateCredentialDefStart(wh, credDefId, toJson(config), cb) + return cb.promise +} + +indy.issuerRotateCredentialDefApply = function issuerRotateCredentialDefApply (wh, credDefId, cb) { + cb = wrapIndyCallback(cb) + capi.issuerRotateCredentialDefApply(wh, credDefId, cb) + return cb.promise +} + indy.issuerCreateAndStoreRevocReg = function issuerCreateAndStoreRevocReg (wh, issuerDid, revocDefType, tag, credDefId, config, tailsWriterHandle, cb) { cb = wrapIndyCallback(cb, function (data) { return [data[0], fromJson(data[1]), fromJson(data[2])] diff --git a/wrappers/nodejs/src/indy.cc b/wrappers/nodejs/src/indy.cc index ef6457be4a..06f36d5ffe 100644 --- a/wrappers/nodejs/src/indy.cc +++ b/wrappers/nodejs/src/indy.cc @@ -430,6 +430,45 @@ NAN_METHOD(issuerCreateAndStoreCredentialDef) { delete arg5; } +void issuerRotateCredentialDefStart_cb(indy_handle_t handle, indy_error_t xerr, const char* arg0) { + IndyCallback* icb = IndyCallback::getCallback(handle); + if(icb != nullptr){ + icb->cbString(xerr, arg0); + } +} +NAN_METHOD(issuerRotateCredentialDefStart) { + INDY_ASSERT_NARGS(issuerRotateCredentialDefStart, 4) + INDY_ASSERT_NUMBER(issuerRotateCredentialDefStart, 0, wh) + INDY_ASSERT_STRING(issuerRotateCredentialDefStart, 1, credDefId) + INDY_ASSERT_STRING(issuerRotateCredentialDefStart, 2, config) + INDY_ASSERT_FUNCTION(issuerRotateCredentialDefStart, 3) + indy_handle_t arg0 = argToInt32(info[0]); + const char* arg1 = argToCString(info[1]); + const char* arg2 = argToCString(info[2]); + IndyCallback* icb = argToIndyCb(info[3]); + indyCalled(icb, indy_issuer_rotate_credential_def_start(icb->handle, arg0, arg1, arg2, issuerRotateCredentialDefStart_cb)); + delete arg1; + delete arg2; +} + +void issuerRotateCredentialDefApply_cb(indy_handle_t handle, indy_error_t xerr) { + IndyCallback* icb = IndyCallback::getCallback(handle); + if(icb != nullptr){ + icb->cbNone(xerr); + } +} +NAN_METHOD(issuerRotateCredentialDefApply) { + INDY_ASSERT_NARGS(issuerRotateCredentialDefStart, 3) + INDY_ASSERT_NUMBER(issuerRotateCredentialDefStart, 0, wh) + INDY_ASSERT_STRING(issuerRotateCredentialDefStart, 1, credDefId) + INDY_ASSERT_FUNCTION(issuerRotateCredentialDefStart, 2) + indy_handle_t arg0 = argToInt32(info[0]); + const char* arg1 = argToCString(info[1]); + IndyCallback* icb = argToIndyCb(info[2]); + indyCalled(icb, indy_issuer_rotate_credential_def_apply(icb->handle, arg0, arg1, issuerRotateCredentialDefApply_cb)); + delete arg1; +} + void issuerCreateAndStoreRevocReg_cb(indy_handle_t handle, indy_error_t xerr, const char* arg0, const char* arg1, const char* arg2) { IndyCallback* icb = IndyCallback::getCallback(handle); if(icb != nullptr){ @@ -3509,6 +3548,8 @@ NAN_METHOD(setDefaultLogger) { NAN_MODULE_INIT(InitAll) { Nan::Export(target, "issuerCreateSchema", issuerCreateSchema); Nan::Export(target, "issuerCreateAndStoreCredentialDef", issuerCreateAndStoreCredentialDef); + Nan::Export(target, "issuerRotateCredentialDefStart", issuerRotateCredentialDefStart); + Nan::Export(target, "issuerRotateCredentialDefApply", issuerRotateCredentialDefApply); Nan::Export(target, "issuerCreateAndStoreRevocReg", issuerCreateAndStoreRevocReg); Nan::Export(target, "issuerCreateCredentialOffer", issuerCreateCredentialOffer); Nan::Export(target, "issuerCreateCredential", issuerCreateCredential); diff --git a/wrappers/nodejs/test/anoncreds.js b/wrappers/nodejs/test/anoncreds.js index 486055232b..2f8995d97a 100644 --- a/wrappers/nodejs/test/anoncreds.js +++ b/wrappers/nodejs/test/anoncreds.js @@ -167,6 +167,12 @@ test('anoncreds', async function (t) { await indy.issuerMergeRevocationRegistryDeltas(revDelta, revocedDelta) + // Rotate credential definition + var tempCredDef = await indy.issuerRotateCredentialDefStart(wh, credDefId, null) + t.not(cred, tempCredDef) + + await indy.issuerRotateCredentialDefApply(wh, credDefId) + await indy.closeWallet(wh) await indy.deleteWallet(walletConfig, walletCredentials) pool.cleanup() diff --git a/wrappers/python/indy/anoncreds.py b/wrappers/python/indy/anoncreds.py index 97c0554a7d..43e15dfdc8 100644 --- a/wrappers/python/indy/anoncreds.py +++ b/wrappers/python/indy/anoncreds.py @@ -83,6 +83,9 @@ async def issuer_create_and_store_credential_def(wallet_handle: int, It is IMPORTANT for current version GET Schema from Ledger with correct seq_no to save compatibility with Ledger. + Note: Use combination of `issuer_rotate_credential_def_start` and `issuer_rotate_credential_def_apply` functions + to generate new keys for an existing credential definition. + :param wallet_handle: wallet handle (created by open_wallet). :param issuer_did: a DID of the issuer signing cred_def transaction to the Ledger :param schema_json: credential schema as a json @@ -147,6 +150,77 @@ async def issuer_create_and_store_credential_def(wallet_handle: int, return res +async def issuer_rotate_credential_def_start(wallet_handle: int, + cred_def_id: str, + config_json: Optional[str]) -> str: + """ + Generate temporary credential definitional keys for an existing one (owned by the caller of the library). + + Use `issuer_rotate_credential_def_apply` function to set generated temporary keys as the main. + + :param wallet_handle: wallet handle (created by open_wallet). + :param cred_def_id: an identifier of created credential definition stored in the wallet + :param config_json: (optional) type-specific configuration of credential definition as json: + - 'CL': + - support_revocation: whether to request non-revocation credential (optional, default false) + :return: + cred_def_json: public part of temporary created credential definition + """ + + logger = logging.getLogger(__name__) + logger.debug("issuer_rotate_credential_def_start: >>> wallet_handle: %r, cred_def_id: %r, config_json: %r", + wallet_handle, + cred_def_id, + config_json) + + if not hasattr(issuer_rotate_credential_def_start, "cb"): + logger.debug("issuer_rotate_credential_def_start: Creating callback") + issuer_rotate_credential_def_start.cb = create_cb(CFUNCTYPE(None, c_int32, c_int32, c_char_p)) + + c_wallet_handle = c_int32(wallet_handle) + c_cred_def_id = c_char_p(cred_def_id.encode('utf-8')) + c_config_json = c_char_p(config_json.encode('utf-8')) if config_json is not None else None + + credential_def_json = await do_call('indy_issuer_rotate_credential_def_start', + c_wallet_handle, + c_cred_def_id, + c_config_json, + issuer_rotate_credential_def_start.cb) + + res = credential_def_json.decode() + logger.debug("issuer_rotate_credential_def_start: <<< res: %r", res) + return res + + +async def issuer_rotate_credential_def_apply(wallet_handle: int, + cred_def_id: str): + """ + Apply temporary keys as main for an existing Credential Definition (owned by the caller of the library). + + :param wallet_handle: wallet handle (created by open_wallet). + :param cred_def_id: an identifier of created credential definition stored in the wallet + """ + + logger = logging.getLogger(__name__) + logger.debug("issuer_rotate_credential_def_apply: >>> wallet_handle: %r, cred_def_id: %r", + wallet_handle, + cred_def_id) + + if not hasattr(issuer_rotate_credential_def_apply, "cb"): + logger.debug("issuer_rotate_credential_def_apply: Creating callback") + issuer_rotate_credential_def_apply.cb = create_cb(CFUNCTYPE(None, c_int32, c_int32)) + + c_wallet_handle = c_int32(wallet_handle) + c_cred_def_id = c_char_p(cred_def_id.encode('utf-8')) + + await do_call('indy_issuer_rotate_credential_def_apply', + c_wallet_handle, + c_cred_def_id, + issuer_rotate_credential_def_apply.cb) + + logger.debug("issuer_rotate_credential_def_apply: <<<") + + async def issuer_create_and_store_revoc_reg(wallet_handle: int, issuer_did: str, revoc_def_type: Optional[str], diff --git a/wrappers/python/tests/anoncreds/test_issuer_rotate_credential_def.py b/wrappers/python/tests/anoncreds/test_issuer_rotate_credential_def.py new file mode 100644 index 0000000000..284ded93d8 --- /dev/null +++ b/wrappers/python/tests/anoncreds/test_issuer_rotate_credential_def.py @@ -0,0 +1,20 @@ +import json + +import pytest + +from indy.anoncreds import \ + issuer_create_and_store_credential_def, \ + issuer_rotate_credential_def_start, \ + issuer_rotate_credential_def_apply + + +@pytest.mark.asyncio +async def test_rotate_credential_def_works(wallet_handle, issuer_did, gvt_schema_json, tag): + cred_def_id, cred_def_json = \ + await issuer_create_and_store_credential_def(wallet_handle, issuer_did, gvt_schema_json, tag, "CL", None) + + temp_cred_def_json = await issuer_rotate_credential_def_start(wallet_handle, cred_def_id, None) + + assert not json.loads(cred_def_json) == json.loads(temp_cred_def_json) + + await issuer_rotate_credential_def_apply(wallet_handle, cred_def_id) From ca0fdeec5019c26369568b54245c9c1aa13fc2d6 Mon Sep 17 00:00:00 2001 From: "artem.ivanov" Date: Mon, 5 Aug 2019 12:27:22 +0300 Subject: [PATCH 074/320] IS-1248: Allow user to modify claim_def - onjective-C wrapper Signed-off-by: artem.ivanov --- .../Case Tests/Anoncreds/AnoncredsHighCases.m | 22 ++++++++++ .../Test Utils/AnoncredsUtils.h | 8 ++++ .../Test Utils/AnoncredsUtils.m | 41 +++++++++++++++++ .../libindy-pod/Indy/Wrapper/IndyAnoncreds.h | 37 +++++++++++++++- .../libindy-pod/Indy/Wrapper/IndyAnoncreds.mm | 44 +++++++++++++++++++ 5 files changed, 151 insertions(+), 1 deletion(-) diff --git a/wrappers/ios/libindy-pod/Indy-demoTests/Case Tests/Anoncreds/AnoncredsHighCases.m b/wrappers/ios/libindy-pod/Indy-demoTests/Case Tests/Anoncreds/AnoncredsHighCases.m index a9c66eb48a..9f9783a04b 100644 --- a/wrappers/ios/libindy-pod/Indy-demoTests/Case Tests/Anoncreds/AnoncredsHighCases.m +++ b/wrappers/ios/libindy-pod/Indy-demoTests/Case Tests/Anoncreds/AnoncredsHighCases.m @@ -927,4 +927,26 @@ - (void)testVerifierVerifyProofWorksForProofDoesNotCorrespondToRequest { XCTAssertEqual(ret.code, AnoncredsProofRejected, @"AnoncredsUtils::verifierVerifyProof returned wrong error"); } +// MARK: - Issuer rotate credential def + +- (void)testIssuerRotateCredentialDef { + + IndyHandle localWalletHandle = 0; + + ret = [[WalletUtils sharedInstance] createAndOpenWalletWithHandle:&localWalletHandle]; + XCTAssertEqual(ret.code, Success, @"WalletUtils::createAndOpenWallet() failed"); + + ret = [[AnoncredsUtils sharedInstance] issuerRotateCredentialDefStartForId:getIssuer1GvtCredDefId + configJSON:nil + walletHandle:localWalletHandle + credDefJson:nil]; + XCTAssertEqual(ret.code, WalletItemNotFound, @"AnoncredsUtils::issuerRotateCredentialDefStartForId() returned wrong code!"); + + ret = [[AnoncredsUtils sharedInstance] issuerRotateCredentialDefApplyForId:getIssuer1GvtCredDefId + walletHandle:localWalletHandle]; + XCTAssertEqual(ret.code, WalletItemNotFound, @"AnoncredsUtils::issuerRotateCredentialDefApplyForId() returned wrong code!"); + + [[WalletUtils sharedInstance] closeWalletWithHandle:localWalletHandle]; +} + @end diff --git a/wrappers/ios/libindy-pod/Indy-demoTests/Test Utils/AnoncredsUtils.h b/wrappers/ios/libindy-pod/Indy-demoTests/Test Utils/AnoncredsUtils.h index f6f4bb97cc..12dbb01f52 100644 --- a/wrappers/ios/libindy-pod/Indy-demoTests/Test Utils/AnoncredsUtils.h +++ b/wrappers/ios/libindy-pod/Indy-demoTests/Test Utils/AnoncredsUtils.h @@ -49,6 +49,14 @@ credDefId:(NSString **)credentialDefId credDefJson:(NSString **)credentialDefJson; +- (NSError *)issuerRotateCredentialDefStartForId:(NSString *)credDefId + configJSON:(NSString *)configJSON + walletHandle:(IndyHandle)walletHandle + credDefJson:(NSString **)credentialDefJson; + +- (NSError *)issuerRotateCredentialDefApplyForId:(NSString *)credDefId + walletHandle:(IndyHandle)walletHandle; + - (NSError *)issuerCreateAndStoreRevocRegForCredentialDefId:(NSString *)credDefID issuerDID:(NSString *)issuerDID type:(NSString *)type diff --git a/wrappers/ios/libindy-pod/Indy-demoTests/Test Utils/AnoncredsUtils.m b/wrappers/ios/libindy-pod/Indy-demoTests/Test Utils/AnoncredsUtils.m index 15a23a3c3b..c9129bbd01 100644 --- a/wrappers/ios/libindy-pod/Indy-demoTests/Test Utils/AnoncredsUtils.m +++ b/wrappers/ios/libindy-pod/Indy-demoTests/Test Utils/AnoncredsUtils.m @@ -241,6 +241,47 @@ - (NSError *)issuerCreateAndStoreCredentialDefForSchema:(NSString *)schemaJSON return err; } +- (NSError *)issuerRotateCredentialDefStartForId:(NSString *)credDefId + configJSON:(NSString *)configJSON + walletHandle:(IndyHandle)walletHandle + credDefJson:(NSString **)credentialDefJson { + __block NSError *err = nil; + __block NSString *outCredentialDefJson = nil; + XCTestExpectation *completionExpectation = [[XCTestExpectation alloc] initWithDescription:@"completion finished"]; + + [IndyAnoncreds issuerRotateCredentialDefStartForId:credDefId + configJSON:configJSON + walletHandle:walletHandle + completion:^(NSError *error, NSString *credDefJSON) { + err = error; + outCredentialDefJson = credDefJSON; + [completionExpectation fulfill]; + }]; + + [self waitForExpectations:@[completionExpectation] timeout:[TestUtils longTimeout]]; + + if (credentialDefJson) {*credentialDefJson = outCredentialDefJson;} + + return err; +} + +- (NSError *)issuerRotateCredentialDefApplyForId:(NSString *)credDefId + walletHandle:(IndyHandle)walletHandle { + __block NSError *err = nil; + XCTestExpectation *completionExpectation = [[XCTestExpectation alloc] initWithDescription:@"completion finished"]; + + [IndyAnoncreds issuerRotateCredentialDefApplyForId:credDefId + walletHandle:walletHandle + completion:^(NSError *error) { + err = error; + [completionExpectation fulfill]; + }]; + + [self waitForExpectations:@[completionExpectation] timeout:[TestUtils longTimeout]]; + + return err; +} + - (NSError *)issuerCreateAndStoreRevocRegForCredentialDefId:(NSString *)credDefID issuerDID:(NSString *)issuerDID type:(NSString *)type diff --git a/wrappers/ios/libindy-pod/Indy/Wrapper/IndyAnoncreds.h b/wrappers/ios/libindy-pod/Indy/Wrapper/IndyAnoncreds.h index ba9e9e9255..f77d1f5c87 100644 --- a/wrappers/ios/libindy-pod/Indy/Wrapper/IndyAnoncreds.h +++ b/wrappers/ios/libindy-pod/Indy/Wrapper/IndyAnoncreds.h @@ -67,7 +67,11 @@ And is documented in this HIPE: - 'CL': - revocationSupport: whether to request non-revocation credential (optional, default false) @param walletHandle Wallet handler (created by IndyWallet::openWalletWithName). - @param completion Callback that takes command result as parameter. + @param completion Callback that takes command result as parameter. + + Note: Use combination of `issuerRotateCredentialDefStartForId` and `issuerRotateCredentialDefApplyForId` functions + to generate new keys for an existing credential definition + Returns: credDefId: identifier of created credential definition. credDefJson: public part of created credential definition @@ -94,6 +98,37 @@ And is documented in this HIPE: walletHandle:(IndyHandle)walletHandle completion:(void (^)(NSError *error, NSString *credDefId, NSString *credDefJSON))completion; +/** + Generate temporary credential definitional keys for an existing one (owned by the caller of the library). + + Use `issuerRotateCredentialDefApplyForId` function to set temporary keys as the main. + + @param credDefId an identifier of created credential definition stored in the wallet + @param configJSON: type-specific configuration of credential definition as json: + - 'CL': + - revocationSupport: whether to request non-revocation credential (optional, default false) + @param walletHandle Wallet handler (created by IndyWallet::openWalletWithName). + @param completion Callback that takes command result as parameter. + Returns: + credDefJson: public part of temporary created credential definition +*/ ++ (void)issuerRotateCredentialDefStartForId:(NSString *)credDefId + configJSON:(NSString *)configJSON + walletHandle:(IndyHandle)walletHandle + completion:(void (^)(NSError *error, NSString *credDefJSON))completion; + +/** + Apply temporary keys as main for an existing Credential Definition (owned by the caller of the library). + + @param credDefId an identifier of created credential definition stored in the wallet + @param walletHandle Wallet handler (created by IndyWallet::openWalletWithName). + @param completion Callback that takes command result as parameter. + Returns: void +*/ ++ (void)issuerRotateCredentialDefApplyForId:(NSString *)credDefId + walletHandle:(IndyHandle)walletHandle + completion:(void (^)(NSError *error))completion; + /** Create a new revocation registry for the given credential definition as tuple of entities: - Revocation registry definition that encapsulates credentials definition reference, revocation type specific configuration and diff --git a/wrappers/ios/libindy-pod/Indy/Wrapper/IndyAnoncreds.mm b/wrappers/ios/libindy-pod/Indy/Wrapper/IndyAnoncreds.mm index 7a02584804..e3501a990b 100644 --- a/wrappers/ios/libindy-pod/Indy/Wrapper/IndyAnoncreds.mm +++ b/wrappers/ios/libindy-pod/Indy/Wrapper/IndyAnoncreds.mm @@ -63,6 +63,50 @@ + (void)issuerCreateAndStoreCredentialDefForSchema:(NSString *)schemaJSON } } ++ (void)issuerRotateCredentialDefStartForId:(NSString *)credDefId + configJSON:(NSString *)configJSON + walletHandle:(IndyHandle)walletHandle + completion:(void (^)(NSError *error, NSString *credDefJSON))completion; { + indy_error_t ret; + + indy_handle_t handle = [[IndyCallbacks sharedInstance] createCommandHandleFor:completion]; + + ret = indy_issuer_rotate_credential_def_start(handle, + walletHandle, + [credDefId UTF8String], + [configJSON UTF8String], + IndyWrapperCommonStringCallback); + if (ret != Success) { + [[IndyCallbacks sharedInstance] deleteCommandHandleFor:handle]; + + dispatch_async(dispatch_get_main_queue(), ^{ + completion([NSError errorFromIndyError:ret], nil); + }); + } +} + ++ (void)issuerRotateCredentialDefApplyForId:(NSString *)credDefId + walletHandle:(IndyHandle)walletHandle + completion:(void (^)(NSError *error))completion; { + indy_error_t ret; + + indy_handle_t handle = [[IndyCallbacks sharedInstance] createCommandHandleFor:completion]; + + ret = indy_issuer_rotate_credential_def_apply(handle, + walletHandle, + [credDefId UTF8String], + IndyWrapperCommonCallback + ); + + if (ret != Success) { + [[IndyCallbacks sharedInstance] deleteCommandHandleFor:handle]; + + dispatch_async(dispatch_get_main_queue(), ^{ + completion([NSError errorFromIndyError:ret]); + }); + } +} + + (void)issuerCreateAndStoreRevocRegForCredentialDefId:(NSString *)credDefId issuerDID:(NSString *)issuerDID type:(NSString *)type From 56ebd1a3868a4cfe0c2a78f6f53ba058cfbd7d6e Mon Sep 17 00:00:00 2001 From: "artem.ivanov" Date: Mon, 5 Aug 2019 10:24:56 +0300 Subject: [PATCH 075/320] IS-1248: Allow user to modify claim_def Signed-off-by: artem.ivanov --- libindy/include/indy_anoncreds.h | 18 ++ libindy/src/api/anoncreds.rs | 113 +++++++++ libindy/src/commands/anoncreds/issuer.rs | 234 +++++++++++++++--- .../domain/anoncreds/credential_definition.rs | 11 +- libindy/src/domain/anoncreds/schema.rs | 3 +- libindy/tests/anoncreds.rs | 56 ++++- libindy/tests/anoncreds_demos.rs | 115 +++++++++ libindy/tests/utils/anoncreds.rs | 8 + wrappers/rust/indy-sys/src/anoncreds.rs | 13 + wrappers/rust/src/anoncreds.rs | 71 ++++++ 10 files changed, 595 insertions(+), 47 deletions(-) diff --git a/libindy/include/indy_anoncreds.h b/libindy/include/indy_anoncreds.h index d62c764522..222c247e1a 100644 --- a/libindy/include/indy_anoncreds.h +++ b/libindy/include/indy_anoncreds.h @@ -30,6 +30,24 @@ extern "C" { const char* cred_def_id, const char* cred_def_json) ); + + extern indy_error_t indy_issuer_rotate_credential_def_start(indy_handle_t command_handle, + indy_handle_t wallet_handle, + const char * cred_def_id, + const char * config_json, + + void (*cb)(indy_handle_t command_handle_, + indy_error_t err, + const char* cred_def_json) + ); + + extern indy_error_t indy_issuer_rotate_credential_def_apply(indy_handle_t command_handle, + indy_handle_t wallet_handle, + const char * cred_def_id, + + void (*cb)(indy_handle_t command_handle_, + indy_error_t err) + ); extern indy_error_t indy_issuer_create_and_store_revoc_reg(indy_handle_t command_handle, indy_handle_t wallet_handle, diff --git a/libindy/src/api/anoncreds.rs b/libindy/src/api/anoncreds.rs index c970eba9ca..75ee2c08fe 100644 --- a/libindy/src/api/anoncreds.rs +++ b/libindy/src/api/anoncreds.rs @@ -113,6 +113,9 @@ pub extern fn indy_issuer_create_schema(command_handle: CommandHandle, /// /// It is IMPORTANT for current version GET Schema from Ledger with correct seq_no to save compatibility with Ledger. /// +/// Note: Use combination of `indy_issuer_rotate_credential_def_start` and `indy_issuer_rotate_credential_def_apply` functions +/// to generate new keys for an existing credential definition. +/// /// #Params /// wallet_handle: wallet handle (created by open_wallet). /// command_handle: command handle to map callback to user context. @@ -202,6 +205,116 @@ pub extern fn indy_issuer_create_and_store_credential_def(command_handle: Comman res } +/// Generate temporary credential definitional keys for an existing one (owned by the caller of the library). +/// +/// Use `indy_issuer_rotate_credential_def_apply` function to set generated temporary keys as the main. +/// +/// #Params +/// command_handle: command handle to map callback to user context. +/// wallet_handle: wallet handle (created by open_wallet). +/// cred_def_id: an identifier of created credential definition stored in the wallet +/// config_json: (optional) type-specific configuration of credential definition as json: +/// - 'CL': +/// - support_revocation: whether to request non-revocation credential (optional, default false) +/// cb: Callback that takes command result as parameter. +/// +/// #Returns +/// cred_def_json: public part of temporary created credential definition +/// +/// Note: `primary` and `revocation` fields of credential definition are complex opaque types that contain data structures internal to Ursa. +/// They should not be parsed and are likely to change in future versions. +/// +/// #Errors +/// Common* +/// Wallet* +/// Anoncreds* +#[no_mangle] +pub extern fn indy_issuer_rotate_credential_def_start(command_handle: CommandHandle, + wallet_handle: WalletHandle, + cred_def_id: *const c_char, + config_json: *const c_char, + cb: Option) -> ErrorCode { + trace!("indy_issuer_rotate_credential_def_start: >>> wallet_handle: {:?}, cred_def_id: {:?}, config_json: {:?}", + wallet_handle, cred_def_id, config_json); + + check_useful_c_str!(cred_def_id, ErrorCode::CommonInvalidParam3); + check_useful_opt_json!(config_json, ErrorCode::CommonInvalidParam4, CredentialDefinitionConfig); + check_useful_c_callback!(cb, ErrorCode::CommonInvalidParam5); + + trace!("indy_issuer_rotate_credential_def_start: entities >>> wallet_handle: {:?}, cred_def_id: {:?}, config_json: {:?}", + wallet_handle, cred_def_id, config_json); + + let result = CommandExecutor::instance() + .send(Command::Anoncreds( + AnoncredsCommand::Issuer( + IssuerCommand::RotateCredentialDefinitionStart( + wallet_handle, + cred_def_id, + config_json, + Box::new(move |result| { + let (err, cred_def_json) = prepare_result_1!(result, String::new()); + trace!("indy_issuer_rotate_credential_def_start:cred_def_json: {:?}", cred_def_json); + let cred_def_json = ctypes::string_to_cstring(cred_def_json); + cb(command_handle, err, cred_def_json.as_ptr()) + }) + )))); + + let res = prepare_result!(result); + + trace!("indy_issuer_rotate_credential_def_start: <<< res: {:?}", res); + + res +} + +/// Apply temporary keys as main for an existing Credential Definition (owned by the caller of the library). +/// +/// #Params +/// wallet_handle: wallet handle (created by open_wallet). +/// command_handle: command handle to map callback to user context. +/// cred_def_id: an identifier of created credential definition stored in the wallet +/// cb: Callback that takes command result as parameter. +/// +/// #Returns +/// +/// #Errors +/// Common* +/// Wallet* +/// Anoncreds* +#[no_mangle] +pub extern fn indy_issuer_rotate_credential_def_apply(command_handle: CommandHandle, + wallet_handle: WalletHandle, + cred_def_id: *const c_char, + cb: Option) -> ErrorCode { + trace!("indy_issuer_rotate_credential_def_apply: >>> wallet_handle: {:?}, cred_def_id: {:?}", + wallet_handle, cred_def_id); + + check_useful_c_str!(cred_def_id, ErrorCode::CommonInvalidParam3); + check_useful_c_callback!(cb, ErrorCode::CommonInvalidParam4); + + trace!("indy_issuer_rotate_credential_def_apply: entities >>> wallet_handle: {:?}, cred_def_id: {:?}", + wallet_handle, cred_def_id); + + let result = CommandExecutor::instance() + .send(Command::Anoncreds( + AnoncredsCommand::Issuer( + IssuerCommand::RotateCredentialDefinitionApply( + wallet_handle, + cred_def_id, + Box::new(move |result| { + let err = prepare_result!(result); + trace!("indy_issuer_rotate_credential_def_apply:"); + cb(command_handle, err) + }) + )))); + + let res = prepare_result!(result); + + trace!("indy_issuer_rotate_credential_def_apply: <<< res: {:?}", res); + + res +} + /// Create a new revocation registry for the given credential definition as tuple of entities /// - Revocation registry definition that encapsulates credentials definition reference, revocation type specific configuration and /// secrets used for credentials revocation diff --git a/libindy/src/commands/anoncreds/issuer.rs b/libindy/src/commands/anoncreds/issuer.rs index 8b1dd06a7f..187962f5d9 100644 --- a/libindy/src/commands/anoncreds/issuer.rs +++ b/libindy/src/commands/anoncreds/issuer.rs @@ -20,6 +20,7 @@ use domain::anoncreds::credential_definition::{ CredentialDefinitionPrivateKey, CredentialDefinitionV1, SignatureType, + TemporaryCredentialDefinition, }; use domain::anoncreds::credential_offer::CredentialOffer; use domain::anoncreds::credential_request::CredentialRequest; @@ -69,11 +70,6 @@ pub enum IssuerCommand { Option, // type Option, // config Box) + Send>), - CreateCredentialDefinition(AttributeNames, - bool, - Box) + Send>), CreateAndStoreCredentialDefinitionContinue( WalletHandle, SchemaV1, // credentials @@ -85,6 +81,25 @@ pub enum IssuerCommand { CredentialPrivateKey, CredentialKeyCorrectnessProof)>, i32), + RotateCredentialDefinitionStart( + WalletHandle, + String, // cred def id + Option, // config + Box) + Send>), + RotateCredentialDefinitionStartComplete( + WalletHandle, + String, + String, + String, + SignatureType, + IndyResult<(CredentialDefinitionData, + CredentialPrivateKey, + CredentialKeyCorrectnessProof)>, + i32), + RotateCredentialDefinitionApply( + WalletHandle, + String, // cred def did + Box) + Send>), CreateAndStoreRevocationRegistry( WalletHandle, String, // issuer did @@ -130,7 +145,8 @@ pub struct IssuerCommandExecutor { pub pool_service: Rc, pub wallet_service: Rc, pub crypto_service: Rc, - pending_callbacks: RefCell) + Send>>>, + pending_str_str_callbacks: RefCell) + Send>>>, + pending_str_callbacks: RefCell) + Send>>>, } impl IssuerCommandExecutor { @@ -145,7 +161,8 @@ impl IssuerCommandExecutor { blob_storage_service, wallet_service, crypto_service, - pending_callbacks: RefCell::new(HashMap::new()), + pending_str_str_callbacks: RefCell::new(HashMap::new()), + pending_str_callbacks: RefCell::new(HashMap::new()), } } @@ -160,13 +177,22 @@ impl IssuerCommandExecutor { self.create_and_store_credential_definition(wallet_handle, &issuer_did, &SchemaV1::from(schema), &tag, type_.as_ref().map(String::as_str), config.as_ref(), cb); } - IssuerCommand::CreateCredentialDefinition(attr_names, support_revocation, cb) => { - self._create_credential_definition(&attr_names, support_revocation, cb) - } IssuerCommand::CreateAndStoreCredentialDefinitionContinue(wallet_handle, schema, schema_id, cred_def_id, tag, signature_type, result, cb_id) => { debug!(target: "wallet_command_executor", "CreateAndStoreCredentialDefinitionContinue command received"); self._create_and_store_credential_definition_continue(cb_id, wallet_handle, &schema, &schema_id, &cred_def_id, &tag, &signature_type, result) } + IssuerCommand::RotateCredentialDefinitionStart(wallet_handle, cred_def_id, cred_def_config, cb) => { + debug!(target: "wallet_command_executor", "RotateCredentialDefinitionStart command received"); + self.rotate_credential_definition_start(wallet_handle, &cred_def_id, cred_def_config.as_ref(), cb); + } + IssuerCommand::RotateCredentialDefinitionStartComplete(wallet_handle, schema_id, cred_def_id, tag, signature_type, result, cb_id) => { + debug!(target: "wallet_command_executor", "RotateCredentialDefinitionStartContinue command received"); + self.rotate_credential_definition_start_complete(cb_id, wallet_handle, &schema_id, &cred_def_id, &tag, &signature_type, result) + } + IssuerCommand::RotateCredentialDefinitionApply(wallet_handle, cred_def_id, cb) => { + debug!(target: "wallet_command_executor", "RotateCredentialDefinitionApply command received"); + cb(self.rotate_credential_definition_apply(wallet_handle, &cred_def_id)); + } IssuerCommand::CreateAndStoreRevocationRegistry(wallet_handle, issuer_did, type_, tag, cred_def_id, config, tails_writer_handle, cb) => { info!(target: "issuer_command_executor", "CreateAndStoreRevocationRegistryRegistry command received"); @@ -249,34 +275,28 @@ impl IssuerCommandExecutor { try_cb!(self._prepare_create_and_store_credential_definition(wallet_handle, issuer_did, schema, tag, type_, config), cb); let cb_id = ::utils::sequence::get_next_id(); - self.pending_callbacks.borrow_mut().insert(cb_id, cb); + self.pending_str_str_callbacks.borrow_mut().insert(cb_id, cb); let tag = tag.to_string(); + let attr_names = schema.attr_names.clone(); let schema = schema.clone(); - CommandExecutor::instance().send(Command::Anoncreds( - AnoncredsCommand::Issuer( - IssuerCommand::CreateCredentialDefinition( - schema.attr_names.clone(), - cred_def_config.support_revocation, - Box::new(move |res| { - CommandExecutor::instance().send( - Command::Anoncreds( - AnoncredsCommand::Issuer( - IssuerCommand::CreateAndStoreCredentialDefinitionContinue( - wallet_handle, - schema.clone(), - schema_id.clone(), - cred_def_id.clone(), - tag.clone(), - signature_type.clone(), - res, - cb_id, - )) - )).unwrap(); - }), - )) - )).unwrap(); + self._create_credential_definition(&attr_names, cred_def_config.support_revocation, Box::new(move |res| { + CommandExecutor::instance().send( + Command::Anoncreds( + AnoncredsCommand::Issuer( + IssuerCommand::CreateAndStoreCredentialDefinitionContinue( + wallet_handle, + schema.clone(), + schema_id.clone(), + cred_def_id.clone(), + tag.clone(), + signature_type.clone(), + res, + cb_id, + )) + )).unwrap(); + })); } fn _create_credential_definition(&self, @@ -300,7 +320,7 @@ impl IssuerCommandExecutor { result: IndyResult<(CredentialDefinitionData, CredentialPrivateKey, CredentialKeyCorrectnessProof)>) { - let cb = self.pending_callbacks.borrow_mut().remove(&cb_id).expect("FIXME INVALID STATE"); + let cb = self.pending_str_str_callbacks.borrow_mut().remove(&cb_id).expect("FIXME INVALID STATE"); cb(result .and_then(|result| { self._complete_create_and_store_credential_definition(wallet_handle, schema, schema_id, cred_def_id, tag, signature_type.clone(), result) @@ -331,7 +351,8 @@ impl IssuerCommandExecutor { let cred_def_id = CredentialDefinition::cred_def_id(issuer_did, &schema_id, &signature_type.to_str(), tag); if self.wallet_service.record_exists::(wallet_handle, &cred_def_id)? { - return Err(err_msg(IndyErrorKind::CredDefAlreadyExists, format!("CredentialDefinition for cred_def_id: {:?} already exists", cred_def_id))); + return Err(err_msg(IndyErrorKind::CredDefAlreadyExists, format!("CredentialDefinition for cred_def_id: {:?} already exists, \ + Use combination of `indy_issuer_rotate_credential_def_start` and `indy_issuer_rotate_credential_def_apply` functions to generate new CredDef keys.", cred_def_id))); }; Ok((cred_def_config.clone(), schema_id, cred_def_id, signature_type)) @@ -367,16 +388,153 @@ impl IssuerCommandExecutor { value: cred_key_correctness_proof }; + let schema_ = Schema::SchemaV1(schema.clone()); + let cred_def_json = self.wallet_service.add_indy_object(wallet_handle, &cred_def_id, &cred_def, &HashMap::new())?; self.wallet_service.add_indy_object(wallet_handle, &cred_def_id, &cred_def_priv_key, &HashMap::new())?; self.wallet_service.add_indy_object(wallet_handle, &cred_def_id, &cred_def_correctness_proof, &HashMap::new())?; + let _ = self.wallet_service.add_indy_object(wallet_handle, &schema_id, &schema_, &HashMap::new()).ok(); - self._wallet_set_schema_id(wallet_handle, &cred_def_id, &schema.id)?; // TODO: FIXME delete temporary storing of schema id + let schema_id = schema.id.clone(); + + self._wallet_set_schema_id(wallet_handle, &cred_def_id, &schema_id)?; // TODO: FIXME delete temporary storing of schema id debug!("create_and_store_credential_definition <<< cred_def_id: {:?}, cred_def_json: {:?}", cred_def_id, cred_def_json); Ok((cred_def_id.to_string(), cred_def_json)) } + fn rotate_credential_definition_start(&self, + wallet_handle: WalletHandle, + cred_def_id: &str, + cred_def_config: Option<&CredentialDefinitionConfig>, + cb: Box) + Send>) { + debug!("rotate_credential_definition_start >>> wallet_handle: {:?}, cred_def_id: {:?}, cred_def_config: {:?}", + wallet_handle, cred_def_id, cred_def_config); + + let cred_def: CredentialDefinitionV1 = match self.wallet_service.get_indy_object::(wallet_handle, &cred_def_id, &RecordOptions::id_value()) { + Ok(cred_def) => CredentialDefinitionV1::from(cred_def), + Err(err) => return cb(Err(err)) + }; + + if let Ok(temp_cred_def) = self.wallet_service.get_indy_object::(wallet_handle, &cred_def_id, &RecordOptions::id_value()) { + debug!("Temporary Credential Definition already exists. Return it: {:?}", temp_cred_def.cred_def); + + let cred_def_json = try_cb!(::serde_json::to_string(&temp_cred_def.cred_def) + .map_err(|err| IndyError::from_msg(IndyErrorKind::InvalidState, format!("Cannot serialize CredentialDefinition: {}", err))), cb); + + return cb(Ok(cred_def_json)); + } + + let schema: SchemaV1 = match self.wallet_service.get_indy_object::(wallet_handle, &cred_def.schema_id, &RecordOptions::id_value()) { + Ok(schema) => SchemaV1::from(schema), + Err(err) => return cb(Err(err)) + }; + + let cb_id = ::utils::sequence::get_next_id(); + self.pending_str_callbacks.borrow_mut().insert(cb_id, cb); + + let support_revocation = cred_def_config.map(|config| config.support_revocation).unwrap_or_default(); + + self._create_credential_definition(&schema.attr_names, support_revocation, Box::new(move |res| { + CommandExecutor::instance().send( + Command::Anoncreds( + AnoncredsCommand::Issuer( + IssuerCommand::RotateCredentialDefinitionStartComplete( + wallet_handle, + cred_def.schema_id.clone(), + cred_def.id.clone(), + cred_def.tag.clone(), + cred_def.signature_type.clone(), + res, + cb_id, + )) + )).unwrap(); + })); + } + + fn rotate_credential_definition_start_complete(&self, + cb_id: CallbackHandle, + wallet_handle: WalletHandle, + schema_id: &str, + cred_def_id: &str, + tag: &str, + signature_type: &SignatureType, + result: IndyResult<(CredentialDefinitionData, + CredentialPrivateKey, + CredentialKeyCorrectnessProof)>) { + let cb = self.pending_str_callbacks.borrow_mut().remove(&cb_id).expect("FIXME INVALID STATE"); + cb(result + .and_then(|result| { + self._rotate_credential_definition_start_complete(wallet_handle, schema_id, cred_def_id, tag, signature_type.clone(), result) + })) + } + + fn _rotate_credential_definition_start_complete(&self, + wallet_handle: WalletHandle, + schema_id: &str, + cred_def_id: &str, + tag: &str, + signature_type: SignatureType, + res: (CredentialDefinitionData, + CredentialPrivateKey, + CredentialKeyCorrectnessProof)) -> IndyResult { + debug!("_rotate_credential_definition_start_complete >>> wallet_handle: {:?}, schema_id: {:?}, cred_def_id: {:?}, tag: {:?}, signature_type: {:?}", + wallet_handle, schema_id, cred_def_id, tag, signature_type); + + let (credential_definition_value, cred_priv_key, cred_key_correctness_proof) = res; + + let cred_def = + CredentialDefinition::CredentialDefinitionV1( + CredentialDefinitionV1 { + id: cred_def_id.to_string(), + schema_id: schema_id.to_string(), + signature_type, + tag: tag.to_string(), + value: credential_definition_value, + }); + + let cred_def_priv_key = CredentialDefinitionPrivateKey { + value: cred_priv_key + }; + + let cred_def_correctness_proof = CredentialDefinitionCorrectnessProof { + value: cred_key_correctness_proof + }; + + let cred_def_json = ::serde_json::to_string(&cred_def) + .map_err(|err| IndyError::from_msg(IndyErrorKind::InvalidState, format!("Cannot serialize CredentialDefinition: {}", err)))?; + + let temp_cred_def = TemporaryCredentialDefinition { + cred_def, + cred_def_priv_key, + cred_def_correctness_proof, + }; + + self.wallet_service.add_indy_object(wallet_handle, &cred_def_id, &temp_cred_def, &HashMap::new())?; + + debug!("_rotate_credential_definition_start_complete <<< cred_def_id: {:?}, cred_def_json: {:?}", cred_def_id, cred_def_json); + Ok(cred_def_json) + } + + fn rotate_credential_definition_apply(&self, + wallet_handle: WalletHandle, + cred_def_id: &str) -> IndyResult<()> { + debug!("rotate_credential_definition_apply >>> wallet_handle: {:?}, cred_def_id: {:?}", wallet_handle, cred_def_id); + + let _cred_def: CredentialDefinition = self.wallet_service.get_indy_object(wallet_handle, &cred_def_id, &RecordOptions::id_value())?; + let temp_cred_def: TemporaryCredentialDefinition = self.wallet_service.get_indy_object(wallet_handle, &cred_def_id, &RecordOptions::id_value())?; + + self.wallet_service.update_indy_object(wallet_handle, &cred_def_id, &temp_cred_def.cred_def)?; + self.wallet_service.update_indy_object(wallet_handle, &cred_def_id, &temp_cred_def.cred_def_priv_key)?; + self.wallet_service.update_indy_object(wallet_handle, &cred_def_id, &temp_cred_def.cred_def_correctness_proof)?; + + self.wallet_service.delete_indy_record::(wallet_handle, &cred_def_id)?; + + debug!("rotate_credential_definition_apply <<<"); + + Ok(()) + } + fn create_and_store_revocation_registry(&self, wallet_handle: WalletHandle, issuer_did: &str, @@ -574,7 +732,7 @@ impl IssuerCommandExecutor { let rev_reg_delta = CryptoRevocationRegistryDelta::from_parts(None, &r_reg.value, &issued, &revoked); Some(Witness::new(rev_reg_info.curr_id, r_reg_def.value.max_cred_num, - r_reg_def.value.issuance_type.to_bool(), &rev_reg_delta, rev_tails_accessor)?) + r_reg_def.value.issuance_type.to_bool(), &rev_reg_delta, rev_tails_accessor)?) } else { None }; diff --git a/libindy/src/domain/anoncreds/credential_definition.rs b/libindy/src/domain/anoncreds/credential_definition.rs index e594043264..b15cf0b6f6 100644 --- a/libindy/src/domain/anoncreds/credential_definition.rs +++ b/libindy/src/domain/anoncreds/credential_definition.rs @@ -27,11 +27,9 @@ impl SignatureType { } } -fn default_false() -> bool { false } - #[derive(Debug, Serialize, Deserialize, Clone)] pub struct CredentialDefinitionConfig { - #[serde(default = "default_false")] + #[serde(default)] pub support_revocation: bool } @@ -68,6 +66,13 @@ pub enum CredentialDefinition { CredentialDefinitionV1(CredentialDefinitionV1) } +#[derive(Debug, Serialize, Deserialize, NamedType)] +pub struct TemporaryCredentialDefinition { + pub cred_def: CredentialDefinition, + pub cred_def_priv_key: CredentialDefinitionPrivateKey, + pub cred_def_correctness_proof: CredentialDefinitionCorrectnessProof +} + impl CredentialDefinition { pub fn cred_def_id(did: &str, schema_id: &str, signature_type: &str, tag: &str) -> String { if ProtocolVersion::is_node_1_3(){ diff --git a/libindy/src/domain/anoncreds/schema.rs b/libindy/src/domain/anoncreds/schema.rs index d194ad3d52..860bbad071 100644 --- a/libindy/src/domain/anoncreds/schema.rs +++ b/libindy/src/domain/anoncreds/schema.rs @@ -1,6 +1,7 @@ use super::DELIMITER; use std::collections::{HashMap, HashSet}; +use named_type::NamedType; pub const SCHEMA_MARKER: &str = "2"; pub const MAX_ATTRIBUTES_COUNT: usize = 125; @@ -16,7 +17,7 @@ pub struct SchemaV1 { pub seq_no: Option, } -#[derive(Debug, Serialize, Deserialize)] +#[derive(Debug, Serialize, Deserialize, NamedType)] #[serde(tag = "ver")] pub enum Schema { #[serde(rename = "1.0")] diff --git a/libindy/tests/anoncreds.rs b/libindy/tests/anoncreds.rs index 5f56ada40e..6ffb94b880 100644 --- a/libindy/tests/anoncreds.rs +++ b/libindy/tests/anoncreds.rs @@ -3489,6 +3489,52 @@ mod high_cases { assert_code!(ErrorCode::CommonInvalidStructure, res); } } + + mod issuer_rotate_credential_def { + use super::*; + + #[test] + fn issuer_rotate_credential_def_works() { + let (wallet_handle, config) = utils::setup_with_wallet("issuer_rotate_credential_def_works"); + + let (cred_def_id, cred_def_json) = anoncreds::issuer_create_credential_definition(wallet_handle, + ISSUER_DID, + &anoncreds::gvt_schema_json(), + TAG_1, + Some(SIGNATURE_TYPE), + Some(&anoncreds::default_cred_def_config())) + .unwrap(); + + let temp_cred_def_json = anoncreds::issuer_rotate_credential_def_start(wallet_handle, &cred_def_id, None).unwrap(); + + assert_ne!(serde_json::from_str::(&cred_def_json).unwrap(), + serde_json::from_str::(&temp_cred_def_json).unwrap()); + + anoncreds::issuer_rotate_credential_def_apply(wallet_handle, &cred_def_id).unwrap(); + + utils::tear_down_with_wallet(wallet_handle, "issuer_rotate_credential_def_works", &config); + } + + #[test] + fn issuer_rotate_credential_def_works_no_cred_def() { + let (wallet_handle, config) = utils::setup_with_wallet("issuer_rotate_credential_def_works_no_cred_def"); + + let res = anoncreds::issuer_rotate_credential_def_start(wallet_handle, &anoncreds::issuer_1_gvt_cred_def_id(), None); + assert_code!(ErrorCode::WalletItemNotFound, res); + + utils::tear_down_with_wallet(wallet_handle, "issuer_rotate_credential_def_works_no_cred_def", &config); + } + + #[test] + fn issuer_rotate_credential_def_apply_works_for_no_temporary_cred_def() { + let (wallet_handle, config) = utils::setup_with_wallet("issuer_rotate_credential_def_apply_works_for_no_temporary_cred_def"); + + let res = anoncreds::issuer_rotate_credential_def_apply(wallet_handle, &anoncreds::issuer_1_gvt_cred_def_id()); + assert_code!(ErrorCode::WalletItemNotFound, res); + + utils::tear_down_with_wallet(wallet_handle, "issuer_rotate_credential_def_apply_works_for_no_temporary_cred_def", &config); + } + } } mod medium_cases { @@ -4109,11 +4155,11 @@ mod medium_cases { } ); let res = anoncreds::verifier_verify_proof(&serde_json::to_string(&proof_req).unwrap(), - &anoncreds::proof_json_restrictions(), - &anoncreds::schemas_for_proof_restrictions(), - &anoncreds::cred_defs_for_proof_restrictions(), - "{}", - "{}"); + &anoncreds::proof_json_restrictions(), + &anoncreds::schemas_for_proof_restrictions(), + &anoncreds::cred_defs_for_proof_restrictions(), + "{}", + "{}"); assert!(res.is_ok()); } diff --git a/libindy/tests/anoncreds_demos.rs b/libindy/tests/anoncreds_demos.rs index 48da549e19..621c3794a1 100644 --- a/libindy/tests/anoncreds_demos.rs +++ b/libindy/tests/anoncreds_demos.rs @@ -2584,4 +2584,119 @@ mod demos { utils::tear_down("anoncreds_works_for_requested_proof_with_revocation_but_provided_primary_only"); } + + + #[test] + fn anoncreds_works_for_cred_def_rotation() { + utils::setup("anoncreds_works_for_cred_def_rotation"); + + //1. Create Issuer wallet, gets wallet handle + let (issuer_wallet_handle, issuer_wallet_config) = wallet::create_and_open_default_wallet("anoncreds_works_for_cred_def_rotation_issuer").unwrap(); + + //2. Create Prover wallet, gets wallet handle + let (prover_wallet_handle, prover_wallet_config) = wallet::create_and_open_default_wallet("anoncreds_works_for_cred_def_rotation_prover").unwrap(); + + //3. Issuer creates Schema and Credential Definition + let (schema_id, schema_json, cred_def_id, cred_def_json) = anoncreds::multi_steps_issuer_preparation(issuer_wallet_handle, + ISSUER_DID, + GVT_SCHEMA_NAME, + GVT_SCHEMA_ATTRIBUTES); + + //4. Prover creates Master Secret + anoncreds::prover_create_master_secret(prover_wallet_handle, COMMON_MASTER_SECRET).unwrap(); + + //5. Issuance credential for Prover + anoncreds::multi_steps_create_credential(COMMON_MASTER_SECRET, + prover_wallet_handle, + issuer_wallet_handle, + CREDENTIAL1_ID, + &anoncreds::gvt_credential_values_json(), + &cred_def_id, + &cred_def_json); + + //6. Proof request + let nonce = anoncreds::generate_nonce().unwrap(); + let proof_req_json = json!({ + "nonce": nonce, + "name":"proof_req_1", + "version":"0.1", + "requested_attributes":{ + "attr1_referent":{ + "name":"name" + } + }, + "requested_predicates":{ + "predicate1_referent":{"name":"age","p_type":">=","p_value":18} + } + }).to_string(); + + //7. Prover gets Credentials for Proof Request + let credentials_json = anoncreds::prover_get_credentials_for_proof_req(prover_wallet_handle, &proof_req_json).unwrap(); + let credential = anoncreds::get_credential_for_attr_referent(&credentials_json, "attr1_referent"); + + //8. Prover creates Proof + let requested_credentials_json = json!({ + "self_attested_attributes": {}, + "requested_attributes": { + "attr1_referent": { "cred_id": credential.referent, "revealed":true } + }, + "requested_predicates": { + "predicate1_referent": { "cred_id": credential.referent } + }, + }).to_string(); + + let schemas_json = json!({schema_id.as_str(): serde_json::from_str::(&schema_json).unwrap()}).to_string(); + let cred_defs_json = json!({cred_def_id.as_str(): serde_json::from_str::(&cred_def_json).unwrap()}).to_string(); + let rev_states_json = json!({}).to_string(); + + let proof_json = anoncreds::prover_create_proof(prover_wallet_handle, + &proof_req_json, + &requested_credentials_json, + COMMON_MASTER_SECRET, + &schemas_json, + &cred_defs_json, + &rev_states_json).unwrap(); + + //9. Verifier verifies proof + let rev_reg_defs_json = json!({}).to_string(); + let rev_regs_json = json!({}).to_string(); + + let valid = anoncreds::verifier_verify_proof(&proof_req_json, + &proof_json, + &schemas_json, + &cred_defs_json, + &rev_reg_defs_json, + &rev_regs_json).unwrap(); + assert!(valid); + + //10. Issuer rotate cred def + let new_cred_def_json = anoncreds::issuer_rotate_credential_def_start(issuer_wallet_handle, &cred_def_id, None).unwrap(); + anoncreds::issuer_rotate_credential_def_apply(issuer_wallet_handle, &cred_def_id).unwrap(); + + //11. Prover generate proof wit rotated cred def but old credential + let schemas_json = json!({schema_id.as_str(): serde_json::from_str::(&schema_json).unwrap()}).to_string(); + let cred_defs_json = json!({cred_def_id.as_str(): serde_json::from_str::(&new_cred_def_json).unwrap()}).to_string(); + + let proof_json = anoncreds::prover_create_proof(prover_wallet_handle, + &proof_req_json, + &requested_credentials_json, + COMMON_MASTER_SECRET, + &schemas_json, + &cred_defs_json, + &rev_states_json).unwrap(); + + //12. Verifier verifies proof + let valid = anoncreds::verifier_verify_proof(&proof_req_json, + &proof_json, + &schemas_json, + &cred_defs_json, + &rev_reg_defs_json, + &rev_regs_json).unwrap(); + assert!(!valid); + + wallet::close_and_delete_wallet(issuer_wallet_handle, &issuer_wallet_config).unwrap(); + wallet::close_and_delete_wallet(prover_wallet_handle, &prover_wallet_config).unwrap(); + + utils::tear_down("anoncreds_works_for_cred_def_rotation"); + } } diff --git a/libindy/tests/utils/anoncreds.rs b/libindy/tests/utils/anoncreds.rs index 4bf3a7cb54..0f2a05700b 100644 --- a/libindy/tests/utils/anoncreds.rs +++ b/libindy/tests/utils/anoncreds.rs @@ -54,6 +54,14 @@ pub fn issuer_create_credential_definition(wallet_handle: i32, issuer_did: &str, anoncreds::issuer_create_and_store_credential_def(wallet_handle, issuer_did, schema, tag, signature_type, config.unwrap_or("{}")).wait() // TODO: FIXME OPTIONAL CONFIG } +pub fn issuer_rotate_credential_def_start(wallet_handle: i32, cred_def_id: &str, config_json: Option<&str>) -> Result { + anoncreds::issuer_rotate_credential_def_start(wallet_handle, cred_def_id, config_json).wait() +} + +pub fn issuer_rotate_credential_def_apply(wallet_handle: i32, cred_def_id: &str) -> Result<(), IndyError> { + anoncreds::issuer_rotate_credential_def_apply(wallet_handle, cred_def_id).wait() +} + pub fn issuer_create_and_store_revoc_reg(wallet_handle: i32, issuer_did: &str, type_: Option<&str>, tag: &str, cred_def_id: &str, config_json: &str, tails_writer_handle: i32) -> Result<(String, String, String), IndyError> { diff --git a/wrappers/rust/indy-sys/src/anoncreds.rs b/wrappers/rust/indy-sys/src/anoncreds.rs index a6dcac1054..5f320cafad 100644 --- a/wrappers/rust/indy-sys/src/anoncreds.rs +++ b/wrappers/rust/indy-sys/src/anoncreds.rs @@ -22,6 +22,19 @@ extern { config_json: CString, cb: Option) -> Error; + #[no_mangle] + pub fn indy_issuer_rotate_credential_def_start(command_handle: CommandHandle, + wallet_handle: WalletHandle, + cred_def_id: CString, + config_json: CString, + cb: Option) -> Error; + + #[no_mangle] + pub fn indy_issuer_rotate_credential_def_apply(command_handle: CommandHandle, + wallet_handle: WalletHandle, + cred_def_id: CString, + cb: Option) -> Error; + #[no_mangle] pub fn indy_issuer_create_and_store_revoc_reg(command_handle: CommandHandle, wallet_handle: WalletHandle, diff --git a/wrappers/rust/src/anoncreds.rs b/wrappers/rust/src/anoncreds.rs index 07cdb1abad..98b4cbea67 100644 --- a/wrappers/rust/src/anoncreds.rs +++ b/wrappers/rust/src/anoncreds.rs @@ -75,6 +75,9 @@ fn _issuer_create_schema(command_handle: CommandHandle, issuer_did: &str, name: /// /// It is IMPORTANT for current version GET Schema from Ledger with correct seq_no to save compatibility with Ledger. /// +/// Note: Use combination of `issuer_rotate_credential_def_start` and `issuer_rotate_credential_def_apply` functions +/// to generate new keys for an existing credential definition. +/// /// # Arguments /// * `wallet_handle`: wallet handle (created by Wallet::open_wallet). /// * `issuer_did`: a DID of the issuer signing cred_def transaction to the Ledger @@ -103,6 +106,10 @@ fn _issuer_create_schema(command_handle: CommandHandle, issuer_did: &str, name: /// }, /// ver: Version of the CredDef json /// } +/// +/// Note: `primary` and `revocation` fields of credential definition are complex opaque types that contain data structures internal to Ursa. +/// They should not be parsed and are likely to change in future versions. +/// pub fn issuer_create_and_store_credential_def(wallet_handle: WalletHandle, issuer_did: &str, schema_json: &str, tag: &str, signature_type: Option<&str>, config_json: &str) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec_string_string(); @@ -132,6 +139,70 @@ fn _issuer_create_and_store_credential_def(command_handle: CommandHandle, wallet }) } +/// Generate temporary credential definitional keys for an existing one (owned by the caller of the library). +/// +/// Use `issuer_rotate_credential_def_apply` function to set generated temporary keys as the main. +/// +/// # Arguments +/// * `wallet_handle`: wallet handle (created by Wallet::open_wallet). +/// * `cred_def_id`: an identifier of created credential definition stored in the wallet +/// * `config_json`: (optional) type-specific configuration of credential definition as json: +/// - 'CL': +/// - support_revocation: whether to request non-revocation credential (optional, default false) +/// +/// # Returns +/// * `cred_def_json`: public part of temporary created credential definition +pub fn issuer_rotate_credential_def_start(wallet_handle: WalletHandle, cred_def_id: &str, config_json: Option<&str>) -> Box> { + let (receiver, command_handle, cb) = ClosureHandler::cb_ec_string(); + + let err = _issuer_rotate_credential_def_start(command_handle, wallet_handle, cred_def_id, config_json, cb); + + ResultHandler::str(command_handle, err, receiver) +} + +fn _issuer_rotate_credential_def_start(command_handle: CommandHandle, wallet_handle: WalletHandle, cred_def_id: &str, config: Option<&str>, cb: Option) -> ErrorCode { + let cred_def_id = c_str!(cred_def_id); + let config_str = opt_c_str!(config); + + ErrorCode::from(unsafe { + anoncreds::indy_issuer_rotate_credential_def_start( + command_handle, + wallet_handle, + cred_def_id.as_ptr(), + opt_c_ptr!(config, config_str), + cb + ) + }) +} + +/// Apply temporary keys as main for an existing Credential Definition (owned by the caller of the library). +/// +/// # Arguments +/// * `wallet_handle`: wallet handle (created by Wallet::open_wallet). +/// * `cred_def_id`: an identifier of created credential definition stored in the wallet +/// +/// # Returns +pub fn issuer_rotate_credential_def_apply(wallet_handle: WalletHandle, cred_def_id: &str) -> Box> { + let (receiver, command_handle, cb) = ClosureHandler::cb_ec(); + + let err = _issuer_rotate_credential_def_apply(command_handle, wallet_handle, cred_def_id, cb); + + ResultHandler::empty(command_handle, err, receiver) +} + +fn _issuer_rotate_credential_def_apply(command_handle: CommandHandle, wallet_handle: WalletHandle, cred_def_id: &str, cb: Option) -> ErrorCode { + let cred_def_id = c_str!(cred_def_id); + + ErrorCode::from(unsafe { + anoncreds::indy_issuer_rotate_credential_def_apply( + command_handle, + wallet_handle, + cred_def_id.as_ptr(), + cb + ) + }) +} + /// Create a new revocation registry for the given credential definition as tuple of entities /// - Revocation registry definition that encapsulates credentials definition reference, revocation type specific configuration and /// secrets used for credentials revocation From ff9721445df84a05f8e53b187d1113dca16f5b99 Mon Sep 17 00:00:00 2001 From: Axel Nennker Date: Mon, 5 Aug 2019 12:12:42 +0200 Subject: [PATCH 076/320] create empty tree without unwrap and without actionally hashing the empty array Signed-off-by: Axel Nennker --- .../services/ledger/merkletree/merkletree.rs | 18 ++++++++++++++++-- libindy/src/services/pool/events.rs | 11 +++++++++-- libindy/src/utils/crypto/hash/openssl.rs | 9 +++++++++ 3 files changed, 34 insertions(+), 4 deletions(-) diff --git a/libindy/src/services/ledger/merkletree/merkletree.rs b/libindy/src/services/ledger/merkletree/merkletree.rs index a46c8ad368..465c7a9ab7 100644 --- a/libindy/src/services/ledger/merkletree/merkletree.rs +++ b/libindy/src/services/ledger/merkletree/merkletree.rs @@ -1,7 +1,7 @@ use errors::prelude::*; use services::ledger::merkletree::proof::{Lemma, Proof}; use services::ledger::merkletree::tree::{LeavesIntoIterator, LeavesIterator, Tree, TreeLeafData}; -use utils::crypto::hash::{Hash, HASHBYTES}; +use utils::crypto::hash::{Hash, HASHBYTES, EMPTY_HASH_BYTES}; /// A Merkle tree is a binary tree, with values of type `T` at the leafs, /// and where every internal node holds the hash of the concatenation of the hashes of its children nodes. @@ -29,7 +29,7 @@ impl MerkleTree { if values.is_empty() { return Ok(MerkleTree { - root: Tree::empty(Hash::hash_empty()?), + root: Tree::empty(EMPTY_HASH_BYTES.to_vec()), height: 0, count: 0, nodes_count: 0 @@ -162,3 +162,17 @@ impl <'a> IntoIterator for &'a MerkleTree { } } + +#[test] +fn test_empty_tree() { + let empty_tree = MerkleTree { + root: Tree::empty(Hash::hash_empty().unwrap()), + height: 0, + count: 0, + nodes_count: 0 + }; + let empty_hash = empty_tree.root.hash(); + // if this fails then probably the hash function changed + assert_eq!(EMPTY_HASH_BYTES.to_vec(), *empty_hash); +} + diff --git a/libindy/src/services/pool/events.rs b/libindy/src/services/pool/events.rs index ee53d94075..4eefc9d5ac 100644 --- a/libindy/src/services/pool/events.rs +++ b/libindy/src/services/pool/events.rs @@ -5,6 +5,8 @@ use domain::ledger::constants; use errors::prelude::*; use services::ledger::merkletree::merkletree::MerkleTree; use services::pool::{PoolService, types:: *}; +use services::ledger::merkletree::tree::Tree; +use utils::crypto::hash::EMPTY_HASH_BYTES; pub const REQUESTS_FOR_STATE_PROOFS: [&str; 10] = [ constants::GET_NYM, @@ -199,8 +201,13 @@ impl Into> for PoolEvent { _parse_msg(&msg).map(|parsed| match parsed { //TODO change mapping for CatchupReq. May be return None - //TODO: REMOVE UNWRAP!!!!! - Message::CatchupReq(_) => RequestEvent::CatchupReq(MerkleTree::from_vec(Vec::new()).unwrap(), 0, vec![]), + Message::CatchupReq(_) => RequestEvent::CatchupReq( + MerkleTree { + root: Tree::empty(EMPTY_HASH_BYTES.to_vec()), + height: 0, + count: 0, + nodes_count: 0 + }, 0, vec![]), Message::CatchupRep(rep) => RequestEvent::CatchupRep(rep, node_alias), Message::LedgerStatus(ls) => RequestEvent::LedgerStatus(ls, Some(node_alias), None), Message::ConsistencyProof(cp) => RequestEvent::ConsistencyProof(cp, node_alias), diff --git a/libindy/src/utils/crypto/hash/openssl.rs b/libindy/src/utils/crypto/hash/openssl.rs index 587786986e..582f220227 100644 --- a/libindy/src/utils/crypto/hash/openssl.rs +++ b/libindy/src/utils/crypto/hash/openssl.rs @@ -6,6 +6,8 @@ use self::openssl::hash::{Hasher, MessageDigest}; pub const HASHBYTES: usize = 32; +pub const EMPTY_HASH_BYTES : [u8; 32] = [227, 176, 196, 66, 152, 252, 28, 20, 154, 251, 244, 200, 153, 111, 185, 36, 39, 174, 65, 228, 100, 155, 147, 76, 164, 149, 153, 27, 120, 82, 184, 85]; + pub fn hash(input: &[u8]) -> Result, IndyError> { let mut hasher = Hash::new_context()?; hasher.update(input)?; @@ -80,3 +82,10 @@ impl From for IndyError { err.to_indy(IndyErrorKind::InvalidState, "Internal OpenSSL error") } } + +#[test] +fn test_hash_empty() { + let empty_hash = Hash::hash_empty().unwrap(); + // if this fails then probably the hash function changed + assert_eq!(EMPTY_HASH_BYTES.to_vec(), empty_hash); +} From 579b763a85e1361877a9dad646156c3faa4e9883 Mon Sep 17 00:00:00 2001 From: "artem.ivanov" Date: Mon, 5 Aug 2019 12:27:22 +0300 Subject: [PATCH 077/320] IS-1248: Allow user to modify claim_def - onjective-C wrapper Signed-off-by: artem.ivanov --- .../Case Tests/Anoncreds/AnoncredsHighCases.m | 24 ++++++++++ .../Test Utils/AnoncredsUtils.h | 8 ++++ .../Test Utils/AnoncredsUtils.m | 41 +++++++++++++++++ .../libindy-pod/Indy/Wrapper/IndyAnoncreds.h | 37 +++++++++++++++- .../libindy-pod/Indy/Wrapper/IndyAnoncreds.mm | 44 +++++++++++++++++++ 5 files changed, 153 insertions(+), 1 deletion(-) diff --git a/wrappers/ios/libindy-pod/Indy-demoTests/Case Tests/Anoncreds/AnoncredsHighCases.m b/wrappers/ios/libindy-pod/Indy-demoTests/Case Tests/Anoncreds/AnoncredsHighCases.m index a9c66eb48a..48a0b95ddc 100644 --- a/wrappers/ios/libindy-pod/Indy-demoTests/Case Tests/Anoncreds/AnoncredsHighCases.m +++ b/wrappers/ios/libindy-pod/Indy-demoTests/Case Tests/Anoncreds/AnoncredsHighCases.m @@ -927,4 +927,28 @@ - (void)testVerifierVerifyProofWorksForProofDoesNotCorrespondToRequest { XCTAssertEqual(ret.code, AnoncredsProofRejected, @"AnoncredsUtils::verifierVerifyProof returned wrong error"); } +// MARK: - Issuer rotate credential def + +- (void)testIssuerRotateCredentialDef { + + IndyHandle localWalletHandle = 0; + + ret = [[WalletUtils sharedInstance] createAndOpenWalletWithHandle:&localWalletHandle]; + XCTAssertEqual(ret.code, Success, @"WalletUtils::createAndOpenWallet() failed"); + + NSString * credDefId = [[AnoncredsUtils sharedInstance] getIssuer1GvtCredDefId]; + + ret = [[AnoncredsUtils sharedInstance] issuerRotateCredentialDefStartForId:credDefId + configJSON:nil + walletHandle:localWalletHandle + credDefJson:nil]; + XCTAssertEqual(ret.code, WalletItemNotFound, @"AnoncredsUtils::issuerRotateCredentialDefStartForId() returned wrong code!"); + + ret = [[AnoncredsUtils sharedInstance] issuerRotateCredentialDefApplyForId:credDefId + walletHandle:localWalletHandle]; + XCTAssertEqual(ret.code, WalletItemNotFound, @"AnoncredsUtils::issuerRotateCredentialDefApplyForId() returned wrong code!"); + + [[WalletUtils sharedInstance] closeWalletWithHandle:localWalletHandle]; +} + @end diff --git a/wrappers/ios/libindy-pod/Indy-demoTests/Test Utils/AnoncredsUtils.h b/wrappers/ios/libindy-pod/Indy-demoTests/Test Utils/AnoncredsUtils.h index f6f4bb97cc..12dbb01f52 100644 --- a/wrappers/ios/libindy-pod/Indy-demoTests/Test Utils/AnoncredsUtils.h +++ b/wrappers/ios/libindy-pod/Indy-demoTests/Test Utils/AnoncredsUtils.h @@ -49,6 +49,14 @@ credDefId:(NSString **)credentialDefId credDefJson:(NSString **)credentialDefJson; +- (NSError *)issuerRotateCredentialDefStartForId:(NSString *)credDefId + configJSON:(NSString *)configJSON + walletHandle:(IndyHandle)walletHandle + credDefJson:(NSString **)credentialDefJson; + +- (NSError *)issuerRotateCredentialDefApplyForId:(NSString *)credDefId + walletHandle:(IndyHandle)walletHandle; + - (NSError *)issuerCreateAndStoreRevocRegForCredentialDefId:(NSString *)credDefID issuerDID:(NSString *)issuerDID type:(NSString *)type diff --git a/wrappers/ios/libindy-pod/Indy-demoTests/Test Utils/AnoncredsUtils.m b/wrappers/ios/libindy-pod/Indy-demoTests/Test Utils/AnoncredsUtils.m index 15a23a3c3b..c9129bbd01 100644 --- a/wrappers/ios/libindy-pod/Indy-demoTests/Test Utils/AnoncredsUtils.m +++ b/wrappers/ios/libindy-pod/Indy-demoTests/Test Utils/AnoncredsUtils.m @@ -241,6 +241,47 @@ - (NSError *)issuerCreateAndStoreCredentialDefForSchema:(NSString *)schemaJSON return err; } +- (NSError *)issuerRotateCredentialDefStartForId:(NSString *)credDefId + configJSON:(NSString *)configJSON + walletHandle:(IndyHandle)walletHandle + credDefJson:(NSString **)credentialDefJson { + __block NSError *err = nil; + __block NSString *outCredentialDefJson = nil; + XCTestExpectation *completionExpectation = [[XCTestExpectation alloc] initWithDescription:@"completion finished"]; + + [IndyAnoncreds issuerRotateCredentialDefStartForId:credDefId + configJSON:configJSON + walletHandle:walletHandle + completion:^(NSError *error, NSString *credDefJSON) { + err = error; + outCredentialDefJson = credDefJSON; + [completionExpectation fulfill]; + }]; + + [self waitForExpectations:@[completionExpectation] timeout:[TestUtils longTimeout]]; + + if (credentialDefJson) {*credentialDefJson = outCredentialDefJson;} + + return err; +} + +- (NSError *)issuerRotateCredentialDefApplyForId:(NSString *)credDefId + walletHandle:(IndyHandle)walletHandle { + __block NSError *err = nil; + XCTestExpectation *completionExpectation = [[XCTestExpectation alloc] initWithDescription:@"completion finished"]; + + [IndyAnoncreds issuerRotateCredentialDefApplyForId:credDefId + walletHandle:walletHandle + completion:^(NSError *error) { + err = error; + [completionExpectation fulfill]; + }]; + + [self waitForExpectations:@[completionExpectation] timeout:[TestUtils longTimeout]]; + + return err; +} + - (NSError *)issuerCreateAndStoreRevocRegForCredentialDefId:(NSString *)credDefID issuerDID:(NSString *)issuerDID type:(NSString *)type diff --git a/wrappers/ios/libindy-pod/Indy/Wrapper/IndyAnoncreds.h b/wrappers/ios/libindy-pod/Indy/Wrapper/IndyAnoncreds.h index ba9e9e9255..f77d1f5c87 100644 --- a/wrappers/ios/libindy-pod/Indy/Wrapper/IndyAnoncreds.h +++ b/wrappers/ios/libindy-pod/Indy/Wrapper/IndyAnoncreds.h @@ -67,7 +67,11 @@ And is documented in this HIPE: - 'CL': - revocationSupport: whether to request non-revocation credential (optional, default false) @param walletHandle Wallet handler (created by IndyWallet::openWalletWithName). - @param completion Callback that takes command result as parameter. + @param completion Callback that takes command result as parameter. + + Note: Use combination of `issuerRotateCredentialDefStartForId` and `issuerRotateCredentialDefApplyForId` functions + to generate new keys for an existing credential definition + Returns: credDefId: identifier of created credential definition. credDefJson: public part of created credential definition @@ -94,6 +98,37 @@ And is documented in this HIPE: walletHandle:(IndyHandle)walletHandle completion:(void (^)(NSError *error, NSString *credDefId, NSString *credDefJSON))completion; +/** + Generate temporary credential definitional keys for an existing one (owned by the caller of the library). + + Use `issuerRotateCredentialDefApplyForId` function to set temporary keys as the main. + + @param credDefId an identifier of created credential definition stored in the wallet + @param configJSON: type-specific configuration of credential definition as json: + - 'CL': + - revocationSupport: whether to request non-revocation credential (optional, default false) + @param walletHandle Wallet handler (created by IndyWallet::openWalletWithName). + @param completion Callback that takes command result as parameter. + Returns: + credDefJson: public part of temporary created credential definition +*/ ++ (void)issuerRotateCredentialDefStartForId:(NSString *)credDefId + configJSON:(NSString *)configJSON + walletHandle:(IndyHandle)walletHandle + completion:(void (^)(NSError *error, NSString *credDefJSON))completion; + +/** + Apply temporary keys as main for an existing Credential Definition (owned by the caller of the library). + + @param credDefId an identifier of created credential definition stored in the wallet + @param walletHandle Wallet handler (created by IndyWallet::openWalletWithName). + @param completion Callback that takes command result as parameter. + Returns: void +*/ ++ (void)issuerRotateCredentialDefApplyForId:(NSString *)credDefId + walletHandle:(IndyHandle)walletHandle + completion:(void (^)(NSError *error))completion; + /** Create a new revocation registry for the given credential definition as tuple of entities: - Revocation registry definition that encapsulates credentials definition reference, revocation type specific configuration and diff --git a/wrappers/ios/libindy-pod/Indy/Wrapper/IndyAnoncreds.mm b/wrappers/ios/libindy-pod/Indy/Wrapper/IndyAnoncreds.mm index 7a02584804..e3501a990b 100644 --- a/wrappers/ios/libindy-pod/Indy/Wrapper/IndyAnoncreds.mm +++ b/wrappers/ios/libindy-pod/Indy/Wrapper/IndyAnoncreds.mm @@ -63,6 +63,50 @@ + (void)issuerCreateAndStoreCredentialDefForSchema:(NSString *)schemaJSON } } ++ (void)issuerRotateCredentialDefStartForId:(NSString *)credDefId + configJSON:(NSString *)configJSON + walletHandle:(IndyHandle)walletHandle + completion:(void (^)(NSError *error, NSString *credDefJSON))completion; { + indy_error_t ret; + + indy_handle_t handle = [[IndyCallbacks sharedInstance] createCommandHandleFor:completion]; + + ret = indy_issuer_rotate_credential_def_start(handle, + walletHandle, + [credDefId UTF8String], + [configJSON UTF8String], + IndyWrapperCommonStringCallback); + if (ret != Success) { + [[IndyCallbacks sharedInstance] deleteCommandHandleFor:handle]; + + dispatch_async(dispatch_get_main_queue(), ^{ + completion([NSError errorFromIndyError:ret], nil); + }); + } +} + ++ (void)issuerRotateCredentialDefApplyForId:(NSString *)credDefId + walletHandle:(IndyHandle)walletHandle + completion:(void (^)(NSError *error))completion; { + indy_error_t ret; + + indy_handle_t handle = [[IndyCallbacks sharedInstance] createCommandHandleFor:completion]; + + ret = indy_issuer_rotate_credential_def_apply(handle, + walletHandle, + [credDefId UTF8String], + IndyWrapperCommonCallback + ); + + if (ret != Success) { + [[IndyCallbacks sharedInstance] deleteCommandHandleFor:handle]; + + dispatch_async(dispatch_get_main_queue(), ^{ + completion([NSError errorFromIndyError:ret]); + }); + } +} + + (void)issuerCreateAndStoreRevocRegForCredentialDefId:(NSString *)credDefId issuerDID:(NSString *)issuerDID type:(NSString *)type From 7a3857e5925bbdb9d1b45d4cf821bfe42e5af4a3 Mon Sep 17 00:00:00 2001 From: "artem.ivanov" Date: Thu, 1 Aug 2019 13:26:50 +0300 Subject: [PATCH 078/320] IS-1243 - Updated configuration document to reflect pool refreshing and CLI TAA Signed-off-by: artem.ivanov --- docs/configuration.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/docs/configuration.md b/docs/configuration.md index 9375dd3a5c..425e980cbd 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -52,6 +52,11 @@ This function accepts a config that defines the behavior of the client-side conn 2 - for Indy Node 1.4 and greater ``` +* Refresh +`indy_refresh_pool_ledger` function updates a list of active nodes in the pool. +This function can be useful for applications working with an Indy network that is run continuously for a long time. +Note that active requests will be dropped. + * State Proof There are some types of requests to Nodes in the Pool which support State Proof optimization in Client-Node communication. Instead of sending requests to all nodes in the Pool, a client can send a request @@ -202,3 +207,20 @@ An example of a batch script: wallet close exit ``` + +#### Transaction Author Agreement +CLI uses session-based approach to work with Transaction Author Agreement. + +#### Workflow +1. On CLI start: Pass a config JSON file containing a label of mechanism how a user is going to accept a transaction author agreement. +`indy-cli --config ` where config looks like: +``` +{ + "taaAcceptanceMechanism": "Click Agreement", + ..... +} +``` +The list of available acceptance mechanisms can be received by sending `get_acceptance_mechanisms` request to ledger. +1. On `pool connect` command execution: User will be asked if he would like to accept TAA. +User either can accept it or skip and accept it later by `pool show-taa` command. +1. On write request sending to Ledger: TAA will be appended to requests. \ No newline at end of file From 050f11903198018ac42595814cad1648dc97d213 Mon Sep 17 00:00:00 2001 From: "artem.ivanov" Date: Mon, 5 Aug 2019 15:57:01 +0300 Subject: [PATCH 079/320] Execute CI/CD cargo test with 1 parallel job Signed-off-by: artem.ivanov --- Jenkinsfile.cd | 8 ++++---- Jenkinsfile.ci | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Jenkinsfile.cd b/Jenkinsfile.cd index 4ba615ae1f..3c8d38d41e 100644 --- a/Jenkinsfile.cd +++ b/Jenkinsfile.cd @@ -346,8 +346,8 @@ def linuxLibindyBuild(file, env_name, network_name, stashBuildResults) { testEnv.inside("--network=${network_name}") { sh ''' cd libindy - RUST_BACKTRACE=1 cargo test --release --no-run --features sodium_static - RUST_BACKTRACE=1 RUST_LOG=indy::=debug,zmq=trace RUST_TEST_THREADS=1 TEST_POOL_IP=10.0.0.2 cargo test --release --features sodium_static + RUST_BACKTRACE=1 cargo test --release -j 1 --no-run --features sodium_static + RUST_BACKTRACE=1 RUST_LOG=indy::=debug,zmq=trace RUST_TEST_THREADS=1 TEST_POOL_IP=10.0.0.2 cargo test --release -j 1 --features sodium_static ''' } @@ -410,7 +410,7 @@ def linuxVcxBuild(file, env_name, network_name, stashBuildResults) { echo "${env_name} Libvcx Test: Run tests" sh ''' cd vcx/libvcx - LIBRARY_PATH=./ LD_LIBRARY_PATH=./:${LD_LIBRARY_PATH} RUST_BACKTRACE=1 RUST_LOG=vcx=debug,indy=debug RUST_TEST_THREADS=1 TEST_POOL_IP=10.0.0.2 cargo test --release --features "pool_tests agency" + LIBRARY_PATH=./ LD_LIBRARY_PATH=./:${LD_LIBRARY_PATH} RUST_BACKTRACE=1 RUST_LOG=vcx=debug,indy=debug RUST_TEST_THREADS=1 TEST_POOL_IP=10.0.0.2 cargo test --release -j 1 --features "pool_tests agency" ''' } @@ -424,7 +424,7 @@ def linuxVcxBuild(file, env_name, network_name, stashBuildResults) { echo "${env_name} Libvcx Test: Run vcx demo test for protocol version 2.0" sh ''' cd vcx/libvcx - LIBRARY_PATH=./ LD_LIBRARY_PATH=./:${LD_LIBRARY_PATH} RUST_BACKTRACE=1 RUST_LOG=vcx=debug,indy=debug RUST_TEST_THREADS=1 TEST_POOL_IP=10.0.0.2 cargo test --release --features "pool_tests agency_v2" tests::test_real_proof_for_protocol_type_v2 -- --exact + LIBRARY_PATH=./ LD_LIBRARY_PATH=./:${LD_LIBRARY_PATH} RUST_BACKTRACE=1 RUST_LOG=vcx=debug,indy=debug RUST_TEST_THREADS=1 TEST_POOL_IP=10.0.0.2 cargo test --release -j 1 --features "pool_tests agency_v2" tests::test_real_proof_for_protocol_type_v2 -- --exact ''' } } diff --git a/Jenkinsfile.ci b/Jenkinsfile.ci index e8e4a9fe2e..79aee7e141 100644 --- a/Jenkinsfile.ci +++ b/Jenkinsfile.ci @@ -484,7 +484,7 @@ def linuxLibindyBuild(file, env_name, network_name) { sh ''' cd libindy RUST_BACKTRACE=1 cargo test -j 1 --no-run --features sodium_static - RUST_BACKTRACE=1 RUST_LOG=indy::=debug,zmq=trace RUST_TEST_THREADS=1 TEST_POOL_IP=10.0.0.2 cargo test --features sodium_static + RUST_BACKTRACE=1 RUST_LOG=indy::=debug,zmq=trace RUST_TEST_THREADS=1 TEST_POOL_IP=10.0.0.2 cargo test -j 1 --features sodium_static ''' } @@ -544,7 +544,7 @@ def linuxVcxBuild(file, env_name, network_name) { echo "${env_name} Libvcx Test: Run tests" sh ''' cd vcx/libvcx - LIBRARY_PATH=./ LD_LIBRARY_PATH=./:${LD_LIBRARY_PATH} RUST_BACKTRACE=1 RUST_LOG=vcx=debug,indy=debug RUST_TEST_THREADS=1 TEST_POOL_IP=10.0.0.2 cargo test --features "pool_tests agency" + LIBRARY_PATH=./ LD_LIBRARY_PATH=./:${LD_LIBRARY_PATH} RUST_BACKTRACE=1 RUST_LOG=vcx=debug,indy=debug RUST_TEST_THREADS=1 TEST_POOL_IP=10.0.0.2 cargo test -j 1 --features "pool_tests agency" ''' } @@ -558,7 +558,7 @@ def linuxVcxBuild(file, env_name, network_name) { echo "${env_name} Libvcx Test: Run tests" sh ''' cd vcx/libvcx - LIBRARY_PATH=./ LD_LIBRARY_PATH=./:${LD_LIBRARY_PATH} RUST_BACKTRACE=1 RUST_LOG=vcx=debug,indy=debug RUST_TEST_THREADS=1 TEST_POOL_IP=10.0.0.2 cargo test --features "pool_tests agency_v2" tests::test_real_proof_for_protocol_type_v2 -- --exact + LIBRARY_PATH=./ LD_LIBRARY_PATH=./:${LD_LIBRARY_PATH} RUST_BACKTRACE=1 RUST_LOG=vcx=debug,indy=debug RUST_TEST_THREADS=1 TEST_POOL_IP=10.0.0.2 cargo test -j 1 --features "pool_tests agency_v2" tests::test_real_proof_for_protocol_type_v2 -- --exact ''' } } From 26dee39e192088a17beced53a7e6ac951135a241 Mon Sep 17 00:00:00 2001 From: Axel Nennker Date: Mon, 5 Aug 2019 15:00:24 +0200 Subject: [PATCH 080/320] add comment explaining EMPTY_HASH_BYTES Signed-off-by: Axel Nennker --- libindy/src/utils/crypto/hash/openssl.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libindy/src/utils/crypto/hash/openssl.rs b/libindy/src/utils/crypto/hash/openssl.rs index 582f220227..fda63828b3 100644 --- a/libindy/src/utils/crypto/hash/openssl.rs +++ b/libindy/src/utils/crypto/hash/openssl.rs @@ -6,7 +6,8 @@ use self::openssl::hash::{Hasher, MessageDigest}; pub const HASHBYTES: usize = 32; -pub const EMPTY_HASH_BYTES : [u8; 32] = [227, 176, 196, 66, 152, 252, 28, 20, 154, 251, 244, 200, 153, 111, 185, 36, 39, 174, 65, 228, 100, 155, 147, 76, 164, 149, 153, 27, 120, 82, 184, 85]; +// these bytes are the same as openssl_hash(MessageDigest::sha256(), &[]) so we do not have to actually call the hash function +pub const EMPTY_HASH_BYTES : [u8; HASHBYTES] = [227, 176, 196, 66, 152, 252, 28, 20, 154, 251, 244, 200, 153, 111, 185, 36, 39, 174, 65, 228, 100, 155, 147, 76, 164, 149, 153, 27, 120, 82, 184, 85]; pub fn hash(input: &[u8]) -> Result, IndyError> { let mut hasher = Hash::new_context()?; From 9a8bc76b2c827f86b6bc206d6d3e1ff9d627483b Mon Sep 17 00:00:00 2001 From: "artem.ivanov" Date: Mon, 5 Aug 2019 17:40:04 +0300 Subject: [PATCH 081/320] Removed redundant spaces Signed-off-by: artem.ivanov --- cli/src/commands/payment_address.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cli/src/commands/payment_address.rs b/cli/src/commands/payment_address.rs index ef739cb17a..c690eea8bc 100644 --- a/cli/src/commands/payment_address.rs +++ b/cli/src/commands/payment_address.rs @@ -108,7 +108,7 @@ pub mod sign_command { use super::*; command!(CommandMetadata::build("sign", "Create a proof of payment address control by signing an input and producing a signature.") - .add_required_param_with_dynamic_completion("address","Payment address to use", DynamicCompletionType::PaymentAddress) + .add_required_param_with_dynamic_completion("address","Payment address to use", DynamicCompletionType::PaymentAddress) .add_required_param("input", "The input data to be signed") .add_example("payment-address sign address=pay:null:lUdSMj9AmoUbmRQ input=123456789") .finalize()); @@ -142,7 +142,7 @@ pub mod verify_command { use super::*; command!(CommandMetadata::build("verify", "Verify a proof of payment address control by verifying a signature.") - .add_required_param_with_dynamic_completion("address","Payment address to use", DynamicCompletionType::PaymentAddress) + .add_required_param_with_dynamic_completion("address","Payment address to use", DynamicCompletionType::PaymentAddress) .add_required_param("input", "The input data that was signed") .add_required_param("signature", "The signature generated from sign-with-address") .add_example("payment-address verify address=pay:null:lUdSMj9AmoUbmRQ input=123456789 signature=0x0006e83221cdaf70b3c01a613675274dd2064ea376bf35656cff8436e62cdf89") From 7de3f2175dbe76ebe116f1543aeddeae142d7849 Mon Sep 17 00:00:00 2001 From: "artem.ivanov" Date: Mon, 5 Aug 2019 15:57:01 +0300 Subject: [PATCH 082/320] Execute CI/CD cargo test with 1 parallel job Signed-off-by: artem.ivanov --- Jenkinsfile.cd | 8 ++++---- Jenkinsfile.ci | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Jenkinsfile.cd b/Jenkinsfile.cd index 4ba615ae1f..3c8d38d41e 100644 --- a/Jenkinsfile.cd +++ b/Jenkinsfile.cd @@ -346,8 +346,8 @@ def linuxLibindyBuild(file, env_name, network_name, stashBuildResults) { testEnv.inside("--network=${network_name}") { sh ''' cd libindy - RUST_BACKTRACE=1 cargo test --release --no-run --features sodium_static - RUST_BACKTRACE=1 RUST_LOG=indy::=debug,zmq=trace RUST_TEST_THREADS=1 TEST_POOL_IP=10.0.0.2 cargo test --release --features sodium_static + RUST_BACKTRACE=1 cargo test --release -j 1 --no-run --features sodium_static + RUST_BACKTRACE=1 RUST_LOG=indy::=debug,zmq=trace RUST_TEST_THREADS=1 TEST_POOL_IP=10.0.0.2 cargo test --release -j 1 --features sodium_static ''' } @@ -410,7 +410,7 @@ def linuxVcxBuild(file, env_name, network_name, stashBuildResults) { echo "${env_name} Libvcx Test: Run tests" sh ''' cd vcx/libvcx - LIBRARY_PATH=./ LD_LIBRARY_PATH=./:${LD_LIBRARY_PATH} RUST_BACKTRACE=1 RUST_LOG=vcx=debug,indy=debug RUST_TEST_THREADS=1 TEST_POOL_IP=10.0.0.2 cargo test --release --features "pool_tests agency" + LIBRARY_PATH=./ LD_LIBRARY_PATH=./:${LD_LIBRARY_PATH} RUST_BACKTRACE=1 RUST_LOG=vcx=debug,indy=debug RUST_TEST_THREADS=1 TEST_POOL_IP=10.0.0.2 cargo test --release -j 1 --features "pool_tests agency" ''' } @@ -424,7 +424,7 @@ def linuxVcxBuild(file, env_name, network_name, stashBuildResults) { echo "${env_name} Libvcx Test: Run vcx demo test for protocol version 2.0" sh ''' cd vcx/libvcx - LIBRARY_PATH=./ LD_LIBRARY_PATH=./:${LD_LIBRARY_PATH} RUST_BACKTRACE=1 RUST_LOG=vcx=debug,indy=debug RUST_TEST_THREADS=1 TEST_POOL_IP=10.0.0.2 cargo test --release --features "pool_tests agency_v2" tests::test_real_proof_for_protocol_type_v2 -- --exact + LIBRARY_PATH=./ LD_LIBRARY_PATH=./:${LD_LIBRARY_PATH} RUST_BACKTRACE=1 RUST_LOG=vcx=debug,indy=debug RUST_TEST_THREADS=1 TEST_POOL_IP=10.0.0.2 cargo test --release -j 1 --features "pool_tests agency_v2" tests::test_real_proof_for_protocol_type_v2 -- --exact ''' } } diff --git a/Jenkinsfile.ci b/Jenkinsfile.ci index e8e4a9fe2e..79aee7e141 100644 --- a/Jenkinsfile.ci +++ b/Jenkinsfile.ci @@ -484,7 +484,7 @@ def linuxLibindyBuild(file, env_name, network_name) { sh ''' cd libindy RUST_BACKTRACE=1 cargo test -j 1 --no-run --features sodium_static - RUST_BACKTRACE=1 RUST_LOG=indy::=debug,zmq=trace RUST_TEST_THREADS=1 TEST_POOL_IP=10.0.0.2 cargo test --features sodium_static + RUST_BACKTRACE=1 RUST_LOG=indy::=debug,zmq=trace RUST_TEST_THREADS=1 TEST_POOL_IP=10.0.0.2 cargo test -j 1 --features sodium_static ''' } @@ -544,7 +544,7 @@ def linuxVcxBuild(file, env_name, network_name) { echo "${env_name} Libvcx Test: Run tests" sh ''' cd vcx/libvcx - LIBRARY_PATH=./ LD_LIBRARY_PATH=./:${LD_LIBRARY_PATH} RUST_BACKTRACE=1 RUST_LOG=vcx=debug,indy=debug RUST_TEST_THREADS=1 TEST_POOL_IP=10.0.0.2 cargo test --features "pool_tests agency" + LIBRARY_PATH=./ LD_LIBRARY_PATH=./:${LD_LIBRARY_PATH} RUST_BACKTRACE=1 RUST_LOG=vcx=debug,indy=debug RUST_TEST_THREADS=1 TEST_POOL_IP=10.0.0.2 cargo test -j 1 --features "pool_tests agency" ''' } @@ -558,7 +558,7 @@ def linuxVcxBuild(file, env_name, network_name) { echo "${env_name} Libvcx Test: Run tests" sh ''' cd vcx/libvcx - LIBRARY_PATH=./ LD_LIBRARY_PATH=./:${LD_LIBRARY_PATH} RUST_BACKTRACE=1 RUST_LOG=vcx=debug,indy=debug RUST_TEST_THREADS=1 TEST_POOL_IP=10.0.0.2 cargo test --features "pool_tests agency_v2" tests::test_real_proof_for_protocol_type_v2 -- --exact + LIBRARY_PATH=./ LD_LIBRARY_PATH=./:${LD_LIBRARY_PATH} RUST_BACKTRACE=1 RUST_LOG=vcx=debug,indy=debug RUST_TEST_THREADS=1 TEST_POOL_IP=10.0.0.2 cargo test -j 1 --features "pool_tests agency_v2" tests::test_real_proof_for_protocol_type_v2 -- --exact ''' } } From c371caf21c8ec67dc28159358e03acc6c4294856 Mon Sep 17 00:00:00 2001 From: Axel Nennker Date: Tue, 6 Aug 2019 08:16:55 +0200 Subject: [PATCH 083/320] MerkleTree::default Signed-off-by: Axel Nennker --- .../services/ledger/merkletree/merkletree.rs | 32 +++++++------------ libindy/src/services/pool/request_handler.rs | 11 ------- libindy/src/utils/crypto/hash/openssl.rs | 11 ------- 3 files changed, 12 insertions(+), 42 deletions(-) diff --git a/libindy/src/services/ledger/merkletree/merkletree.rs b/libindy/src/services/ledger/merkletree/merkletree.rs index 465c7a9ab7..f5aedb9c66 100644 --- a/libindy/src/services/ledger/merkletree/merkletree.rs +++ b/libindy/src/services/ledger/merkletree/merkletree.rs @@ -21,6 +21,17 @@ pub struct MerkleTree { pub nodes_count: usize } +impl Default for MerkleTree { + fn default() -> Self { + MerkleTree { + root: Tree::Empty { hash: EMPTY_HASH_BYTES.to_vec() }, + height: 0, + count: 0, + nodes_count: 0, + } + } +} + impl MerkleTree { /// Constructs a Merkle Tree from a vector of data blocks. @@ -28,12 +39,7 @@ impl MerkleTree { pub fn from_vec(values: Vec) -> IndyResult { if values.is_empty() { - return Ok(MerkleTree { - root: Tree::empty(EMPTY_HASH_BYTES.to_vec()), - height: 0, - count: 0, - nodes_count: 0 - }); + return Ok(MerkleTree::default()); } let count = values.len(); @@ -162,17 +168,3 @@ impl <'a> IntoIterator for &'a MerkleTree { } } - -#[test] -fn test_empty_tree() { - let empty_tree = MerkleTree { - root: Tree::empty(Hash::hash_empty().unwrap()), - height: 0, - count: 0, - nodes_count: 0 - }; - let empty_hash = empty_tree.root.hash(); - // if this fails then probably the hash function changed - assert_eq!(EMPTY_HASH_BYTES.to_vec(), *empty_hash); -} - diff --git a/libindy/src/services/pool/request_handler.rs b/libindy/src/services/pool/request_handler.rs index de8eb9c83c..042fe11464 100644 --- a/libindy/src/services/pool/request_handler.rs +++ b/libindy/src/services/pool/request_handler.rs @@ -875,17 +875,6 @@ pub mod tests { } } - impl Default for MerkleTree { - fn default() -> Self { - MerkleTree { - root: Tree::Empty { hash: Vec::new() }, - height: 0, - count: 0, - nodes_count: 0, - } - } - } - impl Default for Reply { fn default() -> Self { Reply::ReplyV1(ReplyV1 { result: ReplyResultV1 { txn: ReplyTxnV1 { metadata: ResponseMetadata { req_id: 1 } } } }) diff --git a/libindy/src/utils/crypto/hash/openssl.rs b/libindy/src/utils/crypto/hash/openssl.rs index fda63828b3..048e887efc 100644 --- a/libindy/src/utils/crypto/hash/openssl.rs +++ b/libindy/src/utils/crypto/hash/openssl.rs @@ -22,10 +22,6 @@ impl Hash { Ok(Hasher::new(MessageDigest::sha256())?) } - pub fn hash_empty() -> Result, IndyError> { - Ok(hash( &[])?) - } - pub fn hash_leaf(leaf: &T) -> Result, IndyError> where T: Hashable { let mut ctx = Hash::new_context()?; ctx.update(&[0x00])?; @@ -83,10 +79,3 @@ impl From for IndyError { err.to_indy(IndyErrorKind::InvalidState, "Internal OpenSSL error") } } - -#[test] -fn test_hash_empty() { - let empty_hash = Hash::hash_empty().unwrap(); - // if this fails then probably the hash function changed - assert_eq!(EMPTY_HASH_BYTES.to_vec(), empty_hash); -} From 6165110553adbf6ca58dc62f6a7e6b2be1dd6af0 Mon Sep 17 00:00:00 2001 From: "artem.ivanov" Date: Tue, 6 Aug 2019 11:48:45 +0300 Subject: [PATCH 084/320] IS-1337 Make Indy-CLI support endorser Signed-off-by: artem.ivanov --- cli/src/commands/ledger.rs | 260 ++++++++++++++++++++++++++-------- cli/src/libindy/ledger.rs | 5 + cli/src/main.rs | 1 + docs/design/001-cli/README.md | 8 +- 4 files changed, 210 insertions(+), 64 deletions(-) diff --git a/cli/src/commands/ledger.rs b/cli/src/commands/ledger.rs index c946771199..6621c5757f 100644 --- a/cli/src/commands/ledger.rs +++ b/cli/src/commands/ledger.rs @@ -43,27 +43,37 @@ pub mod group { macro_rules! send_write_request { ($ctx:expr, $params:expr, $request:expr, $wallet_handle:expr, $wallet_name:expr, $submitter_did:expr) => ({ let sign = get_opt_bool_param("sign", $params).map_err(error_err!())?.unwrap_or(SIGN_REQUEST); + let endorser = get_opt_str_param("endorser", $params).map_err(error_err!())?; + let mut send = get_opt_bool_param("send", $params).map_err(error_err!())?.unwrap_or(SEND_REQUEST); + + let request = match endorser { + Some(endorser_did) => { + send = false; + Ledger::append_request_endorser($request, endorser_did) + .map_err(|err| handle_indy_error(err, Some($submitter_did), None, Some($wallet_name)))? + }, + None => $request.to_string() + }; let request = if sign { - Ledger::sign_request($wallet_handle, $submitter_did, $request) + Ledger::sign_request($wallet_handle, $submitter_did, &request) .map_err(|err| handle_indy_error(err, Some($submitter_did), None, Some($wallet_name)))? } else {$request.to_string()}; - send_request!($ctx, $params, &request, Some($wallet_name), Some($submitter_did)) + send_request!($ctx, $params, request.as_str(), Some($wallet_name), Some($submitter_did), send) }) } macro_rules! send_read_request { ($ctx:expr, $params:expr, $request:expr, $submitter_did:expr) => ({ - send_request!($ctx, $params, $request, None, $submitter_did) + let send = get_opt_bool_param("send", $params).map_err(error_err!())?.unwrap_or(SEND_REQUEST); + send_request!($ctx, $params, $request, None, $submitter_did, send) }) } macro_rules! send_request { - ($ctx:expr, $params:expr, $request:expr, $wallet_name:expr, $submitter_did:expr) => ({ - let send = get_opt_bool_param("send", $params).map_err(error_err!())?.unwrap_or(SEND_REQUEST); - - if send { + ($ctx:expr, $params:expr, $request:expr, $wallet_name:expr, $submitter_did:expr, $send:expr) => ({ + if $send { let (pool_handle, pool_name) = ensure_connected_pool($ctx)?; let response_json = Ledger::submit_request(pool_handle, $request) .map_err(|err| handle_indy_error(err, $submitter_did, Some(&pool_name), $wallet_name))?; @@ -81,6 +91,33 @@ macro_rules! send_request { }) } +macro_rules! get_transaction_to_use { + ($ctx:expr, $param_txn:expr) => ({ + let request = if let Some(txn_) = $param_txn { + txn_.to_string() + } else if let Some(txn_) = get_transaction($ctx) { + println!("Transaction stored into context: {:?}.", txn_); + println!("Would you like to use it? (y/n)"); + + let use_transaction = ::command_executor::wait_for_user_reply($ctx); + + if !use_transaction { + println!("No transaction has been used."); + return Ok(()); + } + + txn_.to_string() + } else { + println_err!("There is not a transaction to use."); + println!("You either need to explicitly pass transaction as a parameter, or \ + load transaction using `ledger load-transaction`, or \ + build a transaction (with passing either `send=false` or `endorser` parameter)."); + return Err(()); + }; + request + }) +} + pub mod nym_command { use super::*; @@ -98,6 +135,9 @@ pub mod nym_command { .add_optional_param("extra","Optional information for fees payment operation") .add_optional_param("sign","Sign the request (True by default)") .add_optional_param("send","Send the request to the Ledger (True by default). If false then created request will be printed and stored into CLI context.") + .add_optional_param("endorser","DID of the Endorser that will submit the transaction to the ledger. \ + Note that specifying of this parameter implies send=false so the transaction will be prepared to pass to the endorser instead of sending to the ledger.\ + The created request will be printed and stored into CLI context.") .add_example("ledger nym did=VsKV7grR1BUE29mG2Fm2kX") .add_example("ledger nym did=VsKV7grR1BUE29mG2Fm2kX verkey=GjZWsBLgZCR18aL468JAT7w9CZRiBnpxUPPgyQxh4voa") .add_example("ledger nym did=VsKV7grR1BUE29mG2Fm2kX role=TRUSTEE") @@ -155,8 +195,8 @@ pub mod nym_command { "Nym request has been sent to Ledger.", None, &[("dest", "Did"), - ("verkey", "Verkey"), - ("role", "Role")], + ("verkey", "Verkey"), + ("role", "Role")], true))?; let receipts = parse_response_with_fees(&response_json, payment_method)?; @@ -236,6 +276,9 @@ pub mod attrib_command { .add_optional_param("extra","Optional information for fees payment operation") .add_optional_param("sign","Sign the request (True by default)") .add_optional_param("send","Send the request to the Ledger (True by default). If false then created request will be printed and stored into CLI context.") + .add_optional_param("endorser","DID of the Endorser that will submit the transaction to the ledger later. \ + Note that specifying of this parameter implies send=false so the transaction will be prepared to pass to the endorser instead of sending to the ledger.\ + The created request will be printed and stored into CLI context.") .add_example(r#"ledger attrib did=VsKV7grR1BUE29mG2Fm2kX raw={"endpoint":{"ha":"127.0.0.1:5555"}}"#) .add_example(r#"ledger attrib did=VsKV7grR1BUE29mG2Fm2kX hash=83d907821df1c87db829e96569a11f6fc2e7880acba5e43d07ab786959e13bd3"#) .add_example(r#"ledger attrib did=VsKV7grR1BUE29mG2Fm2kX enc=aa3f41f619aa7e5e6b6d0d"#) @@ -357,6 +400,9 @@ pub mod schema_command { .add_optional_param("extra","Optional information for fees payment operation") .add_optional_param("sign","Sign the request (True by default)") .add_optional_param("send","Send the request to the Ledger (True by default). If false then created request will be printed and stored into CLI context.") + .add_optional_param("endorser","DID of the Endorser that will submit the transaction to the ledger later. \ + Note that specifying of this parameter implies send=false so the transaction will be prepared to pass to the endorser instead of sending to the ledger.\ + The created request will be printed and stored into CLI context.") .add_example("ledger schema name=gvt version=1.0 attr_names=name,age") .add_example("ledger schema name=gvt version=1.0 attr_names=name,age send=false") .add_example("ledger schema name=gvt version=1.0 attr_names=name,age fees_inputs=pay:null:111_rBuQo2A1sc9jrJg fees_outputs=(pay:null:FYmoFw55GeQH7SRFa37dkx1d2dZ3zUF8ckg7wmL7ofN4,100)") @@ -555,6 +601,9 @@ pub mod cred_def_command { .add_optional_param("extra","Optional information for fees payment operation") .add_optional_param("sign","Sign the request (True by default)") .add_optional_param("send","Send the request to the Ledger (True by default). If false then created request will be printed and stored into CLI context.") + .add_optional_param("endorser","DID of the Endorser that will submit the transaction to the ledger later. \ + Note that specifying of this parameter implies send=false so the transaction will be prepared to pass to the endorser instead of sending to the ledger.\ + The created request will be printed and stored into CLI context.") .add_example(r#"ledger cred-def schema_id=1 signature_type=CL tag=1 primary={"n":"1","s":"2","rms":"3","r":{"age":"4","name":"5"},"rctxt":"6","z":"7"}"#) .finalize() ); @@ -1074,9 +1123,9 @@ pub mod get_payment_sources_command { print_list_table(&sources, &[("source", "Source"), - ("paymentAddress", "Payment Address"), - ("amount", "Amount"), - ("extra", "Extra")], + ("paymentAddress", "Payment Address"), + ("amount", "Amount"), + ("extra", "Extra")], "There are no source's"); Ok(()) } @@ -1152,9 +1201,9 @@ pub mod payment_command { print_list_table(&receipts, &[("receipt", "Receipt"), - ("recipient", "Recipient Payment Address"), - ("amount", "Amount"), - ("extra", "Extra")], + ("recipient", "Recipient Payment Address"), + ("amount", "Amount"), + ("extra", "Extra")], "There are no receipts's"); Ok(()) } @@ -1209,7 +1258,7 @@ pub mod get_fees_command { print_list_table(&fees, &[("type", "Transaction"), - ("amount", "Amount")], + ("amount", "Amount")], "There are no fees"); Ok(()) @@ -1357,27 +1406,7 @@ pub mod sign_multi_command { let param_txn = get_opt_str_param("txn", params).map_err(error_err!())?; - let txn = if let Some(txn_) = param_txn { - txn_.to_string() - } else if let Some(txn_) = get_transaction(ctx) { - println!("Transaction stored into context: {:?}.", txn_); - println!("Would you like to use it? (y/n)"); - - let use_transaction = ::command_executor::wait_for_user_reply(ctx); - - if !use_transaction { - println!("No transaction has been signed."); - return Ok(()); - } - - txn_.to_string() - } else { - println_err!("There is not a transaction to sign."); - println!("You either need to explicitly pass transaction as a parameter, or \ - load transaction using `ledger load-transaction`, or \ - build a transaction (with passing a `send=false`)."); - return Err(()); - }; + let txn = get_transaction_to_use!(ctx, param_txn); let res = match Ledger::multi_sign_request(wallet_handle, &submitter_did, &txn) { Ok(request) => { @@ -1467,11 +1496,11 @@ pub mod auth_rule_command { "Auth Rule request has been sent to Ledger.", None, &[("auth_type", "Txn Type"), - ("auth_action", "Action"), - ("field", "Field"), - ("old_value", "Old Value"), - ("new_value", "New Value"), - ("constraint", "Constraint")], + ("auth_action", "Action"), + ("field", "Field"), + ("old_value", "Old Value"), + ("new_value", "New Value"), + ("constraint", "Constraint")], false))?; trace!("execute << "); @@ -1596,11 +1625,11 @@ fn print_auth_rules(rules: AuthRulesData) { print_list_table(&constraints, &[("auth_type", "Type"), - ("auth_action", "Action"), - ("field", "Field"), - ("old_value", "Old Value"), - ("new_value", "New Value"), - ("constraint", "Constraint")], + ("auth_action", "Action"), + ("field", "Field"), + ("old_value", "Old Value"), + ("new_value", "New Value"), + ("constraint", "Constraint")], "There are no rules set"); } @@ -1842,6 +1871,48 @@ pub mod aml_command { } } +pub mod endorse_transaction_command { + use super::*; + + command!(CommandMetadata::build("endorse", "Endorse transaction to the ledger with preserving an original author.") + .add_optional_param("txn","Transaction to endorse. Skip to use a transaction stored into CLI context.") + .add_example(r#"ledger endorse txn={"reqId":123456789,"type":"100"}"#) + .add_example(r#"ledger endorse"#) + .finalize() + ); + + fn execute(ctx: &CommandContext, params: &CommandParams) -> Result<(), ()> { + trace!("execute >> ctx {:?} params {:?}", ctx, params); + + let (wallet_handle, wallet_name) = ensure_opened_wallet(&ctx)?; + let submitter_did = ensure_active_did(&ctx)?; + + let param_txn = get_opt_str_param("txn", params).map_err(error_err!())?; + + let request = get_transaction_to_use!(ctx, param_txn); + + let request = Ledger::multi_sign_request(wallet_handle, &submitter_did, &request) + .map_err(|err| handle_indy_error(err, None, None, Some(&wallet_name)))?; + + let (_, response) = send_request!(&ctx, params, &request, None, Some(&submitter_did), true); + + handle_transaction_response(response) + .and_then(|result| parse_transaction_response(result)) + .map(|(metadata_headers, metadata, data)| { + println_succ!("Transaction has been sent to Ledger."); + + println_succ!("Metadata:"); + print_table(&metadata, &metadata_headers); + + println_succ!("Data:"); + print_table(&json!({"data": data}), &[("data", "Data")]); + })?; + + trace!("execute <<"); + Ok(()) + } +} + pub fn set_author_agreement(ctx: &CommandContext, request: &mut String) -> Result<(), ()> { if let Some((text, version, acc_mech_type, time_of_acceptance)) = get_transaction_author_info(&ctx) { if acc_mech_type.is_empty() { @@ -1903,9 +1974,9 @@ pub fn print_response_receipts(receipts: Option>) -> Resu println_succ!("Following Receipts has been received."); print_list_table(&receipt, &[("receipt", "Receipt"), - ("recipient", "Payment Address of recipient"), - ("amount", "Amount"), - ("extra", "Extra")], + ("recipient", "Payment Address of recipient"), + ("amount", "Amount"), + ("extra", "Extra")], ""); } }); @@ -1935,16 +2006,23 @@ fn parse_payment_fees(fees: &[&str]) -> Result { serialize(&fees_map) } -fn print_transaction_response(mut result: serde_json::Value, title: &str, +fn parse_transaction_response(mut result: serde_json::Value) -> Result<(Vec<(&'static str, &'static str)>, serde_json::Value, serde_json::Value), ()> { + match result["ver"].clone().as_str() { + None => Ok(parse_transaction_response_v0(&mut result)), + Some("1") => Ok(parse_transaction_response_v1(&mut result)), + ver => Err(println_err!("Unsupported transaction response format: {:?}", ver)) + } +} + +fn print_transaction_response(result: serde_json::Value, title: &str, data_sub_field: Option<&str>, data_headers: &[(&str, &str)], skip_empty: bool) { println_succ!("{}", title); - let (metadata_headers, metadata, data) = match result["ver"].clone().as_str() { - None => parse_transaction_response_v0(&mut result), - Some("1") => parse_transaction_response_v1(&mut result), - ver=> return println_err!("Unsupported transaction response format: {:?}", ver) + let (metadata_headers, metadata, data) = match parse_transaction_response(result) { + Ok(val) => val, + Err(_) => return }; println_succ!("Metadata:"); @@ -1960,12 +2038,12 @@ fn print_transaction_response(mut result: serde_json::Value, title: &str, print_table(data, &data_headers); } -fn parse_transaction_response_v0(result: &mut serde_json::Value) -> ([(&'static str, &'static str); 4], serde_json::Value, serde_json::Value) { +fn parse_transaction_response_v0(result: &mut serde_json::Value) -> (Vec<(&'static str, &'static str)>, serde_json::Value, serde_json::Value) { if let Some(txn_time) = result["txnTime"].as_i64() { result["txnTime"] = serde_json::Value::String(timestamp_to_datetime(txn_time)) } - let metadata_headers = [ + let metadata_headers = vec![ ("identifier", "Identifier"), ("seqNo", "Sequence Number"), ("reqId", "Request ID"), @@ -1974,12 +2052,12 @@ fn parse_transaction_response_v0(result: &mut serde_json::Value) -> ([(&'static (metadata_headers, result.clone(), result.clone()) } -fn parse_transaction_response_v1(result: &mut serde_json::Value) -> ([(&'static str, &'static str); 4], serde_json::Value, serde_json::Value) { +fn parse_transaction_response_v1(result: &mut serde_json::Value) -> (Vec<(&'static str, &'static str)>, serde_json::Value, serde_json::Value) { if let Some(txn_time) = result["txnMetadata"]["txnTime"].as_i64() { result["txnMetadata"]["txnTime"] = serde_json::Value::String(timestamp_to_datetime(txn_time)) } - let metadata_headers = [ + let mut metadata_headers = vec![ ("from", "From"), ("seqNo", "Sequence Number"), ("reqId", "Request ID"), @@ -1990,6 +2068,11 @@ fn parse_transaction_response_v1(result: &mut serde_json::Value) -> ([(&'static metadata_obj.insert("reqId".to_string(), result["txn"]["metadata"]["reqId"].clone()); metadata_obj.insert("from".to_string(), result["txn"]["metadata"]["from"].clone()); + if result["txn"]["metadata"]["endorser"].is_string() { + metadata_headers.push(("endorser", "Endorser")); + metadata_obj.insert("endorser".to_string(), result["txn"]["metadata"]["endorser"].clone()); + } + let metadata = serde_json::Value::Object(metadata_obj); let data = result["txn"]["data"].clone(); @@ -2183,7 +2266,7 @@ fn prepare_sources_for_payment_cmd(ctx: &CommandContext, outputs: Option>) -> Result<(String, String), ()> { let (inputs, outputs) = match (source_payment_address, target_payment_address, amount) { (Some(source_address), Some(target_address), Some(amount_)) => { - if amount_ <= 0{ + if amount_ <= 0 { println_err!("Payment amount must be greater than 0"); return Err(()) } @@ -2812,6 +2895,34 @@ pub mod tests { assert!(transaction["signature"].is_null()); tear_down_with_wallet_and_pool(&ctx); } + + #[test] + pub fn attrib_works_for_endorser() { + let ctx = setup_with_wallet_and_pool(); + let (endorser_did, _) = use_new_identity(&ctx); + + // Publish new NYM without any role + let (did, verkey) = create_new_did(&ctx); + send_nym(&ctx, &did, &verkey, None); + use_did(&ctx, &did); + + { + let cmd = attrib_command::new(); + let mut params = CommandParams::new(); + params.insert("did", did.clone()); + params.insert("raw", ATTRIB_RAW_DATA.to_string()); + params.insert("endorser", endorser_did.to_string()); + cmd.execute(&ctx, ¶ms).unwrap(); + } + use_did(&ctx, &endorser_did); + { + let cmd = endorse_transaction_command::new(); + let params = CommandParams::new(); + cmd.execute(&ctx, ¶ms).unwrap(); + } + assert!(_ensure_attrib_added(&ctx, &did, Some(ATTRIB_RAW_DATA), None, None).is_ok()); + tear_down_with_wallet_and_pool(&ctx); + } } mod get_attrib { @@ -3054,6 +3165,35 @@ pub mod tests { assert!(transaction["signature"].is_null()); tear_down_with_wallet_and_pool(&ctx); } + + #[test] + pub fn schema_works_for_endorser() { + let ctx = setup_with_wallet_and_pool(); + let (endorser_did, _) = use_new_identity(&ctx); + + // Publish new NYM without any role + let (did, verkey) = create_new_did(&ctx); + send_nym(&ctx, &did, &verkey, None); + use_did(&ctx, &did); + + { + let cmd = schema_command::new(); + let mut params = CommandParams::new(); + params.insert("name", "gvt".to_string()); + params.insert("version", "1.0".to_string()); + params.insert("attr_names", "name,age".to_string()); + params.insert("endorser", endorser_did.to_string()); + cmd.execute(&ctx, ¶ms).unwrap(); + } + use_did(&ctx, &endorser_did); + { + let cmd = endorse_transaction_command::new(); + let params = CommandParams::new(); + cmd.execute(&ctx, ¶ms).unwrap(); + } + assert!(_ensure_schema_added(&ctx, &did).is_ok()); + tear_down_with_wallet_and_pool(&ctx); + } } mod get_validator_info { diff --git a/cli/src/libindy/ledger.rs b/cli/src/libindy/ledger.rs index 2cc43d096c..60a3c4c0d8 100644 --- a/cli/src/libindy/ledger.rs +++ b/cli/src/libindy/ledger.rs @@ -133,4 +133,9 @@ impl Ledger { acc_mech_type, time_of_acceptance).wait() } + + pub fn append_request_endorser(request_json: &str, + endorser_did: &str) -> Result { + ledger::append_request_endorser(request_json, endorser_did).wait() + } } \ No newline at end of file diff --git a/cli/src/main.rs b/cli/src/main.rs index 29c66d681b..b908b17b7a 100644 --- a/cli/src/main.rs +++ b/cli/src/main.rs @@ -183,6 +183,7 @@ fn build_executor() -> CommandExecutor { .add_command(ledger::load_transaction_command::new()) .add_command(ledger::taa_command::new()) .add_command(ledger::aml_command::new()) + .add_command(ledger::endorse_transaction_command::new()) .finalize_group() .add_group(payment_address::group::new()) .add_command(payment_address::create_command::new()) diff --git a/docs/design/001-cli/README.md b/docs/design/001-cli/README.md index 456311f272..76df4ceb8c 100644 --- a/docs/design/001-cli/README.md +++ b/docs/design/001-cli/README.md @@ -253,7 +253,7 @@ indy> ledger #### NYM transaction Send NYM transaction ``` -ledger nym did= [verkey=] [role=] [source_payment_address=] [fee=] [fees_inputs=] [fees_outputs=(,),..,(,)] [extra=] [sign=] [send=] +ledger nym did= [verkey=] [role=] [source_payment_address=] [fee=] [fees_inputs=] [fees_outputs=(,),..,(,)] [extra=] [sign=] [send=] [endorser=] ``` #### GET_NYM transaction @@ -265,7 +265,7 @@ ledger get-nym did= [send=] #### ATTRIB transaction Send ATTRIB transaction ``` -ledger attrib did= [hash=] [raw=] [enc=] [source_payment_address=] [fee=] [fees_inputs=] [fees_outputs=(,),..,(,)] [extra=] [sign=] [send=] +ledger attrib did= [hash=] [raw=] [enc=] [source_payment_address=] [fee=] [fees_inputs=] [fees_outputs=(,),..,(,)] [extra=] [sign=] [send=] [endorser=] ``` #### GET_ATTRIB transaction @@ -277,7 +277,7 @@ ledger get-attrib did= [raw=] [hash=] [enc= version= attr_names= [source_payment_address=] [fee=] [fees_inputs=] [fees_outputs=(,),..,(,)] [extra=] [sign=] [send=] +ledger schema name= version= attr_names= [source_payment_address=] [fee=] [fees_inputs=] [fees_outputs=(,),..,(,)] [extra=] [sign=] [send=] [endorser=] ``` #### GET_SCHEMA transaction @@ -288,7 +288,7 @@ ledger get-schema did= name= version= [sen #### CRED_DEF transaction Send CRED_DEF transaction ``` -ledger cred-def schema_id= signature_type= [tag=] primary= [revocation=] [source_payment_address=] [fee=] [fees_inputs=] [fees_outputs=(,),..,(,)] [extra=] [sign=] [send=] +ledger cred-def schema_id= signature_type= [tag=] primary= [revocation=] [source_payment_address=] [fee=] [fees_inputs=] [fees_outputs=(,),..,(,)] [extra=] [sign=] [send=] [endorser=] ``` #### GET_CRED_DEF transaction From 1fc49a6473f4b5a5d7a58758db61b88c62d41012 Mon Sep 17 00:00:00 2001 From: "artem.ivanov" Date: Tue, 6 Aug 2019 13:09:16 +0300 Subject: [PATCH 085/320] IS-1243 - Added note regarding TAA acepting Signed-off-by: artem.ivanov --- docs/configuration.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/configuration.md b/docs/configuration.md index 425e980cbd..f73d36eb97 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -223,4 +223,8 @@ CLI uses session-based approach to work with Transaction Author Agreement. The list of available acceptance mechanisms can be received by sending `get_acceptance_mechanisms` request to ledger. 1. On `pool connect` command execution: User will be asked if he would like to accept TAA. User either can accept it or skip and accept it later by `pool show-taa` command. + + Note that accepting TAA one time on `pool connect` or `pool show-taa` is a CLI-specific behavior that actually caches value for future uses. + Actual TAA check will be performed on write requests sending only. + 1. On write request sending to Ledger: TAA will be appended to requests. \ No newline at end of file From 6cf843a9581bfb41b67823829327eabd5d14b47a Mon Sep 17 00:00:00 2001 From: "artem.ivanov" Date: Tue, 6 Aug 2019 14:27:46 +0300 Subject: [PATCH 086/320] IS-1203: Remove package-lock.json file from vcx nodejs wrapper Signed-off-by: artem.ivanov --- vcx/wrappers/node/.gitignore | 1 + vcx/wrappers/node/package-lock.json | 4884 -------------------- vcx/wrappers/node/package.json | 2 +- vcx/wrappers/node/src/utils/ffi-helpers.ts | 1 + 4 files changed, 3 insertions(+), 4885 deletions(-) delete mode 100644 vcx/wrappers/node/package-lock.json diff --git a/vcx/wrappers/node/.gitignore b/vcx/wrappers/node/.gitignore index 3759bf88cf..309ed91556 100644 --- a/vcx/wrappers/node/.gitignore +++ b/vcx/wrappers/node/.gitignore @@ -1,6 +1,7 @@ dist/ lib/ doc/ +package-lock.json # Created by https://www.gitignore.io/api/node diff --git a/vcx/wrappers/node/package-lock.json b/vcx/wrappers/node/package-lock.json deleted file mode 100644 index d9577d10b7..0000000000 --- a/vcx/wrappers/node/package-lock.json +++ /dev/null @@ -1,4884 +0,0 @@ -{ - "name": "node-vcx-wrapper", - "version": "0.3.1", - "lockfileVersion": 1, - "requires": true, - "dependencies": { - "@sinonjs/commons": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-1.4.0.tgz", - "integrity": "sha512-9jHK3YF/8HtJ9wCAbG+j8cD0i0+ATS9A7gXFqS36TblLPNy6rEEc+SB0imo91eCboGaBYGV/MT1/br/J+EE7Tw==", - "dev": true, - "requires": { - "type-detect": "4.0.8" - }, - "dependencies": { - "type-detect": { - "version": "4.0.8", - "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", - "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", - "dev": true - } - } - }, - "@sinonjs/formatio": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/@sinonjs/formatio/-/formatio-3.2.1.tgz", - "integrity": "sha512-tsHvOB24rvyvV2+zKMmPkZ7dXX6LSLKZ7aOtXY6Edklp0uRcgGpOsQTTGTcWViFyx4uhWc6GV8QdnALbIbIdeQ==", - "dev": true, - "requires": { - "@sinonjs/commons": "^1", - "@sinonjs/samsam": "^3.1.0" - } - }, - "@sinonjs/samsam": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/@sinonjs/samsam/-/samsam-3.3.0.tgz", - "integrity": "sha512-beHeJM/RRAaLLsMJhsCvHK31rIqZuobfPLa/80yGH5hnD8PV1hyh9xJBJNFfNmO7yWqm+zomijHsXpI6iTQJfQ==", - "dev": true, - "requires": { - "@sinonjs/commons": "^1.0.2", - "array-from": "^2.1.1", - "lodash": "^4.17.11" - } - }, - "@sinonjs/text-encoding": { - "version": "0.7.1", - "resolved": "https://registry.npmjs.org/@sinonjs/text-encoding/-/text-encoding-0.7.1.tgz", - "integrity": "sha512-+iTbntw2IZPb/anVDbypzfQa+ay64MW0Zo8aJ8gZPWMMK6/OubMVb6lUPMagqjOPnmtauXnFCACVl3O7ogjeqQ==", - "dev": true - }, - "@types/chai": { - "version": "4.1.4", - "resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.1.4.tgz", - "integrity": "sha512-h6+VEw2Vr3ORiFCyyJmcho2zALnUq9cvdB/IO8Xs9itrJVCenC7o26A6+m7D0ihTTr65eS259H5/Ghl/VjYs6g==", - "dev": true - }, - "@types/events": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/@types/events/-/events-1.2.0.tgz", - "integrity": "sha512-KEIlhXnIutzKwRbQkGWb/I4HFqBuUykAdHgDED6xqwXJfONCjF5VoE0cXEiurh3XauygxzeDzgtXUqvLkxFzzA==", - "dev": true - }, - "@types/ffi": { - "version": "0.0.19", - "resolved": "https://registry.npmjs.org/@types/ffi/-/ffi-0.0.19.tgz", - "integrity": "sha1-vaEt6ZnhpuRTK4RElzGNuuuYT4I=", - "requires": { - "@types/node": "*", - "@types/ref": "*", - "@types/ref-struct": "*" - } - }, - "@types/fs-extra": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/@types/fs-extra/-/fs-extra-5.0.1.tgz", - "integrity": "sha512-h3wnflb+jMTipvbbZnClgA2BexrT4w0GcfoCz5qyxd0IRsbqhLSyesM6mqZTAnhbVmhyTm5tuxfRu9R+8l+lGw==", - "dev": true, - "requires": { - "@types/node": "*" - } - }, - "@types/glob": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/@types/glob/-/glob-7.1.0.tgz", - "integrity": "sha512-k1M3Y8Ge0bOkG7U5IZObIhkrzZHMpuFpd5RJK9Gh8ekq0EhiezLLqv2ow14ylTKqXTHSqM6AMySbWEHRo+7qdQ==", - "dev": true, - "requires": { - "@types/events": "*", - "@types/minimatch": "*", - "@types/node": "*" - } - }, - "@types/handlebars": { - "version": "4.0.36", - "resolved": "https://registry.npmjs.org/@types/handlebars/-/handlebars-4.0.36.tgz", - "integrity": "sha512-LjNiTX7TY7wtuC6y3QwC93hKMuqYhgV9A1uXBKNvZtVC8ZvyWAjZkJ5BvT0K7RKqORRYRLMrqCxpw5RgS+MdrQ==", - "dev": true - }, - "@types/highlight.js": { - "version": "9.12.2", - "resolved": "https://registry.npmjs.org/@types/highlight.js/-/highlight.js-9.12.2.tgz", - "integrity": "sha512-y5x0XD/WXDaGSyiTaTcKS4FurULJtSiYbGTeQd0m2LYZGBcZZ/7fM6t5H/DzeUF+kv8y6UfmF6yJABQsHcp9VQ==", - "dev": true - }, - "@types/lodash": { - "version": "4.14.109", - "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.109.tgz", - "integrity": "sha512-hop8SdPUEzbcJm6aTsmuwjIYQo1tqLseKCM+s2bBqTU2gErwI4fE+aqUVOlscPSQbKHKgtMMPoC+h4AIGOJYvw==", - "dev": true - }, - "@types/marked": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/@types/marked/-/marked-0.3.0.tgz", - "integrity": "sha512-CSf9YWJdX1DkTNu9zcNtdCcn6hkRtB5ILjbhRId4ZOQqx30fXmdecuaXhugQL6eyrhuXtaHJ7PHI+Vm7k9ZJjg==", - "dev": true - }, - "@types/minimatch": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.3.tgz", - "integrity": "sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA==", - "dev": true - }, - "@types/mocha": { - "version": "5.2.3", - "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-5.2.3.tgz", - "integrity": "sha512-C1wVVr7xhKu6c3Mb27dFzNYR05qvHwgtpN+JOYTGc1pKA7dCEDDYpscn7kul+bCUwa3NoGDbzI1pdznSOa397w==", - "dev": true - }, - "@types/node": { - "version": "8.0.47", - "resolved": "https://registry.npmjs.org/@types/node/-/node-8.0.47.tgz", - "integrity": "sha512-kOwL746WVvt/9Phf6/JgX/bsGQvbrK5iUgzyfwZNcKVFcjAUVSpF9HxevLTld2SG9aywYHOILj38arDdY1r/iQ==" - }, - "@types/ref": { - "version": "0.0.28", - "resolved": "https://registry.npmjs.org/@types/ref/-/ref-0.0.28.tgz", - "integrity": "sha1-FaYSU+0SWQOLR0md4cmwy8pX9Vw=", - "requires": { - "@types/node": "*" - } - }, - "@types/ref-struct": { - "version": "0.0.28", - "resolved": "https://registry.npmjs.org/@types/ref-struct/-/ref-struct-0.0.28.tgz", - "integrity": "sha1-uECorElUEVFdyuIJAQ1axmFVDoQ=", - "requires": { - "@types/ref": "*" - } - }, - "@types/shelljs": { - "version": "0.7.8", - "resolved": "https://registry.npmjs.org/@types/shelljs/-/shelljs-0.7.8.tgz", - "integrity": "sha512-M2giRw93PxKS7YjU6GZjtdV9HASdB7TWqizBXe4Ju7AqbKlWvTr0gNO92XH56D/gMxqD/jNHLNfC5hA34yGqrQ==", - "dev": true, - "requires": { - "@types/glob": "*", - "@types/node": "*" - } - }, - "@types/sinon": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/@types/sinon/-/sinon-5.0.1.tgz", - "integrity": "sha512-yxzBCIjE3lp9lYjfBbIK/LRCoXgCLLbIIBIje7eNCcUIIR2CZZtyX5uto2hVoMSMqLrsRrT6mwwUEd0yFgOwpA==", - "dev": true - }, - "@types/weak": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/@types/weak/-/weak-1.0.0.tgz", - "integrity": "sha512-6WXZpeAac3vj5+OfQvlqYEtc88oOgvkcxbrnmBw53Da6gA+MGztL+Hns3BpnyUevgz+4DxsJblgAew1A/tkcng==", - "dev": true, - "requires": { - "@types/node": "*" - } - }, - "ansi-regex": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", - "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", - "dev": true - }, - "ansi-styles": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", - "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", - "dev": true - }, - "anymatch": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-1.3.2.tgz", - "integrity": "sha512-0XNayC8lTHQ2OI8aljNCN3sSx6hsr/1+rlcDAotXJR7C1oZZHCNsfpbKwMjRA3Uqb5tF1Rae2oloTr4xpq+WjA==", - "dev": true, - "optional": true, - "requires": { - "micromatch": "^2.1.5", - "normalize-path": "^2.0.0" - } - }, - "app-module-path": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/app-module-path/-/app-module-path-2.2.0.tgz", - "integrity": "sha1-ZBqlXft9am8KgUHEucCqULbCTdU=", - "dev": true - }, - "arr-diff": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-2.0.0.tgz", - "integrity": "sha1-jzuCf5Vai9ZpaX5KQlasPOrjVs8=", - "dev": true, - "optional": true, - "requires": { - "arr-flatten": "^1.0.1" - } - }, - "arr-flatten": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/arr-flatten/-/arr-flatten-1.1.0.tgz", - "integrity": "sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg==", - "dev": true, - "optional": true - }, - "arr-union": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/arr-union/-/arr-union-3.1.0.tgz", - "integrity": "sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ=", - "dev": true, - "optional": true - }, - "array-from": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/array-from/-/array-from-2.1.1.tgz", - "integrity": "sha1-z+nYwmYoudxa7MYqn12PHzUsEZU=", - "dev": true - }, - "array-unique": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.2.1.tgz", - "integrity": "sha1-odl8yvy8JiXMcPrc6zalDFiwGlM=", - "dev": true, - "optional": true - }, - "arrify": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz", - "integrity": "sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0=", - "dev": true - }, - "assertion-error": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.0.2.tgz", - "integrity": "sha1-E8pRXYYgbaC6xm6DTdOX2HWBCUw=", - "dev": true - }, - "assign-symbols": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/assign-symbols/-/assign-symbols-1.0.0.tgz", - "integrity": "sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c=", - "dev": true, - "optional": true - }, - "async": { - "version": "2.6.1", - "resolved": "https://registry.npmjs.org/async/-/async-2.6.1.tgz", - "integrity": "sha512-fNEiL2+AZt6AlAw/29Cr0UDe4sRAHCpEHh54WMz+Bb7QfNcFw4h3loofyJpLeQs4Yx7yuqu/2dLgM5hKOs6HlQ==", - "dev": true, - "requires": { - "lodash": "^4.17.10" - }, - "dependencies": { - "lodash": { - "version": "4.17.11", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz", - "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==", - "dev": true - } - } - }, - "async-each": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/async-each/-/async-each-1.0.1.tgz", - "integrity": "sha1-GdOGodntxufByF04iu28xW0zYC0=", - "dev": true, - "optional": true - }, - "atob": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/atob/-/atob-2.1.2.tgz", - "integrity": "sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg==", - "dev": true, - "optional": true - }, - "babel-cli": { - "version": "6.26.0", - "resolved": "https://registry.npmjs.org/babel-cli/-/babel-cli-6.26.0.tgz", - "integrity": "sha1-UCq1SHTX24itALiHoGODzgPQAvE=", - "dev": true, - "requires": { - "babel-core": "^6.26.0", - "babel-polyfill": "^6.26.0", - "babel-register": "^6.26.0", - "babel-runtime": "^6.26.0", - "chokidar": "^1.6.1", - "commander": "^2.11.0", - "convert-source-map": "^1.5.0", - "fs-readdir-recursive": "^1.0.0", - "glob": "^7.1.2", - "lodash": "^4.17.4", - "output-file-sync": "^1.1.2", - "path-is-absolute": "^1.0.1", - "slash": "^1.0.0", - "source-map": "^0.5.6", - "v8flags": "^2.1.1" - }, - "dependencies": { - "source-map": { - "version": "0.5.7", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", - "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", - "dev": true - } - } - }, - "babel-code-frame": { - "version": "6.26.0", - "resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.26.0.tgz", - "integrity": "sha1-Y/1D99weO7fONZR9uP42mj9Yx0s=", - "dev": true, - "requires": { - "chalk": "^1.1.3", - "esutils": "^2.0.2", - "js-tokens": "^3.0.2" - }, - "dependencies": { - "esutils": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz", - "integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=", - "dev": true - } - } - }, - "babel-core": { - "version": "6.26.3", - "resolved": "https://registry.npmjs.org/babel-core/-/babel-core-6.26.3.tgz", - "integrity": "sha512-6jyFLuDmeidKmUEb3NM+/yawG0M2bDZ9Z1qbZP59cyHLz8kYGKYwpJP0UwUKKUiTRNvxfLesJnTedqczP7cTDA==", - "dev": true, - "requires": { - "babel-code-frame": "^6.26.0", - "babel-generator": "^6.26.0", - "babel-helpers": "^6.24.1", - "babel-messages": "^6.23.0", - "babel-register": "^6.26.0", - "babel-runtime": "^6.26.0", - "babel-template": "^6.26.0", - "babel-traverse": "^6.26.0", - "babel-types": "^6.26.0", - "babylon": "^6.18.0", - "convert-source-map": "^1.5.1", - "debug": "^2.6.9", - "json5": "^0.5.1", - "lodash": "^4.17.4", - "minimatch": "^3.0.4", - "path-is-absolute": "^1.0.1", - "private": "^0.1.8", - "slash": "^1.0.0", - "source-map": "^0.5.7" - }, - "dependencies": { - "babylon": { - "version": "6.18.0", - "resolved": "https://registry.npmjs.org/babylon/-/babylon-6.18.0.tgz", - "integrity": "sha512-q/UEjfGJ2Cm3oKV71DJz9d25TPnq5rhBVL2Q4fA5wcC3jcrdn7+SssEybFIxwAvvP+YCsCYNKughoF33GxgycQ==", - "dev": true - }, - "source-map": { - "version": "0.5.7", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", - "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", - "dev": true - } - } - }, - "babel-generator": { - "version": "6.26.1", - "resolved": "https://registry.npmjs.org/babel-generator/-/babel-generator-6.26.1.tgz", - "integrity": "sha512-HyfwY6ApZj7BYTcJURpM5tznulaBvyio7/0d4zFOeMPUmfxkCjHocCuoLa2SAGzBI8AREcH3eP3758F672DppA==", - "dev": true, - "requires": { - "babel-messages": "^6.23.0", - "babel-runtime": "^6.26.0", - "babel-types": "^6.26.0", - "detect-indent": "^4.0.0", - "jsesc": "^1.3.0", - "lodash": "^4.17.4", - "source-map": "^0.5.7", - "trim-right": "^1.0.1" - }, - "dependencies": { - "source-map": { - "version": "0.5.7", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", - "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", - "dev": true - } - } - }, - "babel-helper-call-delegate": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-helper-call-delegate/-/babel-helper-call-delegate-6.24.1.tgz", - "integrity": "sha1-7Oaqzdx25Bw0YfiL/Fdb0Nqi340=", - "dev": true, - "requires": { - "babel-helper-hoist-variables": "^6.24.1", - "babel-runtime": "^6.22.0", - "babel-traverse": "^6.24.1", - "babel-types": "^6.24.1" - } - }, - "babel-helper-define-map": { - "version": "6.26.0", - "resolved": "https://registry.npmjs.org/babel-helper-define-map/-/babel-helper-define-map-6.26.0.tgz", - "integrity": "sha1-pfVtq0GiX5fstJjH66ypgZ+Vvl8=", - "dev": true, - "requires": { - "babel-helper-function-name": "^6.24.1", - "babel-runtime": "^6.26.0", - "babel-types": "^6.26.0", - "lodash": "^4.17.4" - } - }, - "babel-helper-function-name": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-helper-function-name/-/babel-helper-function-name-6.24.1.tgz", - "integrity": "sha1-00dbjAPtmCQqJbSDUasYOZ01gKk=", - "dev": true, - "requires": { - "babel-helper-get-function-arity": "^6.24.1", - "babel-runtime": "^6.22.0", - "babel-template": "^6.24.1", - "babel-traverse": "^6.24.1", - "babel-types": "^6.24.1" - } - }, - "babel-helper-get-function-arity": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-helper-get-function-arity/-/babel-helper-get-function-arity-6.24.1.tgz", - "integrity": "sha1-j3eCqpNAfEHTqlCQj4mwMbG2hT0=", - "dev": true, - "requires": { - "babel-runtime": "^6.22.0", - "babel-types": "^6.24.1" - } - }, - "babel-helper-hoist-variables": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-helper-hoist-variables/-/babel-helper-hoist-variables-6.24.1.tgz", - "integrity": "sha1-HssnaJydJVE+rbyZFKc/VAi+enY=", - "dev": true, - "requires": { - "babel-runtime": "^6.22.0", - "babel-types": "^6.24.1" - } - }, - "babel-helper-optimise-call-expression": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-helper-optimise-call-expression/-/babel-helper-optimise-call-expression-6.24.1.tgz", - "integrity": "sha1-96E0J7qfc/j0+pk8VKl4gtEkQlc=", - "dev": true, - "requires": { - "babel-runtime": "^6.22.0", - "babel-types": "^6.24.1" - } - }, - "babel-helper-regex": { - "version": "6.26.0", - "resolved": "https://registry.npmjs.org/babel-helper-regex/-/babel-helper-regex-6.26.0.tgz", - "integrity": "sha1-MlxZ+QL4LyS3T6zu0DY5VPZJXnI=", - "dev": true, - "requires": { - "babel-runtime": "^6.26.0", - "babel-types": "^6.26.0", - "lodash": "^4.17.4" - } - }, - "babel-helper-replace-supers": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-helper-replace-supers/-/babel-helper-replace-supers-6.24.1.tgz", - "integrity": "sha1-v22/5Dk40XNpohPKiov3S2qQqxo=", - "dev": true, - "requires": { - "babel-helper-optimise-call-expression": "^6.24.1", - "babel-messages": "^6.23.0", - "babel-runtime": "^6.22.0", - "babel-template": "^6.24.1", - "babel-traverse": "^6.24.1", - "babel-types": "^6.24.1" - } - }, - "babel-helpers": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-helpers/-/babel-helpers-6.24.1.tgz", - "integrity": "sha1-NHHenK7DiOXIUOWX5Yom3fN2ArI=", - "dev": true, - "requires": { - "babel-runtime": "^6.22.0", - "babel-template": "^6.24.1" - } - }, - "babel-loader": { - "version": "6.2.4", - "resolved": "https://registry.npmjs.org/babel-loader/-/babel-loader-6.2.4.tgz", - "integrity": "sha1-qnCv+N3CI6WVLoOaQ6bDpMi/oek=", - "dev": true, - "requires": { - "loader-utils": "^0.2.11", - "mkdirp": "^0.5.1", - "object-assign": "^4.0.1" - } - }, - "babel-messages": { - "version": "6.23.0", - "resolved": "https://registry.npmjs.org/babel-messages/-/babel-messages-6.23.0.tgz", - "integrity": "sha1-8830cDhYA1sqKVHG7F7fbGLyYw4=", - "dev": true, - "requires": { - "babel-runtime": "^6.22.0" - } - }, - "babel-plugin-check-es2015-constants": { - "version": "6.22.0", - "resolved": "https://registry.npmjs.org/babel-plugin-check-es2015-constants/-/babel-plugin-check-es2015-constants-6.22.0.tgz", - "integrity": "sha1-NRV7EBQm/S/9PaP3XH0ekYNbv4o=", - "dev": true, - "requires": { - "babel-runtime": "^6.22.0" - } - }, - "babel-plugin-transform-es2015-arrow-functions": { - "version": "6.22.0", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-arrow-functions/-/babel-plugin-transform-es2015-arrow-functions-6.22.0.tgz", - "integrity": "sha1-RSaSy3EdX3ncf4XkQM5BufJE0iE=", - "dev": true, - "requires": { - "babel-runtime": "^6.22.0" - } - }, - "babel-plugin-transform-es2015-block-scoped-functions": { - "version": "6.22.0", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-block-scoped-functions/-/babel-plugin-transform-es2015-block-scoped-functions-6.22.0.tgz", - "integrity": "sha1-u8UbSflk1wy42OC5ToICRs46YUE=", - "dev": true, - "requires": { - "babel-runtime": "^6.22.0" - } - }, - "babel-plugin-transform-es2015-block-scoping": { - "version": "6.26.0", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-block-scoping/-/babel-plugin-transform-es2015-block-scoping-6.26.0.tgz", - "integrity": "sha1-1w9SmcEwjQXBL0Y4E7CgnnOxiV8=", - "dev": true, - "requires": { - "babel-runtime": "^6.26.0", - "babel-template": "^6.26.0", - "babel-traverse": "^6.26.0", - "babel-types": "^6.26.0", - "lodash": "^4.17.4" - } - }, - "babel-plugin-transform-es2015-classes": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-classes/-/babel-plugin-transform-es2015-classes-6.24.1.tgz", - "integrity": "sha1-WkxYpQyclGHlZLSyo7+ryXolhNs=", - "dev": true, - "requires": { - "babel-helper-define-map": "^6.24.1", - "babel-helper-function-name": "^6.24.1", - "babel-helper-optimise-call-expression": "^6.24.1", - "babel-helper-replace-supers": "^6.24.1", - "babel-messages": "^6.23.0", - "babel-runtime": "^6.22.0", - "babel-template": "^6.24.1", - "babel-traverse": "^6.24.1", - "babel-types": "^6.24.1" - } - }, - "babel-plugin-transform-es2015-computed-properties": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-computed-properties/-/babel-plugin-transform-es2015-computed-properties-6.24.1.tgz", - "integrity": "sha1-b+Ko0WiV1WNPTNmZttNICjCBWbM=", - "dev": true, - "requires": { - "babel-runtime": "^6.22.0", - "babel-template": "^6.24.1" - } - }, - "babel-plugin-transform-es2015-destructuring": { - "version": "6.23.0", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-destructuring/-/babel-plugin-transform-es2015-destructuring-6.23.0.tgz", - "integrity": "sha1-mXux8auWf2gtKwh2/jWNYOdlxW0=", - "dev": true, - "requires": { - "babel-runtime": "^6.22.0" - } - }, - "babel-plugin-transform-es2015-duplicate-keys": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-duplicate-keys/-/babel-plugin-transform-es2015-duplicate-keys-6.24.1.tgz", - "integrity": "sha1-c+s9MQypaePvnskcU3QabxV2Qj4=", - "dev": true, - "requires": { - "babel-runtime": "^6.22.0", - "babel-types": "^6.24.1" - } - }, - "babel-plugin-transform-es2015-for-of": { - "version": "6.23.0", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-for-of/-/babel-plugin-transform-es2015-for-of-6.23.0.tgz", - "integrity": "sha1-9HyVsrYT3x0+zC/bdXNiPHUkhpE=", - "dev": true, - "requires": { - "babel-runtime": "^6.22.0" - } - }, - "babel-plugin-transform-es2015-function-name": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-function-name/-/babel-plugin-transform-es2015-function-name-6.24.1.tgz", - "integrity": "sha1-g0yJhTvDaxrw86TF26qU/Y6sqos=", - "dev": true, - "requires": { - "babel-helper-function-name": "^6.24.1", - "babel-runtime": "^6.22.0", - "babel-types": "^6.24.1" - } - }, - "babel-plugin-transform-es2015-literals": { - "version": "6.22.0", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-literals/-/babel-plugin-transform-es2015-literals-6.22.0.tgz", - "integrity": "sha1-T1SgLWzWbPkVKAAZox0xklN3yi4=", - "dev": true, - "requires": { - "babel-runtime": "^6.22.0" - } - }, - "babel-plugin-transform-es2015-modules-amd": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-modules-amd/-/babel-plugin-transform-es2015-modules-amd-6.24.1.tgz", - "integrity": "sha1-Oz5UAXI5hC1tGcMBHEvS8AoA0VQ=", - "dev": true, - "requires": { - "babel-plugin-transform-es2015-modules-commonjs": "^6.24.1", - "babel-runtime": "^6.22.0", - "babel-template": "^6.24.1" - } - }, - "babel-plugin-transform-es2015-modules-commonjs": { - "version": "6.26.2", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-modules-commonjs/-/babel-plugin-transform-es2015-modules-commonjs-6.26.2.tgz", - "integrity": "sha512-CV9ROOHEdrjcwhIaJNBGMBCodN+1cfkwtM1SbUHmvyy35KGT7fohbpOxkE2uLz1o6odKK2Ck/tz47z+VqQfi9Q==", - "dev": true, - "requires": { - "babel-plugin-transform-strict-mode": "^6.24.1", - "babel-runtime": "^6.26.0", - "babel-template": "^6.26.0", - "babel-types": "^6.26.0" - } - }, - "babel-plugin-transform-es2015-modules-systemjs": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-modules-systemjs/-/babel-plugin-transform-es2015-modules-systemjs-6.24.1.tgz", - "integrity": "sha1-/4mhQrkRmpBhlfXxBuzzBdlAfSM=", - "dev": true, - "requires": { - "babel-helper-hoist-variables": "^6.24.1", - "babel-runtime": "^6.22.0", - "babel-template": "^6.24.1" - } - }, - "babel-plugin-transform-es2015-modules-umd": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-modules-umd/-/babel-plugin-transform-es2015-modules-umd-6.24.1.tgz", - "integrity": "sha1-rJl+YoXNGO1hdq22B9YCNErThGg=", - "dev": true, - "requires": { - "babel-plugin-transform-es2015-modules-amd": "^6.24.1", - "babel-runtime": "^6.22.0", - "babel-template": "^6.24.1" - } - }, - "babel-plugin-transform-es2015-object-super": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-object-super/-/babel-plugin-transform-es2015-object-super-6.24.1.tgz", - "integrity": "sha1-JM72muIcuDp/hgPa0CH1cusnj40=", - "dev": true, - "requires": { - "babel-helper-replace-supers": "^6.24.1", - "babel-runtime": "^6.22.0" - } - }, - "babel-plugin-transform-es2015-parameters": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-parameters/-/babel-plugin-transform-es2015-parameters-6.24.1.tgz", - "integrity": "sha1-V6w1GrScrxSpfNE7CfZv3wpiXys=", - "dev": true, - "requires": { - "babel-helper-call-delegate": "^6.24.1", - "babel-helper-get-function-arity": "^6.24.1", - "babel-runtime": "^6.22.0", - "babel-template": "^6.24.1", - "babel-traverse": "^6.24.1", - "babel-types": "^6.24.1" - } - }, - "babel-plugin-transform-es2015-shorthand-properties": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-shorthand-properties/-/babel-plugin-transform-es2015-shorthand-properties-6.24.1.tgz", - "integrity": "sha1-JPh11nIch2YbvZmkYi5R8U3jiqA=", - "dev": true, - "requires": { - "babel-runtime": "^6.22.0", - "babel-types": "^6.24.1" - } - }, - "babel-plugin-transform-es2015-spread": { - "version": "6.22.0", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-spread/-/babel-plugin-transform-es2015-spread-6.22.0.tgz", - "integrity": "sha1-1taKmfia7cRTbIGlQujdnxdG+NE=", - "dev": true, - "requires": { - "babel-runtime": "^6.22.0" - } - }, - "babel-plugin-transform-es2015-sticky-regex": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-sticky-regex/-/babel-plugin-transform-es2015-sticky-regex-6.24.1.tgz", - "integrity": "sha1-AMHNsaynERLN8M9hJsLta0V8zbw=", - "dev": true, - "requires": { - "babel-helper-regex": "^6.24.1", - "babel-runtime": "^6.22.0", - "babel-types": "^6.24.1" - } - }, - "babel-plugin-transform-es2015-template-literals": { - "version": "6.22.0", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-template-literals/-/babel-plugin-transform-es2015-template-literals-6.22.0.tgz", - "integrity": "sha1-qEs0UPfp+PH2g51taH2oS7EjbY0=", - "dev": true, - "requires": { - "babel-runtime": "^6.22.0" - } - }, - "babel-plugin-transform-es2015-typeof-symbol": { - "version": "6.23.0", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-typeof-symbol/-/babel-plugin-transform-es2015-typeof-symbol-6.23.0.tgz", - "integrity": "sha1-3sCfHN3/lLUqxz1QXITfWdzOs3I=", - "dev": true, - "requires": { - "babel-runtime": "^6.22.0" - } - }, - "babel-plugin-transform-es2015-unicode-regex": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-unicode-regex/-/babel-plugin-transform-es2015-unicode-regex-6.24.1.tgz", - "integrity": "sha1-04sS9C6nMj9yk4fxinxa4frrNek=", - "dev": true, - "requires": { - "babel-helper-regex": "^6.24.1", - "babel-runtime": "^6.22.0", - "regexpu-core": "^2.0.0" - } - }, - "babel-plugin-transform-regenerator": { - "version": "6.26.0", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-regenerator/-/babel-plugin-transform-regenerator-6.26.0.tgz", - "integrity": "sha1-4HA2lvveJ/Cj78rPi03KL3s6jy8=", - "dev": true, - "requires": { - "regenerator-transform": "^0.10.0" - } - }, - "babel-plugin-transform-strict-mode": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-strict-mode/-/babel-plugin-transform-strict-mode-6.24.1.tgz", - "integrity": "sha1-1fr3qleKZbvlkc9e2uBKDGcCB1g=", - "dev": true, - "requires": { - "babel-runtime": "^6.22.0", - "babel-types": "^6.24.1" - } - }, - "babel-polyfill": { - "version": "6.26.0", - "resolved": "https://registry.npmjs.org/babel-polyfill/-/babel-polyfill-6.26.0.tgz", - "integrity": "sha1-N5k3q8Z9eJWXCtxiHyhM2WbPIVM=", - "dev": true, - "requires": { - "babel-runtime": "^6.26.0", - "core-js": "^2.5.0", - "regenerator-runtime": "^0.10.5" - }, - "dependencies": { - "regenerator-runtime": { - "version": "0.10.5", - "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.10.5.tgz", - "integrity": "sha1-M2w+/BIgrc7dosn6tntaeVWjNlg=", - "dev": true - } - } - }, - "babel-preset-es2015": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-preset-es2015/-/babel-preset-es2015-6.24.1.tgz", - "integrity": "sha1-1EBQ1rwsn+6nAqrzjXJ6AhBTiTk=", - "dev": true, - "requires": { - "babel-plugin-check-es2015-constants": "^6.22.0", - "babel-plugin-transform-es2015-arrow-functions": "^6.22.0", - "babel-plugin-transform-es2015-block-scoped-functions": "^6.22.0", - "babel-plugin-transform-es2015-block-scoping": "^6.24.1", - "babel-plugin-transform-es2015-classes": "^6.24.1", - "babel-plugin-transform-es2015-computed-properties": "^6.24.1", - "babel-plugin-transform-es2015-destructuring": "^6.22.0", - "babel-plugin-transform-es2015-duplicate-keys": "^6.24.1", - "babel-plugin-transform-es2015-for-of": "^6.22.0", - "babel-plugin-transform-es2015-function-name": "^6.24.1", - "babel-plugin-transform-es2015-literals": "^6.22.0", - "babel-plugin-transform-es2015-modules-amd": "^6.24.1", - "babel-plugin-transform-es2015-modules-commonjs": "^6.24.1", - "babel-plugin-transform-es2015-modules-systemjs": "^6.24.1", - "babel-plugin-transform-es2015-modules-umd": "^6.24.1", - "babel-plugin-transform-es2015-object-super": "^6.24.1", - "babel-plugin-transform-es2015-parameters": "^6.24.1", - "babel-plugin-transform-es2015-shorthand-properties": "^6.24.1", - "babel-plugin-transform-es2015-spread": "^6.22.0", - "babel-plugin-transform-es2015-sticky-regex": "^6.24.1", - "babel-plugin-transform-es2015-template-literals": "^6.22.0", - "babel-plugin-transform-es2015-typeof-symbol": "^6.22.0", - "babel-plugin-transform-es2015-unicode-regex": "^6.24.1", - "babel-plugin-transform-regenerator": "^6.24.1" - } - }, - "babel-register": { - "version": "6.26.0", - "resolved": "https://registry.npmjs.org/babel-register/-/babel-register-6.26.0.tgz", - "integrity": "sha1-btAhFz4vy0htestFxgCahW9kcHE=", - "dev": true, - "requires": { - "babel-core": "^6.26.0", - "babel-runtime": "^6.26.0", - "core-js": "^2.5.0", - "home-or-tmp": "^2.0.0", - "lodash": "^4.17.4", - "mkdirp": "^0.5.1", - "source-map-support": "^0.4.15" - }, - "dependencies": { - "source-map": { - "version": "0.5.7", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", - "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", - "dev": true - }, - "source-map-support": { - "version": "0.4.18", - "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.4.18.tgz", - "integrity": "sha512-try0/JqxPLF9nOjvSta7tVondkP5dwgyLDjVoyMDlmjugT2lRZ1OfsrYTkCd2hkDnJTKRbO/Rl3orm8vlsUzbA==", - "dev": true, - "requires": { - "source-map": "^0.5.6" - } - } - } - }, - "babel-runtime": { - "version": "6.26.0", - "resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz", - "integrity": "sha1-llxwWGaOgrVde/4E/yM3vItWR/4=", - "dev": true, - "requires": { - "core-js": "^2.4.0", - "regenerator-runtime": "^0.11.0" - } - }, - "babel-template": { - "version": "6.26.0", - "resolved": "https://registry.npmjs.org/babel-template/-/babel-template-6.26.0.tgz", - "integrity": "sha1-3gPi0WOWsGn0bdn/+FIfsaDjXgI=", - "dev": true, - "requires": { - "babel-runtime": "^6.26.0", - "babel-traverse": "^6.26.0", - "babel-types": "^6.26.0", - "babylon": "^6.18.0", - "lodash": "^4.17.4" - }, - "dependencies": { - "babylon": { - "version": "6.18.0", - "resolved": "https://registry.npmjs.org/babylon/-/babylon-6.18.0.tgz", - "integrity": "sha512-q/UEjfGJ2Cm3oKV71DJz9d25TPnq5rhBVL2Q4fA5wcC3jcrdn7+SssEybFIxwAvvP+YCsCYNKughoF33GxgycQ==", - "dev": true - } - } - }, - "babel-traverse": { - "version": "6.26.0", - "resolved": "https://registry.npmjs.org/babel-traverse/-/babel-traverse-6.26.0.tgz", - "integrity": "sha1-RqnL1+3MYsjlwGTi0tjQ9ANXZu4=", - "dev": true, - "requires": { - "babel-code-frame": "^6.26.0", - "babel-messages": "^6.23.0", - "babel-runtime": "^6.26.0", - "babel-types": "^6.26.0", - "babylon": "^6.18.0", - "debug": "^2.6.8", - "globals": "^9.18.0", - "invariant": "^2.2.2", - "lodash": "^4.17.4" - }, - "dependencies": { - "babylon": { - "version": "6.18.0", - "resolved": "https://registry.npmjs.org/babylon/-/babylon-6.18.0.tgz", - "integrity": "sha512-q/UEjfGJ2Cm3oKV71DJz9d25TPnq5rhBVL2Q4fA5wcC3jcrdn7+SssEybFIxwAvvP+YCsCYNKughoF33GxgycQ==", - "dev": true - } - } - }, - "babel-types": { - "version": "6.26.0", - "resolved": "https://registry.npmjs.org/babel-types/-/babel-types-6.26.0.tgz", - "integrity": "sha1-o7Bz+Uq0nrb6Vc1lInozQ4BjJJc=", - "dev": true, - "requires": { - "babel-runtime": "^6.26.0", - "esutils": "^2.0.2", - "lodash": "^4.17.4", - "to-fast-properties": "^1.0.3" - }, - "dependencies": { - "esutils": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz", - "integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=", - "dev": true - } - } - }, - "babylon": { - "version": "7.0.0-beta.19", - "resolved": "https://registry.npmjs.org/babylon/-/babylon-7.0.0-beta.19.tgz", - "integrity": "sha512-Vg0C9s/REX6/WIXN37UKpv5ZhRi6A4pjHlpkE34+8/a6c2W1Q692n3hmc+SZG5lKRnaExLUbxtJ1SVT+KaCQ/A==", - "dev": true - }, - "balanced-match": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", - "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", - "dev": true - }, - "base": { - "version": "0.11.2", - "resolved": "https://registry.npmjs.org/base/-/base-0.11.2.tgz", - "integrity": "sha512-5T6P4xPgpp0YDFvSWwEZ4NoE3aM4QBQXDzmVbraCkFj8zHM+mba8SyqB5DbZWyR7mYHo6Y7BdQo3MoA4m0TeQg==", - "dev": true, - "optional": true, - "requires": { - "cache-base": "^1.0.1", - "class-utils": "^0.3.5", - "component-emitter": "^1.2.1", - "define-property": "^1.0.0", - "isobject": "^3.0.1", - "mixin-deep": "^1.2.0", - "pascalcase": "^0.1.1" - }, - "dependencies": { - "define-property": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", - "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", - "dev": true, - "optional": true, - "requires": { - "is-descriptor": "^1.0.0" - } - }, - "is-accessor-descriptor": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", - "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", - "dev": true, - "optional": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-data-descriptor": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", - "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", - "dev": true, - "optional": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-descriptor": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", - "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", - "dev": true, - "optional": true, - "requires": { - "is-accessor-descriptor": "^1.0.0", - "is-data-descriptor": "^1.0.0", - "kind-of": "^6.0.2" - } - }, - "isobject": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", - "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", - "dev": true, - "optional": true - }, - "kind-of": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", - "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", - "dev": true, - "optional": true - } - } - }, - "big.js": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/big.js/-/big.js-3.2.0.tgz", - "integrity": "sha512-+hN/Zh2D08Mx65pZ/4g5bsmNiZUuChDiQfTUQ7qJr4/kuopCr88xZsAXv6mBoZEsUI4OuGHlX59qE94K2mMW8Q==", - "dev": true - }, - "binary-extensions": { - "version": "1.13.0", - "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-1.13.0.tgz", - "integrity": "sha512-EgmjVLMn22z7eGGv3kcnHwSnJXmFHjISTY9E/S5lIcTD3Oxw05QTcBLNkJFzcb3cNueUdF/IN4U+d78V0zO8Hw==", - "dev": true, - "optional": true - }, - "bindings": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.2.1.tgz", - "integrity": "sha1-FK1hE4EtLTfXLme0ystLtyZQXxE=" - }, - "bluebird": { - "version": "3.5.1", - "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.5.1.tgz", - "integrity": "sha512-MKiLiV+I1AA596t9w1sQJ8jkiSr5+ZKi0WKrYGUn6d1Fx+Ij4tIj+m2WMQSGczs5jZVxV339chE8iwk6F64wjA==", - "dev": true - }, - "brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "dev": true, - "requires": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "braces": { - "version": "1.8.5", - "resolved": "https://registry.npmjs.org/braces/-/braces-1.8.5.tgz", - "integrity": "sha1-uneWLhLf+WnWt2cR6RS3N4V79qc=", - "dev": true, - "optional": true, - "requires": { - "expand-range": "^1.8.1", - "preserve": "^0.2.0", - "repeat-element": "^1.1.2" - } - }, - "browser-stdout": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz", - "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==", - "dev": true - }, - "buffer-from": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.0.tgz", - "integrity": "sha512-c5mRlguI/Pe2dSZmpER62rSCu0ryKmWddzRYsuXc50U2/g8jMOulc31VZMa4mYx31U5xsmSOpDCgH88Vl9cDGQ==", - "dev": true - }, - "builtin-modules": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz", - "integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=", - "dev": true - }, - "cache-base": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/cache-base/-/cache-base-1.0.1.tgz", - "integrity": "sha512-AKcdTnFSWATd5/GCPRxr2ChwIJ85CeyrEyjRHlKxQ56d4XJMGym0uAiKn0xbLOGOl3+yRpOTi484dVCEc5AUzQ==", - "dev": true, - "optional": true, - "requires": { - "collection-visit": "^1.0.0", - "component-emitter": "^1.2.1", - "get-value": "^2.0.6", - "has-value": "^1.0.0", - "isobject": "^3.0.1", - "set-value": "^2.0.0", - "to-object-path": "^0.3.0", - "union-value": "^1.0.0", - "unset-value": "^1.0.0" - }, - "dependencies": { - "isobject": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", - "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", - "dev": true, - "optional": true - } - } - }, - "catharsis": { - "version": "0.8.9", - "resolved": "https://registry.npmjs.org/catharsis/-/catharsis-0.8.9.tgz", - "integrity": "sha1-mMyJDKZS3S7w5ws3klMQ/56Q/Is=", - "dev": true, - "requires": { - "underscore-contrib": "~0.3.0" - } - }, - "chai": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chai/-/chai-4.1.2.tgz", - "integrity": "sha1-D2RYS6ZC8PKs4oBiefTwbKI61zw=", - "dev": true, - "requires": { - "assertion-error": "^1.0.1", - "check-error": "^1.0.1", - "deep-eql": "^3.0.0", - "get-func-name": "^2.0.0", - "pathval": "^1.0.0", - "type-detect": "^4.0.0" - } - }, - "chalk": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", - "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", - "dev": true, - "requires": { - "ansi-styles": "^2.2.1", - "escape-string-regexp": "^1.0.2", - "has-ansi": "^2.0.0", - "strip-ansi": "^3.0.0", - "supports-color": "^2.0.0" - }, - "dependencies": { - "supports-color": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", - "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", - "dev": true - } - } - }, - "check-error": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz", - "integrity": "sha1-V00xLt2Iu13YkS6Sht1sCu1KrII=", - "dev": true - }, - "chokidar": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-1.7.0.tgz", - "integrity": "sha1-eY5ol3gVHIB2tLNg5e3SjNortGg=", - "dev": true, - "optional": true, - "requires": { - "anymatch": "^1.3.0", - "async-each": "^1.0.0", - "fsevents": "^1.0.0", - "glob-parent": "^2.0.0", - "inherits": "^2.0.1", - "is-binary-path": "^1.0.0", - "is-glob": "^2.0.0", - "path-is-absolute": "^1.0.0", - "readdirp": "^2.0.0" - } - }, - "class-utils": { - "version": "0.3.6", - "resolved": "https://registry.npmjs.org/class-utils/-/class-utils-0.3.6.tgz", - "integrity": "sha512-qOhPa/Fj7s6TY8H8esGu5QNpMMQxz79h+urzrNYN6mn+9BnxlDGf5QZ+XeCDsxSjPqsSR56XOZOJmpeurnLMeg==", - "dev": true, - "optional": true, - "requires": { - "arr-union": "^3.1.0", - "define-property": "^0.2.5", - "isobject": "^3.0.0", - "static-extend": "^0.1.1" - }, - "dependencies": { - "define-property": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", - "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", - "dev": true, - "optional": true, - "requires": { - "is-descriptor": "^0.1.0" - } - }, - "isobject": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", - "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", - "dev": true, - "optional": true - } - } - }, - "collection-visit": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/collection-visit/-/collection-visit-1.0.0.tgz", - "integrity": "sha1-S8A3PBZLwykbTTaMgpzxqApZ3KA=", - "dev": true, - "optional": true, - "requires": { - "map-visit": "^1.0.0", - "object-visit": "^1.0.0" - } - }, - "color": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/color/-/color-3.0.0.tgz", - "integrity": "sha512-jCpd5+s0s0t7p3pHQKpnJ0TpQKKdleP71LWcA0aqiljpiuAkOSUFN/dyH8ZwF0hRmFlrIuRhufds1QyEP9EB+w==", - "dev": true, - "requires": { - "color-convert": "^1.9.1", - "color-string": "^1.5.2" - }, - "dependencies": { - "color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "dev": true, - "requires": { - "color-name": "1.1.3" - } - } - } - }, - "color-convert": { - "version": "1.9.0", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.0.tgz", - "integrity": "sha1-Gsz5fdc5uYO/mU1W/sj5WFNkG3o=", - "dev": true, - "requires": { - "color-name": "^1.1.1" - } - }, - "color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", - "dev": true - }, - "color-string": { - "version": "1.5.3", - "resolved": "https://registry.npmjs.org/color-string/-/color-string-1.5.3.tgz", - "integrity": "sha512-dC2C5qeWoYkxki5UAXapdjqO672AM4vZuPGRQfO8b5HKuKGBbKWpITyDYN7TOFKvRW7kOgAn3746clDBMDJyQw==", - "dev": true, - "requires": { - "color-name": "^1.0.0", - "simple-swizzle": "^0.2.2" - } - }, - "colornames": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/colornames/-/colornames-1.1.1.tgz", - "integrity": "sha1-+IiQMGhcfE/54qVZ9Qd+t2qBb5Y=", - "dev": true - }, - "colors": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/colors/-/colors-1.3.3.tgz", - "integrity": "sha512-mmGt/1pZqYRjMxB1axhTo16/snVZ5krrKkcmMeVKxzECMMXoCgnvTPp10QgHfcbQZw8Dq2jMNG6je4JlWU0gWg==", - "dev": true - }, - "colorspace": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/colorspace/-/colorspace-1.1.1.tgz", - "integrity": "sha512-pI3btWyiuz7Ken0BWh9Elzsmv2bM9AhA7psXib4anUXy/orfZ/E0MbQwhSOG/9L8hLlalqrU0UhOuqxW1YjmVw==", - "dev": true, - "requires": { - "color": "3.0.x", - "text-hex": "1.0.x" - } - }, - "commander": { - "version": "2.11.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.11.0.tgz", - "integrity": "sha512-b0553uYA5YAEGgyYIGYROzKQ7X5RAqedkfjiZxwi0kL1g3bOaBNNZfYkzt/CL0umgD5wc9Jec2FbB98CjkMRvQ==", - "dev": true - }, - "component-emitter": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.2.1.tgz", - "integrity": "sha1-E3kY1teCg/ffemt8WmPhQOaUJeY=", - "dev": true, - "optional": true - }, - "concat-map": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", - "dev": true - }, - "convert-source-map": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.6.0.tgz", - "integrity": "sha512-eFu7XigvxdZ1ETfbgPBohgyQ/Z++C0eEhTor0qRwBw9unw+L0/6V8wkSuGgzdThkiS5lSpdptOQPD8Ak40a+7A==", - "dev": true, - "requires": { - "safe-buffer": "~5.1.1" - } - }, - "copy-descriptor": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/copy-descriptor/-/copy-descriptor-0.1.1.tgz", - "integrity": "sha1-Z29us8OZl8LuGsOpJP1hJHSPV40=", - "dev": true, - "optional": true - }, - "core-js": { - "version": "2.6.5", - "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.6.5.tgz", - "integrity": "sha512-klh/kDpwX8hryYL14M9w/xei6vrv6sE8gTHDG7/T/+SEovB/G4ejwcfE/CBzO6Edsu+OETZMZ3wcX/EjUkrl5A==", - "dev": true - }, - "core-util-is": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", - "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", - "dev": true - }, - "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "requires": { - "ms": "2.0.0" - } - }, - "decode-uri-component": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz", - "integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=", - "dev": true, - "optional": true - }, - "deep-eql": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-3.0.1.tgz", - "integrity": "sha512-+QeIQyN5ZuO+3Uk5DYh6/1eKO0m0YmJFGNmFHGACpf1ClL1nmlV/p4gNgbl2pJGxgXb4faqo6UE+M5ACEMyVcw==", - "dev": true, - "requires": { - "type-detect": "^4.0.0" - } - }, - "define-property": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-2.0.2.tgz", - "integrity": "sha512-jwK2UV4cnPpbcG7+VRARKTZPUWowwXA8bzH5NP6ud0oeAxyYPuGZUAC7hMugpCdz4BeSZl2Dl9k66CHJ/46ZYQ==", - "dev": true, - "optional": true, - "requires": { - "is-descriptor": "^1.0.2", - "isobject": "^3.0.1" - }, - "dependencies": { - "is-accessor-descriptor": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", - "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", - "dev": true, - "optional": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-data-descriptor": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", - "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", - "dev": true, - "optional": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-descriptor": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", - "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", - "dev": true, - "optional": true, - "requires": { - "is-accessor-descriptor": "^1.0.0", - "is-data-descriptor": "^1.0.0", - "kind-of": "^6.0.2" - } - }, - "isobject": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", - "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", - "dev": true, - "optional": true - }, - "kind-of": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", - "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", - "dev": true, - "optional": true - } - } - }, - "detect-indent": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/detect-indent/-/detect-indent-4.0.0.tgz", - "integrity": "sha1-920GQ1LN9Docts5hnE7jqUdd4gg=", - "dev": true, - "requires": { - "repeating": "^2.0.0" - } - }, - "diagnostics": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/diagnostics/-/diagnostics-1.1.1.tgz", - "integrity": "sha512-8wn1PmdunLJ9Tqbx+Fx/ZEuHfJf4NKSN2ZBj7SJC/OWRWha843+WsTjqMe1B5E3p28jqBlp+mJ2fPVxPyNgYKQ==", - "dev": true, - "requires": { - "colorspace": "1.1.x", - "enabled": "1.0.x", - "kuler": "1.0.x" - } - }, - "diff": { - "version": "3.5.0", - "resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz", - "integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==", - "dev": true - }, - "doctrine": { - "version": "0.7.2", - "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-0.7.2.tgz", - "integrity": "sha1-fLhgNZujvpDgQLJrcpzkv6ZUxSM=", - "dev": true, - "requires": { - "esutils": "^1.1.6", - "isarray": "0.0.1" - } - }, - "emojis-list": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/emojis-list/-/emojis-list-2.1.0.tgz", - "integrity": "sha1-TapNnbAPmBmIDHn6RXrlsJof04k=", - "dev": true - }, - "enabled": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/enabled/-/enabled-1.0.2.tgz", - "integrity": "sha1-ll9lE9LC0cX0ZStkouM5ZGf8L5M=", - "dev": true, - "requires": { - "env-variable": "0.0.x" - } - }, - "env-variable": { - "version": "0.0.5", - "resolved": "https://registry.npmjs.org/env-variable/-/env-variable-0.0.5.tgz", - "integrity": "sha512-zoB603vQReOFvTg5xMl9I1P2PnHsHQQKTEowsKKD7nseUfJq6UWzK+4YtlWUO1nhiQUxe6XMkk+JleSZD1NZFA==", - "dev": true - }, - "escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", - "dev": true - }, - "esutils": { - "version": "1.1.6", - "resolved": "https://registry.npmjs.org/esutils/-/esutils-1.1.6.tgz", - "integrity": "sha1-wBzKqa5LiXxtDD4hCuUvPHqEQ3U=", - "dev": true - }, - "expand-brackets": { - "version": "0.1.5", - "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-0.1.5.tgz", - "integrity": "sha1-3wcoTjQqgHzXM6xa9yQR5YHRF3s=", - "dev": true, - "optional": true, - "requires": { - "is-posix-bracket": "^0.1.0" - } - }, - "expand-range": { - "version": "1.8.2", - "resolved": "https://registry.npmjs.org/expand-range/-/expand-range-1.8.2.tgz", - "integrity": "sha1-opnv/TNf4nIeuujiV+x5ZE/IUzc=", - "dev": true, - "optional": true, - "requires": { - "fill-range": "^2.1.0" - } - }, - "extend-shallow": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-3.0.2.tgz", - "integrity": "sha1-Jqcarwc7OfshJxcnRhMcJwQCjbg=", - "dev": true, - "optional": true, - "requires": { - "assign-symbols": "^1.0.0", - "is-extendable": "^1.0.1" - }, - "dependencies": { - "is-extendable": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz", - "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", - "dev": true, - "optional": true, - "requires": { - "is-plain-object": "^2.0.4" - } - } - } - }, - "extglob": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/extglob/-/extglob-0.3.2.tgz", - "integrity": "sha1-Lhj/PS9JqydlzskCPwEdqo2DSaE=", - "dev": true, - "optional": true, - "requires": { - "is-extglob": "^1.0.0" - } - }, - "fast-safe-stringify": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/fast-safe-stringify/-/fast-safe-stringify-2.0.6.tgz", - "integrity": "sha512-q8BZ89jjc+mz08rSxROs8VsrBBcn1SIw1kq9NjolL509tkABRk9io01RAjSaEv1Xb2uFLt8VtRiZbGp5H8iDtg==", - "dev": true - }, - "fecha": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/fecha/-/fecha-2.3.3.tgz", - "integrity": "sha512-lUGBnIamTAwk4znq5BcqsDaxSmZ9nDVJaij6NvRt/Tg4R69gERA+otPKbS86ROw9nxVMw2/mp1fnaiWqbs6Sdg==", - "dev": true - }, - "ffi": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/ffi/-/ffi-2.3.0.tgz", - "integrity": "sha512-vkPA9Hf9CVuQ5HeMZykYvrZF2QNJ/iKGLkyDkisBnoOOFeFXZQhUPxBARPBIZMJVulvBI2R+jgofW03gyPpJcQ==", - "requires": { - "bindings": "~1.2.0", - "debug": "2", - "nan": "2", - "ref": "1", - "ref-struct": "1" - } - }, - "filename-regex": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/filename-regex/-/filename-regex-2.0.1.tgz", - "integrity": "sha1-wcS5vuPglyXdsQa3XB4wH+LxiyY=", - "dev": true, - "optional": true - }, - "fill-range": { - "version": "2.2.4", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-2.2.4.tgz", - "integrity": "sha512-cnrcCbj01+j2gTG921VZPnHbjmdAf8oQV/iGeV2kZxGSyfYjjTyY79ErsK1WJWMpw6DaApEX72binqJE+/d+5Q==", - "dev": true, - "optional": true, - "requires": { - "is-number": "^2.1.0", - "isobject": "^2.0.0", - "randomatic": "^3.0.0", - "repeat-element": "^1.1.2", - "repeat-string": "^1.5.2" - } - }, - "for-in": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz", - "integrity": "sha1-gQaNKVqBQuwKxybG4iAMMPttXoA=", - "dev": true, - "optional": true - }, - "for-own": { - "version": "0.1.5", - "resolved": "https://registry.npmjs.org/for-own/-/for-own-0.1.5.tgz", - "integrity": "sha1-UmXGgaTylNq78XyVCbZ2OqhFEM4=", - "dev": true, - "optional": true, - "requires": { - "for-in": "^1.0.1" - } - }, - "formatio": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/formatio/-/formatio-1.2.0.tgz", - "integrity": "sha1-87IWfZBoxGmKjVH092CjmlTYGOs=", - "dev": true, - "requires": { - "samsam": "1.x" - } - }, - "fragment-cache": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/fragment-cache/-/fragment-cache-0.2.1.tgz", - "integrity": "sha1-QpD60n8T6Jvn8zeZxrxaCr//DRk=", - "dev": true, - "optional": true, - "requires": { - "map-cache": "^0.2.2" - } - }, - "fs-extra": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-4.0.2.tgz", - "integrity": "sha1-+RcExT0bRh+JNFKwwwfZmXZHq2s=", - "requires": { - "graceful-fs": "^4.1.2", - "jsonfile": "^4.0.0", - "universalify": "^0.1.0" - }, - "dependencies": { - "graceful-fs": { - "version": "4.1.11", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", - "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=" - } - } - }, - "fs-readdir-recursive": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/fs-readdir-recursive/-/fs-readdir-recursive-1.1.0.tgz", - "integrity": "sha512-GNanXlVr2pf02+sPN40XN8HG+ePaNcvM0q5mZBd668Obwb0yD5GiUbZOFgwn8kGMY6I3mdyDJzieUy3PTYyTRA==", - "dev": true - }, - "fs.realpath": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", - "dev": true - }, - "fsevents": { - "version": "1.2.7", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.7.tgz", - "integrity": "sha512-Pxm6sI2MeBD7RdD12RYsqaP0nMiwx8eZBXCa6z2L+mRHm2DYrOYwihmhjpkdjUHwQhslWQjRpEgNq4XvBmaAuw==", - "dev": true, - "optional": true, - "requires": { - "nan": "^2.9.2", - "node-pre-gyp": "^0.10.0" - }, - "dependencies": { - "abbrev": { - "version": "1.1.1", - "bundled": true, - "dev": true, - "optional": true - }, - "ansi-regex": { - "version": "2.1.1", - "bundled": true, - "dev": true, - "optional": true - }, - "aproba": { - "version": "1.2.0", - "bundled": true, - "dev": true, - "optional": true - }, - "are-we-there-yet": { - "version": "1.1.5", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "delegates": "^1.0.0", - "readable-stream": "^2.0.6" - } - }, - "balanced-match": { - "version": "1.0.0", - "bundled": true, - "dev": true, - "optional": true - }, - "brace-expansion": { - "version": "1.1.11", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "chownr": { - "version": "1.1.1", - "bundled": true, - "dev": true, - "optional": true - }, - "code-point-at": { - "version": "1.1.0", - "bundled": true, - "dev": true, - "optional": true - }, - "concat-map": { - "version": "0.0.1", - "bundled": true, - "dev": true, - "optional": true - }, - "console-control-strings": { - "version": "1.1.0", - "bundled": true, - "dev": true, - "optional": true - }, - "core-util-is": { - "version": "1.0.2", - "bundled": true, - "dev": true, - "optional": true - }, - "debug": { - "version": "2.6.9", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "ms": "2.0.0" - } - }, - "deep-extend": { - "version": "0.6.0", - "bundled": true, - "dev": true, - "optional": true - }, - "delegates": { - "version": "1.0.0", - "bundled": true, - "dev": true, - "optional": true - }, - "detect-libc": { - "version": "1.0.3", - "bundled": true, - "dev": true, - "optional": true - }, - "fs-minipass": { - "version": "1.2.5", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "minipass": "^2.2.1" - } - }, - "fs.realpath": { - "version": "1.0.0", - "bundled": true, - "dev": true, - "optional": true - }, - "gauge": { - "version": "2.7.4", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "aproba": "^1.0.3", - "console-control-strings": "^1.0.0", - "has-unicode": "^2.0.0", - "object-assign": "^4.1.0", - "signal-exit": "^3.0.0", - "string-width": "^1.0.1", - "strip-ansi": "^3.0.1", - "wide-align": "^1.1.0" - } - }, - "glob": { - "version": "7.1.3", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - } - }, - "has-unicode": { - "version": "2.0.1", - "bundled": true, - "dev": true, - "optional": true - }, - "iconv-lite": { - "version": "0.4.24", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "safer-buffer": ">= 2.1.2 < 3" - } - }, - "ignore-walk": { - "version": "3.0.1", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "minimatch": "^3.0.4" - } - }, - "inflight": { - "version": "1.0.6", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "once": "^1.3.0", - "wrappy": "1" - } - }, - "inherits": { - "version": "2.0.3", - "bundled": true, - "dev": true, - "optional": true - }, - "ini": { - "version": "1.3.5", - "bundled": true, - "dev": true, - "optional": true - }, - "is-fullwidth-code-point": { - "version": "1.0.0", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "number-is-nan": "^1.0.0" - } - }, - "isarray": { - "version": "1.0.0", - "bundled": true, - "dev": true, - "optional": true - }, - "minimatch": { - "version": "3.0.4", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "brace-expansion": "^1.1.7" - } - }, - "minimist": { - "version": "0.0.8", - "bundled": true, - "dev": true, - "optional": true - }, - "minipass": { - "version": "2.3.5", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "safe-buffer": "^5.1.2", - "yallist": "^3.0.0" - } - }, - "minizlib": { - "version": "1.2.1", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "minipass": "^2.2.1" - } - }, - "mkdirp": { - "version": "0.5.1", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "minimist": "0.0.8" - } - }, - "ms": { - "version": "2.0.0", - "bundled": true, - "dev": true, - "optional": true - }, - "needle": { - "version": "2.2.4", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "debug": "^2.1.2", - "iconv-lite": "^0.4.4", - "sax": "^1.2.4" - } - }, - "node-pre-gyp": { - "version": "0.10.3", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "detect-libc": "^1.0.2", - "mkdirp": "^0.5.1", - "needle": "^2.2.1", - "nopt": "^4.0.1", - "npm-packlist": "^1.1.6", - "npmlog": "^4.0.2", - "rc": "^1.2.7", - "rimraf": "^2.6.1", - "semver": "^5.3.0", - "tar": "^4" - } - }, - "nopt": { - "version": "4.0.1", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "abbrev": "1", - "osenv": "^0.1.4" - } - }, - "npm-bundled": { - "version": "1.0.5", - "bundled": true, - "dev": true, - "optional": true - }, - "npm-packlist": { - "version": "1.2.0", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "ignore-walk": "^3.0.1", - "npm-bundled": "^1.0.1" - } - }, - "npmlog": { - "version": "4.1.2", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "are-we-there-yet": "~1.1.2", - "console-control-strings": "~1.1.0", - "gauge": "~2.7.3", - "set-blocking": "~2.0.0" - } - }, - "number-is-nan": { - "version": "1.0.1", - "bundled": true, - "dev": true, - "optional": true - }, - "object-assign": { - "version": "4.1.1", - "bundled": true, - "dev": true, - "optional": true - }, - "once": { - "version": "1.4.0", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "wrappy": "1" - } - }, - "os-homedir": { - "version": "1.0.2", - "bundled": true, - "dev": true, - "optional": true - }, - "os-tmpdir": { - "version": "1.0.2", - "bundled": true, - "dev": true, - "optional": true - }, - "osenv": { - "version": "0.1.5", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "os-homedir": "^1.0.0", - "os-tmpdir": "^1.0.0" - } - }, - "path-is-absolute": { - "version": "1.0.1", - "bundled": true, - "dev": true, - "optional": true - }, - "process-nextick-args": { - "version": "2.0.0", - "bundled": true, - "dev": true, - "optional": true - }, - "rc": { - "version": "1.2.8", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "deep-extend": "^0.6.0", - "ini": "~1.3.0", - "minimist": "^1.2.0", - "strip-json-comments": "~2.0.1" - }, - "dependencies": { - "minimist": { - "version": "1.2.0", - "bundled": true, - "dev": true, - "optional": true - } - } - }, - "readable-stream": { - "version": "2.3.6", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "rimraf": { - "version": "2.6.3", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "glob": "^7.1.3" - } - }, - "safe-buffer": { - "version": "5.1.2", - "bundled": true, - "dev": true, - "optional": true - }, - "safer-buffer": { - "version": "2.1.2", - "bundled": true, - "dev": true, - "optional": true - }, - "sax": { - "version": "1.2.4", - "bundled": true, - "dev": true, - "optional": true - }, - "semver": { - "version": "5.6.0", - "bundled": true, - "dev": true, - "optional": true - }, - "set-blocking": { - "version": "2.0.0", - "bundled": true, - "dev": true, - "optional": true - }, - "signal-exit": { - "version": "3.0.2", - "bundled": true, - "dev": true, - "optional": true - }, - "string-width": { - "version": "1.0.2", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "code-point-at": "^1.0.0", - "is-fullwidth-code-point": "^1.0.0", - "strip-ansi": "^3.0.0" - } - }, - "string_decoder": { - "version": "1.1.1", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "safe-buffer": "~5.1.0" - } - }, - "strip-ansi": { - "version": "3.0.1", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "ansi-regex": "^2.0.0" - } - }, - "strip-json-comments": { - "version": "2.0.1", - "bundled": true, - "dev": true, - "optional": true - }, - "tar": { - "version": "4.4.8", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "chownr": "^1.1.1", - "fs-minipass": "^1.2.5", - "minipass": "^2.3.4", - "minizlib": "^1.1.1", - "mkdirp": "^0.5.0", - "safe-buffer": "^5.1.2", - "yallist": "^3.0.2" - } - }, - "util-deprecate": { - "version": "1.0.2", - "bundled": true, - "dev": true, - "optional": true - }, - "wide-align": { - "version": "1.1.3", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "string-width": "^1.0.2 || 2" - } - }, - "wrappy": { - "version": "1.0.2", - "bundled": true, - "dev": true, - "optional": true - }, - "yallist": { - "version": "3.0.3", - "bundled": true, - "dev": true, - "optional": true - } - } - }, - "get-func-name": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.0.tgz", - "integrity": "sha1-6td0q+5y4gQJQzoGY2YCPdaIekE=", - "dev": true - }, - "get-value": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/get-value/-/get-value-2.0.6.tgz", - "integrity": "sha1-3BXKHGcjh8p2vTesCjlbogQqLCg=", - "dev": true, - "optional": true - }, - "glob": { - "version": "7.1.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.3.tgz", - "integrity": "sha512-vcfuiIxogLV4DlGBHIUOwI0IbrJ8HWPc4MU7HzviGeNho/UJDfi6B5p3sHeWIQ0KGIU0Jpxi5ZHxemQfLkkAwQ==", - "dev": true, - "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - } - }, - "glob-base": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/glob-base/-/glob-base-0.3.0.tgz", - "integrity": "sha1-27Fk9iIbHAscz4Kuoyi0l98Oo8Q=", - "dev": true, - "optional": true, - "requires": { - "glob-parent": "^2.0.0", - "is-glob": "^2.0.0" - } - }, - "glob-parent": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-2.0.0.tgz", - "integrity": "sha1-gTg9ctsFT8zPUzbaqQLxgvbtuyg=", - "dev": true, - "optional": true, - "requires": { - "is-glob": "^2.0.0" - } - }, - "globals": { - "version": "9.18.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-9.18.0.tgz", - "integrity": "sha512-S0nG3CLEQiY/ILxqtztTWH/3iRRdyBLw6KMDxnKMchrtbj2OFmehVh0WUCfW3DUrIgx/qFrJPICrq4Z4sTR9UQ==", - "dev": true - }, - "graceful-fs": { - "version": "4.1.11", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", - "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=", - "dev": true - }, - "growl": { - "version": "1.10.5", - "resolved": "https://registry.npmjs.org/growl/-/growl-1.10.5.tgz", - "integrity": "sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA==", - "dev": true - }, - "handlebars": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.1.2.tgz", - "integrity": "sha512-nvfrjqvt9xQ8Z/w0ijewdD/vvWDTOweBUm96NTr66Wfvo1mJenBLwcYmPs3TIBP5ruzYGD7Hx/DaM9RmhroGPw==", - "dev": true, - "requires": { - "neo-async": "^2.6.0", - "optimist": "^0.6.1", - "source-map": "^0.6.1", - "uglify-js": "^3.1.4" - } - }, - "has-ansi": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", - "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=", - "dev": true, - "requires": { - "ansi-regex": "^2.0.0" - } - }, - "has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", - "dev": true - }, - "has-value": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/has-value/-/has-value-1.0.0.tgz", - "integrity": "sha1-GLKB2lhbHFxR3vJMkw7SmgvmsXc=", - "dev": true, - "optional": true, - "requires": { - "get-value": "^2.0.6", - "has-values": "^1.0.0", - "isobject": "^3.0.0" - }, - "dependencies": { - "isobject": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", - "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", - "dev": true, - "optional": true - } - } - }, - "has-values": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/has-values/-/has-values-1.0.0.tgz", - "integrity": "sha1-lbC2P+whRmGab+V/51Yo1aOe/k8=", - "dev": true, - "optional": true, - "requires": { - "is-number": "^3.0.0", - "kind-of": "^4.0.0" - }, - "dependencies": { - "is-number": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", - "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", - "dev": true, - "optional": true, - "requires": { - "kind-of": "^3.0.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "optional": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "kind-of": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-4.0.0.tgz", - "integrity": "sha1-IIE989cSkosgc3hpGkUGb65y3Vc=", - "dev": true, - "optional": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "he": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/he/-/he-1.1.1.tgz", - "integrity": "sha1-k0EP0hsAlzUVH4howvJx80J+I/0=", - "dev": true - }, - "highlight.js": { - "version": "9.12.0", - "resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-9.12.0.tgz", - "integrity": "sha1-5tnb5Xy+/mB1HwKvM2GVhwyQwB4=", - "dev": true - }, - "home-or-tmp": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/home-or-tmp/-/home-or-tmp-2.0.0.tgz", - "integrity": "sha1-42w/LSyufXRqhX440Y1fMqeILbg=", - "dev": true, - "requires": { - "os-homedir": "^1.0.0", - "os-tmpdir": "^1.0.1" - } - }, - "inflight": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", - "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", - "dev": true, - "requires": { - "once": "^1.3.0", - "wrappy": "1" - } - }, - "inherits": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", - "dev": true - }, - "interpret": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/interpret/-/interpret-1.1.0.tgz", - "integrity": "sha1-ftGxQQxqDg94z5XTuEQMY/eLhhQ=", - "dev": true - }, - "invariant": { - "version": "2.2.4", - "resolved": "https://registry.npmjs.org/invariant/-/invariant-2.2.4.tgz", - "integrity": "sha512-phJfQVBuaJM5raOpJjSfkiD6BpbCE4Ns//LaXl6wGYtUBY83nWS6Rf9tXm2e8VaK60JEjYldbPif/A2B1C2gNA==", - "dev": true, - "requires": { - "loose-envify": "^1.0.0" - } - }, - "is-accessor-descriptor": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", - "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", - "dev": true, - "optional": true, - "requires": { - "kind-of": "^3.0.2" - } - }, - "is-arrayish": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.3.2.tgz", - "integrity": "sha512-eVRqCvVlZbuw3GrM63ovNSNAeA1K16kaR/LRY/92w0zxQ5/1YzwblUX652i4Xs9RwAGjW9d9y6X88t8OaAJfWQ==", - "dev": true - }, - "is-binary-path": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-1.0.1.tgz", - "integrity": "sha1-dfFmQrSA8YenEcgUFh/TpKdlWJg=", - "dev": true, - "optional": true, - "requires": { - "binary-extensions": "^1.0.0" - } - }, - "is-buffer": { - "version": "1.1.6", - "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", - "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", - "dev": true, - "optional": true - }, - "is-data-descriptor": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", - "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", - "dev": true, - "optional": true, - "requires": { - "kind-of": "^3.0.2" - } - }, - "is-descriptor": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", - "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", - "dev": true, - "optional": true, - "requires": { - "is-accessor-descriptor": "^0.1.6", - "is-data-descriptor": "^0.1.4", - "kind-of": "^5.0.0" - }, - "dependencies": { - "kind-of": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", - "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", - "dev": true, - "optional": true - } - } - }, - "is-dotfile": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/is-dotfile/-/is-dotfile-1.0.3.tgz", - "integrity": "sha1-pqLzL/0t+wT1yiXs0Pa4PPeYoeE=", - "dev": true, - "optional": true - }, - "is-equal-shallow": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/is-equal-shallow/-/is-equal-shallow-0.1.3.tgz", - "integrity": "sha1-IjgJj8Ih3gvPpdnqxMRdY4qhxTQ=", - "dev": true, - "optional": true, - "requires": { - "is-primitive": "^2.0.0" - } - }, - "is-extendable": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz", - "integrity": "sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik=", - "dev": true, - "optional": true - }, - "is-extglob": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-1.0.0.tgz", - "integrity": "sha1-rEaBd8SUNAWgkvyPKXYMb/xiBsA=", - "dev": true, - "optional": true - }, - "is-finite": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-finite/-/is-finite-1.0.2.tgz", - "integrity": "sha1-zGZ3aVYCvlUO8R6LSqYwU0K20Ko=", - "dev": true, - "requires": { - "number-is-nan": "^1.0.0" - } - }, - "is-glob": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-2.0.1.tgz", - "integrity": "sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM=", - "dev": true, - "optional": true, - "requires": { - "is-extglob": "^1.0.0" - } - }, - "is-number": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-2.1.0.tgz", - "integrity": "sha1-Afy7s5NGOlSPL0ZszhbezknbkI8=", - "dev": true, - "optional": true, - "requires": { - "kind-of": "^3.0.2" - } - }, - "is-plain-object": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", - "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", - "dev": true, - "optional": true, - "requires": { - "isobject": "^3.0.1" - }, - "dependencies": { - "isobject": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", - "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", - "dev": true, - "optional": true - } - } - }, - "is-posix-bracket": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/is-posix-bracket/-/is-posix-bracket-0.1.1.tgz", - "integrity": "sha1-MzTceXdDaOkvAW5vvAqI9c1ua8Q=", - "dev": true, - "optional": true - }, - "is-primitive": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-primitive/-/is-primitive-2.0.0.tgz", - "integrity": "sha1-IHurkWOEmcB7Kt8kCkGochADRXU=", - "dev": true, - "optional": true - }, - "is-stream": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", - "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=", - "dev": true - }, - "is-windows": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.2.tgz", - "integrity": "sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA==", - "dev": true, - "optional": true - }, - "isarray": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", - "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=", - "dev": true - }, - "isobject": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-2.1.0.tgz", - "integrity": "sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk=", - "dev": true, - "optional": true, - "requires": { - "isarray": "1.0.0" - }, - "dependencies": { - "isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", - "dev": true, - "optional": true - } - } - }, - "js-tokens": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz", - "integrity": "sha1-mGbfOVECEw449/mWvOtlRDIJwls=", - "dev": true - }, - "js2xmlparser": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/js2xmlparser/-/js2xmlparser-3.0.0.tgz", - "integrity": "sha1-P7YOqgicVED5MZ9RdgzNB+JJlzM=", - "dev": true, - "requires": { - "xmlcreate": "^1.0.1" - } - }, - "jsdoc": { - "version": "3.5.5", - "resolved": "https://registry.npmjs.org/jsdoc/-/jsdoc-3.5.5.tgz", - "integrity": "sha512-6PxB65TAU4WO0Wzyr/4/YhlGovXl0EVYfpKbpSroSj0qBxT4/xod/l40Opkm38dRHRdQgdeY836M0uVnJQG7kg==", - "dev": true, - "requires": { - "babylon": "7.0.0-beta.19", - "bluebird": "~3.5.0", - "catharsis": "~0.8.9", - "escape-string-regexp": "~1.0.5", - "js2xmlparser": "~3.0.0", - "klaw": "~2.0.0", - "marked": "~0.3.6", - "mkdirp": "~0.5.1", - "requizzle": "~0.2.1", - "strip-json-comments": "~2.0.1", - "taffydb": "2.6.2", - "underscore": "~1.8.3" - } - }, - "jsesc": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-1.3.0.tgz", - "integrity": "sha1-RsP+yMGJKxKwgz25vHYiF226s0s=", - "dev": true - }, - "json5": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/json5/-/json5-0.5.1.tgz", - "integrity": "sha1-Hq3nrMASA0rYTiOWdn6tn6VJWCE=", - "dev": true - }, - "jsonfile": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", - "integrity": "sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=", - "requires": { - "graceful-fs": "^4.1.6" - }, - "dependencies": { - "graceful-fs": { - "version": "4.1.11", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", - "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=", - "optional": true - } - } - }, - "just-extend": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/just-extend/-/just-extend-4.0.2.tgz", - "integrity": "sha512-FrLwOgm+iXrPV+5zDU6Jqu4gCRXbWEQg2O3SKONsWE4w7AXFRkryS53bpWdaL9cNol+AmR3AEYz6kn+o0fCPnw==", - "dev": true - }, - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "optional": true, - "requires": { - "is-buffer": "^1.1.5" - } - }, - "klaw": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/klaw/-/klaw-2.0.0.tgz", - "integrity": "sha1-WcEo4Nxc5BAgEVEZTuucv4WGUPY=", - "dev": true, - "requires": { - "graceful-fs": "^4.1.9" - } - }, - "kuler": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/kuler/-/kuler-1.0.1.tgz", - "integrity": "sha512-J9nVUucG1p/skKul6DU3PUZrhs0LPulNaeUOox0IyXDi8S4CztTHs1gQphhuZmzXG7VOQSf6NJfKuzteQLv9gQ==", - "dev": true, - "requires": { - "colornames": "^1.1.1" - } - }, - "loader-utils": { - "version": "0.2.17", - "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-0.2.17.tgz", - "integrity": "sha1-+G5jdNQyBabmxg6RlvF8Apm/s0g=", - "dev": true, - "requires": { - "big.js": "^3.1.3", - "emojis-list": "^2.0.0", - "json5": "^0.5.0", - "object-assign": "^4.0.1" - } - }, - "lodash": { - "version": "4.17.13", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.13.tgz", - "integrity": "sha512-vm3/XWXfWtRua0FkUyEHBZy8kCPjErNBT9fJx8Zvs+U6zjqPbTUOpkaoum3O5uiA8sm+yNMHXfYkTUHFoMxFNA==" - }, - "lodash.get": { - "version": "4.4.2", - "resolved": "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz", - "integrity": "sha1-LRd/ZS+jHpObRDjVNBSZ36OCXpk=", - "dev": true - }, - "logform": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/logform/-/logform-2.1.2.tgz", - "integrity": "sha512-+lZh4OpERDBLqjiwDLpAWNQu6KMjnlXH2ByZwCuSqVPJletw0kTWJf5CgSNAUKn1KUkv3m2cUz/LK8zyEy7wzQ==", - "dev": true, - "requires": { - "colors": "^1.2.1", - "fast-safe-stringify": "^2.0.4", - "fecha": "^2.3.3", - "ms": "^2.1.1", - "triple-beam": "^1.3.0" - }, - "dependencies": { - "ms": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", - "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==", - "dev": true - } - } - }, - "lolex": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/lolex/-/lolex-2.3.0.tgz", - "integrity": "sha512-rPO6R1t8PjYL6xbsFUg7aByKkWAql907na6powPBORVs4DCm8aMBUkL4+6CXO0gEIV8vtu3mWV0FB8ZaCYPBmA==", - "dev": true - }, - "loose-envify": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", - "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", - "dev": true, - "requires": { - "js-tokens": "^3.0.0 || ^4.0.0" - } - }, - "make-error": { - "version": "1.3.4", - "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.4.tgz", - "integrity": "sha512-0Dab5btKVPhibSalc9QGXb559ED7G7iLjFXBaj9Wq8O3vorueR5K5jaE3hkG6ZQINyhA/JgG6Qk4qdFQjsYV6g==", - "dev": true - }, - "map-cache": { - "version": "0.2.2", - "resolved": "https://registry.npmjs.org/map-cache/-/map-cache-0.2.2.tgz", - "integrity": "sha1-wyq9C9ZSXZsFFkW7TyasXcmKDb8=", - "dev": true, - "optional": true - }, - "map-visit": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/map-visit/-/map-visit-1.0.0.tgz", - "integrity": "sha1-7Nyo8TFE5mDxtb1B8S80edmN+48=", - "dev": true, - "optional": true, - "requires": { - "object-visit": "^1.0.0" - } - }, - "marked": { - "version": "0.3.19", - "resolved": "https://registry.npmjs.org/marked/-/marked-0.3.19.tgz", - "integrity": "sha512-ea2eGWOqNxPcXv8dyERdSr/6FmzvWwzjMxpfGB/sbMccXoct+xY+YukPD+QTUZwyvK7BZwcr4m21WBOW41pAkg==", - "dev": true - }, - "math-random": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/math-random/-/math-random-1.0.4.tgz", - "integrity": "sha512-rUxjysqif/BZQH2yhd5Aaq7vXMSx9NdEsQcyA07uEzIvxgI7zIr33gGsh+RU0/XjmQpCW7RsVof1vlkvQVCK5A==", - "dev": true, - "optional": true - }, - "micromatch": { - "version": "2.3.11", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-2.3.11.tgz", - "integrity": "sha1-hmd8l9FyCzY0MdBNDRUpO9OMFWU=", - "dev": true, - "optional": true, - "requires": { - "arr-diff": "^2.0.0", - "array-unique": "^0.2.1", - "braces": "^1.8.2", - "expand-brackets": "^0.1.4", - "extglob": "^0.3.1", - "filename-regex": "^2.0.0", - "is-extglob": "^1.0.0", - "is-glob": "^2.0.1", - "kind-of": "^3.0.2", - "normalize-path": "^2.0.1", - "object.omit": "^2.0.0", - "parse-glob": "^3.0.4", - "regex-cache": "^0.4.2" - } - }, - "minimatch": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", - "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", - "dev": true, - "requires": { - "brace-expansion": "^1.1.7" - } - }, - "minimist": { - "version": "0.0.8", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", - "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", - "dev": true - }, - "mixin-deep": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/mixin-deep/-/mixin-deep-1.3.1.tgz", - "integrity": "sha512-8ZItLHeEgaqEvd5lYBXfm4EZSFCX29Jb9K+lAHhDKzReKBQKj3R+7NOF6tjqYi9t4oI8VUfaWITJQm86wnXGNQ==", - "dev": true, - "optional": true, - "requires": { - "for-in": "^1.0.2", - "is-extendable": "^1.0.1" - }, - "dependencies": { - "is-extendable": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz", - "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", - "dev": true, - "optional": true, - "requires": { - "is-plain-object": "^2.0.4" - } - } - } - }, - "mkdirp": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", - "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", - "dev": true, - "requires": { - "minimist": "0.0.8" - } - }, - "mocha": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-5.2.0.tgz", - "integrity": "sha512-2IUgKDhc3J7Uug+FxMXuqIyYzH7gJjXECKe/w43IGgQHTSj3InJi+yAA7T24L9bQMRKiUEHxEX37G5JpVUGLcQ==", - "dev": true, - "requires": { - "browser-stdout": "1.3.1", - "commander": "2.15.1", - "debug": "3.1.0", - "diff": "3.5.0", - "escape-string-regexp": "1.0.5", - "glob": "7.1.2", - "growl": "1.10.5", - "he": "1.1.1", - "minimatch": "3.0.4", - "mkdirp": "0.5.1", - "supports-color": "5.4.0" - }, - "dependencies": { - "commander": { - "version": "2.15.1", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.15.1.tgz", - "integrity": "sha512-VlfT9F3V0v+jr4yxPc5gg9s62/fIVWsd2Bk2iD435um1NlGMYdVCq+MjcXnhYq2icNOizHr1kK+5TI6H0Hy0ag==", - "dev": true - }, - "debug": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", - "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", - "dev": true, - "requires": { - "ms": "2.0.0" - } - }, - "glob": { - "version": "7.1.2", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", - "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", - "dev": true, - "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - } - } - } - }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" - }, - "nan": { - "version": "2.12.1", - "resolved": "https://registry.npmjs.org/nan/-/nan-2.12.1.tgz", - "integrity": "sha512-JY7V6lRkStKcKTvHO5NVSQRv+RV+FIL5pvDoLiAtSL9pKlC5x9PKQcZDsq7m4FO4d57mkhC6Z+QhAh3Jdk5JFw==" - }, - "nanomatch": { - "version": "1.2.13", - "resolved": "https://registry.npmjs.org/nanomatch/-/nanomatch-1.2.13.tgz", - "integrity": "sha512-fpoe2T0RbHwBTBUOftAfBPaDEi06ufaUai0mE6Yn1kacc3SnTErfb/h+X94VXzI64rKFHYImXSvdwGGCmwOqCA==", - "dev": true, - "optional": true, - "requires": { - "arr-diff": "^4.0.0", - "array-unique": "^0.3.2", - "define-property": "^2.0.2", - "extend-shallow": "^3.0.2", - "fragment-cache": "^0.2.1", - "is-windows": "^1.0.2", - "kind-of": "^6.0.2", - "object.pick": "^1.3.0", - "regex-not": "^1.0.0", - "snapdragon": "^0.8.1", - "to-regex": "^3.0.1" - }, - "dependencies": { - "arr-diff": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-4.0.0.tgz", - "integrity": "sha1-1kYQdP6/7HHn4VI1dhoyml3HxSA=", - "dev": true, - "optional": true - }, - "array-unique": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.3.2.tgz", - "integrity": "sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg=", - "dev": true, - "optional": true - }, - "kind-of": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", - "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", - "dev": true, - "optional": true - } - } - }, - "neo-async": { - "version": "2.6.1", - "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.1.tgz", - "integrity": "sha512-iyam8fBuCUpWeKPGpaNMetEocMt364qkCsfL9JuhjXX6dRnguRVOfk2GZaDpPjcOKiiXCPINZC1GczQ7iTq3Zw==", - "dev": true - }, - "nise": { - "version": "1.4.10", - "resolved": "https://registry.npmjs.org/nise/-/nise-1.4.10.tgz", - "integrity": "sha512-sa0RRbj53dovjc7wombHmVli9ZihXbXCQ2uH3TNm03DyvOSIQbxg+pbqDKrk2oxMK1rtLGVlKxcB9rrc6X5YjA==", - "dev": true, - "requires": { - "@sinonjs/formatio": "^3.1.0", - "@sinonjs/text-encoding": "^0.7.1", - "just-extend": "^4.0.2", - "lolex": "^2.3.2", - "path-to-regexp": "^1.7.0" - }, - "dependencies": { - "lolex": { - "version": "2.7.5", - "resolved": "https://registry.npmjs.org/lolex/-/lolex-2.7.5.tgz", - "integrity": "sha512-l9x0+1offnKKIzYVjyXU2SiwhXDLekRzKyhnbyldPHvC7BvLPVpdNUNR2KeMAiCN2D/kLNttZgQD5WjSxuBx3Q==", - "dev": true - } - } - }, - "normalize-path": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz", - "integrity": "sha1-GrKLVW4Zg2Oowab35vogE3/mrtk=", - "dev": true, - "optional": true, - "requires": { - "remove-trailing-separator": "^1.0.1" - } - }, - "number-is-nan": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", - "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", - "dev": true - }, - "object-assign": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", - "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", - "dev": true - }, - "object-copy": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/object-copy/-/object-copy-0.1.0.tgz", - "integrity": "sha1-fn2Fi3gb18mRpBupde04EnVOmYw=", - "dev": true, - "optional": true, - "requires": { - "copy-descriptor": "^0.1.0", - "define-property": "^0.2.5", - "kind-of": "^3.0.3" - }, - "dependencies": { - "define-property": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", - "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", - "dev": true, - "optional": true, - "requires": { - "is-descriptor": "^0.1.0" - } - } - } - }, - "object-visit": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/object-visit/-/object-visit-1.0.1.tgz", - "integrity": "sha1-95xEk68MU3e1n+OdOV5BBC3QRbs=", - "dev": true, - "optional": true, - "requires": { - "isobject": "^3.0.0" - }, - "dependencies": { - "isobject": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", - "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", - "dev": true, - "optional": true - } - } - }, - "object.omit": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/object.omit/-/object.omit-2.0.1.tgz", - "integrity": "sha1-Gpx0SCnznbuFjHbKNXmuKlTr0fo=", - "dev": true, - "optional": true, - "requires": { - "for-own": "^0.1.4", - "is-extendable": "^0.1.1" - } - }, - "object.pick": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/object.pick/-/object.pick-1.3.0.tgz", - "integrity": "sha1-h6EKxMFpS9Lhy/U1kaZhQftd10c=", - "dev": true, - "optional": true, - "requires": { - "isobject": "^3.0.1" - }, - "dependencies": { - "isobject": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", - "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", - "dev": true, - "optional": true - } - } - }, - "once": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", - "dev": true, - "requires": { - "wrappy": "1" - } - }, - "one-time": { - "version": "0.0.4", - "resolved": "https://registry.npmjs.org/one-time/-/one-time-0.0.4.tgz", - "integrity": "sha1-+M33eISCb+Tf+T46nMN7HkSAdC4=", - "dev": true - }, - "optimist": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/optimist/-/optimist-0.6.1.tgz", - "integrity": "sha1-2j6nRob6IaGaERwybpDrFaAZZoY=", - "dev": true, - "requires": { - "minimist": "~0.0.1", - "wordwrap": "~0.0.2" - } - }, - "os-homedir": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", - "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=", - "dev": true - }, - "os-tmpdir": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", - "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", - "dev": true - }, - "output-file-sync": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/output-file-sync/-/output-file-sync-1.1.2.tgz", - "integrity": "sha1-0KM+7+YaIF+suQCS6CZZjVJFznY=", - "dev": true, - "requires": { - "graceful-fs": "^4.1.4", - "mkdirp": "^0.5.1", - "object-assign": "^4.1.0" - } - }, - "parse-glob": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/parse-glob/-/parse-glob-3.0.4.tgz", - "integrity": "sha1-ssN2z7EfNVE7rdFz7wu246OIORw=", - "dev": true, - "optional": true, - "requires": { - "glob-base": "^0.3.0", - "is-dotfile": "^1.0.0", - "is-extglob": "^1.0.0", - "is-glob": "^2.0.0" - } - }, - "pascalcase": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/pascalcase/-/pascalcase-0.1.1.tgz", - "integrity": "sha1-s2PlXoAGym/iF4TS2yK9FdeRfxQ=", - "dev": true, - "optional": true - }, - "path-is-absolute": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", - "dev": true - }, - "path-parse": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz", - "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==", - "dev": true - }, - "path-to-regexp": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-1.7.0.tgz", - "integrity": "sha1-Wf3g9DW62suhA6hOnTvGTpa5k30=", - "dev": true, - "requires": { - "isarray": "0.0.1" - } - }, - "pathval": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.0.tgz", - "integrity": "sha1-uULm1L3mUwBe9rcTYd74cn0GReA=", - "dev": true - }, - "posix-character-classes": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/posix-character-classes/-/posix-character-classes-0.1.1.tgz", - "integrity": "sha1-AerA/jta9xoqbAL+q7jB/vfgDqs=", - "dev": true, - "optional": true - }, - "preserve": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/preserve/-/preserve-0.2.0.tgz", - "integrity": "sha1-gV7R9uvGWSb4ZbMQwHE7yzMVzks=", - "dev": true, - "optional": true - }, - "private": { - "version": "0.1.8", - "resolved": "https://registry.npmjs.org/private/-/private-0.1.8.tgz", - "integrity": "sha512-VvivMrbvd2nKkiG38qjULzlc+4Vx4wm/whI9pQD35YrARNnhxeiRktSOhSukRLFNlzg6Br/cJPet5J/u19r/mg==", - "dev": true - }, - "process-nextick-args": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.0.tgz", - "integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw==", - "dev": true - }, - "progress": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.0.tgz", - "integrity": "sha1-ihvjZr+Pwj2yvSPxDG/pILQ4nR8=", - "dev": true - }, - "randomatic": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/randomatic/-/randomatic-3.1.1.tgz", - "integrity": "sha512-TuDE5KxZ0J461RVjrJZCJc+J+zCkTb1MbH9AQUq68sMhOMcy9jLcb3BrZKgp9q9Ncltdg4QVqWrH02W2EFFVYw==", - "dev": true, - "optional": true, - "requires": { - "is-number": "^4.0.0", - "kind-of": "^6.0.0", - "math-random": "^1.0.1" - }, - "dependencies": { - "is-number": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-4.0.0.tgz", - "integrity": "sha512-rSklcAIlf1OmFdyAqbnWTLVelsQ58uvZ66S/ZyawjWqIviTWCjg2PzVGw8WUA+nNuPTqb4wgA+NszrJ+08LlgQ==", - "dev": true, - "optional": true - }, - "kind-of": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", - "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", - "dev": true, - "optional": true - } - } - }, - "readable-stream": { - "version": "2.3.6", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", - "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", - "dev": true, - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - }, - "dependencies": { - "isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", - "dev": true - } - } - }, - "readdirp": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-2.2.1.tgz", - "integrity": "sha512-1JU/8q+VgFZyxwrJ+SVIOsh+KywWGpds3NTqikiKpDMZWScmAYyKIgqkO+ARvNWJfXeXR1zxz7aHF4u4CyH6vQ==", - "dev": true, - "optional": true, - "requires": { - "graceful-fs": "^4.1.11", - "micromatch": "^3.1.10", - "readable-stream": "^2.0.2" - }, - "dependencies": { - "arr-diff": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-4.0.0.tgz", - "integrity": "sha1-1kYQdP6/7HHn4VI1dhoyml3HxSA=", - "dev": true, - "optional": true - }, - "array-unique": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.3.2.tgz", - "integrity": "sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg=", - "dev": true, - "optional": true - }, - "braces": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-2.3.2.tgz", - "integrity": "sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w==", - "dev": true, - "optional": true, - "requires": { - "arr-flatten": "^1.1.0", - "array-unique": "^0.3.2", - "extend-shallow": "^2.0.1", - "fill-range": "^4.0.0", - "isobject": "^3.0.1", - "repeat-element": "^1.1.2", - "snapdragon": "^0.8.1", - "snapdragon-node": "^2.0.1", - "split-string": "^3.0.2", - "to-regex": "^3.0.1" - }, - "dependencies": { - "extend-shallow": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", - "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", - "dev": true, - "optional": true, - "requires": { - "is-extendable": "^0.1.0" - } - } - } - }, - "expand-brackets": { - "version": "2.1.4", - "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-2.1.4.tgz", - "integrity": "sha1-t3c14xXOMPa27/D4OwQVGiJEliI=", - "dev": true, - "optional": true, - "requires": { - "debug": "^2.3.3", - "define-property": "^0.2.5", - "extend-shallow": "^2.0.1", - "posix-character-classes": "^0.1.0", - "regex-not": "^1.0.0", - "snapdragon": "^0.8.1", - "to-regex": "^3.0.1" - }, - "dependencies": { - "define-property": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", - "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", - "dev": true, - "optional": true, - "requires": { - "is-descriptor": "^0.1.0" - } - }, - "extend-shallow": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", - "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", - "dev": true, - "optional": true, - "requires": { - "is-extendable": "^0.1.0" - } - }, - "is-accessor-descriptor": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", - "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", - "dev": true, - "optional": true, - "requires": { - "kind-of": "^3.0.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "optional": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "is-data-descriptor": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", - "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", - "dev": true, - "optional": true, - "requires": { - "kind-of": "^3.0.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "optional": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "is-descriptor": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", - "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", - "dev": true, - "optional": true, - "requires": { - "is-accessor-descriptor": "^0.1.6", - "is-data-descriptor": "^0.1.4", - "kind-of": "^5.0.0" - } - }, - "kind-of": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", - "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", - "dev": true, - "optional": true - } - } - }, - "extglob": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/extglob/-/extglob-2.0.4.tgz", - "integrity": "sha512-Nmb6QXkELsuBr24CJSkilo6UHHgbekK5UiZgfE6UHD3Eb27YC6oD+bhcT+tJ6cl8dmsgdQxnWlcry8ksBIBLpw==", - "dev": true, - "optional": true, - "requires": { - "array-unique": "^0.3.2", - "define-property": "^1.0.0", - "expand-brackets": "^2.1.4", - "extend-shallow": "^2.0.1", - "fragment-cache": "^0.2.1", - "regex-not": "^1.0.0", - "snapdragon": "^0.8.1", - "to-regex": "^3.0.1" - }, - "dependencies": { - "define-property": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", - "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", - "dev": true, - "optional": true, - "requires": { - "is-descriptor": "^1.0.0" - } - }, - "extend-shallow": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", - "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", - "dev": true, - "optional": true, - "requires": { - "is-extendable": "^0.1.0" - } - } - } - }, - "fill-range": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz", - "integrity": "sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc=", - "dev": true, - "optional": true, - "requires": { - "extend-shallow": "^2.0.1", - "is-number": "^3.0.0", - "repeat-string": "^1.6.1", - "to-regex-range": "^2.1.0" - }, - "dependencies": { - "extend-shallow": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", - "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", - "dev": true, - "optional": true, - "requires": { - "is-extendable": "^0.1.0" - } - } - } - }, - "is-accessor-descriptor": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", - "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", - "dev": true, - "optional": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-data-descriptor": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", - "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", - "dev": true, - "optional": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-descriptor": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", - "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", - "dev": true, - "optional": true, - "requires": { - "is-accessor-descriptor": "^1.0.0", - "is-data-descriptor": "^1.0.0", - "kind-of": "^6.0.2" - } - }, - "is-number": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", - "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", - "dev": true, - "optional": true, - "requires": { - "kind-of": "^3.0.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "optional": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "isobject": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", - "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", - "dev": true, - "optional": true - }, - "kind-of": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", - "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", - "dev": true, - "optional": true - }, - "micromatch": { - "version": "3.1.10", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.10.tgz", - "integrity": "sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg==", - "dev": true, - "optional": true, - "requires": { - "arr-diff": "^4.0.0", - "array-unique": "^0.3.2", - "braces": "^2.3.1", - "define-property": "^2.0.2", - "extend-shallow": "^3.0.2", - "extglob": "^2.0.4", - "fragment-cache": "^0.2.1", - "kind-of": "^6.0.2", - "nanomatch": "^1.2.9", - "object.pick": "^1.3.0", - "regex-not": "^1.0.0", - "snapdragon": "^0.8.1", - "to-regex": "^3.0.2" - } - } - } - }, - "readline-sync": { - "version": "1.4.9", - "resolved": "https://registry.npmjs.org/readline-sync/-/readline-sync-1.4.9.tgz", - "integrity": "sha1-PtqOZfI80qF+YTAbHwADOWr17No=", - "dev": true - }, - "rechoir": { - "version": "0.6.2", - "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.6.2.tgz", - "integrity": "sha1-hSBLVNuoLVdC4oyWdW70OvUOM4Q=", - "dev": true, - "requires": { - "resolve": "^1.1.6" - } - }, - "ref": { - "version": "1.3.5", - "resolved": "https://registry.npmjs.org/ref/-/ref-1.3.5.tgz", - "integrity": "sha512-2cBCniTtxcGUjDpvFfVpw323a83/0RLSGJJY5l5lcomZWhYpU2cuLdsvYqMixvsdLJ9+sTdzEkju8J8ZHDM2nA==", - "requires": { - "bindings": "1", - "debug": "2", - "nan": "2" - }, - "dependencies": { - "bindings": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.3.0.tgz", - "integrity": "sha512-DpLh5EzMR2kzvX1KIlVC0VkC3iZtHKTgdtZ0a3pglBZdaQFjt5S9g9xd1lE+YvXyfd6mtCeRnrUfOLYiTMlNSw==" - }, - "nan": { - "version": "2.7.0", - "resolved": "https://registry.npmjs.org/nan/-/nan-2.7.0.tgz", - "integrity": "sha1-2Vv3IeyHfgjbJ27T/G63j5CDrUY=" - } - } - }, - "ref-struct": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/ref-struct/-/ref-struct-1.1.0.tgz", - "integrity": "sha1-XV7mWtQc78Olxf60BYcmHkee3BM=", - "requires": { - "debug": "2", - "ref": "1" - } - }, - "regenerate": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/regenerate/-/regenerate-1.4.0.tgz", - "integrity": "sha512-1G6jJVDWrt0rK99kBjvEtziZNCICAuvIPkSiUFIQxVP06RCVpq3dmDo2oi6ABpYaDYaTRr67BEhL8r1wgEZZKg==", - "dev": true - }, - "regenerator-runtime": { - "version": "0.11.1", - "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz", - "integrity": "sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg==", - "dev": true - }, - "regenerator-transform": { - "version": "0.10.1", - "resolved": "https://registry.npmjs.org/regenerator-transform/-/regenerator-transform-0.10.1.tgz", - "integrity": "sha512-PJepbvDbuK1xgIgnau7Y90cwaAmO/LCLMI2mPvaXq2heGMR3aWW5/BQvYrhJ8jgmQjXewXvBjzfqKcVOmhjZ6Q==", - "dev": true, - "requires": { - "babel-runtime": "^6.18.0", - "babel-types": "^6.19.0", - "private": "^0.1.6" - } - }, - "regex-cache": { - "version": "0.4.4", - "resolved": "https://registry.npmjs.org/regex-cache/-/regex-cache-0.4.4.tgz", - "integrity": "sha512-nVIZwtCjkC9YgvWkpM55B5rBhBYRZhAaJbgcFYXXsHnbZ9UZI9nnVWYZpBlCqv9ho2eZryPnWrZGsOdPwVWXWQ==", - "dev": true, - "optional": true, - "requires": { - "is-equal-shallow": "^0.1.3" - } - }, - "regex-not": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/regex-not/-/regex-not-1.0.2.tgz", - "integrity": "sha512-J6SDjUgDxQj5NusnOtdFxDwN/+HWykR8GELwctJ7mdqhcyy1xEc4SRFHUXvxTp661YaVKAjfRLZ9cCqS6tn32A==", - "dev": true, - "optional": true, - "requires": { - "extend-shallow": "^3.0.2", - "safe-regex": "^1.1.0" - } - }, - "regexpu-core": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/regexpu-core/-/regexpu-core-2.0.0.tgz", - "integrity": "sha1-SdA4g3uNz4v6W5pCE5k45uoq4kA=", - "dev": true, - "requires": { - "regenerate": "^1.2.1", - "regjsgen": "^0.2.0", - "regjsparser": "^0.1.4" - } - }, - "regjsgen": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/regjsgen/-/regjsgen-0.2.0.tgz", - "integrity": "sha1-bAFq3qxVT3WCP+N6wFuS1aTtsfc=", - "dev": true - }, - "regjsparser": { - "version": "0.1.5", - "resolved": "https://registry.npmjs.org/regjsparser/-/regjsparser-0.1.5.tgz", - "integrity": "sha1-fuj4Tcb6eS0/0K4ijSS9lJ6tIFw=", - "dev": true, - "requires": { - "jsesc": "~0.5.0" - }, - "dependencies": { - "jsesc": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-0.5.0.tgz", - "integrity": "sha1-597mbjXW/Bb3EP6R1c9p9w8IkR0=", - "dev": true - } - } - }, - "remove-trailing-separator": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz", - "integrity": "sha1-wkvOKig62tW8P1jg1IJJuSN52O8=", - "dev": true, - "optional": true - }, - "repeat-element": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/repeat-element/-/repeat-element-1.1.3.tgz", - "integrity": "sha512-ahGq0ZnV5m5XtZLMb+vP76kcAM5nkLqk0lpqAuojSKGgQtn4eRi4ZZGm2olo2zKFH+sMsWaqOCW1dqAnOru72g==", - "dev": true, - "optional": true - }, - "repeat-string": { - "version": "1.6.1", - "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz", - "integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc=", - "dev": true, - "optional": true - }, - "repeating": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/repeating/-/repeating-2.0.1.tgz", - "integrity": "sha1-UhTFOpJtNVJwdSf7q0FdvAjQbdo=", - "dev": true, - "requires": { - "is-finite": "^1.0.0" - } - }, - "requizzle": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/requizzle/-/requizzle-0.2.1.tgz", - "integrity": "sha1-aUPDUwxNmn5G8c3dUcFY/GcM294=", - "dev": true, - "requires": { - "underscore": "~1.6.0" - }, - "dependencies": { - "underscore": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.6.0.tgz", - "integrity": "sha1-izixDKze9jM3uLJOT/htRa6lKag=", - "dev": true - } - } - }, - "resolve": { - "version": "1.8.1", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.8.1.tgz", - "integrity": "sha512-AicPrAC7Qu1JxPCZ9ZgCZlY35QgFnNqc+0LtbRNxnVw4TXvjQ72wnuL9JQcEBgXkI9JM8MsT9kaQoHcpCRJOYA==", - "dev": true, - "requires": { - "path-parse": "^1.0.5" - } - }, - "resolve-url": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/resolve-url/-/resolve-url-0.2.1.tgz", - "integrity": "sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo=", - "dev": true, - "optional": true - }, - "ret": { - "version": "0.1.15", - "resolved": "https://registry.npmjs.org/ret/-/ret-0.1.15.tgz", - "integrity": "sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg==", - "dev": true, - "optional": true - }, - "safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", - "dev": true - }, - "safe-regex": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/safe-regex/-/safe-regex-1.1.0.tgz", - "integrity": "sha1-QKNmnzsHfR6UPURinhV91IAjvy4=", - "dev": true, - "optional": true, - "requires": { - "ret": "~0.1.10" - } - }, - "samsam": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/samsam/-/samsam-1.3.0.tgz", - "integrity": "sha512-1HwIYD/8UlOtFS3QO3w7ey+SdSDFE4HRNLZoZRYVQefrOY3l17epswImeB1ijgJFQJodIaHcwkp3r/myBjFVbg==", - "dev": true - }, - "semver": { - "version": "5.4.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.4.1.tgz", - "integrity": "sha512-WfG/X9+oATh81XtllIo/I8gOiY9EXRdv1cQdyykeXK17YcUW3EXUAi2To4pcH6nZtJPr7ZOpM5OMyWJZm+8Rsg==", - "dev": true - }, - "set-value": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/set-value/-/set-value-2.0.0.tgz", - "integrity": "sha512-hw0yxk9GT/Hr5yJEYnHNKYXkIA8mVJgd9ditYZCe16ZczcaELYYcfvaXesNACk2O8O0nTiPQcQhGUQj8JLzeeg==", - "dev": true, - "optional": true, - "requires": { - "extend-shallow": "^2.0.1", - "is-extendable": "^0.1.1", - "is-plain-object": "^2.0.3", - "split-string": "^3.0.1" - }, - "dependencies": { - "extend-shallow": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", - "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", - "dev": true, - "optional": true, - "requires": { - "is-extendable": "^0.1.0" - } - } - } - }, - "shelljs": { - "version": "0.8.2", - "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.8.2.tgz", - "integrity": "sha512-pRXeNrCA2Wd9itwhvLp5LZQvPJ0wU6bcjaTMywHHGX5XWhVN2nzSu7WV0q+oUY7mGK3mgSkDDzP3MgjqdyIgbQ==", - "dev": true, - "requires": { - "glob": "^7.0.0", - "interpret": "^1.0.0", - "rechoir": "^0.6.2" - } - }, - "simple-swizzle": { - "version": "0.2.2", - "resolved": "https://registry.npmjs.org/simple-swizzle/-/simple-swizzle-0.2.2.tgz", - "integrity": "sha1-pNprY1/8zMoz9w0Xy5JZLeleVXo=", - "dev": true, - "requires": { - "is-arrayish": "^0.3.1" - } - }, - "sinon": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/sinon/-/sinon-4.1.2.tgz", - "integrity": "sha512-5uLBZPdCWl59Lpbf45ygKj7Z0LVol+ftBe7RDIXOQV/sF58pcFmbK8raA7bt6eljNuGnvBP+/ZxlicVn0emDjA==", - "dev": true, - "requires": { - "diff": "^3.1.0", - "formatio": "1.2.0", - "lodash.get": "^4.4.2", - "lolex": "^2.2.0", - "nise": "^1.2.0", - "supports-color": "^4.4.0", - "type-detect": "^4.0.0" - }, - "dependencies": { - "has-flag": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz", - "integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=", - "dev": true - }, - "supports-color": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.5.0.tgz", - "integrity": "sha1-vnoN5ITexcXN34s9WRJQRJEvY1s=", - "dev": true, - "requires": { - "has-flag": "^2.0.0" - } - } - } - }, - "slash": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/slash/-/slash-1.0.0.tgz", - "integrity": "sha1-xB8vbDn8FtHNF61LXYlhFK5HDVU=", - "dev": true - }, - "sleep-promise": { - "version": "8.0.1", - "resolved": "https://registry.npmjs.org/sleep-promise/-/sleep-promise-8.0.1.tgz", - "integrity": "sha1-jXlaJ+ojlT32tSuRCB5eImZZk8U=", - "dev": true - }, - "snapdragon": { - "version": "0.8.2", - "resolved": "https://registry.npmjs.org/snapdragon/-/snapdragon-0.8.2.tgz", - "integrity": "sha512-FtyOnWN/wCHTVXOMwvSv26d+ko5vWlIDD6zoUJ7LW8vh+ZBC8QdljveRP+crNrtBwioEUWy/4dMtbBjA4ioNlg==", - "dev": true, - "optional": true, - "requires": { - "base": "^0.11.1", - "debug": "^2.2.0", - "define-property": "^0.2.5", - "extend-shallow": "^2.0.1", - "map-cache": "^0.2.2", - "source-map": "^0.5.6", - "source-map-resolve": "^0.5.0", - "use": "^3.1.0" - }, - "dependencies": { - "define-property": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", - "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", - "dev": true, - "optional": true, - "requires": { - "is-descriptor": "^0.1.0" - } - }, - "extend-shallow": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", - "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", - "dev": true, - "optional": true, - "requires": { - "is-extendable": "^0.1.0" - } - }, - "source-map": { - "version": "0.5.7", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", - "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", - "dev": true, - "optional": true - } - } - }, - "snapdragon-node": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/snapdragon-node/-/snapdragon-node-2.1.1.tgz", - "integrity": "sha512-O27l4xaMYt/RSQ5TR3vpWCAB5Kb/czIcqUFOM/C4fYcLnbZUc1PkjTAMjof2pBWaSTwOUd6qUHcFGVGj7aIwnw==", - "dev": true, - "optional": true, - "requires": { - "define-property": "^1.0.0", - "isobject": "^3.0.0", - "snapdragon-util": "^3.0.1" - }, - "dependencies": { - "define-property": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", - "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", - "dev": true, - "optional": true, - "requires": { - "is-descriptor": "^1.0.0" - } - }, - "is-accessor-descriptor": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", - "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", - "dev": true, - "optional": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-data-descriptor": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", - "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", - "dev": true, - "optional": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-descriptor": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", - "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", - "dev": true, - "optional": true, - "requires": { - "is-accessor-descriptor": "^1.0.0", - "is-data-descriptor": "^1.0.0", - "kind-of": "^6.0.2" - } - }, - "isobject": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", - "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", - "dev": true, - "optional": true - }, - "kind-of": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", - "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", - "dev": true, - "optional": true - } - } - }, - "snapdragon-util": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/snapdragon-util/-/snapdragon-util-3.0.1.tgz", - "integrity": "sha512-mbKkMdQKsjX4BAL4bRYTj21edOf8cN7XHdYUJEe+Zn99hVEYcMvKPct1IqNe7+AZPirn8BCDOQBHQZknqmKlZQ==", - "dev": true, - "optional": true, - "requires": { - "kind-of": "^3.2.0" - } - }, - "source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true - }, - "source-map-resolve": { - "version": "0.5.2", - "resolved": "https://registry.npmjs.org/source-map-resolve/-/source-map-resolve-0.5.2.tgz", - "integrity": "sha512-MjqsvNwyz1s0k81Goz/9vRBe9SZdB09Bdw+/zYyO+3CuPk6fouTaxscHkgtE8jKvf01kVfl8riHzERQ/kefaSA==", - "dev": true, - "optional": true, - "requires": { - "atob": "^2.1.1", - "decode-uri-component": "^0.2.0", - "resolve-url": "^0.2.1", - "source-map-url": "^0.4.0", - "urix": "^0.1.0" - } - }, - "source-map-support": { - "version": "0.5.6", - "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.6.tgz", - "integrity": "sha512-N4KXEz7jcKqPf2b2vZF11lQIz9W5ZMuUcIOGj243lduidkf2fjkVKJS9vNxVWn3u/uxX38AcE8U9nnH9FPcq+g==", - "dev": true, - "requires": { - "buffer-from": "^1.0.0", - "source-map": "^0.6.0" - } - }, - "source-map-url": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/source-map-url/-/source-map-url-0.4.0.tgz", - "integrity": "sha1-PpNdfd1zYxuXZZlW1VEo6HtQhKM=", - "dev": true, - "optional": true - }, - "split-string": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/split-string/-/split-string-3.1.0.tgz", - "integrity": "sha512-NzNVhJDYpwceVVii8/Hu6DKfD2G+NrQHlS/V/qgv763EYudVwEcMQNxd2lh+0VrUByXN/oJkl5grOhYWvQUYiw==", - "dev": true, - "optional": true, - "requires": { - "extend-shallow": "^3.0.0" - } - }, - "stack-trace": { - "version": "0.0.10", - "resolved": "https://registry.npmjs.org/stack-trace/-/stack-trace-0.0.10.tgz", - "integrity": "sha1-VHxws0fo0ytOEI6hoqFZ5f3eGcA=", - "dev": true - }, - "static-extend": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/static-extend/-/static-extend-0.1.2.tgz", - "integrity": "sha1-YICcOcv/VTNyJv1eC1IPNB8ftcY=", - "dev": true, - "optional": true, - "requires": { - "define-property": "^0.2.5", - "object-copy": "^0.1.0" - }, - "dependencies": { - "define-property": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", - "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", - "dev": true, - "optional": true, - "requires": { - "is-descriptor": "^0.1.0" - } - } - } - }, - "string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "dev": true, - "requires": { - "safe-buffer": "~5.1.0" - } - }, - "strip-ansi": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", - "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", - "dev": true, - "requires": { - "ansi-regex": "^2.0.0" - } - }, - "strip-json-comments": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", - "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=", - "dev": true - }, - "supports-color": { - "version": "5.4.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.4.0.tgz", - "integrity": "sha512-zjaXglF5nnWpsq470jSv6P9DwPvgLkuapYmfDm3JWOm0vkNTVF2tI4UrN2r6jH1qM/uc/WtxYY1hYoA2dOKj5w==", - "dev": true, - "requires": { - "has-flag": "^3.0.0" - } - }, - "taffydb": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/taffydb/-/taffydb-2.6.2.tgz", - "integrity": "sha1-fLy2S1oUG2ou/CxdLGe04VCyomg=", - "dev": true - }, - "text-hex": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/text-hex/-/text-hex-1.0.0.tgz", - "integrity": "sha512-uuVGNWzgJ4yhRaNSiubPY7OjISw4sw4E5Uv0wbjp+OzcbmVU/rsT8ujgcXJhn9ypzsgr5vlzpPqP+MBBKcGvbg==", - "dev": true - }, - "to-fast-properties": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-1.0.3.tgz", - "integrity": "sha1-uDVx+k2MJbguIxsG46MFXeTKGkc=", - "dev": true - }, - "to-object-path": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/to-object-path/-/to-object-path-0.3.0.tgz", - "integrity": "sha1-KXWIt7Dn4KwI4E5nL4XB9JmeF68=", - "dev": true, - "optional": true, - "requires": { - "kind-of": "^3.0.2" - } - }, - "to-regex": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/to-regex/-/to-regex-3.0.2.tgz", - "integrity": "sha512-FWtleNAtZ/Ki2qtqej2CXTOayOH9bHDQF+Q48VpWyDXjbYxA4Yz8iDB31zXOBUlOHHKidDbqGVrTUvQMPmBGBw==", - "dev": true, - "optional": true, - "requires": { - "define-property": "^2.0.2", - "extend-shallow": "^3.0.2", - "regex-not": "^1.0.2", - "safe-regex": "^1.1.0" - } - }, - "to-regex-range": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-2.1.1.tgz", - "integrity": "sha1-fIDBe53+vlmeJzZ+DU3VWQFB2zg=", - "dev": true, - "optional": true, - "requires": { - "is-number": "^3.0.0", - "repeat-string": "^1.6.1" - }, - "dependencies": { - "is-number": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", - "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", - "dev": true, - "optional": true, - "requires": { - "kind-of": "^3.0.2" - } - } - } - }, - "trim-right": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/trim-right/-/trim-right-1.0.1.tgz", - "integrity": "sha1-yy4SAwZ+DI3h9hQJS5/kVwTqYAM=", - "dev": true - }, - "triple-beam": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/triple-beam/-/triple-beam-1.3.0.tgz", - "integrity": "sha512-XrHUvV5HpdLmIj4uVMxHggLbFSZYIn7HEWsqePZcI50pco+MPqJ50wMGY794X7AOOhxOBAjbkqfAbEe/QMp2Lw==", - "dev": true - }, - "ts-node": { - "version": "6.1.2", - "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-6.1.2.tgz", - "integrity": "sha512-FS0pXZK0RAHFn+aq7iuWx4FPHiyUMM6p6DgKCl44c5tZKad2aUnwDH09XhsUmR0ncV2gd+ND1EV/Br5HpTxGJg==", - "dev": true, - "requires": { - "arrify": "^1.0.0", - "buffer-from": "^1.1.0", - "diff": "^3.1.0", - "make-error": "^1.1.1", - "minimist": "^1.2.0", - "mkdirp": "^0.5.1", - "source-map-support": "^0.5.6", - "yn": "^2.0.0" - }, - "dependencies": { - "minimist": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", - "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", - "dev": true - } - } - }, - "tslib": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.8.0.tgz", - "integrity": "sha512-ymKWWZJST0/CkgduC2qkzjMOWr4bouhuURNXCn/inEX0L57BnRG6FhX76o7FOnsjHazCjfU2LKeSrlS2sIKQJg==", - "dev": true - }, - "tslint": { - "version": "5.8.0", - "resolved": "https://registry.npmjs.org/tslint/-/tslint-5.8.0.tgz", - "integrity": "sha1-H0mtWy53x2w69N3K5VKuTjYS6xM=", - "dev": true, - "requires": { - "babel-code-frame": "^6.22.0", - "builtin-modules": "^1.1.1", - "chalk": "^2.1.0", - "commander": "^2.9.0", - "diff": "^3.2.0", - "glob": "^7.1.1", - "minimatch": "^3.0.4", - "resolve": "^1.3.2", - "semver": "^5.3.0", - "tslib": "^1.7.1", - "tsutils": "^2.12.1" - }, - "dependencies": { - "ansi-regex": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", - "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", - "dev": true - }, - "ansi-styles": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", - "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", - "dev": true - }, - "babel-code-frame": { - "version": "6.26.0", - "resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.26.0.tgz", - "integrity": "sha1-Y/1D99weO7fONZR9uP42mj9Yx0s=", - "dev": true, - "requires": { - "chalk": "^1.1.3", - "esutils": "^2.0.2", - "js-tokens": "^3.0.2" - }, - "dependencies": { - "chalk": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", - "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", - "dev": true, - "requires": { - "ansi-styles": "^2.2.1", - "escape-string-regexp": "^1.0.2", - "has-ansi": "^2.0.0", - "strip-ansi": "^3.0.0", - "supports-color": "^2.0.0" - } - } - } - }, - "balanced-match": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", - "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", - "dev": true - }, - "brace-expansion": { - "version": "1.1.8", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.8.tgz", - "integrity": "sha1-wHshHHyVLsH479Uad+8NHTmQopI=", - "dev": true, - "requires": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "chalk": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.0.tgz", - "integrity": "sha512-Az5zJR2CBujap2rqXGaJKaPHyJ0IrUimvYNX+ncCy8PJP4ltOGTrHUIo097ZaL2zMeKYpiCdqDvS6zdrTFok3Q==", - "dev": true, - "requires": { - "ansi-styles": "^3.1.0", - "escape-string-regexp": "^1.0.5", - "supports-color": "^4.0.0" - }, - "dependencies": { - "ansi-styles": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", - "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==", - "dev": true, - "requires": { - "color-convert": "^1.9.0" - } - }, - "supports-color": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.5.0.tgz", - "integrity": "sha1-vnoN5ITexcXN34s9WRJQRJEvY1s=", - "dev": true, - "requires": { - "has-flag": "^2.0.0" - } - } - } - }, - "concat-map": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", - "dev": true - }, - "escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", - "dev": true - }, - "esutils": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz", - "integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=", - "dev": true - }, - "fs.realpath": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", - "dev": true - }, - "glob": { - "version": "7.1.2", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", - "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", - "dev": true, - "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - } - }, - "has-ansi": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", - "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=", - "dev": true, - "requires": { - "ansi-regex": "^2.0.0" - } - }, - "has-flag": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz", - "integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=", - "dev": true - }, - "inflight": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", - "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", - "dev": true, - "requires": { - "once": "^1.3.0", - "wrappy": "1" - } - }, - "inherits": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", - "dev": true - }, - "js-tokens": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz", - "integrity": "sha1-mGbfOVECEw449/mWvOtlRDIJwls=", - "dev": true - }, - "minimatch": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", - "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", - "dev": true, - "requires": { - "brace-expansion": "^1.1.7" - } - }, - "once": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", - "dev": true, - "requires": { - "wrappy": "1" - } - }, - "path-is-absolute": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", - "dev": true - }, - "path-parse": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.5.tgz", - "integrity": "sha1-PBrfhx6pzWyUMbbqK9dKD/BVxME=", - "dev": true - }, - "resolve": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.5.0.tgz", - "integrity": "sha512-hgoSGrc3pjzAPHNBg+KnFcK2HwlHTs/YrAGUr6qgTVUZmXv1UEXXl0bZNBKMA9fud6lRYFdPGz0xXxycPzmmiw==", - "dev": true, - "requires": { - "path-parse": "^1.0.5" - } - }, - "strip-ansi": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", - "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", - "dev": true, - "requires": { - "ansi-regex": "^2.0.0" - } - }, - "supports-color": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", - "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", - "dev": true - }, - "wrappy": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", - "dev": true - } - } - }, - "tslint-config-standard": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/tslint-config-standard/-/tslint-config-standard-7.1.0.tgz", - "integrity": "sha512-cETzxZcEQ1RKjwtEScGryAtqwiRFc55xBxhZP6bePyOfXmo6i1/QKQrTgFKBiM4FjCvcqTjJq20/KGrh+TzTfQ==", - "dev": true, - "requires": { - "tslint-eslint-rules": "^5.3.1" - } - }, - "tslint-eslint-rules": { - "version": "5.3.1", - "resolved": "https://registry.npmjs.org/tslint-eslint-rules/-/tslint-eslint-rules-5.3.1.tgz", - "integrity": "sha512-qq2H/AU/FlFbQJKXuxhtIk+ni/nQu9jHHhsFKa6hnA0/n3zl1/RWRc3TVFlL8HfWFMzkST350VeTrFpy1u4OUg==", - "dev": true, - "requires": { - "doctrine": "0.7.2", - "tslib": "1.9.0", - "tsutils": "2.8.0" - }, - "dependencies": { - "tslib": { - "version": "1.9.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.9.0.tgz", - "integrity": "sha512-f/qGG2tUkrISBlQZEjEqoZ3B2+npJjIf04H1wuAv9iA8i04Icp+61KRXxFdha22670NJopsZCIjhC3SnjPRKrQ==", - "dev": true - }, - "tsutils": { - "version": "2.8.0", - "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-2.8.0.tgz", - "integrity": "sha1-AWAXNymzvxOGKN0UoVN+AIUdgUo=", - "dev": true, - "requires": { - "tslib": "^1.7.1" - } - } - } - }, - "tsutils": { - "version": "2.12.1", - "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-2.12.1.tgz", - "integrity": "sha1-9Nlc4zkciXHkblTEzw7bCiHdWyQ=", - "dev": true, - "requires": { - "tslib": "^1.7.1" - } - }, - "type-detect": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.3.tgz", - "integrity": "sha1-Dj8mcLRAmbC0bChNE2p+9Jx0wuo=", - "dev": true - }, - "typedoc": { - "version": "0.11.1", - "resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.11.1.tgz", - "integrity": "sha512-jdNIoHm5wkZqxQTe/g9AQ3LKnZyrzHXqu6A/c9GUOeJyBWLxNr7/Dm3rwFvLksuxRNwTvY/0HRDU9sJTa9WQSg==", - "dev": true, - "requires": { - "@types/fs-extra": "5.0.1", - "@types/handlebars": "4.0.36", - "@types/highlight.js": "9.12.2", - "@types/lodash": "4.14.104", - "@types/marked": "0.3.0", - "@types/minimatch": "3.0.3", - "@types/shelljs": "0.7.8", - "fs-extra": "^5.0.0", - "handlebars": "^4.0.6", - "highlight.js": "^9.0.0", - "lodash": "^4.17.5", - "marked": "^0.3.17", - "minimatch": "^3.0.0", - "progress": "^2.0.0", - "shelljs": "^0.8.1", - "typedoc-default-themes": "^0.5.0", - "typescript": "2.7.2" - }, - "dependencies": { - "@types/lodash": { - "version": "4.14.104", - "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.104.tgz", - "integrity": "sha512-ufQcVg4daO8xQ5kopxRHanqFdL4AI7ondQkV+2f+7mz3gvp0LkBx2zBRC6hfs3T87mzQFmf5Fck7Fi145Ul6NQ==", - "dev": true - }, - "fs-extra": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-5.0.0.tgz", - "integrity": "sha512-66Pm4RYbjzdyeuqudYqhFiNBbCIuI9kgRqLPSHIlXHidW8NIQtVdkM1yeZ4lXwuhbTETv3EUGMNHAAw6hiundQ==", - "dev": true, - "requires": { - "graceful-fs": "^4.1.2", - "jsonfile": "^4.0.0", - "universalify": "^0.1.0" - } - }, - "lodash": { - "version": "4.17.11", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz", - "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==", - "dev": true - }, - "marked": { - "version": "0.3.19", - "resolved": "https://registry.npmjs.org/marked/-/marked-0.3.19.tgz", - "integrity": "sha512-ea2eGWOqNxPcXv8dyERdSr/6FmzvWwzjMxpfGB/sbMccXoct+xY+YukPD+QTUZwyvK7BZwcr4m21WBOW41pAkg==", - "dev": true - }, - "typescript": { - "version": "2.7.2", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-2.7.2.tgz", - "integrity": "sha512-p5TCYZDAO0m4G344hD+wx/LATebLWZNkkh2asWUFqSsD2OrDNhbAHuSjobrmsUmdzjJjEeZVU9g1h3O6vpstnw==", - "dev": true - } - } - }, - "typedoc-default-themes": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/typedoc-default-themes/-/typedoc-default-themes-0.5.0.tgz", - "integrity": "sha1-bcJDPnjti+qOiHo6zeLzF4W9Yic=", - "dev": true - }, - "typescript": { - "version": "2.9.1", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-2.9.1.tgz", - "integrity": "sha512-h6pM2f/GDchCFlldnriOhs1QHuwbnmj6/v7499eMHqPeW4V2G0elua2eIc2nu8v2NdHV0Gm+tzX83Hr6nUFjQA==", - "dev": true - }, - "uglify-js": { - "version": "3.4.9", - "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.4.9.tgz", - "integrity": "sha512-8CJsbKOtEbnJsTyv6LE6m6ZKniqMiFWmm9sRbopbkGs3gMPPfd3Fh8iIA4Ykv5MgaTbqHr4BaoGLJLZNhsrW1Q==", - "dev": true, - "optional": true, - "requires": { - "commander": "~2.17.1", - "source-map": "~0.6.1" - }, - "dependencies": { - "commander": { - "version": "2.17.1", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.17.1.tgz", - "integrity": "sha512-wPMUt6FnH2yzG95SA6mzjQOEKUU3aLaDEmzs1ti+1E9h+CsrZghRlqEM/EJ4KscsQVG8uNN4uVreUeT8+drlgg==", - "dev": true, - "optional": true - } - } - }, - "underscore": { - "version": "1.8.3", - "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", - "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=", - "dev": true - }, - "underscore-contrib": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/underscore-contrib/-/underscore-contrib-0.3.0.tgz", - "integrity": "sha1-ZltmwkeD+PorGMn4y7Dix9SMJsc=", - "dev": true, - "requires": { - "underscore": "1.6.0" - }, - "dependencies": { - "underscore": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.6.0.tgz", - "integrity": "sha1-izixDKze9jM3uLJOT/htRa6lKag=", - "dev": true - } - } - }, - "union-value": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/union-value/-/union-value-1.0.0.tgz", - "integrity": "sha1-XHHDTLW61dzr4+oM0IIHulqhrqQ=", - "dev": true, - "optional": true, - "requires": { - "arr-union": "^3.1.0", - "get-value": "^2.0.6", - "is-extendable": "^0.1.1", - "set-value": "^0.4.3" - }, - "dependencies": { - "extend-shallow": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", - "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", - "dev": true, - "optional": true, - "requires": { - "is-extendable": "^0.1.0" - } - }, - "set-value": { - "version": "0.4.3", - "resolved": "https://registry.npmjs.org/set-value/-/set-value-0.4.3.tgz", - "integrity": "sha1-fbCPnT0i3H945Trzw79GZuzfzPE=", - "dev": true, - "optional": true, - "requires": { - "extend-shallow": "^2.0.1", - "is-extendable": "^0.1.1", - "is-plain-object": "^2.0.1", - "to-object-path": "^0.3.0" - } - } - } - }, - "universalify": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.1.tgz", - "integrity": "sha1-+nG63UQ3r0wUiEHjs7Fl+enlkLc=" - }, - "unset-value": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/unset-value/-/unset-value-1.0.0.tgz", - "integrity": "sha1-g3aHP30jNRef+x5vw6jtDfyKtVk=", - "dev": true, - "optional": true, - "requires": { - "has-value": "^0.3.1", - "isobject": "^3.0.0" - }, - "dependencies": { - "has-value": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/has-value/-/has-value-0.3.1.tgz", - "integrity": "sha1-ex9YutpiyoJ+wKIHgCVlSEWZXh8=", - "dev": true, - "optional": true, - "requires": { - "get-value": "^2.0.3", - "has-values": "^0.1.4", - "isobject": "^2.0.0" - }, - "dependencies": { - "isobject": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-2.1.0.tgz", - "integrity": "sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk=", - "dev": true, - "optional": true, - "requires": { - "isarray": "1.0.0" - } - } - } - }, - "has-values": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/has-values/-/has-values-0.1.4.tgz", - "integrity": "sha1-bWHeldkd/Km5oCCJrThL/49it3E=", - "dev": true, - "optional": true - }, - "isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", - "dev": true, - "optional": true - }, - "isobject": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", - "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", - "dev": true, - "optional": true - } - } - }, - "urix": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/urix/-/urix-0.1.0.tgz", - "integrity": "sha1-2pN/emLiH+wf0Y1Js1wpNQZ6bHI=", - "dev": true, - "optional": true - }, - "use": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/use/-/use-3.1.1.tgz", - "integrity": "sha512-cwESVXlO3url9YWlFW/TA9cshCEhtu7IKJ/p5soJ/gGpj7vbvFrAY/eIioQ6Dw23KjZhYgiIo8HOs1nQ2vr/oQ==", - "dev": true, - "optional": true - }, - "user-home": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/user-home/-/user-home-1.1.1.tgz", - "integrity": "sha1-K1viOjK2Onyd640PKNSFcko98ZA=", - "dev": true - }, - "util-deprecate": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", - "dev": true - }, - "v8flags": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/v8flags/-/v8flags-2.1.1.tgz", - "integrity": "sha1-qrGh+jDUX4jdMhFIh1rALAtV5bQ=", - "dev": true, - "requires": { - "user-home": "^1.1.1" - } - }, - "weak": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/weak/-/weak-1.0.1.tgz", - "integrity": "sha1-q5mqswcGlZqgIAy4z1RbucszuZ4=", - "requires": { - "bindings": "^1.2.1", - "nan": "^2.0.5" - }, - "dependencies": { - "bindings": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.3.0.tgz", - "integrity": "sha512-DpLh5EzMR2kzvX1KIlVC0VkC3iZtHKTgdtZ0a3pglBZdaQFjt5S9g9xd1lE+YvXyfd6mtCeRnrUfOLYiTMlNSw==" - }, - "nan": { - "version": "2.7.0", - "resolved": "https://registry.npmjs.org/nan/-/nan-2.7.0.tgz", - "integrity": "sha1-2Vv3IeyHfgjbJ27T/G63j5CDrUY=" - } - } - }, - "winston": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/winston/-/winston-3.2.1.tgz", - "integrity": "sha512-zU6vgnS9dAWCEKg/QYigd6cgMVVNwyTzKs81XZtTFuRwJOcDdBg7AU0mXVyNbs7O5RH2zdv+BdNZUlx7mXPuOw==", - "dev": true, - "requires": { - "async": "^2.6.1", - "diagnostics": "^1.1.1", - "is-stream": "^1.1.0", - "logform": "^2.1.1", - "one-time": "0.0.4", - "readable-stream": "^3.1.1", - "stack-trace": "0.0.x", - "triple-beam": "^1.3.0", - "winston-transport": "^4.3.0" - }, - "dependencies": { - "readable-stream": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.2.0.tgz", - "integrity": "sha512-RV20kLjdmpZuTF1INEb9IA3L68Nmi+Ri7ppZqo78wj//Pn62fCoJyV9zalccNzDD/OuJpMG4f+pfMl8+L6QdGw==", - "dev": true, - "requires": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - } - } - } - }, - "winston-transport": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/winston-transport/-/winston-transport-4.3.0.tgz", - "integrity": "sha512-B2wPuwUi3vhzn/51Uukcao4dIduEiPOcOt9HJ3QeaXgkJ5Z7UwpBzxS4ZGNHtrxrUvTwemsQiSys0ihOf8Mp1A==", - "dev": true, - "requires": { - "readable-stream": "^2.3.6", - "triple-beam": "^1.2.0" - } - }, - "wordwrap": { - "version": "0.0.3", - "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.3.tgz", - "integrity": "sha1-o9XabNXAvAAI03I0u68b7WMFkQc=", - "dev": true - }, - "wrappy": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", - "dev": true - }, - "xmlcreate": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/xmlcreate/-/xmlcreate-1.0.2.tgz", - "integrity": "sha1-+mv3YqYKQT+z3Y9LA8WyaSONMI8=", - "dev": true - }, - "yn": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/yn/-/yn-2.0.0.tgz", - "integrity": "sha1-5a2ryKz0CPY4X8dklWhMiOavaJo=", - "dev": true - } - } -} diff --git a/vcx/wrappers/node/package.json b/vcx/wrappers/node/package.json index 5d790a6502..6c6f30713d 100644 --- a/vcx/wrappers/node/package.json +++ b/vcx/wrappers/node/package.json @@ -65,7 +65,7 @@ "tslint": "^5.8.0", "tslint-config-standard": "^7.1.0", "typedoc": "0.11.1", - "typescript": "^2.9.1", + "typescript": "^3.0.0", "winston": "^3.2.1" }, "main": "dist/src/index.js", diff --git a/vcx/wrappers/node/src/utils/ffi-helpers.ts b/vcx/wrappers/node/src/utils/ffi-helpers.ts index d19e9c8a0d..91979b1be4 100644 --- a/vcx/wrappers/node/src/utils/ffi-helpers.ts +++ b/vcx/wrappers/node/src/utils/ffi-helpers.ts @@ -15,6 +15,7 @@ export type ICreateFFICallbackPromiseCb = ( ) => ICbRef export const createFFICallbackPromise = (fn: ICreateFFICallbackPromiseFn, cb: ICreateFFICallbackPromiseCb) => { + // @ts-ignore let cbRef = null // TODO: Research why registering a callback doesn't keep parent thread alive https://github.com/node-ffi/node-ffi const processKeepAliveTimer = setTimeout(() => undefined, maxTimeout) From a76d2a58ada0b3b0dd5a70ad67e42f27985afdea Mon Sep 17 00:00:00 2001 From: Nikita Khateev Date: Fri, 2 Aug 2019 19:41:34 +0300 Subject: [PATCH 087/320] IS-1334 -- Initial commit Signed-off-by: Nikita Khateev --- docs/architecture/language-bindings.md | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 docs/architecture/language-bindings.md diff --git a/docs/architecture/language-bindings.md b/docs/architecture/language-bindings.md new file mode 100644 index 0000000000..4ac24838dc --- /dev/null +++ b/docs/architecture/language-bindings.md @@ -0,0 +1,11 @@ +# Language Bindings in SDK + +Libindy has these wrappers: +* Python -- Docs -- Sources +* Java -- Docs -- Sources +* Rust -- Docs -- Sources +* iOS -- Docs -- Sources +* NodeJS -- Sources +* .NET (not supported right now) + +![alt text](indy-sdk-components.svg) \ No newline at end of file From 7d0f33244eb4060d558a5773a3cc9dbb61fcf99d Mon Sep 17 00:00:00 2001 From: Nikita Khateev Date: Sun, 4 Aug 2019 12:11:46 +0300 Subject: [PATCH 088/320] IS-1334 -- Added document about Indy SDK language bindings. Updated diagram. Signed-off-by: Nikita Khateev --- docs/architecture/indy-sdk-components.puml | 8 +++++++- docs/architecture/indy-sdk-components.svg | 24 ++++++++++++++-------- docs/architecture/language-bindings.md | 22 ++++++++++++-------- 3 files changed, 35 insertions(+), 19 deletions(-) diff --git a/docs/architecture/indy-sdk-components.puml b/docs/architecture/indy-sdk-components.puml index f6b290d919..139db64f95 100644 --- a/docs/architecture/indy-sdk-components.puml +++ b/docs/architecture/indy-sdk-components.puml @@ -10,6 +10,12 @@ package "Programming lanugages wrappers" { [Java Wrapper] as java_wrapper cinterface <.. java_wrapper + [NodeJS Wrapper] as nodejs_wrapper + cinterface <.. nodejs_wrapper + + [Rust Wrapper] as rust_wrapper + cinterface <.. rust_wrapper + [Python Wrapper] as python_wrapper cinterface <.. python_wrapper @@ -20,4 +26,4 @@ package "Programming lanugages wrappers" { cinterface <.. dnet_wrapper } -@enduml \ No newline at end of file +@enduml diff --git a/docs/architecture/indy-sdk-components.svg b/docs/architecture/indy-sdk-components.svg index d8860237f6..f7e75b72c0 100644 --- a/docs/architecture/indy-sdk-components.svg +++ b/docs/architecture/indy-sdk-components.svg @@ -1,4 +1,4 @@ -Programming lanugages wrappersJava WrapperPython WrapperObjectiveC Wrapper (iOS).Net Wrapper (iOS)C InterfacelibindyIndy CLIProgramming lanugages wrappersJava WrapperNodeJS WrapperRust WrapperPython WrapperObjectiveC Wrapper (iOS).Net Wrapper (iOS)C InterfacelibindyIndy CLI \ No newline at end of file diff --git a/docs/architecture/language-bindings.md b/docs/architecture/language-bindings.md index 4ac24838dc..5aa0a6fd1a 100644 --- a/docs/architecture/language-bindings.md +++ b/docs/architecture/language-bindings.md @@ -1,11 +1,15 @@ # Language Bindings in SDK -Libindy has these wrappers: -* Python -- Docs -- Sources -* Java -- Docs -- Sources -* Rust -- Docs -- Sources -* iOS -- Docs -- Sources -* NodeJS -- Sources -* .NET (not supported right now) - -![alt text](indy-sdk-components.svg) \ No newline at end of file +Libindy has a set of wrappers that convert its patterns to comply the best practices of corresponding languages. + +![alt text](indy-sdk-components.svg) + +There is some more detailed information about these wrappers: +* Java -- [Sources](https://github.com/hyperledger/indy-sdk/tree/master/wrappers/java) -- [Samples](https://github.com/hyperledger/indy-sdk/tree/master/samples/java) +* Python -- [Sources](https://github.com/hyperledger/indy-sdk/tree/master/wrappers/python) -- [Samples](https://github.com/hyperledger/indy-sdk/tree/master/samples/python) +* Rust -- [Sources](https://github.com/hyperledger/indy-sdk/tree/master/wrappers/rust) -- [Samples](https://github.com/hyperledger/indy-sdk/blob/master/libindy/tests/demo.rs) +* iOS -- [Sources](https://github.com/hyperledger/indy-sdk/tree/master/wrappers/ios) +* NodeJS -- [Sources](https://github.com/hyperledger/indy-sdk/tree/master/wrappers/nodejs) -- [Samples](https://github.com/hyperledger/indy-sdk/tree/master/samples/nodejs) +* .NET (not supported right now) -- [Sources](https://github.com/hyperledger/indy-sdk/tree/master/wrappers/dotnet) -- [Samples](https://github.com/hyperledger/indy-sdk/tree/master/samples/dotnet) + +All wrappers support native logging -- you can read about it in wrapper's readme From 8cf6416a46f4d72a0230a2177202737444a81cdf Mon Sep 17 00:00:00 2001 From: Nikita Khateev Date: Mon, 5 Aug 2019 10:27:37 +0300 Subject: [PATCH 089/320] IS-1334 -- Started threading doc Signed-off-by: Nikita Khateev --- docs/architecture/threading-model.md | 0 docs/architecture/threading-model.puml | 8 ++++++++ 2 files changed, 8 insertions(+) create mode 100644 docs/architecture/threading-model.md create mode 100644 docs/architecture/threading-model.puml diff --git a/docs/architecture/threading-model.md b/docs/architecture/threading-model.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/architecture/threading-model.puml b/docs/architecture/threading-model.puml new file mode 100644 index 0000000000..b9c2e7a986 --- /dev/null +++ b/docs/architecture/threading-model.puml @@ -0,0 +1,8 @@ +@startuml +"Client Thread" -> "Command Thread": +"Command Thread" -> "Pool Thread": + +"Client Thread" -> "Command Thread": +"Command Thread" -> "Wallet Thread": + +@enduml \ No newline at end of file From 222543cb7066a5d02b0f3d96dff3958294b11c46 Mon Sep 17 00:00:00 2001 From: Nikita Khateev Date: Mon, 5 Aug 2019 17:06:54 +0300 Subject: [PATCH 090/320] IS-1334 -- Initial commit for Threading Model Signed-off-by: Nikita Khateev --- docs/architecture/language-bindings.md | 2 +- docs/architecture/threading-model.md | 8 ++ docs/architecture/threading-model.puml | 137 ++++++++++++++++++++++- libindy/src/commands/anoncreds/issuer.rs | 2 + 4 files changed, 144 insertions(+), 5 deletions(-) diff --git a/docs/architecture/language-bindings.md b/docs/architecture/language-bindings.md index 5aa0a6fd1a..a5ba1c08f7 100644 --- a/docs/architecture/language-bindings.md +++ b/docs/architecture/language-bindings.md @@ -2,7 +2,7 @@ Libindy has a set of wrappers that convert its patterns to comply the best practices of corresponding languages. -![alt text](indy-sdk-components.svg) +![Components UML](indy-sdk-components.svg) There is some more detailed information about these wrappers: * Java -- [Sources](https://github.com/hyperledger/indy-sdk/tree/master/wrappers/java) -- [Samples](https://github.com/hyperledger/indy-sdk/tree/master/samples/java) diff --git a/docs/architecture/threading-model.md b/docs/architecture/threading-model.md index e69de29bb2..f2246dced6 100644 --- a/docs/architecture/threading-model.md +++ b/docs/architecture/threading-model.md @@ -0,0 +1,8 @@ +# Threading model + +![Threading model](threading_model.svg) + +Libindy uses 4 main threads: +1) Client thread -- +3) Pool thread -- +4) Wallet thread -- . \ No newline at end of file diff --git a/docs/architecture/threading-model.puml b/docs/architecture/threading-model.puml index b9c2e7a986..999b4ec503 100644 --- a/docs/architecture/threading-model.puml +++ b/docs/architecture/threading-model.puml @@ -1,8 +1,137 @@ @startuml -"Client Thread" -> "Command Thread": -"Command Thread" -> "Pool Thread": +actor "Client app" as App +participant "Client Thread" as Client +note over Client + Thread of an application, + used to transfer commands + to Command thread. +end note +participant "Command Thread" as Command +/ note over Command + Main thread of the library. + It executes biggest part of logic + that is implemented in Libindy +end note +participant "Expensive Thread" as Expensive +/ note over Expensive + Thread that is occasionally + used for execution of + some heavy operations like + credential definition creation + or key derivation +end note +participant "Pool Thread" as Pool +/ note over Pool + Thread used for communication + with nodes in pool +end note +actor "Pool with nodes" as Nodes #blue -"Client Thread" -> "Command Thread": -"Command Thread" -> "Wallet Thread": +==Common command cycle== +App -> Client: indy_create_and_store_my_did +activate Client +Client -> Command: CreateAndStoreMyDid +activate Command +Command -> Command: do_logic +Client --> App: error code +note over App + App waits for result + asynchronously if there + was no error before +end note +deactivate Client +Command -> Command: execute callback +Command --> App: result +deactivate Command +==Expensive commands (key derivation, credential definition creation)== +App -> Client: indy_issuer_create_and_store_credential_def +activate Client +Client -> Command: CreateAndStoreCredentialDefinition +activate Command +Client --> App: error code +deactivate Client +note over App + App waits for result + asynchronously if there + was no error before +end note +Command -> Command: CreateCredentialDefinition +Command -> Expensive: new_credential_definition +deactivate Command +note over Command + Command thread can execute + other commands during + the work of expensive thread +end note +activate Expensive +Expensive -> Command: CreateAndStoreCredentialDefinitionContinue +deactivate Expensive +activate Command +Command -> Command: execute callback +Command --> App: result +deactivate Command + +==Pool communication commands== +App -> Client: indy_open_pool +activate Client +Client -> Command: Open +activate Command +Client --> App: error code +deactivate Client +Command -> Pool: Pool::new +activate Pool +Pool -> Nodes: sync network +Nodes --> Pool: fresh network info +Command --> App: pool_handle +deactivate Command + +note over App + From now on pool works + and requests can be sent +end note + +App -> Client: indy_submit_request +activate Client +Client -> Command: SubmitRequest +activate Command +Client --> App: error code +deactivate Client + +note over App + App waits for result + asynchronously if there + was no error before +end note +Command -> Command: send_tx +Command -> Pool: _send_message +note over Command + Command thread can execute + other commands during + the work of pool thread +end note +deactivate Command +Pool -> Nodes: send(json) +Nodes -> Pool: responses +Pool --> Command: aggregated response +activate Command +Command --> App: result +deactivate Command + +note over App + When the work is over, + you should close the pool + and it will kill the thread +end note + +App -> Client: indy_close_pool +activate Client +Client -> Command: Close +activate Command +Client -> App: error code +deactivate Client +Command -> Pool: Pool::close +deactivate Pool +Command --> App: error code +deactivate Command @enduml \ No newline at end of file diff --git a/libindy/src/commands/anoncreds/issuer.rs b/libindy/src/commands/anoncreds/issuer.rs index 8b1dd06a7f..72a5a98c9d 100644 --- a/libindy/src/commands/anoncreds/issuer.rs +++ b/libindy/src/commands/anoncreds/issuer.rs @@ -254,6 +254,8 @@ impl IssuerCommandExecutor { let tag = tag.to_string(); let schema = schema.clone(); + // FIXME: Check and fix this level of command -- CreateCredentialDefinition looks excessive. + // NB: CreateAndStoreCredentialDefinitionContinue is needed! CommandExecutor::instance().send(Command::Anoncreds( AnoncredsCommand::Issuer( IssuerCommand::CreateCredentialDefinition( From 7b01562b1c29708b655449a2204d573ca2c6a022 Mon Sep 17 00:00:00 2001 From: Nikita Khateev Date: Mon, 5 Aug 2019 17:09:24 +0300 Subject: [PATCH 091/320] IS-1334 -- Small fix Signed-off-by: Nikita Khateev --- docs/architecture/threading-model.md | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/docs/architecture/threading-model.md b/docs/architecture/threading-model.md index f2246dced6..95ca99683d 100644 --- a/docs/architecture/threading-model.md +++ b/docs/architecture/threading-model.md @@ -1,8 +1,3 @@ # Threading model -![Threading model](threading_model.svg) - -Libindy uses 4 main threads: -1) Client thread -- -3) Pool thread -- -4) Wallet thread -- . \ No newline at end of file +![Threading model](threading-model.svg) \ No newline at end of file From cabf6d77ae6d62d26bce050ae9bf651ff96b04ca Mon Sep 17 00:00:00 2001 From: Nikita Khateev Date: Mon, 5 Aug 2019 17:10:41 +0300 Subject: [PATCH 092/320] IS-1334 -- Models and fixes Signed-off-by: Nikita Khateev --- docs/architecture/threading-model.md | 2 +- docs/architecture/threading_model.svg | 150 ++++++++++++++++++++++++++ 2 files changed, 151 insertions(+), 1 deletion(-) create mode 100644 docs/architecture/threading_model.svg diff --git a/docs/architecture/threading-model.md b/docs/architecture/threading-model.md index 95ca99683d..963f437e02 100644 --- a/docs/architecture/threading-model.md +++ b/docs/architecture/threading-model.md @@ -1,3 +1,3 @@ # Threading model -![Threading model](threading-model.svg) \ No newline at end of file +![Threading model](threading_model.svg) \ No newline at end of file diff --git a/docs/architecture/threading_model.svg b/docs/architecture/threading_model.svg new file mode 100644 index 0000000000..97ca6c853d --- /dev/null +++ b/docs/architecture/threading_model.svg @@ -0,0 +1,150 @@ +Client appClient appClient ThreadClient ThreadCommand ThreadCommand ThreadExpensive ThreadExpensive ThreadPool ThreadPool ThreadPool with nodesPool with nodesThread of an application,used to transfer commandsto Command thread.Main thread of the library.It executes biggest part of logicthat is implemented in LibindyThread that is occasionallyused for execution ofsome heavy operations likecredential definition creationor key derivationThread used for communicationwith nodes in poolCommon command cycleindy_create_and_store_my_didCreateAndStoreMyDiddo_logicerror codeApp waits for resultasynchronously if therewas no error beforeexecute callbackresultExpensive commands (key derivation, credential definition creation)indy_issuer_create_and_store_credential_defCreateAndStoreCredentialDefinitionerror codeApp waits for resultasynchronously if therewas no error beforeCreateCredentialDefinitionnew_credential_definitionCommand thread can executeother commands duringthe work of expensive threadCreateAndStoreCredentialDefinitionContinueexecute callbackresultPool communication commandsindy_open_poolOpenerror codePool::newsync networkfresh network infopool_handleFrom now on pool worksand requests can be sentindy_submit_requestSubmitRequesterror codeApp waits for resultasynchronously if therewas no error beforesend_tx_send_messageCommand thread can executeother commands duringthe work of pool threadsend(json)responsesaggregated responseresultWhen the work is over,you should close the pooland it will kill the threadindy_close_poolCloseerror codePool::closeerror code \ No newline at end of file From 90cd40e17984e887e42c969d5f04f61b734f554f Mon Sep 17 00:00:00 2001 From: Nikita Khateev Date: Mon, 5 Aug 2019 17:15:20 +0300 Subject: [PATCH 093/320] IS-1334 -- Models and fixes Signed-off-by: Nikita Khateev --- docs/architecture/threading-model.puml | 7 +++++++ docs/architecture/threading_model.svg | 9 ++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/docs/architecture/threading-model.puml b/docs/architecture/threading-model.puml index 999b4ec503..fbf2e7f843 100644 --- a/docs/architecture/threading-model.puml +++ b/docs/architecture/threading-model.puml @@ -134,4 +134,11 @@ Command -> Pool: Pool::close deactivate Pool Command --> App: error code deactivate Command + +==Synchronous calls== +App -> Client: indy_set_protocol_version +activate Client +Client -> Client: some config setup +Client -> App: error code +deactivate Client @enduml \ No newline at end of file diff --git a/docs/architecture/threading_model.svg b/docs/architecture/threading_model.svg index 97ca6c853d..bf2161296a 100644 --- a/docs/architecture/threading_model.svg +++ b/docs/architecture/threading_model.svg @@ -1,4 +1,4 @@ -Client appClient appClient ThreadClient ThreadCommand ThreadCommand ThreadExpensive ThreadExpensive ThreadPool ThreadPool ThreadPool with nodesPool with nodesThread of an application,used to transfer commandsto Command thread.Main thread of the library.It executes biggest part of logicthat is implemented in LibindyThread that is occasionallyused for execution ofsome heavy operations likecredential definition creationor key derivationThread used for communicationwith nodes in poolCommon command cycleindy_create_and_store_my_didCreateAndStoreMyDiddo_logicerror codeApp waits for resultasynchronously if therewas no error beforeexecute callbackresultExpensive commands (key derivation, credential definition creation)indy_issuer_create_and_store_credential_defCreateAndStoreCredentialDefinitionerror codeApp waits for resultasynchronously if therewas no error beforeCreateCredentialDefinitionnew_credential_definitionCommand thread can executeother commands duringthe work of expensive threadCreateAndStoreCredentialDefinitionContinueexecute callbackresultPool communication commandsindy_open_poolOpenerror codePool::newsync networkfresh network infopool_handleFrom now on pool worksand requests can be sentindy_submit_requestSubmitRequesterror codeApp waits for resultasynchronously if therewas no error beforesend_tx_send_messageCommand thread can executeother commands duringthe work of pool threadsend(json)responsesaggregated responseresultWhen the work is over,you should close the pooland it will kill the threadindy_close_poolCloseerror codePool::closeerror code App: error code +deactivate Client +Command -> Pool: Pool::new +activate Pool +deactivate Command +Pool -> Nodes: sync network +Nodes --> Pool: fresh network info +Pool -> Command: OpenAck +activate Command +Command --> App: pool_handle +deactivate Command + +note over App + From now on pool works + and requests can be sent +end note + +App -> Client: indy_submit_request +activate Client +Client -> Command: SubmitRequest +activate Command +Client --> App: error code +deactivate Client + +note over App + App waits for result + asynchronously if there + was no error before +end note +Command -> Command: send_tx +Command -> Pool: _send_message +note over Command + Command thread can execute + other commands during + the work of pool thread +end note +deactivate Command +Pool -> Nodes: send(json) +Nodes -> Pool: responses +Pool --> Command: aggregated response +activate Command +Command --> App: result +deactivate Command + +note over App + When the work is over, + you should close the pool + and it will kill the thread +end note + +App -> Client: indy_close_pool +activate Client +Client -> Command: Close +activate Command +Client -> App: error code +deactivate Client +Command -> Pool: Pool::close +deactivate Pool +Command --> App: error code +deactivate Command +@enduml \ No newline at end of file diff --git a/docs/architecture/pool_communication_threading.svg b/docs/architecture/pool_communication_threading.svg new file mode 100644 index 0000000000..78e3b4d211 --- /dev/null +++ b/docs/architecture/pool_communication_threading.svg @@ -0,0 +1,99 @@ +Client appClient appClient ThreadClient ThreadCommand ThreadCommand ThreadPool ThreadPool ThreadPool with nodesPool with nodesThread of an application,used to transfer commandsto Command thread.Main thread of the library.It executes biggest part of logicthat is implemented in LibindyThread used for communicationwith nodes in poolPool communication commandsindy_open_poolOpenerror codePool::newsync networkfresh network infoOpenAckpool_handleFrom now on pool worksand requests can be sentindy_submit_requestSubmitRequesterror codeApp waits for resultasynchronously if therewas no error beforesend_tx_send_messageCommand thread can executeother commands duringthe work of pool threadsend(json)responsesaggregated responseresultWhen the work is over,you should close the pooland it will kill the threadindy_close_poolCloseerror codePool::closeerror code \ No newline at end of file diff --git a/docs/architecture/threading-model.md b/docs/architecture/threading-model.md index 963f437e02..4a534a8808 100644 --- a/docs/architecture/threading-model.md +++ b/docs/architecture/threading-model.md @@ -1,3 +1,5 @@ # Threading model -![Threading model](threading_model.svg) \ No newline at end of file +![Threading model](threading_model.svg) + +![Pool communication model](pool_communication_model.svg) \ No newline at end of file diff --git a/docs/architecture/threading-model.puml b/docs/architecture/threading-model.puml index fbf2e7f843..c4add74334 100644 --- a/docs/architecture/threading-model.puml +++ b/docs/architecture/threading-model.puml @@ -20,12 +20,6 @@ participant "Expensive Thread" as Expensive credential definition creation or key derivation end note -participant "Pool Thread" as Pool -/ note over Pool - Thread used for communication - with nodes in pool -end note -actor "Pool with nodes" as Nodes #blue ==Common command cycle== App -> Client: indy_create_and_store_my_did @@ -72,69 +66,6 @@ Command -> Command: execute callback Command --> App: result deactivate Command -==Pool communication commands== -App -> Client: indy_open_pool -activate Client -Client -> Command: Open -activate Command -Client --> App: error code -deactivate Client -Command -> Pool: Pool::new -activate Pool -Pool -> Nodes: sync network -Nodes --> Pool: fresh network info -Command --> App: pool_handle -deactivate Command - -note over App - From now on pool works - and requests can be sent -end note - -App -> Client: indy_submit_request -activate Client -Client -> Command: SubmitRequest -activate Command -Client --> App: error code -deactivate Client - -note over App - App waits for result - asynchronously if there - was no error before -end note -Command -> Command: send_tx -Command -> Pool: _send_message -note over Command - Command thread can execute - other commands during - the work of pool thread -end note -deactivate Command -Pool -> Nodes: send(json) -Nodes -> Pool: responses -Pool --> Command: aggregated response -activate Command -Command --> App: result -deactivate Command - -note over App - When the work is over, - you should close the pool - and it will kill the thread -end note - -App -> Client: indy_close_pool -activate Client -Client -> Command: Close -activate Command -Client -> App: error code -deactivate Client -Command -> Pool: Pool::close -deactivate Pool -Command --> App: error code -deactivate Command - ==Synchronous calls== App -> Client: indy_set_protocol_version activate Client diff --git a/docs/architecture/threading_model.svg b/docs/architecture/threading_model.svg index bf2161296a..16d1cc77f1 100644 --- a/docs/architecture/threading_model.svg +++ b/docs/architecture/threading_model.svg @@ -1,4 +1,4 @@ -Client appClient appClient ThreadClient ThreadCommand ThreadCommand ThreadExpensive ThreadExpensive ThreadPool ThreadPool ThreadPool with nodesPool with nodesThread of an application,used to transfer commandsto Command thread.Main thread of the library.It executes biggest part of logicthat is implemented in LibindyThread that is occasionallyused for execution ofsome heavy operations likecredential definition creationor key derivationThread used for communicationwith nodes in poolCommon command cycleindy_create_and_store_my_didCreateAndStoreMyDiddo_logicerror codeApp waits for resultasynchronously if therewas no error beforeexecute callbackresultExpensive commands (key derivation, credential definition creation)indy_issuer_create_and_store_credential_defCreateAndStoreCredentialDefinitionerror codeApp waits for resultasynchronously if therewas no error beforeCreateCredentialDefinitionnew_credential_definitionCommand thread can executeother commands duringthe work of expensive threadCreateAndStoreCredentialDefinitionContinueexecute callbackresultPool communication commandsindy_open_poolOpenerror codePool::newsync networkfresh network infopool_handleFrom now on pool worksand requests can be sentindy_submit_requestSubmitRequesterror codeApp waits for resultasynchronously if therewas no error beforesend_tx_send_messageCommand thread can executeother commands duringthe work of pool threadsend(json)responsesaggregated responseresultWhen the work is over,you should close the pooland it will kill the threadindy_close_poolCloseerror codePool::closeerror codeSynchronous callsindy_set_protocol_versionsome config setuperror code App: error code deactivate Client Command -> Pool: Pool::new -activate Pool deactivate Command +activate Pool Pool -> Nodes: sync network Nodes --> Pool: fresh network info Pool -> Command: OpenAck From dd13d2eac261b85d1207e180f57cd383642b6360 Mon Sep 17 00:00:00 2001 From: Nikita Khateev Date: Mon, 5 Aug 2019 18:09:19 +0300 Subject: [PATCH 097/320] IS-1334 Small explanation added Signed-off-by: Nikita Khateev --- docs/architecture/threading-model.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/architecture/threading-model.md b/docs/architecture/threading-model.md index c0c74b61a6..a2789a5b0e 100644 --- a/docs/architecture/threading-model.md +++ b/docs/architecture/threading-model.md @@ -1,5 +1,7 @@ # Threading model +Libindy uses four threads during its lifecycle -- client thread, command thread, pool thread and thread for expensive operations. Beneath you can see diagrams with explanation of these threads' work. + ![Threading model](threading_model.svg) ![Pool communication model](pool_communication_threading.svg) \ No newline at end of file From aef70c171b7315e09f90c6eeb95f2966f4f3c77d Mon Sep 17 00:00:00 2001 From: Nikita Khateev Date: Tue, 6 Aug 2019 14:31:40 +0300 Subject: [PATCH 098/320] IS-1334 -- How to add a new API call Signed-off-by: Nikita Khateev --- README.md | 1 + docs/how-tos/how-to-add-a-new-API-call.md | 115 ++++++++++++++++++++++ 2 files changed, 116 insertions(+) create mode 100644 docs/how-tos/how-to-add-a-new-API-call.md diff --git a/README.md b/README.md index f1816d38a2..e3c1830812 100644 --- a/README.md +++ b/README.md @@ -322,6 +322,7 @@ The documents that provide necessary information for Libindy migrations. ## How to Contribute * We'd love your help; see these [instructions on how to contribute](http://bit.ly/2ugd0bq). +* If you need to add a new call, read this [instruction](docs/how-tos/how-to-add-a-new-API-call.md). * You may also want to read this info about [maintainers](MAINTAINERS.md) and our process. * We use developer certificate of origin (DCO) in all hyperledger repositories, so to get your pull requests accepted, you must certify your commits by signing off on each commit. diff --git a/docs/how-tos/how-to-add-a-new-API-call.md b/docs/how-tos/how-to-add-a-new-API-call.md new file mode 100644 index 0000000000..dba1469f94 --- /dev/null +++ b/docs/how-tos/how-to-add-a-new-API-call.md @@ -0,0 +1,115 @@ +# How to add a new API call (code walkthrough) + +In this guide you will see how to add a new call to Libindy. As an example we will take `indy_create_and_store_my_did` call. + +### API Layer + +These changes should be made in directory [`libindy/src/api`](libindy/src/api) in file `did.rs`. For your function you should choose which file it fill logically fit or create a new one (first option is preferred) + +#### Call definition: +```rust +#[no_mangle] +pub extern fn indy_create_and_store_my_did(command_handle: CommandHandle, + wallet_handle: WalletHandle, + did_info: *const c_char, + cb: Option) -> ErrorCode { + // this will be done later +} +``` +What you can modify here is function name and params. + +For the function name there is only one strict rule -- it should have prefix `indy_` to avoid collisions with other libraries in system. + +Rules for params: +1) First parameter is almost always `command_handle` -- you will need this param if your call will work asynchronously -- you will need it most of the times. +2) After the command handle list all of the params that you need to pass. Please, don't use `Option` on the types other than `extern fn`. +3) The last parameter is almost always `cb` -- it is a callback. His first param should be `command_handle_` (for your app to identify which call this callback came for), then `err` for the error code and then all the values that you call is going to return. +4) Please, use the types that were defined in `libindy/src/api/mod.rs` such as `IndyHandle`, `WalletHandle` and so on for the types of your parameters. + +#### Parameter checks: + +```rust +trace!("indy_create_and_store_my_did: >>> wallet_handle: {:?}, did_json: {:?}", wallet_handle, did_info); + +check_useful_json!(did_info, ErrorCode::CommonInvalidParam3, MyDidInfo); // redefine to MyDidInfo if valid +check_useful_c_callback!(cb, ErrorCode::CommonInvalidParam4); + +trace!("indy_create_and_store_my_did: entities >>> wallet_handle: {:?}, did_json: {:?}", wallet_handle, secret!(&did_info)); +``` + +For most C-types that need to be converted to Rust types Libindy has a set of macroses that will check and convert it if everything is good or throw specified error code otherwise. You can see these macroses in [`libindy\src\utils\ctypes.rs`](libindy\src\utils\ctypes.rs) + +### Passing command to Command Thread + +#### Adding new command + +For that you should go to [`libindy/src/commands`](libindy/src/commands) directory and choose a module that fits your call. In most of the times it matches by the name to the module from the previous section. In our case it is `did.rs`. + +Here you will find a enum named like `SomeCommand`, `DidCommand` in our case. Here you have to add a new variant. In our case it will look like this: + +```rust +CreateAndStoreMyDid( + WalletHandle, + MyDidInfo, // my did info + Box) + Send>), +``` + +It has params that you have passed to the function and a callback to return values. + +#### Sending the command + +In our API call we need to add some code to pass the command we just created: +```rust +let result = CommandExecutor::instance() + .send(Command::Did(DidCommand::CreateAndStoreMyDid( + wallet_handle, + did_info, + Box::new(move |result| { + // here goes a call to the callback that you have passed + }), + ))); +``` +`CommandExecutor` is a holder of a channel to communicate with the Command Thread. + +#### Receiving the command + +In a module with commands you will find a struct named like `SomeCommandExecutor`. In our case it will be `DidCommandExecutor`. +Here you should add a new function for your business logic and a new match clause to the function `execute`. In our case it will look like this: + +```rust + pub fn execute(&self, command: DidCommand) { + match command { + // some other clauses + DidCommand::CreateAndStoreMyDid(wallet_handle, my_did_info, cb) => { + info!("CreateAndStoreMyDid command received"); + cb(self.create_and_store_my_did(wallet_handle, &my_did_info)); + } + } + } + // some other functions + fn create_and_store_my_did(&self, + wallet_handle: WalletHandle, + my_did_info: &MyDidInfo) -> IndyResult<(String, String)> { + debug!("create_and_store_my_did >>> wallet_handle: {:?}, my_did_info_json: {:?}", wallet_handle, secret!(my_did_info)); + + let (did, key) = self.crypto_service.create_my_did(&my_did_info)?; + + if self.wallet_service.record_exists::(wallet_handle, &did.did)? { + return Err(err_msg(IndyErrorKind::DIDAlreadyExists, did.did)); + }; + + self.wallet_service.add_indy_object(wallet_handle, &did.did, &did, &HashMap::new())?; + self.wallet_service.add_indy_object(wallet_handle, &key.verkey, &key, &HashMap::new())?; + + let res = (did.did, did.verkey); + + debug!("create_and_store_my_did <<< res: {:?}", res); + + Ok(res) + } +``` +In the function you should put business logic of your call. +Notice, that if you have some functionality that can be reused later by other commands, you should put it into the service and execute service call in the function. \ No newline at end of file From 959aa221e65e3e50239421b0a7bd2e4f32946cf3 Mon Sep 17 00:00:00 2001 From: Axel Nennker Date: Tue, 6 Aug 2019 15:06:30 +0200 Subject: [PATCH 099/320] ignore error in test Signed-off-by: Axel Nennker --- libindy/tests/pool.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libindy/tests/pool.rs b/libindy/tests/pool.rs index e9aaba371c..be27ea8931 100644 --- a/libindy/tests/pool.rs +++ b/libindy/tests/pool.rs @@ -86,7 +86,7 @@ mod high_cases { pool::create_pool_ledger_config("create_pool_ledger_config_works_for_specific_config", Some(pool_config.as_str())).unwrap(); - fs::remove_file(txn_file_path); + let _ = fs::remove_file(txn_file_path); utils::tear_down("create_pool_ledger_config_works_for_specific_config"); } From e8a17ce25809c7af3811c87b9d3aa013fa4691a4 Mon Sep 17 00:00:00 2001 From: Nikita Khateev Date: Tue, 6 Aug 2019 17:22:39 +0300 Subject: [PATCH 100/320] IS-1334 -- Minor updates Signed-off-by: Nikita Khateev --- docs/architecture/indy-sdk-components.puml | 40 +++++++- docs/architecture/indy-sdk-components.svg | 96 ++++++++++++------- .../indy_sdk_language_bindings.svg | 39 ++++++++ docs/architecture/language-bindings.md | 6 +- .../pool_communication_threading.puml | 3 + .../pool_communication_threading.svg | 7 +- 6 files changed, 149 insertions(+), 42 deletions(-) create mode 100644 docs/architecture/indy_sdk_language_bindings.svg diff --git a/docs/architecture/indy-sdk-components.puml b/docs/architecture/indy-sdk-components.puml index 139db64f95..616782b0d4 100644 --- a/docs/architecture/indy-sdk-components.puml +++ b/docs/architecture/indy-sdk-components.puml @@ -3,10 +3,7 @@ () "C Interface" as cinterface [libindy] -- cinterface -[Indy CLI] as cli -cinterface <.. cli - -package "Programming lanugages wrappers" { +package "Libindy language bindings" { [Java Wrapper] as java_wrapper cinterface <.. java_wrapper @@ -22,8 +19,41 @@ package "Programming lanugages wrappers" { [ObjectiveC Wrapper (iOS)] as objc_wrapper cinterface <.. objc_wrapper - [.Net Wrapper (iOS)] as dnet_wrapper + [.Net Wrapper] as dnet_wrapper cinterface <.. dnet_wrapper } +node "Pluggable payments" as payments { + [libnullpay] +} + +cinterface <.. payments + +node "Pluggable wallet storages" as wallets { + [Postgres] +} + +cinterface <.. wallets + +[Indy CLI] as cli +rust_wrapper <.. cli + +rust_wrapper <.. [LibVCX] +() "C Interface LibVCX" as cinterface_libvcx +[LibVCX] -- cinterface_libvcx + +package "LibVCX language bindings" { + [ObjectiveC Wrapper (iOS)] as objc_wrapper_libvcx + cinterface_libvcx <.. objc_wrapper_libvcx + + [Java Wrapper] as java_wrapper_libvcx + cinterface_libvcx <.. java_wrapper_libvcx + + [NodeJS Wrapper] as nodejs_wrapper_libvcx + cinterface_libvcx <.. nodejs_wrapper_libvcx + + [Python Wrapper] as python_wrapper_libvcx + cinterface_libvcx <.. python_wrapper_libvcx +} + @enduml diff --git a/docs/architecture/indy-sdk-components.svg b/docs/architecture/indy-sdk-components.svg index f7e75b72c0..ce3607fe6a 100644 --- a/docs/architecture/indy-sdk-components.svg +++ b/docs/architecture/indy-sdk-components.svg @@ -1,41 +1,71 @@ -Programming lanugages wrappersJava WrapperNodeJS WrapperRust WrapperPython WrapperObjectiveC Wrapper (iOS).Net Wrapper (iOS)C InterfacelibindyIndy CLILibindy language bindingsPluggable paymentsPluggable wallet storagesLibVCX language bindingsJava WrapperNodeJS WrapperRust WrapperPython WrapperObjectiveC Wrapper (iOS).Net WrapperlibnullpayPostgresObjectiveC Wrapper (iOS)Java WrapperNodeJS WrapperPython WrapperC InterfacelibindyIndy CLILibVCXC Interface LibVCXProgramming lanugages wrappersJava WrapperNodeJS WrapperRust WrapperPython WrapperObjectiveC Wrapper (iOS).Net WrapperC Interfacelibindy \ No newline at end of file diff --git a/docs/architecture/language-bindings.md b/docs/architecture/language-bindings.md index a5ba1c08f7..ce9a083b94 100644 --- a/docs/architecture/language-bindings.md +++ b/docs/architecture/language-bindings.md @@ -2,14 +2,16 @@ Libindy has a set of wrappers that convert its patterns to comply the best practices of corresponding languages. -![Components UML](indy-sdk-components.svg) +![Components UML](indy_sdk_language_bindings.svg) There is some more detailed information about these wrappers: * Java -- [Sources](https://github.com/hyperledger/indy-sdk/tree/master/wrappers/java) -- [Samples](https://github.com/hyperledger/indy-sdk/tree/master/samples/java) * Python -- [Sources](https://github.com/hyperledger/indy-sdk/tree/master/wrappers/python) -- [Samples](https://github.com/hyperledger/indy-sdk/tree/master/samples/python) * Rust -- [Sources](https://github.com/hyperledger/indy-sdk/tree/master/wrappers/rust) -- [Samples](https://github.com/hyperledger/indy-sdk/blob/master/libindy/tests/demo.rs) -* iOS -- [Sources](https://github.com/hyperledger/indy-sdk/tree/master/wrappers/ios) +* iOS -- [Sources](https://github.com/hyperledger/indy-sdk/tree/master/wrappers/ios) -- [Samples](https://github.com/hyperledger/indy-sdk/tree/master/wrappers/ios/libindy-pod/Indy-demoTests/Demo%20Tests) * NodeJS -- [Sources](https://github.com/hyperledger/indy-sdk/tree/master/wrappers/nodejs) -- [Samples](https://github.com/hyperledger/indy-sdk/tree/master/samples/nodejs) * .NET (not supported right now) -- [Sources](https://github.com/hyperledger/indy-sdk/tree/master/wrappers/dotnet) -- [Samples](https://github.com/hyperledger/indy-sdk/tree/master/samples/dotnet) +We have some more examples (they a grouped by usecases, not by languages) [here](https://github.com/hyperledger/indy-sdk/tree/master/docs/how-tos) + All wrappers support native logging -- you can read about it in wrapper's readme diff --git a/docs/architecture/pool_communication_threading.puml b/docs/architecture/pool_communication_threading.puml index 8839addc4a..e01e648420 100644 --- a/docs/architecture/pool_communication_threading.puml +++ b/docs/architecture/pool_communication_threading.puml @@ -32,6 +32,7 @@ Pool -> Nodes: sync network Nodes --> Pool: fresh network info Pool -> Command: OpenAck activate Command +Command -> Command: execute callback Command --> App: pool_handle deactivate Command @@ -64,6 +65,7 @@ Pool -> Nodes: send(json) Nodes -> Pool: responses Pool --> Command: aggregated response activate Command +Command -> Command: execute callback Command --> App: result deactivate Command @@ -81,6 +83,7 @@ Client -> App: error code deactivate Client Command -> Pool: Pool::close deactivate Pool +Command -> Command: execute callback Command --> App: error code deactivate Command @enduml \ No newline at end of file diff --git a/docs/architecture/pool_communication_threading.svg b/docs/architecture/pool_communication_threading.svg index 78e3b4d211..02d9adf3e7 100644 --- a/docs/architecture/pool_communication_threading.svg +++ b/docs/architecture/pool_communication_threading.svg @@ -1,4 +1,4 @@ -Client appClient appClient ThreadClient ThreadCommand ThreadCommand ThreadPool ThreadPool ThreadPool with nodesPool with nodesThread of an application,used to transfer commandsto Command thread.Main thread of the library.It executes biggest part of logicthat is implemented in LibindyThread used for communicationwith nodes in poolPool communication commandsindy_open_poolOpenerror codePool::newsync networkfresh network infoOpenAckpool_handleFrom now on pool worksand requests can be sentindy_submit_requestSubmitRequesterror codeApp waits for resultasynchronously if therewas no error beforesend_tx_send_messageCommand thread can executeother commands duringthe work of pool threadsend(json)responsesaggregated responseresultWhen the work is over,you should close the pooland it will kill the threadindy_close_poolCloseerror codePool::closeerror code + + + + diff --git a/samples/java/src/main/java/Anoncreds.java b/samples/java/src/main/java/Anoncreds.java index 33a7fe5a57..3e147492bb 100644 --- a/samples/java/src/main/java/Anoncreds.java +++ b/samples/java/src/main/java/Anoncreds.java @@ -27,21 +27,21 @@ static void demo() throws Exception { Pool pool = Pool.openPoolLedger(poolName, "{}").get(); //2. Issuer Create and Open Wallet - String issuerWalletConfig = "{\"id\":\"issuerWallet\"}"; - String issuerWalletCredentials = "{\"key\":\"issuer_wallet_key\"}"; + String issuerWalletConfig = new JSONObject().put("id", "issuerWallet").toString(); + String issuerWalletCredentials = new JSONObject().put("key", "issuer_wallet_key").toString(); Wallet.createWallet(issuerWalletConfig, issuerWalletCredentials).get(); Wallet issuerWallet = Wallet.openWallet(issuerWalletConfig, issuerWalletCredentials).get(); //3. Prover Create and Open Wallet - String proverWalletConfig = "{\"id\":\"trusteeWallet\"}"; - String proverWalletCredentials = "{\"key\":\"prover_wallet_key\"}"; + String proverWalletConfig = new JSONObject().put("id", "trusteeWallet").toString(); + String proverWalletCredentials = new JSONObject().put("key", "prover_wallet_key").toString(); Wallet.createWallet(proverWalletConfig, proverWalletCredentials).get(); Wallet proverWallet = Wallet.openWallet(proverWalletConfig, proverWalletCredentials).get(); //4. Issuer Creates Credential Schema String schemaName = "gvt"; String schemaVersion = "1.0"; - String schemaAttributes = "[\"name\", \"age\", \"sex\", \"height\"]"; + String schemaAttributes = new JSONArray().put("name").put("age").put("sex").put("height").toString(); AnoncredsResults.IssuerCreateSchemaResult createSchemaResult = issuerCreateSchema(issuerDid, schemaName, schemaVersion, schemaAttributes).get(); String schemaId = createSchemaResult.getSchemaId(); @@ -49,7 +49,7 @@ static void demo() throws Exception { //5. Issuer create Credential Definition String credDefTag = "Tag1"; - String credDefConfigJson = "{\"support_revocation\":false}"; + String credDefConfigJson = new JSONObject().put("support_revocation", false).toString(); AnoncredsResults.IssuerCreateAndStoreCredentialDefResult createCredDefResult = issuerCreateAndStoreCredentialDef(issuerWallet, issuerDid, schemaJson, credDefTag, null, credDefConfigJson).get(); String credDefId = createCredDefResult.getCredDefId(); @@ -69,12 +69,12 @@ static void demo() throws Exception { //9. Issuer create Credential // note that encoding is not standardized by Indy except that 32-bit integers are encoded as themselves. IS-786 - String credValuesJson = new JSONObject("{\n" + - " \"sex\": {\"raw\": \"male\", \"encoded\": \"594465709955896723921094925839488742869205008160769251991705001\"},\n" + - " \"name\": {\"raw\": \"Alex\", \"encoded\": \"1139481716457488690172217916278103335\"},\n" + - " \"height\": {\"raw\": \"175\", \"encoded\": \"175\"},\n" + - " \"age\": {\"raw\": \"28\", \"encoded\": \"28\"}\n" + - " }").toString(); + String credValuesJson = new JSONObject() + .put("sex", new JSONObject().put("raw", "male").put("encoded", "594465709955896723921094925839488742869205008160769251991705001")) + .put("name", new JSONObject().put("raw", "Alex").put("encoded", "1139481716457488690172217916278103335")) + .put("height", new JSONObject().put("raw", "175").put("encoded", "175")) + .put("age", new JSONObject().put("raw", "28").put("encoded", "28")) + .toString(); AnoncredsResults.IssuerCreateCredentialResult createCredentialResult = issuerCreateCredential(issuerWallet, credOffer, credReqJson, credValuesJson, null, - 1).get(); @@ -84,19 +84,24 @@ static void demo() throws Exception { proverStoreCredential(proverWallet, null, credReqMetadataJson, credential, credDefJson, null).get(); //11. Prover Gets Credentials for Proof Request - String proofRequestJson = new JSONObject("{" + - " \"nonce\":\"123432421212\",\n" + - " \"name\":\"proof_req_1\",\n" + - " \"version\":\"0.1\", " + - " \"requested_attributes\": {" + - " \"attr1_referent\":{\"name\":\"name\"}," + - " \"attr2_referent\":{\"name\":\"sex\"}," + - " \"attr3_referent\":{\"name\":\"phone\"}" + - " }," + - " \"requested_predicates\":{" + - " \"predicate1_referent\":{\"name\":\"age\",\"p_type\":\">=\",\"p_value\":18}" + - " }" + - " }").toString(); + String nonce = generateNonce().get(); + String proofRequestJson = new JSONObject() + .put("nonce", nonce) + .put("name", "proof_req_1") + .put("version", "0.1") + .put("requested_attributes", new JSONObject() + .put("attr1_referent", new JSONObject().put("name", "name")) + .put("attr2_referent", new JSONObject().put("name", "sex")) + .put("attr3_referent", new JSONObject().put("name", "phone")) + ) + .put("requested_predicates", new JSONObject() + .put("predicate1_referent", new JSONObject() + .put("name", "age") + .put("p_type", ">=") + .put("p_value", 18) + ) + ) + .toString(); CredentialsSearchForProofReq credentialsSearch = CredentialsSearchForProofReq.open(proverWallet, proofRequestJson, null).get(); @@ -116,19 +121,37 @@ static void demo() throws Exception { //12. Prover Creates Proof String selfAttestedValue = "8-800-300"; - String requestedCredentialsJson = new JSONObject(String.format("{\n" + - " \"self_attested_attributes\":{\"attr3_referent\":\"%s\"},\n" + - " \"requested_attributes\":{\"attr1_referent\":{\"cred_id\":\"%s\", \"revealed\":true},\n" + - " \"attr2_referent\":{\"cred_id\":\"%s\", \"revealed\":false}},\n" + - " \"requested_predicates\":{\"predicate1_referent\":{\"cred_id\":\"%s\"}}\n" + - " }", selfAttestedValue, credentialIdForAttribute1, credentialIdForAttribute2, credentialIdForPredicate)).toString(); - - String schemas = new JSONObject(String.format("{\"%s\":%s}", schemaId, schemaJson)).toString(); - String credentialDefs = new JSONObject(String.format("{\"%s\":%s}", credDefId, credDefJson)).toString(); - String revocStates = new JSONObject("{}").toString(); - - String proofJson = proverCreateProof(proverWallet, proofRequestJson, requestedCredentialsJson, - masterSecretId, schemas, credentialDefs, revocStates).get(); + String requestedCredentialsJson = new JSONObject() + .put("self_attested_attributes", new JSONObject().put("attr3_referent", selfAttestedValue)) + .put("requested_attributes", new JSONObject() + .put("attr1_referent", new JSONObject() + .put("cred_id", credentialIdForAttribute1) + .put("revealed", true) + ) + .put("attr2_referent", new JSONObject() + .put("cred_id", credentialIdForAttribute2) + .put("revealed", false) + ) + ) + .put("requested_predicates", new JSONObject() + .put("predicate1_referent", new JSONObject() + .put("cred_id",credentialIdForPredicate) + ) + ) + .toString(); + + String schemas = new JSONObject().put(schemaId, new JSONObject(schemaJson)).toString(); + String credentialDefs = new JSONObject().put(credDefId, new JSONObject(credDefJson)).toString(); + String revocStates = new JSONObject().toString(); + + String proofJson = ""; + try { + proofJson = proverCreateProof(proverWallet, proofRequestJson, requestedCredentialsJson, + masterSecretId, schemas, credentialDefs, revocStates).get(); + } catch (Exception e){ + System.out.println(""); + } + JSONObject proof = new JSONObject(proofJson); //13. Verifier verify Proof @@ -139,8 +162,8 @@ static void demo() throws Exception { assertEquals(selfAttestedValue, proof.getJSONObject("requested_proof").getJSONObject("self_attested_attrs").getString("attr3_referent")); - String revocRegDefs = new JSONObject("{}").toString(); - String revocRegs = new JSONObject("{}").toString(); + String revocRegDefs = new JSONObject().toString(); + String revocRegs = new JSONObject().toString(); Boolean valid = verifierVerifyProof(proofRequestJson, proofJson, schemas, credentialDefs, revocRegDefs, revocRegs).get(); assertTrue(valid); diff --git a/samples/java/src/main/java/AnoncredsRevocation.java b/samples/java/src/main/java/AnoncredsRevocation.java index 9cd91ca09d..4deea27dbc 100644 --- a/samples/java/src/main/java/AnoncredsRevocation.java +++ b/samples/java/src/main/java/AnoncredsRevocation.java @@ -30,21 +30,21 @@ static void demo() throws Exception { Pool pool = Pool.openPoolLedger(poolName, "{}").get(); //2. Issuer Create and Open Wallet - String issuerWalletConfig = "{\"id\":\"issuerWallet\"}"; - String issuerWalletCredentials = "{\"key\":\"issuer_wallet_key\"}"; + String issuerWalletConfig = new JSONObject().put("id", "issuerWallet").toString(); + String issuerWalletCredentials = new JSONObject().put("key", "issuer_wallet_key").toString(); Wallet.createWallet(issuerWalletConfig, issuerWalletCredentials).get(); Wallet issuerWallet = Wallet.openWallet(issuerWalletConfig, issuerWalletCredentials).get(); //3. Prover Create and Open Wallet - String proverWalletConfig = "{\"id\":\"trusteeWallet\"}"; - String proverWalletCredentials = "{\"key\":\"prover_wallet_key\"}"; + String proverWalletConfig = new JSONObject().put("id", "trusteeWallet").toString(); + String proverWalletCredentials = new JSONObject().put("key", "prover_wallet_key").toString(); Wallet.createWallet(proverWalletConfig, proverWalletCredentials).get(); Wallet proverWallet = Wallet.openWallet(proverWalletConfig, proverWalletCredentials).get(); //4. Issuer Creates Credential Schema String schemaName = "gvt"; String schemaVersion = "1.0"; - String schemaAttributes = "[\"name\", \"age\", \"sex\", \"height\"]"; + String schemaAttributes = new JSONArray().put("name").put("age").put("sex").put("height").toString(); AnoncredsResults.IssuerCreateSchemaResult createSchemaResult = issuerCreateSchema(issuerDid, schemaName, schemaVersion, schemaAttributes).get(); String schemaId = createSchemaResult.getSchemaId(); @@ -52,15 +52,21 @@ static void demo() throws Exception { //5. Issuer create Credential Definition String credDefTag = "Tag1"; - String credDefConfigJson = "{\"support_revocation\":true}"; + String credDefConfigJson = new JSONObject().put("support_revocation", true).toString(); AnoncredsResults.IssuerCreateAndStoreCredentialDefResult createCredDefResult = issuerCreateAndStoreCredentialDef(issuerWallet, issuerDid, schemaJson, credDefTag, null, credDefConfigJson).get(); String credDefId = createCredDefResult.getCredDefId(); String credDefJson = createCredDefResult.getCredDefJson(); //6. Issuer create Revocation Registry - String revRegDefConfig = new JSONObject("{\"issuance_type\":\"ISSUANCE_ON_DEMAND\",\"max_cred_num\":5}").toString(); - String tailsWriterConfig = new JSONObject(String.format("{\"base_dir\":\"%s\", \"uri_pattern\":\"\"}", getIndyHomePath("tails")).replace('\\', '/')).toString(); + String revRegDefConfig = new JSONObject() + .put("issuance_type", "ISSUANCE_ON_DEMAND") + .put("max_cred_num", 5) + .toString(); + String tailsWriterConfig = new JSONObject() + .put("base_dir", getIndyHomePath("tails").replace('\\', '/')) + .put("uri_pattern", "") + .toString(); BlobStorageWriter tailsWriter = BlobStorageWriter.openWriter("default", tailsWriterConfig).get(); String revRegDefTag = "Tag2"; @@ -87,12 +93,12 @@ static void demo() throws Exception { //11. Issuer create Credential // note that encoding is not standardized by Indy except that 32-bit integers are encoded as themselves. IS-786 - String credValuesJson = new JSONObject("{\n" + - " \"sex\": {\"raw\": \"male\", \"encoded\": \"594465709955896723921094925839488742869205008160769251991705001\"},\n" + - " \"name\": {\"raw\": \"Alex\", \"encoded\": \"1139481716457488690172217916278103335\"},\n" + - " \"height\": {\"raw\": \"175\", \"encoded\": \"175\"},\n" + - " \"age\": {\"raw\": \"28\", \"encoded\": \"28\"}\n" + - " }").toString(); + String credValuesJson = new JSONObject() + .put("sex", new JSONObject().put("raw", "male").put("encoded", "594465709955896723921094925839488742869205008160769251991705001")) + .put("name", new JSONObject().put("raw", "Alex").put("encoded", "1139481716457488690172217916278103335")) + .put("height", new JSONObject().put("raw", "175").put("encoded", "175")) + .put("age", new JSONObject().put("raw", "28").put("encoded", "28")) + .toString(); AnoncredsResults.IssuerCreateCredentialResult createCredentialResult = Anoncreds.issuerCreateCredential(issuerWallet, credOffer, credReqJson, credValuesJson, revRegId, blobStorageReaderHandle).get(); @@ -104,17 +110,26 @@ static void demo() throws Exception { Anoncreds.proverStoreCredential(proverWallet, null, credReqMetadataJson, credentialJson, credDefJson, revRegDefJson).get(); //13. Prover Gets Credentials for Proof Request - String proofRequestJson = new JSONObject("{\n" + - " \"nonce\":\"123432421212\",\n" + - " \"name\":\"proof_req_1\",\n" + - " \"version\":\"0.1\", " + - " \"requested_attributes\":{" + - " \"attr1_referent\":{\"name\":\"name\"}" + - " },\n" + - " \"requested_predicates\":{" + - " \"predicate1_referent\":{\"name\":\"age\",\"p_type\":\">=\",\"p_value\":18}" + - " }" + - " }").toString(); + long timestamp = System.currentTimeMillis() / 1000; + String nonce = generateNonce().get(); + String proofRequestJson = new JSONObject() + .put("nonce", nonce) + .put("name", "proof_req_1") + .put("version", "0.1") + .put("requested_attributes", new JSONObject() + .put("attr1_referent", new JSONObject().put("name", "name")) + ) + .put("requested_predicates", new JSONObject() + .put("predicate1_referent", new JSONObject() + .put("name", "age") + .put("p_type", ">=") + .put("p_value", 18) + ) + ) + .put("non_revoked", new JSONObject() + .put("to", timestamp) + ) + .toString(); CredentialsSearchForProofReq credentialsSearch = CredentialsSearchForProofReq.open(proverWallet, proofRequestJson, null).get(); @@ -127,19 +142,29 @@ static void demo() throws Exception { credentialsSearch.close(); //14. Prover create RevocationState - int timestamp = 100; String revStateJson = Anoncreds.createRevocationState(blobStorageReaderHandle, revRegDefJson, revRegDeltaJson, timestamp, credRevId).get(); //15. Prover Creates Proof - String requestedCredentialsJson = new JSONObject(String.format("{" + - "\"self_attested_attributes\":{}," + - "\"requested_attributes\":{\"attr1_referent\":{\"cred_id\":\"%s\", \"revealed\":true, \"timestamp\":%d }}," + - "\"requested_predicates\":{\"predicate1_referent\":{\"cred_id\":\"%s\", \"timestamp\":%d}}" + - "}", credIdForAttr1, timestamp, credIdForPred1, timestamp)).toString(); - - String schemas = new JSONObject(String.format("{\"%s\":%s}", schemaId, schemaJson)).toString(); - String credentialDefs = new JSONObject(String.format("{\"%s\":%s}", credDefId, credDefJson)).toString(); - String revStates = new JSONObject(String.format("{\"%s\": { \"%s\":%s }}", revRegId, timestamp, revStateJson)).toString(); + String requestedCredentialsJson = new JSONObject() + .put("self_attested_attributes", new JSONObject()) + .put("requested_attributes", new JSONObject() + .put("attr1_referent", new JSONObject() + .put("cred_id", credIdForAttr1) + .put("revealed", true) + .put("timestamp", timestamp) + ) + ) + .put("requested_predicates", new JSONObject() + .put("predicate1_referent", new JSONObject() + .put("cred_id", credIdForPred1) + .put("timestamp", timestamp) + ) + ) + .toString(); + + String schemas = new JSONObject().put(schemaId, new JSONObject(schemaJson)).toString(); + String credentialDefs = new JSONObject().put(credDefId, new JSONObject(credDefJson)).toString(); + String revStates = new JSONObject().put(revRegId, new JSONObject().put("" + timestamp, new JSONObject(revStateJson))).toString(); String proofJson = Anoncreds.proverCreateProof(proverWallet, proofRequestJson, requestedCredentialsJson, masterSecretId, schemas, credentialDefs, revStates).get(); @@ -149,8 +174,8 @@ static void demo() throws Exception { JSONObject revealedAttr1 = proof.getJSONObject("requested_proof").getJSONObject("revealed_attrs").getJSONObject("attr1_referent"); assertEquals("Alex", revealedAttr1.getString("raw")); - String revRegDefs = new JSONObject(String.format("{\"%s\":%s}", revRegId, revRegDefJson)).toString(); - String revRegs = new JSONObject(String.format("{\"%s\": { \"%s\":%s }}", revRegId, timestamp, revRegDeltaJson)).toString(); + String revRegDefs = new JSONObject().put(revRegId, new JSONObject(revRegDefJson)).toString(); + String revRegs = new JSONObject().put(revRegId, new JSONObject().put("" + timestamp, new JSONObject(revRegDeltaJson))).toString(); boolean valid = Anoncreds.verifierVerifyProof(proofRequestJson, proofJson, schemas, credentialDefs, revRegDefs, revRegs).get(); assertTrue(valid); diff --git a/samples/java/src/main/java/Crypto.java b/samples/java/src/main/java/Crypto.java index fa209a25eb..393a8a82c4 100644 --- a/samples/java/src/main/java/Crypto.java +++ b/samples/java/src/main/java/Crypto.java @@ -2,6 +2,7 @@ import org.hyperledger.indy.sdk.did.DidResults.CreateAndStoreMyDidResult; import org.hyperledger.indy.sdk.crypto.CryptoResults.AuthDecryptResult; import org.hyperledger.indy.sdk.wallet.Wallet; +import org.json.JSONObject; import org.junit.Assert; import utils.PoolUtils; @@ -25,14 +26,14 @@ static void demo() throws Exception { Pool pool = Pool.openPoolLedger(poolName, "{}").get(); // 2. Create and Open My Wallet - String myWalletConfig = "{\"id\":\"myWallet\"}"; - String myWalletCredentials = "{\"key\":\"my_wallet_key\"}"; + String myWalletConfig = new JSONObject().put("id", "myWallet").toString(); + String myWalletCredentials = new JSONObject().put("key", "my_wallet_key").toString(); Wallet.createWallet(myWalletConfig, myWalletCredentials).get(); Wallet myWallet = Wallet.openWallet(myWalletConfig, myWalletCredentials).get(); // 3. Create and Open Their Wallet - String theirWalletConfig = "{\"id\":\"theirWallet\"}"; - String theirWalletCredentials = "{\"key\":\"their_wallet_key\"}"; + String theirWalletConfig = new JSONObject().put("id", "theirWallet").toString(); + String theirWalletCredentials = new JSONObject().put("key", "their_wallet_key").toString(); Wallet.createWallet(theirWalletConfig, theirWalletCredentials).get(); Wallet theirWallet = Wallet.openWallet(theirWalletConfig, theirWalletCredentials).get(); @@ -45,14 +46,14 @@ static void demo() throws Exception { String theirVerkey = createTheirDidResult.getVerkey(); // 6. Their auth encrypt message - String msg = "{\n" + - " \"reqId\":1495034346617224651,\n" + - " \"identifier\":\"GJ1SzoWzavQYfNL9XkaJdrQejfztN4XqdsiV4ct3LXKL\",\n" + - " \"operation\":{\n" + - " \"type\":\"1\",\n" + - " \"dest\":\"4efZu2SXufS556yss7W5k6Po37jt4371RM4whbPKBKdB\"\n" + - " }\n" + - " }"; + String msg = new JSONObject() + .put("reqId", "1495034346617224651") + .put("identifier", "GJ1SzoWzavQYfNL9XkaJdrQejfztN4XqdsiV4ct3LXKL") + .put("operation", new JSONObject() + .put("type", "1") + .put("dest", "4efZu2SXufS556yss7W5k6Po37jt4371RM4whbPKBKdB") + ) + .toString(); byte[] encryptedMessage = authCrypt(theirWallet, theirVerkey, myVerkey, msg.getBytes()).get(); diff --git a/samples/java/src/main/java/Endorser.java b/samples/java/src/main/java/Endorser.java new file mode 100644 index 0000000000..9b7168e0f8 --- /dev/null +++ b/samples/java/src/main/java/Endorser.java @@ -0,0 +1,124 @@ +import org.hyperledger.indy.sdk.anoncreds.AnoncredsResults; +import org.hyperledger.indy.sdk.pool.Pool; +import org.hyperledger.indy.sdk.wallet.Wallet; +import org.hyperledger.indy.sdk.did.Did; +import org.hyperledger.indy.sdk.did.DidJSONParameters; +import org.hyperledger.indy.sdk.did.DidResults.CreateAndStoreMyDidResult; +import org.json.JSONArray; +import org.json.JSONObject; +import utils.PoolUtils; + +import java.util.Arrays; + +import static org.hyperledger.indy.sdk.ledger.Ledger.buildNymRequest; +import static org.hyperledger.indy.sdk.ledger.Ledger.buildSchemaRequest; +import static org.hyperledger.indy.sdk.ledger.Ledger.signAndSubmitRequest; +import static org.hyperledger.indy.sdk.ledger.Ledger.submitRequest; +import static org.hyperledger.indy.sdk.ledger.Ledger.multiSignRequest; +import static org.hyperledger.indy.sdk.ledger.Ledger.appendRequestEndorser; +import static org.hyperledger.indy.sdk.anoncreds.Anoncreds.issuerCreateSchema; +import static org.junit.Assert.assertEquals; + +class Endorser { + static void demo() throws Exception { + + System.out.println("Endorser sample -> started"); + String trusteeSeed = "000000000000000000000000Trustee1"; + + // Set protocol version 2 to work with Indy Node 1.4 + Pool.setProtocolVersion(PoolUtils.PROTOCOL_VERSION).get(); + + // 1. Create and Open Pool + String poolName = PoolUtils.createPoolLedgerConfig(); + Pool pool = Pool.openPoolLedger(poolName, "{}").get(); + + // 2. Create and Open Author Wallet + String authorWalletConfig = new JSONObject().put("id", "authorWallet").toString(); + String authorWalletCredentials = new JSONObject().put("key", "author_wallet_key").toString(); + Wallet.createWallet(authorWalletConfig, authorWalletCredentials).get(); + Wallet authorWallet = Wallet.openWallet(authorWalletConfig, authorWalletCredentials).get(); + + // 3. Create and Open Endorser Wallet + String endorserWalletConfig = new JSONObject().put("id", "endorserWallet").toString(); + String endorserWalletCredentials = new JSONObject().put("key", "endorser_wallet_key").toString(); + Wallet.createWallet(endorserWalletConfig, endorserWalletCredentials).get(); + Wallet endorserWallet = Wallet.openWallet(endorserWalletConfig, endorserWalletCredentials).get(); + + // 3. Create and Open Trustee Wallet + String trusteeWalletConfig = new JSONObject().put("id", "trusteeWallet").toString(); + String trusteeWalletCredentials = new JSONObject().put("key", "trustee_wallet_key").toString(); + Wallet.createWallet(trusteeWalletConfig, trusteeWalletCredentials).get(); + Wallet trusteeWallet = Wallet.openWallet(trusteeWalletConfig, trusteeWalletCredentials).get(); + + // 4. Create Trustee DID + DidJSONParameters.CreateAndStoreMyDidJSONParameter theirDidJson = + new DidJSONParameters.CreateAndStoreMyDidJSONParameter(null, trusteeSeed, null, null); + CreateAndStoreMyDidResult createTheirDidResult = Did.createAndStoreMyDid(trusteeWallet, theirDidJson.toJson()).get(); + String trusteeDid = createTheirDidResult.getDid(); + + // 5. Create Author DID + CreateAndStoreMyDidResult createMyDidResult = Did.createAndStoreMyDid(authorWallet, "{}").get(); + String authorDid = createMyDidResult.getDid(); + String authorVerkey = createMyDidResult.getVerkey(); + + // 6. Create Endorser DID + createMyDidResult = Did.createAndStoreMyDid(endorserWallet, "{}").get(); + String endorserDid = createMyDidResult.getDid(); + String endorserVerkey = createMyDidResult.getVerkey(); + + // 7. Build Author Nym Request + String nymRequest = buildNymRequest(trusteeDid, authorDid, authorVerkey, null, null).get(); + + // 8. Trustee Sign Author Nym Request + signAndSubmitRequest(pool, trusteeWallet, trusteeDid, nymRequest).get(); + + // 9. Build Endorser Nym Request + nymRequest = buildNymRequest(trusteeDid, endorserDid, endorserVerkey, null, "ENDORSER").get(); + + // 10. Trustee Sign Endorser Nym Request + signAndSubmitRequest(pool, trusteeWallet, trusteeDid, nymRequest).get(); + + // 11. Create schema with endorser + + String schemaName = "gvt"; + String schemaVersion = "1.0"; + String schemaAttributes = new JSONArray().put("name").put("age").put("sex").put("height").toString(); + AnoncredsResults.IssuerCreateSchemaResult createSchemaResult = + issuerCreateSchema(authorDid, schemaName, schemaVersion, schemaAttributes).get(); + String schemaId = createSchemaResult.getSchemaId(); + String schemaJson = createSchemaResult.getSchemaJson(); + + // Transaction Author builds Schema Request + String schemaRequest = buildSchemaRequest(authorDid, schemaJson).get(); + + // Transaction Author appends Endorser's DID into the request + String schemaRequestWithEndorser = appendRequestEndorser(schemaRequest, endorserDid).get(); + + // Transaction Author signs the request with the added endorser field + String schemaRequestWithEndorserAuthorSigned = + multiSignRequest(authorWallet, authorDid, schemaRequestWithEndorser).get(); + + // Transaction Endorser signs the request + String schemaRequestWithEndorserSigned = + multiSignRequest(endorserWallet, endorserDid, schemaRequestWithEndorserAuthorSigned).get(); + + // Transaction Endorser sends the request + String response = submitRequest(pool, schemaRequestWithEndorserSigned).get(); + JSONObject responseJson = new JSONObject(response); + assertEquals("REPLY", responseJson.getString("op")); + + pool.closePoolLedger().get(); + Pool.deletePoolLedgerConfig(poolName).get(); + + trusteeWallet.closeWallet().get(); + Wallet.deleteWallet(trusteeWalletConfig, trusteeWalletCredentials).get(); + + authorWallet.closeWallet().get(); + Wallet.deleteWallet(authorWalletConfig, authorWalletCredentials).get(); + + endorserWallet.closeWallet().get(); + Wallet.deleteWallet(endorserWalletConfig, endorserWalletCredentials).get(); + + System.out.println("Endorser sample -> completed"); + } +} \ No newline at end of file diff --git a/samples/java/src/main/java/Ledger.java b/samples/java/src/main/java/Ledger.java index 99a4b41cab..1759c23e6c 100644 --- a/samples/java/src/main/java/Ledger.java +++ b/samples/java/src/main/java/Ledger.java @@ -27,14 +27,14 @@ static void demo() throws Exception { Pool pool = Pool.openPoolLedger(poolName, "{}").get(); // 2. Create and Open My Wallet - String myWalletConfig = "{\"id\":\"myWallet\"}"; - String myWalletCredentials = "{\"key\":\"my_wallet_key\"}"; + String myWalletConfig = new JSONObject().put("id", "myWallet").toString(); + String myWalletCredentials = new JSONObject().put("key", "my_wallet_key").toString(); Wallet.createWallet(myWalletConfig, myWalletCredentials).get(); Wallet myWallet = Wallet.openWallet(myWalletConfig, myWalletCredentials).get(); // 3. Create and Open Trustee Wallet - String trusteeWalletConfig = "{\"id\":\"theirWallet\"}"; - String trusteeWalletCredentials = "{\"key\":\"trustee_wallet_key\"}"; + String trusteeWalletConfig = new JSONObject().put("id", "theirWallet").toString(); + String trusteeWalletCredentials = new JSONObject().put("key", "trustee_wallet_key").toString(); Wallet.createWallet(trusteeWalletConfig, trusteeWalletCredentials).get(); Wallet trusteeWallet = Wallet.openWallet(trusteeWalletConfig, trusteeWalletCredentials).get(); diff --git a/samples/java/src/main/java/Main.java b/samples/java/src/main/java/Main.java index c885456a69..d2a6a4e6c4 100644 --- a/samples/java/src/main/java/Main.java +++ b/samples/java/src/main/java/Main.java @@ -5,5 +5,6 @@ public static void main(String[] args) throws Exception { AnoncredsRevocation.demo(); Ledger.demo(); Crypto.demo(); + Endorser.demo(); } } diff --git a/samples/nodejs/package-lock.json b/samples/nodejs/package-lock.json index 22b324cca0..8f43c028ad 100644 --- a/samples/nodejs/package-lock.json +++ b/samples/nodejs/package-lock.json @@ -4,6 +4,90 @@ "lockfileVersion": 1, "requires": true, "dependencies": { + "abbrev": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", + "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==" + }, + "ajv": { + "version": "6.10.2", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.10.2.tgz", + "integrity": "sha512-TXtUUEYHuaTEbLZWIKUr5pmBuhDLy+8KYtPYdcV8qC+pOZL+NKqYwvWSRrVXHn+ZmRRAu8vJTAznH7Oag6RVRw==", + "requires": { + "fast-deep-equal": "^2.0.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + } + }, + "ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=" + }, + "aproba": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/aproba/-/aproba-1.2.0.tgz", + "integrity": "sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw==" + }, + "are-we-there-yet": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-1.1.5.tgz", + "integrity": "sha512-5hYdAkZlcG8tOLujVDTgCT+uPX0VnpAH28gWsLfzpXYm7wP6mp5Q/gYyR7YQ0cKVJcXJnl3j2kpBan13PtQf6w==", + "requires": { + "delegates": "^1.0.0", + "readable-stream": "^2.0.6" + } + }, + "asn1": { + "version": "0.2.4", + "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz", + "integrity": "sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==", + "requires": { + "safer-buffer": "~2.1.0" + } + }, + "assert-plus": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" + }, + "asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" + }, + "aws-sign2": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", + "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=" + }, + "aws4": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.8.0.tgz", + "integrity": "sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ==" + }, + "balanced-match": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=" + }, + "bcrypt-pbkdf": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", + "integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=", + "requires": { + "tweetnacl": "^0.14.3" + } + }, + "bindings": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz", + "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==", + "requires": { + "file-uri-to-path": "1.0.0" + } + }, "boom": { "version": "7.2.2", "resolved": "https://registry.npmjs.org/boom/-/boom-7.2.2.tgz", @@ -12,6 +96,53 @@ "hoek": "6.x.x" } }, + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "caseless": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", + "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=" + }, + "chownr": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.2.tgz", + "integrity": "sha512-GkfeAQh+QNy3wquu9oIZr6SS5x7wGdSgNQvD10X3r+AZr1Oys22HW8kAmDMvNg2+Dm0TeGaEuO8gFwdBXxwO8A==" + }, + "code-point-at": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", + "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=" + }, + "combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "requires": { + "delayed-stream": "~1.0.0" + } + }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" + }, + "console-control-strings": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz", + "integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=" + }, + "core-util-is": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" + }, "cryptiles": { "version": "4.1.3", "resolved": "https://registry.npmjs.org/cryptiles/-/cryptiles-4.1.3.tgz", @@ -20,6 +151,146 @@ "boom": "7.x.x" } }, + "dashdash": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", + "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", + "requires": { + "assert-plus": "^1.0.0" + } + }, + "delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=" + }, + "delegates": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz", + "integrity": "sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o=" + }, + "ecc-jsbn": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", + "integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk=", + "requires": { + "jsbn": "~0.1.0", + "safer-buffer": "^2.1.0" + } + }, + "extend": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==" + }, + "extsprintf": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", + "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=" + }, + "fast-deep-equal": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz", + "integrity": "sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk=" + }, + "fast-json-stable-stringify": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", + "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=" + }, + "file-uri-to-path": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", + "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==" + }, + "forever-agent": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", + "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=" + }, + "form-data": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz", + "integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==", + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.6", + "mime-types": "^2.1.12" + } + }, + "fs-minipass": { + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-1.2.6.tgz", + "integrity": "sha512-crhvyXcMejjv3Z5d2Fa9sf5xLYVCF5O1c71QxbVnbLsmYMBEvDAftewesN/HhY03YRoA7zOMxjNGrF5svGaaeQ==", + "requires": { + "minipass": "^2.2.1" + } + }, + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" + }, + "gauge": { + "version": "2.7.4", + "resolved": "https://registry.npmjs.org/gauge/-/gauge-2.7.4.tgz", + "integrity": "sha1-LANAXHU4w51+s3sxcCLjJfsBi/c=", + "requires": { + "aproba": "^1.0.3", + "console-control-strings": "^1.0.0", + "has-unicode": "^2.0.0", + "object-assign": "^4.1.0", + "signal-exit": "^3.0.0", + "string-width": "^1.0.1", + "strip-ansi": "^3.0.1", + "wide-align": "^1.1.0" + } + }, + "getpass": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", + "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", + "requires": { + "assert-plus": "^1.0.0" + } + }, + "glob": { + "version": "7.1.4", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.4.tgz", + "integrity": "sha512-hkLPepehmnKk41pUGm3sYxoFs/umurYfYJCerbXEyFIWcAzvpipAgVkBqqT9RBKMGjnq6kMuyYwha6csxbiM1A==", + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "graceful-fs": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.2.tgz", + "integrity": "sha512-IItsdsea19BoLC7ELy13q1iJFNmd7ofZH5+X/pJr90/nRoPEX0DJo1dHDbgtYWOhJhcCgMDTOw84RZ72q6lB+Q==" + }, + "har-schema": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", + "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=" + }, + "har-validator": { + "version": "5.1.3", + "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.3.tgz", + "integrity": "sha512-sNvOCzEQNr/qrvJgc3UG/kD4QtlHycrzwS+6mfTrrSq97BvaYcPZZI1ZSqGSPR73Cxn4LKTD4PttRwfU7jWq5g==", + "requires": { + "ajv": "^6.5.5", + "har-schema": "^2.0.0" + } + }, + "has-unicode": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz", + "integrity": "sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk=" + }, "hoek": { "version": "6.0.3", "resolved": "https://registry.npmjs.org/hoek/-/hoek-6.0.3.tgz", @@ -30,5455 +301,118 @@ "resolved": "https://registry.npmjs.org/home-dir/-/home-dir-1.0.0.tgz", "integrity": "sha1-KRfrRL3JByztqUJXlUOEfjAX/k4=" }, + "http-signature": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", + "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", + "requires": { + "assert-plus": "^1.0.0", + "jsprim": "^1.2.2", + "sshpk": "^1.7.0" + } + }, "indy-sdk": { - "version": "file:../../wrappers/nodejs", + "version": "1.11.0", + "resolved": "https://registry.npmjs.org/indy-sdk/-/indy-sdk-1.11.0.tgz", + "integrity": "sha512-XjvNaS6IkeFPB1B4252NPckD8sDY+dU9DcljTMcrWP5Hm3QAiN//OR5xRxg0HLV73QY/MKH3GEJof6aEPT1owQ==", "requires": { - "bindings": "^1.3.0", - "nan": "^2.10.0", - "node-gyp": "^3.6.2" - }, - "dependencies": { - "@ava/babel-plugin-throws-helper": { - "version": "2.0.0", - "bundled": true - }, - "@ava/babel-preset-stage-4": { - "version": "1.1.0", - "bundled": true, - "requires": { - "babel-plugin-check-es2015-constants": "^6.8.0", - "babel-plugin-syntax-trailing-function-commas": "^6.20.0", - "babel-plugin-transform-async-to-generator": "^6.16.0", - "babel-plugin-transform-es2015-destructuring": "^6.19.0", - "babel-plugin-transform-es2015-function-name": "^6.9.0", - "babel-plugin-transform-es2015-modules-commonjs": "^6.18.0", - "babel-plugin-transform-es2015-parameters": "^6.21.0", - "babel-plugin-transform-es2015-spread": "^6.8.0", - "babel-plugin-transform-es2015-sticky-regex": "^6.8.0", - "babel-plugin-transform-es2015-unicode-regex": "^6.11.0", - "babel-plugin-transform-exponentiation-operator": "^6.8.0", - "package-hash": "^1.2.0" - }, - "dependencies": { - "md5-hex": { - "version": "1.3.0", - "bundled": true, - "requires": { - "md5-o-matic": "^0.1.1" - } - }, - "package-hash": { - "version": "1.2.0", - "bundled": true, - "requires": { - "md5-hex": "^1.3.0" - } - } - } - }, - "@ava/babel-preset-transform-test-files": { - "version": "3.0.0", - "bundled": true, - "requires": { - "@ava/babel-plugin-throws-helper": "^2.0.0", - "babel-plugin-espower": "^2.3.2" - } - }, - "@ava/write-file-atomic": { - "version": "2.2.0", - "bundled": true, - "requires": { - "graceful-fs": "^4.1.11", - "imurmurhash": "^0.1.4", - "slide": "^1.1.5" - } - }, - "@concordance/react": { - "version": "1.0.0", - "bundled": true, - "requires": { - "arrify": "^1.0.1" - } - }, - "@ladjs/time-require": { - "version": "0.1.4", - "bundled": true, - "requires": { - "chalk": "^0.4.0", - "date-time": "^0.1.1", - "pretty-ms": "^0.2.1", - "text-table": "^0.2.0" - }, - "dependencies": { - "ansi-styles": { - "version": "1.0.0", - "bundled": true - }, - "chalk": { - "version": "0.4.0", - "bundled": true, - "requires": { - "ansi-styles": "~1.0.0", - "has-color": "~0.1.0", - "strip-ansi": "~0.1.0" - } - }, - "pretty-ms": { - "version": "0.2.2", - "bundled": true, - "requires": { - "parse-ms": "^0.1.0" - } - }, - "strip-ansi": { - "version": "0.1.1", - "bundled": true - } - } - }, - "abbrev": { - "version": "1.1.1", - "bundled": true - }, - "acorn": { - "version": "5.7.3", - "bundled": true - }, - "acorn-jsx": { - "version": "3.0.1", - "bundled": true, - "requires": { - "acorn": "^3.0.4" - }, - "dependencies": { - "acorn": { - "version": "3.3.0", - "bundled": true - } - } - }, - "ajv": { - "version": "6.5.5", - "bundled": true, - "requires": { - "fast-deep-equal": "^2.0.1", - "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.4.1", - "uri-js": "^4.2.2" - } - }, - "ajv-keywords": { - "version": "2.1.1", - "bundled": true - }, - "ansi-align": { - "version": "2.0.0", - "bundled": true, - "requires": { - "string-width": "^2.0.0" - }, - "dependencies": { - "ansi-regex": { - "version": "3.0.0", - "bundled": true - }, - "is-fullwidth-code-point": { - "version": "2.0.0", - "bundled": true - }, - "string-width": { - "version": "2.1.1", - "bundled": true, - "requires": { - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^4.0.0" - } - }, - "strip-ansi": { - "version": "4.0.0", - "bundled": true, - "requires": { - "ansi-regex": "^3.0.0" - } - } - } - }, - "ansi-escapes": { - "version": "3.1.0", - "bundled": true - }, - "ansi-regex": { - "version": "2.1.1", - "bundled": true - }, - "ansi-styles": { - "version": "3.2.1", - "bundled": true, - "requires": { - "color-convert": "^1.9.0" - } - }, - "anymatch": { - "version": "1.3.2", - "bundled": true, - "requires": { - "micromatch": "^2.1.5", - "normalize-path": "^2.0.0" - } - }, - "aproba": { - "version": "1.2.0", - "bundled": true - }, - "are-we-there-yet": { - "version": "1.1.5", - "bundled": true, - "requires": { - "delegates": "^1.0.0", - "readable-stream": "^2.0.6" - } - }, - "argparse": { - "version": "1.0.10", - "bundled": true, - "requires": { - "sprintf-js": "~1.0.2" - } - }, - "arr-diff": { - "version": "2.0.0", - "bundled": true, - "requires": { - "arr-flatten": "^1.0.1" - } - }, - "arr-exclude": { - "version": "1.0.0", - "bundled": true - }, - "arr-flatten": { - "version": "1.1.0", - "bundled": true - }, - "arr-union": { - "version": "3.1.0", - "bundled": true - }, - "array-differ": { - "version": "1.0.0", - "bundled": true - }, - "array-find-index": { - "version": "1.0.2", - "bundled": true - }, - "array-includes": { - "version": "3.0.3", - "bundled": true, - "requires": { - "define-properties": "^1.1.2", - "es-abstract": "^1.7.0" - } - }, - "array-union": { - "version": "1.0.2", - "bundled": true, - "requires": { - "array-uniq": "^1.0.1" - } - }, - "array-uniq": { - "version": "1.0.3", - "bundled": true - }, - "array-unique": { - "version": "0.2.1", - "bundled": true - }, - "arrify": { - "version": "1.0.1", - "bundled": true - }, - "asn1": { - "version": "0.2.4", - "bundled": true, - "requires": { - "safer-buffer": "~2.1.0" - } - }, - "assert-plus": { - "version": "1.0.0", - "bundled": true - }, - "assign-symbols": { - "version": "1.0.0", - "bundled": true - }, - "async-each": { - "version": "1.0.1", - "bundled": true - }, - "asynckit": { - "version": "0.4.0", - "bundled": true - }, - "atob": { - "version": "2.1.2", - "bundled": true - }, - "auto-bind": { - "version": "1.2.1", - "bundled": true - }, - "ava": { - "version": "0.25.0", - "bundled": true, - "requires": { - "@ava/babel-preset-stage-4": "^1.1.0", - "@ava/babel-preset-transform-test-files": "^3.0.0", - "@ava/write-file-atomic": "^2.2.0", - "@concordance/react": "^1.0.0", - "@ladjs/time-require": "^0.1.4", - "ansi-escapes": "^3.0.0", - "ansi-styles": "^3.1.0", - "arr-flatten": "^1.0.1", - "array-union": "^1.0.1", - "array-uniq": "^1.0.2", - "arrify": "^1.0.0", - "auto-bind": "^1.1.0", - "ava-init": "^0.2.0", - "babel-core": "^6.17.0", - "babel-generator": "^6.26.0", - "babel-plugin-syntax-object-rest-spread": "^6.13.0", - "bluebird": "^3.0.0", - "caching-transform": "^1.0.0", - "chalk": "^2.0.1", - "chokidar": "^1.4.2", - "clean-stack": "^1.1.1", - "clean-yaml-object": "^0.1.0", - "cli-cursor": "^2.1.0", - "cli-spinners": "^1.0.0", - "cli-truncate": "^1.0.0", - "co-with-promise": "^4.6.0", - "code-excerpt": "^2.1.1", - "common-path-prefix": "^1.0.0", - "concordance": "^3.0.0", - "convert-source-map": "^1.5.1", - "core-assert": "^0.2.0", - "currently-unhandled": "^0.4.1", - "debug": "^3.0.1", - "dot-prop": "^4.1.0", - "empower-core": "^0.6.1", - "equal-length": "^1.0.0", - "figures": "^2.0.0", - "find-cache-dir": "^1.0.0", - "fn-name": "^2.0.0", - "get-port": "^3.0.0", - "globby": "^6.0.0", - "has-flag": "^2.0.0", - "hullabaloo-config-manager": "^1.1.0", - "ignore-by-default": "^1.0.0", - "import-local": "^0.1.1", - "indent-string": "^3.0.0", - "is-ci": "^1.0.7", - "is-generator-fn": "^1.0.0", - "is-obj": "^1.0.0", - "is-observable": "^1.0.0", - "is-promise": "^2.1.0", - "last-line-stream": "^1.0.0", - "lodash.clonedeepwith": "^4.5.0", - "lodash.debounce": "^4.0.3", - "lodash.difference": "^4.3.0", - "lodash.flatten": "^4.2.0", - "loud-rejection": "^1.2.0", - "make-dir": "^1.0.0", - "matcher": "^1.0.0", - "md5-hex": "^2.0.0", - "meow": "^3.7.0", - "ms": "^2.0.0", - "multimatch": "^2.1.0", - "observable-to-promise": "^0.5.0", - "option-chain": "^1.0.0", - "package-hash": "^2.0.0", - "pkg-conf": "^2.0.0", - "plur": "^2.0.0", - "pretty-ms": "^3.0.0", - "require-precompiled": "^0.1.0", - "resolve-cwd": "^2.0.0", - "safe-buffer": "^5.1.1", - "semver": "^5.4.1", - "slash": "^1.0.0", - "source-map-support": "^0.5.0", - "stack-utils": "^1.0.1", - "strip-ansi": "^4.0.0", - "strip-bom-buf": "^1.0.0", - "supertap": "^1.0.0", - "supports-color": "^5.0.0", - "trim-off-newlines": "^1.0.1", - "unique-temp-dir": "^1.0.0", - "update-notifier": "^2.3.0" - }, - "dependencies": { - "ansi-regex": { - "version": "3.0.0", - "bundled": true - }, - "semver": { - "version": "5.6.0", - "bundled": true - }, - "strip-ansi": { - "version": "4.0.0", - "bundled": true, - "requires": { - "ansi-regex": "^3.0.0" - } - } - } - }, - "ava-init": { - "version": "0.2.1", - "bundled": true, - "requires": { - "arr-exclude": "^1.0.0", - "execa": "^0.7.0", - "has-yarn": "^1.0.0", - "read-pkg-up": "^2.0.0", - "write-pkg": "^3.1.0" - } - }, - "aws-sign2": { - "version": "0.7.0", - "bundled": true - }, - "aws4": { - "version": "1.8.0", - "bundled": true - }, - "babel-code-frame": { - "version": "6.26.0", - "bundled": true, - "requires": { - "chalk": "^1.1.3", - "esutils": "^2.0.2", - "js-tokens": "^3.0.2" - }, - "dependencies": { - "ansi-styles": { - "version": "2.2.1", - "bundled": true - }, - "chalk": { - "version": "1.1.3", - "bundled": true, - "requires": { - "ansi-styles": "^2.2.1", - "escape-string-regexp": "^1.0.2", - "has-ansi": "^2.0.0", - "strip-ansi": "^3.0.0", - "supports-color": "^2.0.0" - } - }, - "supports-color": { - "version": "2.0.0", - "bundled": true - } - } - }, - "babel-core": { - "version": "6.26.3", - "bundled": true, - "requires": { - "babel-code-frame": "^6.26.0", - "babel-generator": "^6.26.0", - "babel-helpers": "^6.24.1", - "babel-messages": "^6.23.0", - "babel-register": "^6.26.0", - "babel-runtime": "^6.26.0", - "babel-template": "^6.26.0", - "babel-traverse": "^6.26.0", - "babel-types": "^6.26.0", - "babylon": "^6.18.0", - "convert-source-map": "^1.5.1", - "debug": "^2.6.9", - "json5": "^0.5.1", - "lodash": "^4.17.4", - "minimatch": "^3.0.4", - "path-is-absolute": "^1.0.1", - "private": "^0.1.8", - "slash": "^1.0.0", - "source-map": "^0.5.7" - }, - "dependencies": { - "debug": { - "version": "2.6.9", - "bundled": true, - "requires": { - "ms": "2.0.0" - } - }, - "ms": { - "version": "2.0.0", - "bundled": true - } - } - }, - "babel-generator": { - "version": "6.26.1", - "bundled": true, - "requires": { - "babel-messages": "^6.23.0", - "babel-runtime": "^6.26.0", - "babel-types": "^6.26.0", - "detect-indent": "^4.0.0", - "jsesc": "^1.3.0", - "lodash": "^4.17.4", - "source-map": "^0.5.7", - "trim-right": "^1.0.1" - }, - "dependencies": { - "jsesc": { - "version": "1.3.0", - "bundled": true - } - } - }, - "babel-helper-builder-binary-assignment-operator-visitor": { - "version": "6.24.1", - "bundled": true, - "requires": { - "babel-helper-explode-assignable-expression": "^6.24.1", - "babel-runtime": "^6.22.0", - "babel-types": "^6.24.1" - } - }, - "babel-helper-call-delegate": { - "version": "6.24.1", - "bundled": true, - "requires": { - "babel-helper-hoist-variables": "^6.24.1", - "babel-runtime": "^6.22.0", - "babel-traverse": "^6.24.1", - "babel-types": "^6.24.1" - } - }, - "babel-helper-explode-assignable-expression": { - "version": "6.24.1", - "bundled": true, - "requires": { - "babel-runtime": "^6.22.0", - "babel-traverse": "^6.24.1", - "babel-types": "^6.24.1" - } - }, - "babel-helper-function-name": { - "version": "6.24.1", - "bundled": true, - "requires": { - "babel-helper-get-function-arity": "^6.24.1", - "babel-runtime": "^6.22.0", - "babel-template": "^6.24.1", - "babel-traverse": "^6.24.1", - "babel-types": "^6.24.1" - } - }, - "babel-helper-get-function-arity": { - "version": "6.24.1", - "bundled": true, - "requires": { - "babel-runtime": "^6.22.0", - "babel-types": "^6.24.1" - } - }, - "babel-helper-hoist-variables": { - "version": "6.24.1", - "bundled": true, - "requires": { - "babel-runtime": "^6.22.0", - "babel-types": "^6.24.1" - } - }, - "babel-helper-regex": { - "version": "6.26.0", - "bundled": true, - "requires": { - "babel-runtime": "^6.26.0", - "babel-types": "^6.26.0", - "lodash": "^4.17.4" - } - }, - "babel-helper-remap-async-to-generator": { - "version": "6.24.1", - "bundled": true, - "requires": { - "babel-helper-function-name": "^6.24.1", - "babel-runtime": "^6.22.0", - "babel-template": "^6.24.1", - "babel-traverse": "^6.24.1", - "babel-types": "^6.24.1" - } - }, - "babel-helpers": { - "version": "6.24.1", - "bundled": true, - "requires": { - "babel-runtime": "^6.22.0", - "babel-template": "^6.24.1" - } - }, - "babel-messages": { - "version": "6.23.0", - "bundled": true, - "requires": { - "babel-runtime": "^6.22.0" - } - }, - "babel-plugin-check-es2015-constants": { - "version": "6.22.0", - "bundled": true, - "requires": { - "babel-runtime": "^6.22.0" - } - }, - "babel-plugin-espower": { - "version": "2.4.0", - "bundled": true, - "requires": { - "babel-generator": "^6.1.0", - "babylon": "^6.1.0", - "call-matcher": "^1.0.0", - "core-js": "^2.0.0", - "espower-location-detector": "^1.0.0", - "espurify": "^1.6.0", - "estraverse": "^4.1.1" - } - }, - "babel-plugin-syntax-async-functions": { - "version": "6.13.0", - "bundled": true - }, - "babel-plugin-syntax-exponentiation-operator": { - "version": "6.13.0", - "bundled": true - }, - "babel-plugin-syntax-object-rest-spread": { - "version": "6.13.0", - "bundled": true - }, - "babel-plugin-syntax-trailing-function-commas": { - "version": "6.22.0", - "bundled": true - }, - "babel-plugin-transform-async-to-generator": { - "version": "6.24.1", - "bundled": true, - "requires": { - "babel-helper-remap-async-to-generator": "^6.24.1", - "babel-plugin-syntax-async-functions": "^6.8.0", - "babel-runtime": "^6.22.0" - } - }, - "babel-plugin-transform-es2015-destructuring": { - "version": "6.23.0", - "bundled": true, - "requires": { - "babel-runtime": "^6.22.0" - } - }, - "babel-plugin-transform-es2015-function-name": { - "version": "6.24.1", - "bundled": true, - "requires": { - "babel-helper-function-name": "^6.24.1", - "babel-runtime": "^6.22.0", - "babel-types": "^6.24.1" - } - }, - "babel-plugin-transform-es2015-modules-commonjs": { - "version": "6.26.2", - "bundled": true, - "requires": { - "babel-plugin-transform-strict-mode": "^6.24.1", - "babel-runtime": "^6.26.0", - "babel-template": "^6.26.0", - "babel-types": "^6.26.0" - } - }, - "babel-plugin-transform-es2015-parameters": { - "version": "6.24.1", - "bundled": true, - "requires": { - "babel-helper-call-delegate": "^6.24.1", - "babel-helper-get-function-arity": "^6.24.1", - "babel-runtime": "^6.22.0", - "babel-template": "^6.24.1", - "babel-traverse": "^6.24.1", - "babel-types": "^6.24.1" - } - }, - "babel-plugin-transform-es2015-spread": { - "version": "6.22.0", - "bundled": true, - "requires": { - "babel-runtime": "^6.22.0" - } - }, - "babel-plugin-transform-es2015-sticky-regex": { - "version": "6.24.1", - "bundled": true, - "requires": { - "babel-helper-regex": "^6.24.1", - "babel-runtime": "^6.22.0", - "babel-types": "^6.24.1" - } - }, - "babel-plugin-transform-es2015-unicode-regex": { - "version": "6.24.1", - "bundled": true, - "requires": { - "babel-helper-regex": "^6.24.1", - "babel-runtime": "^6.22.0", - "regexpu-core": "^2.0.0" - } - }, - "babel-plugin-transform-exponentiation-operator": { - "version": "6.24.1", - "bundled": true, - "requires": { - "babel-helper-builder-binary-assignment-operator-visitor": "^6.24.1", - "babel-plugin-syntax-exponentiation-operator": "^6.8.0", - "babel-runtime": "^6.22.0" - } - }, - "babel-plugin-transform-strict-mode": { - "version": "6.24.1", - "bundled": true, - "requires": { - "babel-runtime": "^6.22.0", - "babel-types": "^6.24.1" - } - }, - "babel-register": { - "version": "6.26.0", - "bundled": true, - "requires": { - "babel-core": "^6.26.0", - "babel-runtime": "^6.26.0", - "core-js": "^2.5.0", - "home-or-tmp": "^2.0.0", - "lodash": "^4.17.4", - "mkdirp": "^0.5.1", - "source-map-support": "^0.4.15" - }, - "dependencies": { - "source-map-support": { - "version": "0.4.18", - "bundled": true, - "requires": { - "source-map": "^0.5.6" - } - } - } - }, - "babel-runtime": { - "version": "6.26.0", - "bundled": true, - "requires": { - "core-js": "^2.4.0", - "regenerator-runtime": "^0.11.0" - } - }, - "babel-template": { - "version": "6.26.0", - "bundled": true, - "requires": { - "babel-runtime": "^6.26.0", - "babel-traverse": "^6.26.0", - "babel-types": "^6.26.0", - "babylon": "^6.18.0", - "lodash": "^4.17.4" - } - }, - "babel-traverse": { - "version": "6.26.0", - "bundled": true, - "requires": { - "babel-code-frame": "^6.26.0", - "babel-messages": "^6.23.0", - "babel-runtime": "^6.26.0", - "babel-types": "^6.26.0", - "babylon": "^6.18.0", - "debug": "^2.6.8", - "globals": "^9.18.0", - "invariant": "^2.2.2", - "lodash": "^4.17.4" - }, - "dependencies": { - "debug": { - "version": "2.6.9", - "bundled": true, - "requires": { - "ms": "2.0.0" - } - }, - "ms": { - "version": "2.0.0", - "bundled": true - } - } - }, - "babel-types": { - "version": "6.26.0", - "bundled": true, - "requires": { - "babel-runtime": "^6.26.0", - "esutils": "^2.0.2", - "lodash": "^4.17.4", - "to-fast-properties": "^1.0.3" - } - }, - "babylon": { - "version": "6.18.0", - "bundled": true - }, - "balanced-match": { - "version": "1.0.0", - "bundled": true - }, - "base": { - "version": "0.11.2", - "bundled": true, - "requires": { - "cache-base": "^1.0.1", - "class-utils": "^0.3.5", - "component-emitter": "^1.2.1", - "define-property": "^1.0.0", - "isobject": "^3.0.1", - "mixin-deep": "^1.2.0", - "pascalcase": "^0.1.1" - }, - "dependencies": { - "define-property": { - "version": "1.0.0", - "bundled": true, - "requires": { - "is-descriptor": "^1.0.0" - } - }, - "is-accessor-descriptor": { - "version": "1.0.0", - "bundled": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-data-descriptor": { - "version": "1.0.0", - "bundled": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-descriptor": { - "version": "1.0.2", - "bundled": true, - "requires": { - "is-accessor-descriptor": "^1.0.0", - "is-data-descriptor": "^1.0.0", - "kind-of": "^6.0.2" - } - }, - "isobject": { - "version": "3.0.1", - "bundled": true - }, - "kind-of": { - "version": "6.0.2", - "bundled": true - } - } - }, - "bcrypt-pbkdf": { - "version": "1.0.2", - "bundled": true, - "requires": { - "tweetnacl": "^0.14.3" - } - }, - "binary-extensions": { - "version": "1.12.0", - "bundled": true - }, - "bindings": { - "version": "1.3.0", - "bundled": true - }, - "block-stream": { - "version": "0.0.9", - "bundled": true, - "requires": { - "inherits": "~2.0.0" - } - }, - "bluebird": { - "version": "3.5.3", - "bundled": true - }, - "boxen": { - "version": "1.3.0", - "bundled": true, - "requires": { - "ansi-align": "^2.0.0", - "camelcase": "^4.0.0", - "chalk": "^2.0.1", - "cli-boxes": "^1.0.0", - "string-width": "^2.0.0", - "term-size": "^1.2.0", - "widest-line": "^2.0.0" - }, - "dependencies": { - "ansi-regex": { - "version": "3.0.0", - "bundled": true - }, - "camelcase": { - "version": "4.1.0", - "bundled": true - }, - "is-fullwidth-code-point": { - "version": "2.0.0", - "bundled": true - }, - "string-width": { - "version": "2.1.1", - "bundled": true, - "requires": { - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^4.0.0" - } - }, - "strip-ansi": { - "version": "4.0.0", - "bundled": true, - "requires": { - "ansi-regex": "^3.0.0" - } - } - } - }, - "brace-expansion": { - "version": "1.1.11", - "bundled": true, - "requires": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "braces": { - "version": "1.8.5", - "bundled": true, - "requires": { - "expand-range": "^1.8.1", - "preserve": "^0.2.0", - "repeat-element": "^1.1.2" - } - }, - "buf-compare": { - "version": "1.0.1", - "bundled": true - }, - "buffer-from": { - "version": "1.1.1", - "bundled": true - }, - "builtin-modules": { - "version": "1.1.1", - "bundled": true - }, - "cache-base": { - "version": "1.0.1", - "bundled": true, - "requires": { - "collection-visit": "^1.0.0", - "component-emitter": "^1.2.1", - "get-value": "^2.0.6", - "has-value": "^1.0.0", - "isobject": "^3.0.1", - "set-value": "^2.0.0", - "to-object-path": "^0.3.0", - "union-value": "^1.0.0", - "unset-value": "^1.0.0" - }, - "dependencies": { - "isobject": { - "version": "3.0.1", - "bundled": true - } - } - }, - "caching-transform": { - "version": "1.0.1", - "bundled": true, - "requires": { - "md5-hex": "^1.2.0", - "mkdirp": "^0.5.1", - "write-file-atomic": "^1.1.4" - }, - "dependencies": { - "md5-hex": { - "version": "1.3.0", - "bundled": true, - "requires": { - "md5-o-matic": "^0.1.1" - } - }, - "write-file-atomic": { - "version": "1.3.4", - "bundled": true, - "requires": { - "graceful-fs": "^4.1.11", - "imurmurhash": "^0.1.4", - "slide": "^1.1.5" - } - } - } - }, - "call-matcher": { - "version": "1.1.0", - "bundled": true, - "requires": { - "core-js": "^2.0.0", - "deep-equal": "^1.0.0", - "espurify": "^1.6.0", - "estraverse": "^4.0.0" - } - }, - "call-signature": { - "version": "0.0.2", - "bundled": true - }, - "caller-path": { - "version": "0.1.0", - "bundled": true, - "requires": { - "callsites": "^0.2.0" - } - }, - "callsites": { - "version": "0.2.0", - "bundled": true - }, - "camelcase": { - "version": "2.1.1", - "bundled": true - }, - "camelcase-keys": { - "version": "2.1.0", - "bundled": true, - "requires": { - "camelcase": "^2.0.0", - "map-obj": "^1.0.0" - } - }, - "capture-stack-trace": { - "version": "1.0.1", - "bundled": true - }, - "caseless": { - "version": "0.12.0", - "bundled": true - }, - "chalk": { - "version": "2.4.1", - "bundled": true, - "requires": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - } - }, - "chardet": { - "version": "0.4.2", - "bundled": true - }, - "chokidar": { - "version": "1.7.0", - "bundled": true, - "requires": { - "anymatch": "^1.3.0", - "async-each": "^1.0.0", - "fsevents": "^1.0.0", - "glob-parent": "^2.0.0", - "inherits": "^2.0.1", - "is-binary-path": "^1.0.0", - "is-glob": "^2.0.0", - "path-is-absolute": "^1.0.0", - "readdirp": "^2.0.0" - } - }, - "ci-info": { - "version": "1.6.0", - "bundled": true - }, - "class-utils": { - "version": "0.3.6", - "bundled": true, - "requires": { - "arr-union": "^3.1.0", - "define-property": "^0.2.5", - "isobject": "^3.0.0", - "static-extend": "^0.1.1" - }, - "dependencies": { - "define-property": { - "version": "0.2.5", - "bundled": true, - "requires": { - "is-descriptor": "^0.1.0" - } - }, - "isobject": { - "version": "3.0.1", - "bundled": true - } - } - }, - "clean-stack": { - "version": "1.3.0", - "bundled": true - }, - "clean-yaml-object": { - "version": "0.1.0", - "bundled": true - }, - "cli-boxes": { - "version": "1.0.0", - "bundled": true - }, - "cli-cursor": { - "version": "2.1.0", - "bundled": true, - "requires": { - "restore-cursor": "^2.0.0" - } - }, - "cli-spinners": { - "version": "1.3.1", - "bundled": true - }, - "cli-truncate": { - "version": "1.1.0", - "bundled": true, - "requires": { - "slice-ansi": "^1.0.0", - "string-width": "^2.0.0" - }, - "dependencies": { - "ansi-regex": { - "version": "3.0.0", - "bundled": true - }, - "is-fullwidth-code-point": { - "version": "2.0.0", - "bundled": true - }, - "string-width": { - "version": "2.1.1", - "bundled": true, - "requires": { - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^4.0.0" - } - }, - "strip-ansi": { - "version": "4.0.0", - "bundled": true, - "requires": { - "ansi-regex": "^3.0.0" - } - } - } - }, - "cli-width": { - "version": "2.2.0", - "bundled": true - }, - "co": { - "version": "4.6.0", - "bundled": true - }, - "co-with-promise": { - "version": "4.6.0", - "bundled": true, - "requires": { - "pinkie-promise": "^1.0.0" - } - }, - "code-excerpt": { - "version": "2.1.1", - "bundled": true, - "requires": { - "convert-to-spaces": "^1.0.1" - } - }, - "code-point-at": { - "version": "1.1.0", - "bundled": true - }, - "collection-visit": { - "version": "1.0.0", - "bundled": true, - "requires": { - "map-visit": "^1.0.0", - "object-visit": "^1.0.0" - } - }, - "color-convert": { - "version": "1.9.3", - "bundled": true, - "requires": { - "color-name": "1.1.3" - } - }, - "color-name": { - "version": "1.1.3", - "bundled": true - }, - "combined-stream": { - "version": "1.0.7", - "bundled": true, - "requires": { - "delayed-stream": "~1.0.0" - } - }, - "common-path-prefix": { - "version": "1.0.0", - "bundled": true - }, - "commondir": { - "version": "1.0.1", - "bundled": true - }, - "component-emitter": { - "version": "1.2.1", - "bundled": true - }, - "concat-map": { - "version": "0.0.1", - "bundled": true - }, - "concat-stream": { - "version": "1.6.2", - "bundled": true, - "requires": { - "buffer-from": "^1.0.0", - "inherits": "^2.0.3", - "readable-stream": "^2.2.2", - "typedarray": "^0.0.6" - } - }, - "concordance": { - "version": "3.0.0", - "bundled": true, - "requires": { - "date-time": "^2.1.0", - "esutils": "^2.0.2", - "fast-diff": "^1.1.1", - "function-name-support": "^0.2.0", - "js-string-escape": "^1.0.1", - "lodash.clonedeep": "^4.5.0", - "lodash.flattendeep": "^4.4.0", - "lodash.merge": "^4.6.0", - "md5-hex": "^2.0.0", - "semver": "^5.3.0", - "well-known-symbols": "^1.0.0" - }, - "dependencies": { - "date-time": { - "version": "2.1.0", - "bundled": true, - "requires": { - "time-zone": "^1.0.0" - } - } - } - }, - "configstore": { - "version": "3.1.2", - "bundled": true, - "requires": { - "dot-prop": "^4.1.0", - "graceful-fs": "^4.1.2", - "make-dir": "^1.0.0", - "unique-string": "^1.0.0", - "write-file-atomic": "^2.0.0", - "xdg-basedir": "^3.0.0" - } - }, - "console-control-strings": { - "version": "1.1.0", - "bundled": true - }, - "contains-path": { - "version": "0.1.0", - "bundled": true - }, - "convert-source-map": { - "version": "1.6.0", - "bundled": true, - "requires": { - "safe-buffer": "~5.1.1" - } - }, - "convert-to-spaces": { - "version": "1.0.2", - "bundled": true - }, - "copy-descriptor": { - "version": "0.1.1", - "bundled": true - }, - "core-assert": { - "version": "0.2.1", - "bundled": true, - "requires": { - "buf-compare": "^1.0.0", - "is-error": "^2.2.0" - } - }, - "core-js": { - "version": "2.5.7", - "bundled": true - }, - "core-util-is": { - "version": "1.0.2", - "bundled": true - }, - "create-error-class": { - "version": "3.0.2", - "bundled": true, - "requires": { - "capture-stack-trace": "^1.0.0" - } - }, - "cross-spawn": { - "version": "5.1.0", - "bundled": true, - "requires": { - "lru-cache": "^4.0.1", - "shebang-command": "^1.2.0", - "which": "^1.2.9" - } - }, - "crypto-random-string": { - "version": "1.0.0", - "bundled": true - }, - "cuid": { - "version": "2.1.4", - "bundled": true - }, - "currently-unhandled": { - "version": "0.4.1", - "bundled": true, - "requires": { - "array-find-index": "^1.0.1" - } - }, - "dashdash": { - "version": "1.14.1", - "bundled": true, - "requires": { - "assert-plus": "^1.0.0" - } - }, - "date-time": { - "version": "0.1.1", - "bundled": true - }, - "debug": { - "version": "3.2.6", - "bundled": true, - "requires": { - "ms": "^2.1.1" - } - }, - "debug-log": { - "version": "1.0.1", - "bundled": true - }, - "decamelize": { - "version": "1.2.0", - "bundled": true - }, - "decode-uri-component": { - "version": "0.2.0", - "bundled": true - }, - "deep-equal": { - "version": "1.0.1", - "bundled": true - }, - "deep-extend": { - "version": "0.6.0", - "bundled": true - }, - "deep-is": { - "version": "0.1.3", - "bundled": true - }, - "define-properties": { - "version": "1.1.3", - "bundled": true, - "requires": { - "object-keys": "^1.0.12" - } - }, - "define-property": { - "version": "2.0.2", - "bundled": true, - "requires": { - "is-descriptor": "^1.0.2", - "isobject": "^3.0.1" - }, - "dependencies": { - "is-accessor-descriptor": { - "version": "1.0.0", - "bundled": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-data-descriptor": { - "version": "1.0.0", - "bundled": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-descriptor": { - "version": "1.0.2", - "bundled": true, - "requires": { - "is-accessor-descriptor": "^1.0.0", - "is-data-descriptor": "^1.0.0", - "kind-of": "^6.0.2" - } - }, - "isobject": { - "version": "3.0.1", - "bundled": true - }, - "kind-of": { - "version": "6.0.2", - "bundled": true - } - } - }, - "deglob": { - "version": "2.1.1", - "bundled": true, - "requires": { - "find-root": "^1.0.0", - "glob": "^7.0.5", - "ignore": "^3.0.9", - "pkg-config": "^1.1.0", - "run-parallel": "^1.1.2", - "uniq": "^1.0.1" - } - }, - "del": { - "version": "3.0.0", - "bundled": true, - "requires": { - "globby": "^6.1.0", - "is-path-cwd": "^1.0.0", - "is-path-in-cwd": "^1.0.0", - "p-map": "^1.1.1", - "pify": "^3.0.0", - "rimraf": "^2.2.8" - }, - "dependencies": { - "pify": { - "version": "3.0.0", - "bundled": true - } - } - }, - "delayed-stream": { - "version": "1.0.0", - "bundled": true - }, - "delegates": { - "version": "1.0.0", - "bundled": true - }, - "detect-indent": { - "version": "4.0.0", - "bundled": true, - "requires": { - "repeating": "^2.0.0" - } - }, - "doctrine": { - "version": "2.1.0", - "bundled": true, - "requires": { - "esutils": "^2.0.2" - } - }, - "dot-prop": { - "version": "4.2.0", - "bundled": true, - "requires": { - "is-obj": "^1.0.0" - } - }, - "duplexer3": { - "version": "0.1.4", - "bundled": true - }, - "ecc-jsbn": { - "version": "0.1.2", - "bundled": true, - "requires": { - "jsbn": "~0.1.0", - "safer-buffer": "^2.1.0" - } - }, - "empower-core": { - "version": "0.6.2", - "bundled": true, - "requires": { - "call-signature": "0.0.2", - "core-js": "^2.0.0" - } - }, - "equal-length": { - "version": "1.0.1", - "bundled": true - }, - "error-ex": { - "version": "1.3.2", - "bundled": true, - "requires": { - "is-arrayish": "^0.2.1" - } - }, - "es-abstract": { - "version": "1.12.0", - "bundled": true, - "requires": { - "es-to-primitive": "^1.1.1", - "function-bind": "^1.1.1", - "has": "^1.0.1", - "is-callable": "^1.1.3", - "is-regex": "^1.0.4" - } - }, - "es-to-primitive": { - "version": "1.2.0", - "bundled": true, - "requires": { - "is-callable": "^1.1.4", - "is-date-object": "^1.0.1", - "is-symbol": "^1.0.2" - } - }, - "es6-error": { - "version": "4.1.1", - "bundled": true - }, - "escape-string-regexp": { - "version": "1.0.5", - "bundled": true - }, - "eslint": { - "version": "4.18.2", - "bundled": true, - "requires": { - "ajv": "^5.3.0", - "babel-code-frame": "^6.22.0", - "chalk": "^2.1.0", - "concat-stream": "^1.6.0", - "cross-spawn": "^5.1.0", - "debug": "^3.1.0", - "doctrine": "^2.1.0", - "eslint-scope": "^3.7.1", - "eslint-visitor-keys": "^1.0.0", - "espree": "^3.5.2", - "esquery": "^1.0.0", - "esutils": "^2.0.2", - "file-entry-cache": "^2.0.0", - "functional-red-black-tree": "^1.0.1", - "glob": "^7.1.2", - "globals": "^11.0.1", - "ignore": "^3.3.3", - "imurmurhash": "^0.1.4", - "inquirer": "^3.0.6", - "is-resolvable": "^1.0.0", - "js-yaml": "^3.9.1", - "json-stable-stringify-without-jsonify": "^1.0.1", - "levn": "^0.3.0", - "lodash": "^4.17.4", - "minimatch": "^3.0.2", - "mkdirp": "^0.5.1", - "natural-compare": "^1.4.0", - "optionator": "^0.8.2", - "path-is-inside": "^1.0.2", - "pluralize": "^7.0.0", - "progress": "^2.0.0", - "require-uncached": "^1.0.3", - "semver": "^5.3.0", - "strip-ansi": "^4.0.0", - "strip-json-comments": "~2.0.1", - "table": "4.0.2", - "text-table": "~0.2.0" - }, - "dependencies": { - "ajv": { - "version": "5.5.2", - "bundled": true, - "requires": { - "co": "^4.6.0", - "fast-deep-equal": "^1.0.0", - "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.3.0" - } - }, - "ansi-regex": { - "version": "3.0.0", - "bundled": true - }, - "fast-deep-equal": { - "version": "1.1.0", - "bundled": true - }, - "globals": { - "version": "11.8.0", - "bundled": true - }, - "json-schema-traverse": { - "version": "0.3.1", - "bundled": true - }, - "strip-ansi": { - "version": "4.0.0", - "bundled": true, - "requires": { - "ansi-regex": "^3.0.0" - } - } - } - }, - "eslint-config-standard": { - "version": "11.0.0", - "bundled": true - }, - "eslint-config-standard-jsx": { - "version": "5.0.0", - "bundled": true - }, - "eslint-import-resolver-node": { - "version": "0.3.2", - "bundled": true, - "requires": { - "debug": "^2.6.9", - "resolve": "^1.5.0" - }, - "dependencies": { - "debug": { - "version": "2.6.9", - "bundled": true, - "requires": { - "ms": "2.0.0" - } - }, - "ms": { - "version": "2.0.0", - "bundled": true - } - } - }, - "eslint-module-utils": { - "version": "2.2.0", - "bundled": true, - "requires": { - "debug": "^2.6.8", - "pkg-dir": "^1.0.0" - }, - "dependencies": { - "debug": { - "version": "2.6.9", - "bundled": true, - "requires": { - "ms": "2.0.0" - } - }, - "find-up": { - "version": "1.1.2", - "bundled": true, - "requires": { - "path-exists": "^2.0.0", - "pinkie-promise": "^2.0.0" - } - }, - "ms": { - "version": "2.0.0", - "bundled": true - }, - "path-exists": { - "version": "2.1.0", - "bundled": true, - "requires": { - "pinkie-promise": "^2.0.0" - } - }, - "pinkie": { - "version": "2.0.4", - "bundled": true - }, - "pinkie-promise": { - "version": "2.0.1", - "bundled": true, - "requires": { - "pinkie": "^2.0.0" - } - }, - "pkg-dir": { - "version": "1.0.0", - "bundled": true, - "requires": { - "find-up": "^1.0.0" - } - } - } - }, - "eslint-plugin-import": { - "version": "2.9.0", - "bundled": true, - "requires": { - "builtin-modules": "^1.1.1", - "contains-path": "^0.1.0", - "debug": "^2.6.8", - "doctrine": "1.5.0", - "eslint-import-resolver-node": "^0.3.1", - "eslint-module-utils": "^2.1.1", - "has": "^1.0.1", - "lodash": "^4.17.4", - "minimatch": "^3.0.3", - "read-pkg-up": "^2.0.0" - }, - "dependencies": { - "debug": { - "version": "2.6.9", - "bundled": true, - "requires": { - "ms": "2.0.0" - } - }, - "doctrine": { - "version": "1.5.0", - "bundled": true, - "requires": { - "esutils": "^2.0.2", - "isarray": "^1.0.0" - } - }, - "ms": { - "version": "2.0.0", - "bundled": true - } - } - }, - "eslint-plugin-node": { - "version": "6.0.1", - "bundled": true, - "requires": { - "ignore": "^3.3.6", - "minimatch": "^3.0.4", - "resolve": "^1.3.3", - "semver": "^5.4.1" - }, - "dependencies": { - "semver": { - "version": "5.6.0", - "bundled": true - } - } - }, - "eslint-plugin-promise": { - "version": "3.7.0", - "bundled": true - }, - "eslint-plugin-react": { - "version": "7.7.0", - "bundled": true, - "requires": { - "doctrine": "^2.0.2", - "has": "^1.0.1", - "jsx-ast-utils": "^2.0.1", - "prop-types": "^15.6.0" - } - }, - "eslint-plugin-standard": { - "version": "3.0.1", - "bundled": true - }, - "eslint-scope": { - "version": "3.7.3", - "bundled": true, - "requires": { - "esrecurse": "^4.1.0", - "estraverse": "^4.1.1" - } - }, - "eslint-visitor-keys": { - "version": "1.0.0", - "bundled": true - }, - "espower-location-detector": { - "version": "1.0.0", - "bundled": true, - "requires": { - "is-url": "^1.2.1", - "path-is-absolute": "^1.0.0", - "source-map": "^0.5.0", - "xtend": "^4.0.0" - } - }, - "espree": { - "version": "3.5.4", - "bundled": true, - "requires": { - "acorn": "^5.5.0", - "acorn-jsx": "^3.0.0" - } - }, - "esprima": { - "version": "4.0.1", - "bundled": true - }, - "espurify": { - "version": "1.8.1", - "bundled": true, - "requires": { - "core-js": "^2.0.0" - } - }, - "esquery": { - "version": "1.0.1", - "bundled": true, - "requires": { - "estraverse": "^4.0.0" - } - }, - "esrecurse": { - "version": "4.2.1", - "bundled": true, - "requires": { - "estraverse": "^4.1.0" - } - }, - "estraverse": { - "version": "4.2.0", - "bundled": true - }, - "esutils": { - "version": "2.0.2", - "bundled": true - }, - "execa": { - "version": "0.7.0", - "bundled": true, - "requires": { - "cross-spawn": "^5.0.1", - "get-stream": "^3.0.0", - "is-stream": "^1.1.0", - "npm-run-path": "^2.0.0", - "p-finally": "^1.0.0", - "signal-exit": "^3.0.0", - "strip-eof": "^1.0.0" - } - }, - "expand-brackets": { - "version": "0.1.5", - "bundled": true, - "requires": { - "is-posix-bracket": "^0.1.0" - } - }, - "expand-range": { - "version": "1.8.2", - "bundled": true, - "requires": { - "fill-range": "^2.1.0" - } - }, - "extend": { - "version": "3.0.2", - "bundled": true - }, - "extend-shallow": { - "version": "3.0.2", - "bundled": true, - "requires": { - "assign-symbols": "^1.0.0", - "is-extendable": "^1.0.1" - }, - "dependencies": { - "is-extendable": { - "version": "1.0.1", - "bundled": true, - "requires": { - "is-plain-object": "^2.0.4" - } - } - } - }, - "external-editor": { - "version": "2.2.0", - "bundled": true, - "requires": { - "chardet": "^0.4.0", - "iconv-lite": "^0.4.17", - "tmp": "^0.0.33" - } - }, - "extglob": { - "version": "0.3.2", - "bundled": true, - "requires": { - "is-extglob": "^1.0.0" - } - }, - "extsprintf": { - "version": "1.3.0", - "bundled": true - }, - "fast-deep-equal": { - "version": "2.0.1", - "bundled": true - }, - "fast-diff": { - "version": "1.2.0", - "bundled": true - }, - "fast-json-stable-stringify": { - "version": "2.0.0", - "bundled": true - }, - "fast-levenshtein": { - "version": "2.0.6", - "bundled": true - }, - "figures": { - "version": "2.0.0", - "bundled": true, - "requires": { - "escape-string-regexp": "^1.0.5" - } - }, - "file-entry-cache": { - "version": "2.0.0", - "bundled": true, - "requires": { - "flat-cache": "^1.2.1", - "object-assign": "^4.0.1" - } - }, - "filename-regex": { - "version": "2.0.1", - "bundled": true - }, - "fill-range": { - "version": "2.2.4", - "bundled": true, - "requires": { - "is-number": "^2.1.0", - "isobject": "^2.0.0", - "randomatic": "^3.0.0", - "repeat-element": "^1.1.2", - "repeat-string": "^1.5.2" - } - }, - "find-cache-dir": { - "version": "1.0.0", - "bundled": true, - "requires": { - "commondir": "^1.0.1", - "make-dir": "^1.0.0", - "pkg-dir": "^2.0.0" - } - }, - "find-root": { - "version": "1.1.0", - "bundled": true - }, - "find-up": { - "version": "2.1.0", - "bundled": true, - "requires": { - "locate-path": "^2.0.0" - } - }, - "flat-cache": { - "version": "1.3.1", - "bundled": true, - "requires": { - "del": "^3.0.0", - "flatted": "^2.0.0", - "graceful-fs": "^4.1.2", - "write": "^0.2.1" - } - }, - "flatted": { - "version": "2.0.0", - "bundled": true - }, - "fn-name": { - "version": "2.0.1", - "bundled": true - }, - "for-in": { - "version": "1.0.2", - "bundled": true - }, - "for-own": { - "version": "0.1.5", - "bundled": true, - "requires": { - "for-in": "^1.0.1" - } - }, - "forever-agent": { - "version": "0.6.1", - "bundled": true - }, - "form-data": { - "version": "2.3.3", - "bundled": true, - "requires": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.6", - "mime-types": "^2.1.12" - } - }, - "fragment-cache": { - "version": "0.2.1", - "bundled": true, - "requires": { - "map-cache": "^0.2.2" - } - }, - "fs.realpath": { - "version": "1.0.0", - "bundled": true - }, - "fsevents": { - "version": "1.2.4", - "bundled": true, - "optional": true, - "requires": { - "nan": "^2.9.2", - "node-pre-gyp": "^0.10.0" - }, - "dependencies": { - "abbrev": { - "version": "1.1.1", - "bundled": true, - "optional": true - }, - "ansi-regex": { - "version": "2.1.1", - "bundled": true - }, - "aproba": { - "version": "1.2.0", - "bundled": true, - "optional": true - }, - "are-we-there-yet": { - "version": "1.1.4", - "bundled": true, - "optional": true, - "requires": { - "delegates": "^1.0.0", - "readable-stream": "^2.0.6" - } - }, - "balanced-match": { - "version": "1.0.0", - "bundled": true - }, - "brace-expansion": { - "version": "1.1.11", - "bundled": true, - "requires": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "chownr": { - "version": "1.0.1", - "bundled": true, - "optional": true - }, - "code-point-at": { - "version": "1.1.0", - "bundled": true - }, - "concat-map": { - "version": "0.0.1", - "bundled": true - }, - "console-control-strings": { - "version": "1.1.0", - "bundled": true - }, - "core-util-is": { - "version": "1.0.2", - "bundled": true, - "optional": true - }, - "debug": { - "version": "2.6.9", - "bundled": true, - "optional": true, - "requires": { - "ms": "2.0.0" - } - }, - "deep-extend": { - "version": "0.5.1", - "bundled": true, - "optional": true - }, - "delegates": { - "version": "1.0.0", - "bundled": true, - "optional": true - }, - "detect-libc": { - "version": "1.0.3", - "bundled": true, - "optional": true - }, - "fs-minipass": { - "version": "1.2.5", - "bundled": true, - "optional": true, - "requires": { - "minipass": "^2.2.1" - } - }, - "fs.realpath": { - "version": "1.0.0", - "bundled": true, - "optional": true - }, - "gauge": { - "version": "2.7.4", - "bundled": true, - "optional": true, - "requires": { - "aproba": "^1.0.3", - "console-control-strings": "^1.0.0", - "has-unicode": "^2.0.0", - "object-assign": "^4.1.0", - "signal-exit": "^3.0.0", - "string-width": "^1.0.1", - "strip-ansi": "^3.0.1", - "wide-align": "^1.1.0" - } - }, - "glob": { - "version": "7.1.2", - "bundled": true, - "optional": true, - "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - } - }, - "has-unicode": { - "version": "2.0.1", - "bundled": true, - "optional": true - }, - "iconv-lite": { - "version": "0.4.21", - "bundled": true, - "optional": true, - "requires": { - "safer-buffer": "^2.1.0" - } - }, - "ignore-walk": { - "version": "3.0.1", - "bundled": true, - "optional": true, - "requires": { - "minimatch": "^3.0.4" - } - }, - "inflight": { - "version": "1.0.6", - "bundled": true, - "optional": true, - "requires": { - "once": "^1.3.0", - "wrappy": "1" - } - }, - "inherits": { - "version": "2.0.3", - "bundled": true - }, - "ini": { - "version": "1.3.5", - "bundled": true, - "optional": true - }, - "is-fullwidth-code-point": { - "version": "1.0.0", - "bundled": true, - "requires": { - "number-is-nan": "^1.0.0" - } - }, - "isarray": { - "version": "1.0.0", - "bundled": true, - "optional": true - }, - "minimatch": { - "version": "3.0.4", - "bundled": true, - "requires": { - "brace-expansion": "^1.1.7" - } - }, - "minimist": { - "version": "0.0.8", - "bundled": true - }, - "minipass": { - "version": "2.2.4", - "bundled": true, - "requires": { - "safe-buffer": "^5.1.1", - "yallist": "^3.0.0" - } - }, - "minizlib": { - "version": "1.1.0", - "bundled": true, - "optional": true, - "requires": { - "minipass": "^2.2.1" - } - }, - "mkdirp": { - "version": "0.5.1", - "bundled": true, - "requires": { - "minimist": "0.0.8" - } - }, - "ms": { - "version": "2.0.0", - "bundled": true, - "optional": true - }, - "needle": { - "version": "2.2.0", - "bundled": true, - "optional": true, - "requires": { - "debug": "^2.1.2", - "iconv-lite": "^0.4.4", - "sax": "^1.2.4" - } - }, - "node-pre-gyp": { - "version": "0.10.0", - "bundled": true, - "optional": true, - "requires": { - "detect-libc": "^1.0.2", - "mkdirp": "^0.5.1", - "needle": "^2.2.0", - "nopt": "^4.0.1", - "npm-packlist": "^1.1.6", - "npmlog": "^4.0.2", - "rc": "^1.1.7", - "rimraf": "^2.6.1", - "semver": "^5.3.0", - "tar": "^4" - } - }, - "nopt": { - "version": "4.0.1", - "bundled": true, - "optional": true, - "requires": { - "abbrev": "1", - "osenv": "^0.1.4" - } - }, - "npm-bundled": { - "version": "1.0.3", - "bundled": true, - "optional": true - }, - "npm-packlist": { - "version": "1.1.10", - "bundled": true, - "optional": true, - "requires": { - "ignore-walk": "^3.0.1", - "npm-bundled": "^1.0.1" - } - }, - "npmlog": { - "version": "4.1.2", - "bundled": true, - "optional": true, - "requires": { - "are-we-there-yet": "~1.1.2", - "console-control-strings": "~1.1.0", - "gauge": "~2.7.3", - "set-blocking": "~2.0.0" - } - }, - "number-is-nan": { - "version": "1.0.1", - "bundled": true - }, - "object-assign": { - "version": "4.1.1", - "bundled": true, - "optional": true - }, - "once": { - "version": "1.4.0", - "bundled": true, - "requires": { - "wrappy": "1" - } - }, - "os-homedir": { - "version": "1.0.2", - "bundled": true, - "optional": true - }, - "os-tmpdir": { - "version": "1.0.2", - "bundled": true, - "optional": true - }, - "osenv": { - "version": "0.1.5", - "bundled": true, - "optional": true, - "requires": { - "os-homedir": "^1.0.0", - "os-tmpdir": "^1.0.0" - } - }, - "path-is-absolute": { - "version": "1.0.1", - "bundled": true, - "optional": true - }, - "process-nextick-args": { - "version": "2.0.0", - "bundled": true, - "optional": true - }, - "rc": { - "version": "1.2.7", - "bundled": true, - "optional": true, - "requires": { - "deep-extend": "^0.5.1", - "ini": "~1.3.0", - "minimist": "^1.2.0", - "strip-json-comments": "~2.0.1" - }, - "dependencies": { - "minimist": { - "version": "1.2.0", - "bundled": true, - "optional": true - } - } - }, - "readable-stream": { - "version": "2.3.6", - "bundled": true, - "optional": true, - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "rimraf": { - "version": "2.6.2", - "bundled": true, - "optional": true, - "requires": { - "glob": "^7.0.5" - } - }, - "safe-buffer": { - "version": "5.1.1", - "bundled": true - }, - "safer-buffer": { - "version": "2.1.2", - "bundled": true, - "optional": true - }, - "sax": { - "version": "1.2.4", - "bundled": true, - "optional": true - }, - "semver": { - "version": "5.5.0", - "bundled": true, - "optional": true - }, - "set-blocking": { - "version": "2.0.0", - "bundled": true, - "optional": true - }, - "signal-exit": { - "version": "3.0.2", - "bundled": true, - "optional": true - }, - "string-width": { - "version": "1.0.2", - "bundled": true, - "requires": { - "code-point-at": "^1.0.0", - "is-fullwidth-code-point": "^1.0.0", - "strip-ansi": "^3.0.0" - } - }, - "string_decoder": { - "version": "1.1.1", - "bundled": true, - "optional": true, - "requires": { - "safe-buffer": "~5.1.0" - } - }, - "strip-ansi": { - "version": "3.0.1", - "bundled": true, - "requires": { - "ansi-regex": "^2.0.0" - } - }, - "strip-json-comments": { - "version": "2.0.1", - "bundled": true, - "optional": true - }, - "tar": { - "version": "4.4.1", - "bundled": true, - "optional": true, - "requires": { - "chownr": "^1.0.1", - "fs-minipass": "^1.2.5", - "minipass": "^2.2.4", - "minizlib": "^1.1.0", - "mkdirp": "^0.5.0", - "safe-buffer": "^5.1.1", - "yallist": "^3.0.2" - } - }, - "util-deprecate": { - "version": "1.0.2", - "bundled": true, - "optional": true - }, - "wide-align": { - "version": "1.1.2", - "bundled": true, - "optional": true, - "requires": { - "string-width": "^1.0.2" - } - }, - "wrappy": { - "version": "1.0.2", - "bundled": true - }, - "yallist": { - "version": "3.0.2", - "bundled": true - } - } - }, - "fstream": { - "version": "1.0.11", - "bundled": true, - "requires": { - "graceful-fs": "^4.1.2", - "inherits": "~2.0.0", - "mkdirp": ">=0.5 0", - "rimraf": "2" - } - }, - "function-bind": { - "version": "1.1.1", - "bundled": true - }, - "function-name-support": { - "version": "0.2.0", - "bundled": true - }, - "functional-red-black-tree": { - "version": "1.0.1", - "bundled": true - }, - "gauge": { - "version": "2.7.4", - "bundled": true, - "requires": { - "aproba": "^1.0.3", - "console-control-strings": "^1.0.0", - "has-unicode": "^2.0.0", - "object-assign": "^4.1.0", - "signal-exit": "^3.0.0", - "string-width": "^1.0.1", - "strip-ansi": "^3.0.1", - "wide-align": "^1.1.0" - } - }, - "get-port": { - "version": "3.2.0", - "bundled": true - }, - "get-stdin": { - "version": "4.0.1", - "bundled": true - }, - "get-stream": { - "version": "3.0.0", - "bundled": true - }, - "get-value": { - "version": "2.0.6", - "bundled": true - }, - "getpass": { - "version": "0.1.7", - "bundled": true, - "requires": { - "assert-plus": "^1.0.0" - } - }, - "glob": { - "version": "7.1.3", - "bundled": true, - "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - } - }, - "glob-base": { - "version": "0.3.0", - "bundled": true, - "requires": { - "glob-parent": "^2.0.0", - "is-glob": "^2.0.0" - } - }, - "glob-parent": { - "version": "2.0.0", - "bundled": true, - "requires": { - "is-glob": "^2.0.0" - } - }, - "global-dirs": { - "version": "0.1.1", - "bundled": true, - "requires": { - "ini": "^1.3.4" - } - }, - "globals": { - "version": "9.18.0", - "bundled": true - }, - "globby": { - "version": "6.1.0", - "bundled": true, - "requires": { - "array-union": "^1.0.1", - "glob": "^7.0.3", - "object-assign": "^4.0.1", - "pify": "^2.0.0", - "pinkie-promise": "^2.0.0" - }, - "dependencies": { - "pinkie": { - "version": "2.0.4", - "bundled": true - }, - "pinkie-promise": { - "version": "2.0.1", - "bundled": true, - "requires": { - "pinkie": "^2.0.0" - } - } - } - }, - "got": { - "version": "6.7.1", - "bundled": true, - "requires": { - "create-error-class": "^3.0.0", - "duplexer3": "^0.1.4", - "get-stream": "^3.0.0", - "is-redirect": "^1.0.0", - "is-retry-allowed": "^1.0.0", - "is-stream": "^1.0.0", - "lowercase-keys": "^1.0.0", - "safe-buffer": "^5.0.1", - "timed-out": "^4.0.0", - "unzip-response": "^2.0.1", - "url-parse-lax": "^1.0.0" - } - }, - "graceful-fs": { - "version": "4.1.15", - "bundled": true - }, - "har-schema": { - "version": "2.0.0", - "bundled": true - }, - "har-validator": { - "version": "5.1.2", - "bundled": true, - "requires": { - "ajv": "^6.5.5", - "har-schema": "^2.0.0" - } - }, - "has": { - "version": "1.0.3", - "bundled": true, - "requires": { - "function-bind": "^1.1.1" - } - }, - "has-ansi": { - "version": "2.0.0", - "bundled": true, - "requires": { - "ansi-regex": "^2.0.0" - } - }, - "has-color": { - "version": "0.1.7", - "bundled": true - }, - "has-flag": { - "version": "2.0.0", - "bundled": true - }, - "has-symbols": { - "version": "1.0.0", - "bundled": true - }, - "has-unicode": { - "version": "2.0.1", - "bundled": true - }, - "has-value": { - "version": "1.0.0", - "bundled": true, - "requires": { - "get-value": "^2.0.6", - "has-values": "^1.0.0", - "isobject": "^3.0.0" - }, - "dependencies": { - "isobject": { - "version": "3.0.1", - "bundled": true - } - } - }, - "has-values": { - "version": "1.0.0", - "bundled": true, - "requires": { - "is-number": "^3.0.0", - "kind-of": "^4.0.0" - }, - "dependencies": { - "is-number": { - "version": "3.0.0", - "bundled": true, - "requires": { - "kind-of": "^3.0.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "bundled": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "kind-of": { - "version": "4.0.0", - "bundled": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "has-yarn": { - "version": "1.0.0", - "bundled": true - }, - "home-dir": { - "version": "1.0.0", - "bundled": true - }, - "home-or-tmp": { - "version": "2.0.0", - "bundled": true, - "requires": { - "os-homedir": "^1.0.0", - "os-tmpdir": "^1.0.1" - } - }, - "hosted-git-info": { - "version": "2.7.1", - "bundled": true - }, - "http-signature": { - "version": "1.2.0", - "bundled": true, - "requires": { - "assert-plus": "^1.0.0", - "jsprim": "^1.2.2", - "sshpk": "^1.7.0" - } - }, - "hullabaloo-config-manager": { - "version": "1.1.1", - "bundled": true, - "requires": { - "dot-prop": "^4.1.0", - "es6-error": "^4.0.2", - "graceful-fs": "^4.1.11", - "indent-string": "^3.1.0", - "json5": "^0.5.1", - "lodash.clonedeep": "^4.5.0", - "lodash.clonedeepwith": "^4.5.0", - "lodash.isequal": "^4.5.0", - "lodash.merge": "^4.6.0", - "md5-hex": "^2.0.0", - "package-hash": "^2.0.0", - "pkg-dir": "^2.0.0", - "resolve-from": "^3.0.0", - "safe-buffer": "^5.0.1" - } - }, - "iconv-lite": { - "version": "0.4.24", - "bundled": true, - "requires": { - "safer-buffer": ">= 2.1.2 < 3" - } - }, - "ignore": { - "version": "3.3.10", - "bundled": true - }, - "ignore-by-default": { - "version": "1.0.1", - "bundled": true - }, - "import-lazy": { - "version": "2.1.0", - "bundled": true - }, - "import-local": { - "version": "0.1.1", - "bundled": true, - "requires": { - "pkg-dir": "^2.0.0", - "resolve-cwd": "^2.0.0" - } - }, - "imurmurhash": { - "version": "0.1.4", - "bundled": true - }, - "indent-string": { - "version": "3.2.0", - "bundled": true - }, - "inflight": { - "version": "1.0.6", - "bundled": true, - "requires": { - "once": "^1.3.0", - "wrappy": "1" - } - }, - "inherits": { - "version": "2.0.3", - "bundled": true - }, - "ini": { - "version": "1.3.5", - "bundled": true - }, - "inquirer": { - "version": "3.3.0", - "bundled": true, - "requires": { - "ansi-escapes": "^3.0.0", - "chalk": "^2.0.0", - "cli-cursor": "^2.1.0", - "cli-width": "^2.0.0", - "external-editor": "^2.0.4", - "figures": "^2.0.0", - "lodash": "^4.3.0", - "mute-stream": "0.0.7", - "run-async": "^2.2.0", - "rx-lite": "^4.0.8", - "rx-lite-aggregates": "^4.0.8", - "string-width": "^2.1.0", - "strip-ansi": "^4.0.0", - "through": "^2.3.6" - }, - "dependencies": { - "ansi-regex": { - "version": "3.0.0", - "bundled": true - }, - "is-fullwidth-code-point": { - "version": "2.0.0", - "bundled": true - }, - "string-width": { - "version": "2.1.1", - "bundled": true, - "requires": { - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^4.0.0" - } - }, - "strip-ansi": { - "version": "4.0.0", - "bundled": true, - "requires": { - "ansi-regex": "^3.0.0" - } - } - } - }, - "invariant": { - "version": "2.2.4", - "bundled": true, - "requires": { - "loose-envify": "^1.0.0" - } - }, - "irregular-plurals": { - "version": "1.4.0", - "bundled": true - }, - "is-accessor-descriptor": { - "version": "0.1.6", - "bundled": true, - "requires": { - "kind-of": "^3.0.2" - } - }, - "is-arrayish": { - "version": "0.2.1", - "bundled": true - }, - "is-binary-path": { - "version": "1.0.1", - "bundled": true, - "requires": { - "binary-extensions": "^1.0.0" - } - }, - "is-buffer": { - "version": "1.1.6", - "bundled": true - }, - "is-builtin-module": { - "version": "1.0.0", - "bundled": true, - "requires": { - "builtin-modules": "^1.0.0" - } - }, - "is-callable": { - "version": "1.1.4", - "bundled": true - }, - "is-ci": { - "version": "1.2.1", - "bundled": true, - "requires": { - "ci-info": "^1.5.0" - } - }, - "is-data-descriptor": { - "version": "0.1.4", - "bundled": true, - "requires": { - "kind-of": "^3.0.2" - } - }, - "is-date-object": { - "version": "1.0.1", - "bundled": true - }, - "is-descriptor": { - "version": "0.1.6", - "bundled": true, - "requires": { - "is-accessor-descriptor": "^0.1.6", - "is-data-descriptor": "^0.1.4", - "kind-of": "^5.0.0" - }, - "dependencies": { - "kind-of": { - "version": "5.1.0", - "bundled": true - } - } - }, - "is-dotfile": { - "version": "1.0.3", - "bundled": true - }, - "is-equal-shallow": { - "version": "0.1.3", - "bundled": true, - "requires": { - "is-primitive": "^2.0.0" - } - }, - "is-error": { - "version": "2.2.1", - "bundled": true - }, - "is-extendable": { - "version": "0.1.1", - "bundled": true - }, - "is-extglob": { - "version": "1.0.0", - "bundled": true - }, - "is-finite": { - "version": "1.0.2", - "bundled": true, - "requires": { - "number-is-nan": "^1.0.0" - } - }, - "is-fullwidth-code-point": { - "version": "1.0.0", - "bundled": true, - "requires": { - "number-is-nan": "^1.0.0" - } - }, - "is-generator-fn": { - "version": "1.0.0", - "bundled": true - }, - "is-glob": { - "version": "2.0.1", - "bundled": true, - "requires": { - "is-extglob": "^1.0.0" - } - }, - "is-installed-globally": { - "version": "0.1.0", - "bundled": true, - "requires": { - "global-dirs": "^0.1.0", - "is-path-inside": "^1.0.0" - } - }, - "is-npm": { - "version": "1.0.0", - "bundled": true - }, - "is-number": { - "version": "2.1.0", - "bundled": true, - "requires": { - "kind-of": "^3.0.2" - } - }, - "is-obj": { - "version": "1.0.1", - "bundled": true - }, - "is-observable": { - "version": "1.1.0", - "bundled": true, - "requires": { - "symbol-observable": "^1.1.0" - } - }, - "is-path-cwd": { - "version": "1.0.0", - "bundled": true - }, - "is-path-in-cwd": { - "version": "1.0.1", - "bundled": true, - "requires": { - "is-path-inside": "^1.0.0" - } - }, - "is-path-inside": { - "version": "1.0.1", - "bundled": true, - "requires": { - "path-is-inside": "^1.0.1" - } - }, - "is-plain-obj": { - "version": "1.1.0", - "bundled": true - }, - "is-plain-object": { - "version": "2.0.4", - "bundled": true, - "requires": { - "isobject": "^3.0.1" - }, - "dependencies": { - "isobject": { - "version": "3.0.1", - "bundled": true - } - } - }, - "is-posix-bracket": { - "version": "0.1.1", - "bundled": true - }, - "is-primitive": { - "version": "2.0.0", - "bundled": true - }, - "is-promise": { - "version": "2.1.0", - "bundled": true - }, - "is-redirect": { - "version": "1.0.0", - "bundled": true - }, - "is-regex": { - "version": "1.0.4", - "bundled": true, - "requires": { - "has": "^1.0.1" - } - }, - "is-resolvable": { - "version": "1.1.0", - "bundled": true - }, - "is-retry-allowed": { - "version": "1.1.0", - "bundled": true - }, - "is-stream": { - "version": "1.1.0", - "bundled": true - }, - "is-symbol": { - "version": "1.0.2", - "bundled": true, - "requires": { - "has-symbols": "^1.0.0" - } - }, - "is-typedarray": { - "version": "1.0.0", - "bundled": true - }, - "is-url": { - "version": "1.2.4", - "bundled": true - }, - "is-utf8": { - "version": "0.2.1", - "bundled": true - }, - "is-windows": { - "version": "1.0.2", - "bundled": true - }, - "isarray": { - "version": "1.0.0", - "bundled": true - }, - "isexe": { - "version": "2.0.0", - "bundled": true - }, - "isobject": { - "version": "2.1.0", - "bundled": true, - "requires": { - "isarray": "1.0.0" - } - }, - "isstream": { - "version": "0.1.2", - "bundled": true - }, - "js-string-escape": { - "version": "1.0.1", - "bundled": true - }, - "js-tokens": { - "version": "3.0.2", - "bundled": true - }, - "js-yaml": { - "version": "3.12.0", - "bundled": true, - "requires": { - "argparse": "^1.0.7", - "esprima": "^4.0.0" - } - }, - "jsbn": { - "version": "0.1.1", - "bundled": true - }, - "jsesc": { - "version": "0.5.0", - "bundled": true - }, - "json-parse-better-errors": { - "version": "1.0.2", - "bundled": true - }, - "json-schema": { - "version": "0.2.3", - "bundled": true - }, - "json-schema-traverse": { - "version": "0.4.1", - "bundled": true - }, - "json-stable-stringify-without-jsonify": { - "version": "1.0.1", - "bundled": true - }, - "json-stringify-pretty-compact": { - "version": "1.2.0", - "bundled": true - }, - "json-stringify-safe": { - "version": "5.0.1", - "bundled": true - }, - "json5": { - "version": "0.5.1", - "bundled": true - }, - "jsprim": { - "version": "1.4.1", - "bundled": true, - "requires": { - "assert-plus": "1.0.0", - "extsprintf": "1.3.0", - "json-schema": "0.2.3", - "verror": "1.10.0" - } - }, - "jsx-ast-utils": { - "version": "2.0.1", - "bundled": true, - "requires": { - "array-includes": "^3.0.3" - } - }, - "kind-of": { - "version": "3.2.2", - "bundled": true, - "requires": { - "is-buffer": "^1.1.5" - } - }, - "last-line-stream": { - "version": "1.0.0", - "bundled": true, - "requires": { - "through2": "^2.0.0" - } - }, - "latest-version": { - "version": "3.1.0", - "bundled": true, - "requires": { - "package-json": "^4.0.0" - } - }, - "levn": { - "version": "0.3.0", - "bundled": true, - "requires": { - "prelude-ls": "~1.1.2", - "type-check": "~0.3.2" - } - }, - "load-json-file": { - "version": "2.0.0", - "bundled": true, - "requires": { - "graceful-fs": "^4.1.2", - "parse-json": "^2.2.0", - "pify": "^2.0.0", - "strip-bom": "^3.0.0" - } - }, - "locate-path": { - "version": "2.0.0", - "bundled": true, - "requires": { - "p-locate": "^2.0.0", - "path-exists": "^3.0.0" - } - }, - "lodash": { - "version": "4.17.11", - "bundled": true - }, - "lodash.clonedeep": { - "version": "4.5.0", - "bundled": true - }, - "lodash.clonedeepwith": { - "version": "4.5.0", - "bundled": true - }, - "lodash.debounce": { - "version": "4.0.8", - "bundled": true - }, - "lodash.difference": { - "version": "4.5.0", - "bundled": true - }, - "lodash.flatten": { - "version": "4.4.0", - "bundled": true - }, - "lodash.flattendeep": { - "version": "4.4.0", - "bundled": true - }, - "lodash.isequal": { - "version": "4.5.0", - "bundled": true - }, - "lodash.merge": { - "version": "4.6.1", - "bundled": true - }, - "loose-envify": { - "version": "1.4.0", - "bundled": true, - "requires": { - "js-tokens": "^3.0.0 || ^4.0.0" - } - }, - "loud-rejection": { - "version": "1.6.0", - "bundled": true, - "requires": { - "currently-unhandled": "^0.4.1", - "signal-exit": "^3.0.0" - } - }, - "lowercase-keys": { - "version": "1.0.1", - "bundled": true - }, - "lru-cache": { - "version": "4.1.3", - "bundled": true, - "requires": { - "pseudomap": "^1.0.2", - "yallist": "^2.1.2" - } - }, - "make-dir": { - "version": "1.3.0", - "bundled": true, - "requires": { - "pify": "^3.0.0" - }, - "dependencies": { - "pify": { - "version": "3.0.0", - "bundled": true - } - } - }, - "map-cache": { - "version": "0.2.2", - "bundled": true - }, - "map-obj": { - "version": "1.0.1", - "bundled": true - }, - "map-visit": { - "version": "1.0.0", - "bundled": true, - "requires": { - "object-visit": "^1.0.0" - } - }, - "markdown-escape": { - "version": "1.0.2", - "bundled": true - }, - "matcher": { - "version": "1.1.1", - "bundled": true, - "requires": { - "escape-string-regexp": "^1.0.4" - } - }, - "math-random": { - "version": "1.0.1", - "bundled": true - }, - "md5-hex": { - "version": "2.0.0", - "bundled": true, - "requires": { - "md5-o-matic": "^0.1.1" - } - }, - "md5-o-matic": { - "version": "0.1.1", - "bundled": true - }, - "meow": { - "version": "3.7.0", - "bundled": true, - "requires": { - "camelcase-keys": "^2.0.0", - "decamelize": "^1.1.2", - "loud-rejection": "^1.0.0", - "map-obj": "^1.0.1", - "minimist": "^1.1.3", - "normalize-package-data": "^2.3.4", - "object-assign": "^4.0.1", - "read-pkg-up": "^1.0.1", - "redent": "^1.0.0", - "trim-newlines": "^1.0.0" - }, - "dependencies": { - "find-up": { - "version": "1.1.2", - "bundled": true, - "requires": { - "path-exists": "^2.0.0", - "pinkie-promise": "^2.0.0" - } - }, - "load-json-file": { - "version": "1.1.0", - "bundled": true, - "requires": { - "graceful-fs": "^4.1.2", - "parse-json": "^2.2.0", - "pify": "^2.0.0", - "pinkie-promise": "^2.0.0", - "strip-bom": "^2.0.0" - } - }, - "minimist": { - "version": "1.2.0", - "bundled": true - }, - "path-exists": { - "version": "2.1.0", - "bundled": true, - "requires": { - "pinkie-promise": "^2.0.0" - } - }, - "path-type": { - "version": "1.1.0", - "bundled": true, - "requires": { - "graceful-fs": "^4.1.2", - "pify": "^2.0.0", - "pinkie-promise": "^2.0.0" - } - }, - "pinkie": { - "version": "2.0.4", - "bundled": true - }, - "pinkie-promise": { - "version": "2.0.1", - "bundled": true, - "requires": { - "pinkie": "^2.0.0" - } - }, - "read-pkg": { - "version": "1.1.0", - "bundled": true, - "requires": { - "load-json-file": "^1.0.0", - "normalize-package-data": "^2.3.2", - "path-type": "^1.0.0" - } - }, - "read-pkg-up": { - "version": "1.0.1", - "bundled": true, - "requires": { - "find-up": "^1.0.0", - "read-pkg": "^1.0.0" - } - }, - "strip-bom": { - "version": "2.0.0", - "bundled": true, - "requires": { - "is-utf8": "^0.2.0" - } - } - } - }, - "micromatch": { - "version": "2.3.11", - "bundled": true, - "requires": { - "arr-diff": "^2.0.0", - "array-unique": "^0.2.1", - "braces": "^1.8.2", - "expand-brackets": "^0.1.4", - "extglob": "^0.3.1", - "filename-regex": "^2.0.0", - "is-extglob": "^1.0.0", - "is-glob": "^2.0.1", - "kind-of": "^3.0.2", - "normalize-path": "^2.0.1", - "object.omit": "^2.0.0", - "parse-glob": "^3.0.4", - "regex-cache": "^0.4.2" - } - }, - "mime-db": { - "version": "1.37.0", - "bundled": true - }, - "mime-types": { - "version": "2.1.21", - "bundled": true, - "requires": { - "mime-db": "~1.37.0" - } - }, - "mimic-fn": { - "version": "1.2.0", - "bundled": true - }, - "minimatch": { - "version": "3.0.4", - "bundled": true, - "requires": { - "brace-expansion": "^1.1.7" - } - }, - "minimist": { - "version": "0.0.8", - "bundled": true - }, - "mixin-deep": { - "version": "1.3.1", - "bundled": true, - "requires": { - "for-in": "^1.0.2", - "is-extendable": "^1.0.1" - }, - "dependencies": { - "is-extendable": { - "version": "1.0.1", - "bundled": true, - "requires": { - "is-plain-object": "^2.0.4" - } - } - } - }, - "mkdirp": { - "version": "0.5.1", - "bundled": true, - "requires": { - "minimist": "0.0.8" - } - }, - "ms": { - "version": "2.1.1", - "bundled": true - }, - "multimatch": { - "version": "2.1.0", - "bundled": true, - "requires": { - "array-differ": "^1.0.0", - "array-union": "^1.0.1", - "arrify": "^1.0.0", - "minimatch": "^3.0.0" - } - }, - "mute-stream": { - "version": "0.0.7", - "bundled": true - }, - "nan": { - "version": "2.11.1", - "bundled": true - }, - "nanomatch": { - "version": "1.2.13", - "bundled": true, - "requires": { - "arr-diff": "^4.0.0", - "array-unique": "^0.3.2", - "define-property": "^2.0.2", - "extend-shallow": "^3.0.2", - "fragment-cache": "^0.2.1", - "is-windows": "^1.0.2", - "kind-of": "^6.0.2", - "object.pick": "^1.3.0", - "regex-not": "^1.0.0", - "snapdragon": "^0.8.1", - "to-regex": "^3.0.1" - }, - "dependencies": { - "arr-diff": { - "version": "4.0.0", - "bundled": true - }, - "array-unique": { - "version": "0.3.2", - "bundled": true - }, - "kind-of": { - "version": "6.0.2", - "bundled": true - } - } - }, - "natural-compare": { - "version": "1.4.0", - "bundled": true - }, - "node-gyp": { - "version": "3.8.0", - "bundled": true, - "requires": { - "fstream": "^1.0.0", - "glob": "^7.0.3", - "graceful-fs": "^4.1.2", - "mkdirp": "^0.5.0", - "nopt": "2 || 3", - "npmlog": "0 || 1 || 2 || 3 || 4", - "osenv": "0", - "request": "^2.87.0", - "rimraf": "2", - "semver": "~5.3.0", - "tar": "^2.0.0", - "which": "1" - } - }, - "nopt": { - "version": "3.0.6", - "bundled": true, - "requires": { - "abbrev": "1" - } - }, - "normalize-package-data": { - "version": "2.4.0", - "bundled": true, - "requires": { - "hosted-git-info": "^2.1.4", - "is-builtin-module": "^1.0.0", - "semver": "2 || 3 || 4 || 5", - "validate-npm-package-license": "^3.0.1" - } - }, - "normalize-path": { - "version": "2.1.1", - "bundled": true, - "requires": { - "remove-trailing-separator": "^1.0.1" - } - }, - "npm-run-path": { - "version": "2.0.2", - "bundled": true, - "requires": { - "path-key": "^2.0.0" - } - }, - "npmlog": { - "version": "4.1.2", - "bundled": true, - "requires": { - "are-we-there-yet": "~1.1.2", - "console-control-strings": "~1.1.0", - "gauge": "~2.7.3", - "set-blocking": "~2.0.0" - } - }, - "number-is-nan": { - "version": "1.0.1", - "bundled": true - }, - "oauth-sign": { - "version": "0.9.0", - "bundled": true - }, - "object-assign": { - "version": "4.1.1", - "bundled": true - }, - "object-copy": { - "version": "0.1.0", - "bundled": true, - "requires": { - "copy-descriptor": "^0.1.0", - "define-property": "^0.2.5", - "kind-of": "^3.0.3" - }, - "dependencies": { - "define-property": { - "version": "0.2.5", - "bundled": true, - "requires": { - "is-descriptor": "^0.1.0" - } - } - } - }, - "object-keys": { - "version": "1.0.12", - "bundled": true - }, - "object-visit": { - "version": "1.0.1", - "bundled": true, - "requires": { - "isobject": "^3.0.0" - }, - "dependencies": { - "isobject": { - "version": "3.0.1", - "bundled": true - } - } - }, - "object.omit": { - "version": "2.0.1", - "bundled": true, - "requires": { - "for-own": "^0.1.4", - "is-extendable": "^0.1.1" - } - }, - "object.pick": { - "version": "1.3.0", - "bundled": true, - "requires": { - "isobject": "^3.0.1" - }, - "dependencies": { - "isobject": { - "version": "3.0.1", - "bundled": true - } - } - }, - "observable-to-promise": { - "version": "0.5.0", - "bundled": true, - "requires": { - "is-observable": "^0.2.0", - "symbol-observable": "^1.0.4" - }, - "dependencies": { - "is-observable": { - "version": "0.2.0", - "bundled": true, - "requires": { - "symbol-observable": "^0.2.2" - }, - "dependencies": { - "symbol-observable": { - "version": "0.2.4", - "bundled": true - } - } - } - } - }, - "once": { - "version": "1.4.0", - "bundled": true, - "requires": { - "wrappy": "1" - } - }, - "onetime": { - "version": "2.0.1", - "bundled": true, - "requires": { - "mimic-fn": "^1.0.0" - } - }, - "option-chain": { - "version": "1.0.0", - "bundled": true - }, - "optionator": { - "version": "0.8.2", - "bundled": true, - "requires": { - "deep-is": "~0.1.3", - "fast-levenshtein": "~2.0.4", - "levn": "~0.3.0", - "prelude-ls": "~1.1.2", - "type-check": "~0.3.2", - "wordwrap": "~1.0.0" - } - }, - "os-homedir": { - "version": "1.0.2", - "bundled": true - }, - "os-tmpdir": { - "version": "1.0.2", - "bundled": true - }, - "osenv": { - "version": "0.1.5", - "bundled": true, - "requires": { - "os-homedir": "^1.0.0", - "os-tmpdir": "^1.0.0" - } - }, - "p-finally": { - "version": "1.0.0", - "bundled": true - }, - "p-limit": { - "version": "1.3.0", - "bundled": true, - "requires": { - "p-try": "^1.0.0" - } - }, - "p-locate": { - "version": "2.0.0", - "bundled": true, - "requires": { - "p-limit": "^1.1.0" - } - }, - "p-map": { - "version": "1.2.0", - "bundled": true - }, - "p-try": { - "version": "1.0.0", - "bundled": true - }, - "package-hash": { - "version": "2.0.0", - "bundled": true, - "requires": { - "graceful-fs": "^4.1.11", - "lodash.flattendeep": "^4.4.0", - "md5-hex": "^2.0.0", - "release-zalgo": "^1.0.0" - } - }, - "package-json": { - "version": "4.0.1", - "bundled": true, - "requires": { - "got": "^6.7.1", - "registry-auth-token": "^3.0.1", - "registry-url": "^3.0.3", - "semver": "^5.1.0" - } - }, - "parse-glob": { - "version": "3.0.4", - "bundled": true, - "requires": { - "glob-base": "^0.3.0", - "is-dotfile": "^1.0.0", - "is-extglob": "^1.0.0", - "is-glob": "^2.0.0" - } - }, - "parse-json": { - "version": "2.2.0", - "bundled": true, - "requires": { - "error-ex": "^1.2.0" - } - }, - "parse-ms": { - "version": "0.1.2", - "bundled": true - }, - "pascalcase": { - "version": "0.1.1", - "bundled": true - }, - "path-exists": { - "version": "3.0.0", - "bundled": true - }, - "path-is-absolute": { - "version": "1.0.1", - "bundled": true - }, - "path-is-inside": { - "version": "1.0.2", - "bundled": true - }, - "path-key": { - "version": "2.0.1", - "bundled": true - }, - "path-parse": { - "version": "1.0.6", - "bundled": true - }, - "path-type": { - "version": "2.0.0", - "bundled": true, - "requires": { - "pify": "^2.0.0" - } - }, - "performance-now": { - "version": "2.1.0", - "bundled": true - }, - "pify": { - "version": "2.3.0", - "bundled": true - }, - "pinkie": { - "version": "1.0.0", - "bundled": true - }, - "pinkie-promise": { - "version": "1.0.0", - "bundled": true, - "requires": { - "pinkie": "^1.0.0" - } - }, - "pkg-conf": { - "version": "2.1.0", - "bundled": true, - "requires": { - "find-up": "^2.0.0", - "load-json-file": "^4.0.0" - }, - "dependencies": { - "load-json-file": { - "version": "4.0.0", - "bundled": true, - "requires": { - "graceful-fs": "^4.1.2", - "parse-json": "^4.0.0", - "pify": "^3.0.0", - "strip-bom": "^3.0.0" - } - }, - "parse-json": { - "version": "4.0.0", - "bundled": true, - "requires": { - "error-ex": "^1.3.1", - "json-parse-better-errors": "^1.0.1" - } - }, - "pify": { - "version": "3.0.0", - "bundled": true - } - } - }, - "pkg-config": { - "version": "1.1.1", - "bundled": true, - "requires": { - "debug-log": "^1.0.0", - "find-root": "^1.0.0", - "xtend": "^4.0.1" - } - }, - "pkg-dir": { - "version": "2.0.0", - "bundled": true, - "requires": { - "find-up": "^2.1.0" - } - }, - "plur": { - "version": "2.1.2", - "bundled": true, - "requires": { - "irregular-plurals": "^1.0.0" - } - }, - "pluralize": { - "version": "7.0.0", - "bundled": true - }, - "posix-character-classes": { - "version": "0.1.1", - "bundled": true - }, - "prelude-ls": { - "version": "1.1.2", - "bundled": true - }, - "prepend-http": { - "version": "1.0.4", - "bundled": true - }, - "preserve": { - "version": "0.2.0", - "bundled": true - }, - "pretty-ms": { - "version": "3.2.0", - "bundled": true, - "requires": { - "parse-ms": "^1.0.0" - }, - "dependencies": { - "parse-ms": { - "version": "1.0.1", - "bundled": true - } - } - }, - "private": { - "version": "0.1.8", - "bundled": true - }, - "process-nextick-args": { - "version": "2.0.0", - "bundled": true - }, - "progress": { - "version": "2.0.1", - "bundled": true - }, - "prop-types": { - "version": "15.6.2", - "bundled": true, - "requires": { - "loose-envify": "^1.3.1", - "object-assign": "^4.1.1" - } - }, - "pseudomap": { - "version": "1.0.2", - "bundled": true - }, - "psl": { - "version": "1.1.29", - "bundled": true - }, - "punycode": { - "version": "2.1.1", - "bundled": true - }, - "qs": { - "version": "6.5.2", - "bundled": true - }, - "randomatic": { - "version": "3.1.1", - "bundled": true, - "requires": { - "is-number": "^4.0.0", - "kind-of": "^6.0.0", - "math-random": "^1.0.1" - }, - "dependencies": { - "is-number": { - "version": "4.0.0", - "bundled": true - }, - "kind-of": { - "version": "6.0.2", - "bundled": true - } - } - }, - "rc": { - "version": "1.2.8", - "bundled": true, - "requires": { - "deep-extend": "^0.6.0", - "ini": "~1.3.0", - "minimist": "^1.2.0", - "strip-json-comments": "~2.0.1" - }, - "dependencies": { - "minimist": { - "version": "1.2.0", - "bundled": true - } - } - }, - "read-pkg": { - "version": "2.0.0", - "bundled": true, - "requires": { - "load-json-file": "^2.0.0", - "normalize-package-data": "^2.3.2", - "path-type": "^2.0.0" - } - }, - "read-pkg-up": { - "version": "2.0.0", - "bundled": true, - "requires": { - "find-up": "^2.0.0", - "read-pkg": "^2.0.0" - } - }, - "readable-stream": { - "version": "2.3.6", - "bundled": true, - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "readdirp": { - "version": "2.2.1", - "bundled": true, - "requires": { - "graceful-fs": "^4.1.11", - "micromatch": "^3.1.10", - "readable-stream": "^2.0.2" - }, - "dependencies": { - "arr-diff": { - "version": "4.0.0", - "bundled": true - }, - "array-unique": { - "version": "0.3.2", - "bundled": true - }, - "braces": { - "version": "2.3.2", - "bundled": true, - "requires": { - "arr-flatten": "^1.1.0", - "array-unique": "^0.3.2", - "extend-shallow": "^2.0.1", - "fill-range": "^4.0.0", - "isobject": "^3.0.1", - "repeat-element": "^1.1.2", - "snapdragon": "^0.8.1", - "snapdragon-node": "^2.0.1", - "split-string": "^3.0.2", - "to-regex": "^3.0.1" - }, - "dependencies": { - "extend-shallow": { - "version": "2.0.1", - "bundled": true, - "requires": { - "is-extendable": "^0.1.0" - } - } - } - }, - "debug": { - "version": "2.6.9", - "bundled": true, - "requires": { - "ms": "2.0.0" - } - }, - "expand-brackets": { - "version": "2.1.4", - "bundled": true, - "requires": { - "debug": "^2.3.3", - "define-property": "^0.2.5", - "extend-shallow": "^2.0.1", - "posix-character-classes": "^0.1.0", - "regex-not": "^1.0.0", - "snapdragon": "^0.8.1", - "to-regex": "^3.0.1" - }, - "dependencies": { - "define-property": { - "version": "0.2.5", - "bundled": true, - "requires": { - "is-descriptor": "^0.1.0" - } - }, - "extend-shallow": { - "version": "2.0.1", - "bundled": true, - "requires": { - "is-extendable": "^0.1.0" - } - }, - "is-accessor-descriptor": { - "version": "0.1.6", - "bundled": true, - "requires": { - "kind-of": "^3.0.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "bundled": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "is-data-descriptor": { - "version": "0.1.4", - "bundled": true, - "requires": { - "kind-of": "^3.0.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "bundled": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "is-descriptor": { - "version": "0.1.6", - "bundled": true, - "requires": { - "is-accessor-descriptor": "^0.1.6", - "is-data-descriptor": "^0.1.4", - "kind-of": "^5.0.0" - } - }, - "kind-of": { - "version": "5.1.0", - "bundled": true - } - } - }, - "extglob": { - "version": "2.0.4", - "bundled": true, - "requires": { - "array-unique": "^0.3.2", - "define-property": "^1.0.0", - "expand-brackets": "^2.1.4", - "extend-shallow": "^2.0.1", - "fragment-cache": "^0.2.1", - "regex-not": "^1.0.0", - "snapdragon": "^0.8.1", - "to-regex": "^3.0.1" - }, - "dependencies": { - "define-property": { - "version": "1.0.0", - "bundled": true, - "requires": { - "is-descriptor": "^1.0.0" - } - }, - "extend-shallow": { - "version": "2.0.1", - "bundled": true, - "requires": { - "is-extendable": "^0.1.0" - } - } - } - }, - "fill-range": { - "version": "4.0.0", - "bundled": true, - "requires": { - "extend-shallow": "^2.0.1", - "is-number": "^3.0.0", - "repeat-string": "^1.6.1", - "to-regex-range": "^2.1.0" - }, - "dependencies": { - "extend-shallow": { - "version": "2.0.1", - "bundled": true, - "requires": { - "is-extendable": "^0.1.0" - } - } - } - }, - "is-accessor-descriptor": { - "version": "1.0.0", - "bundled": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-data-descriptor": { - "version": "1.0.0", - "bundled": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-descriptor": { - "version": "1.0.2", - "bundled": true, - "requires": { - "is-accessor-descriptor": "^1.0.0", - "is-data-descriptor": "^1.0.0", - "kind-of": "^6.0.2" - } - }, - "is-number": { - "version": "3.0.0", - "bundled": true, - "requires": { - "kind-of": "^3.0.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "bundled": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "isobject": { - "version": "3.0.1", - "bundled": true - }, - "kind-of": { - "version": "6.0.2", - "bundled": true - }, - "micromatch": { - "version": "3.1.10", - "bundled": true, - "requires": { - "arr-diff": "^4.0.0", - "array-unique": "^0.3.2", - "braces": "^2.3.1", - "define-property": "^2.0.2", - "extend-shallow": "^3.0.2", - "extglob": "^2.0.4", - "fragment-cache": "^0.2.1", - "kind-of": "^6.0.2", - "nanomatch": "^1.2.9", - "object.pick": "^1.3.0", - "regex-not": "^1.0.0", - "snapdragon": "^0.8.1", - "to-regex": "^3.0.2" - } - }, - "ms": { - "version": "2.0.0", - "bundled": true - } - } - }, - "redent": { - "version": "1.0.0", - "bundled": true, - "requires": { - "indent-string": "^2.1.0", - "strip-indent": "^1.0.1" - }, - "dependencies": { - "indent-string": { - "version": "2.1.0", - "bundled": true, - "requires": { - "repeating": "^2.0.0" - } - } - } - }, - "regenerate": { - "version": "1.4.0", - "bundled": true - }, - "regenerator-runtime": { - "version": "0.11.1", - "bundled": true - }, - "regex-cache": { - "version": "0.4.4", - "bundled": true, - "requires": { - "is-equal-shallow": "^0.1.3" - } - }, - "regex-not": { - "version": "1.0.2", - "bundled": true, - "requires": { - "extend-shallow": "^3.0.2", - "safe-regex": "^1.1.0" - } - }, - "regexpu-core": { - "version": "2.0.0", - "bundled": true, - "requires": { - "regenerate": "^1.2.1", - "regjsgen": "^0.2.0", - "regjsparser": "^0.1.4" - } - }, - "registry-auth-token": { - "version": "3.3.2", - "bundled": true, - "requires": { - "rc": "^1.1.6", - "safe-buffer": "^5.0.1" - } - }, - "registry-url": { - "version": "3.1.0", - "bundled": true, - "requires": { - "rc": "^1.0.1" - } - }, - "regjsgen": { - "version": "0.2.0", - "bundled": true - }, - "regjsparser": { - "version": "0.1.5", - "bundled": true, - "requires": { - "jsesc": "~0.5.0" - } - }, - "release-zalgo": { - "version": "1.0.0", - "bundled": true, - "requires": { - "es6-error": "^4.0.1" - } - }, - "remove-trailing-separator": { - "version": "1.1.0", - "bundled": true - }, - "repeat-element": { - "version": "1.1.3", - "bundled": true - }, - "repeat-string": { - "version": "1.6.1", - "bundled": true - }, - "repeating": { - "version": "2.0.1", - "bundled": true, - "requires": { - "is-finite": "^1.0.0" - } - }, - "request": { - "version": "2.88.0", - "bundled": true, - "requires": { - "aws-sign2": "~0.7.0", - "aws4": "^1.8.0", - "caseless": "~0.12.0", - "combined-stream": "~1.0.6", - "extend": "~3.0.2", - "forever-agent": "~0.6.1", - "form-data": "~2.3.2", - "har-validator": "~5.1.0", - "http-signature": "~1.2.0", - "is-typedarray": "~1.0.0", - "isstream": "~0.1.2", - "json-stringify-safe": "~5.0.1", - "mime-types": "~2.1.19", - "oauth-sign": "~0.9.0", - "performance-now": "^2.1.0", - "qs": "~6.5.2", - "safe-buffer": "^5.1.2", - "tough-cookie": "~2.4.3", - "tunnel-agent": "^0.6.0", - "uuid": "^3.3.2" - } - }, - "require-precompiled": { - "version": "0.1.0", - "bundled": true - }, - "require-uncached": { - "version": "1.0.3", - "bundled": true, - "requires": { - "caller-path": "^0.1.0", - "resolve-from": "^1.0.0" - }, - "dependencies": { - "resolve-from": { - "version": "1.0.1", - "bundled": true - } - } - }, - "resolve": { - "version": "1.8.1", - "bundled": true, - "requires": { - "path-parse": "^1.0.5" - } - }, - "resolve-cwd": { - "version": "2.0.0", - "bundled": true, - "requires": { - "resolve-from": "^3.0.0" - } - }, - "resolve-from": { - "version": "3.0.0", - "bundled": true - }, - "resolve-url": { - "version": "0.2.1", - "bundled": true - }, - "restore-cursor": { - "version": "2.0.0", - "bundled": true, - "requires": { - "onetime": "^2.0.0", - "signal-exit": "^3.0.2" - } - }, - "ret": { - "version": "0.1.15", - "bundled": true - }, - "rimraf": { - "version": "2.6.2", - "bundled": true, - "requires": { - "glob": "^7.0.5" - } - }, - "run-async": { - "version": "2.3.0", - "bundled": true, - "requires": { - "is-promise": "^2.1.0" - } - }, - "run-parallel": { - "version": "1.1.9", - "bundled": true - }, - "rx-lite": { - "version": "4.0.8", - "bundled": true - }, - "rx-lite-aggregates": { - "version": "4.0.8", - "bundled": true, - "requires": { - "rx-lite": "*" - } - }, - "safe-buffer": { - "version": "5.1.2", - "bundled": true - }, - "safe-regex": { - "version": "1.1.0", - "bundled": true, - "requires": { - "ret": "~0.1.10" - } - }, - "safer-buffer": { - "version": "2.1.2", - "bundled": true - }, - "semver": { - "version": "5.3.0", - "bundled": true - }, - "semver-diff": { - "version": "2.1.0", - "bundled": true, - "requires": { - "semver": "^5.0.3" - } - }, - "serialize-error": { - "version": "2.1.0", - "bundled": true - }, - "set-blocking": { - "version": "2.0.0", - "bundled": true - }, - "set-value": { - "version": "2.0.0", - "bundled": true, - "requires": { - "extend-shallow": "^2.0.1", - "is-extendable": "^0.1.1", - "is-plain-object": "^2.0.3", - "split-string": "^3.0.1" - }, - "dependencies": { - "extend-shallow": { - "version": "2.0.1", - "bundled": true, - "requires": { - "is-extendable": "^0.1.0" - } - } - } - }, - "shebang-command": { - "version": "1.2.0", - "bundled": true, - "requires": { - "shebang-regex": "^1.0.0" - } - }, - "shebang-regex": { - "version": "1.0.0", - "bundled": true - }, - "signal-exit": { - "version": "3.0.2", - "bundled": true - }, - "slash": { - "version": "1.0.0", - "bundled": true - }, - "slice-ansi": { - "version": "1.0.0", - "bundled": true, - "requires": { - "is-fullwidth-code-point": "^2.0.0" - }, - "dependencies": { - "is-fullwidth-code-point": { - "version": "2.0.0", - "bundled": true - } - } - }, - "slide": { - "version": "1.1.6", - "bundled": true - }, - "snapdragon": { - "version": "0.8.2", - "bundled": true, - "requires": { - "base": "^0.11.1", - "debug": "^2.2.0", - "define-property": "^0.2.5", - "extend-shallow": "^2.0.1", - "map-cache": "^0.2.2", - "source-map": "^0.5.6", - "source-map-resolve": "^0.5.0", - "use": "^3.1.0" - }, - "dependencies": { - "debug": { - "version": "2.6.9", - "bundled": true, - "requires": { - "ms": "2.0.0" - } - }, - "define-property": { - "version": "0.2.5", - "bundled": true, - "requires": { - "is-descriptor": "^0.1.0" - } - }, - "extend-shallow": { - "version": "2.0.1", - "bundled": true, - "requires": { - "is-extendable": "^0.1.0" - } - }, - "ms": { - "version": "2.0.0", - "bundled": true - } - } - }, - "snapdragon-node": { - "version": "2.1.1", - "bundled": true, - "requires": { - "define-property": "^1.0.0", - "isobject": "^3.0.0", - "snapdragon-util": "^3.0.1" - }, - "dependencies": { - "define-property": { - "version": "1.0.0", - "bundled": true, - "requires": { - "is-descriptor": "^1.0.0" - } - }, - "is-accessor-descriptor": { - "version": "1.0.0", - "bundled": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-data-descriptor": { - "version": "1.0.0", - "bundled": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-descriptor": { - "version": "1.0.2", - "bundled": true, - "requires": { - "is-accessor-descriptor": "^1.0.0", - "is-data-descriptor": "^1.0.0", - "kind-of": "^6.0.2" - } - }, - "isobject": { - "version": "3.0.1", - "bundled": true - }, - "kind-of": { - "version": "6.0.2", - "bundled": true - } - } - }, - "snapdragon-util": { - "version": "3.0.1", - "bundled": true, - "requires": { - "kind-of": "^3.2.0" - } - }, - "sort-keys": { - "version": "2.0.0", - "bundled": true, - "requires": { - "is-plain-obj": "^1.0.0" - } - }, - "source-map": { - "version": "0.5.7", - "bundled": true - }, - "source-map-resolve": { - "version": "0.5.2", - "bundled": true, - "requires": { - "atob": "^2.1.1", - "decode-uri-component": "^0.2.0", - "resolve-url": "^0.2.1", - "source-map-url": "^0.4.0", - "urix": "^0.1.0" - } - }, - "source-map-support": { - "version": "0.5.9", - "bundled": true, - "requires": { - "buffer-from": "^1.0.0", - "source-map": "^0.6.0" - }, - "dependencies": { - "source-map": { - "version": "0.6.1", - "bundled": true - } - } - }, - "source-map-url": { - "version": "0.4.0", - "bundled": true - }, - "spdx-correct": { - "version": "3.0.2", - "bundled": true, - "requires": { - "spdx-expression-parse": "^3.0.0", - "spdx-license-ids": "^3.0.0" - } - }, - "spdx-exceptions": { - "version": "2.2.0", - "bundled": true - }, - "spdx-expression-parse": { - "version": "3.0.0", - "bundled": true, - "requires": { - "spdx-exceptions": "^2.1.0", - "spdx-license-ids": "^3.0.0" - } - }, - "spdx-license-ids": { - "version": "3.0.2", - "bundled": true - }, - "split-string": { - "version": "3.1.0", - "bundled": true, - "requires": { - "extend-shallow": "^3.0.0" - } - }, - "sprintf-js": { - "version": "1.0.3", - "bundled": true - }, - "sshpk": { - "version": "1.15.2", - "bundled": true, - "requires": { - "asn1": "~0.2.3", - "assert-plus": "^1.0.0", - "bcrypt-pbkdf": "^1.0.0", - "dashdash": "^1.12.0", - "ecc-jsbn": "~0.1.1", - "getpass": "^0.1.1", - "jsbn": "~0.1.0", - "safer-buffer": "^2.0.2", - "tweetnacl": "~0.14.0" - } - }, - "stack-utils": { - "version": "1.0.1", - "bundled": true - }, - "standard": { - "version": "11.0.1", - "bundled": true, - "requires": { - "eslint": "~4.18.0", - "eslint-config-standard": "11.0.0", - "eslint-config-standard-jsx": "5.0.0", - "eslint-plugin-import": "~2.9.0", - "eslint-plugin-node": "~6.0.0", - "eslint-plugin-promise": "~3.7.0", - "eslint-plugin-react": "~7.7.0", - "eslint-plugin-standard": "~3.0.1", - "standard-engine": "~8.0.0" - } - }, - "standard-engine": { - "version": "8.0.1", - "bundled": true, - "requires": { - "deglob": "^2.1.0", - "get-stdin": "^6.0.0", - "minimist": "^1.1.0", - "pkg-conf": "^2.0.0" - }, - "dependencies": { - "get-stdin": { - "version": "6.0.0", - "bundled": true - }, - "minimist": { - "version": "1.2.0", - "bundled": true - } - } - }, - "static-extend": { - "version": "0.1.2", - "bundled": true, - "requires": { - "define-property": "^0.2.5", - "object-copy": "^0.1.0" - }, - "dependencies": { - "define-property": { - "version": "0.2.5", - "bundled": true, - "requires": { - "is-descriptor": "^0.1.0" - } - } - } - }, - "string-width": { - "version": "1.0.2", - "bundled": true, - "requires": { - "code-point-at": "^1.0.0", - "is-fullwidth-code-point": "^1.0.0", - "strip-ansi": "^3.0.0" - } - }, - "string_decoder": { - "version": "1.1.1", - "bundled": true, - "requires": { - "safe-buffer": "~5.1.0" - } - }, - "strip-ansi": { - "version": "3.0.1", - "bundled": true, - "requires": { - "ansi-regex": "^2.0.0" - } - }, - "strip-bom": { - "version": "3.0.0", - "bundled": true - }, - "strip-bom-buf": { - "version": "1.0.0", - "bundled": true, - "requires": { - "is-utf8": "^0.2.1" - } - }, - "strip-eof": { - "version": "1.0.0", - "bundled": true - }, - "strip-indent": { - "version": "1.0.1", - "bundled": true, - "requires": { - "get-stdin": "^4.0.1" - } - }, - "strip-json-comments": { - "version": "2.0.1", - "bundled": true - }, - "supertap": { - "version": "1.0.0", - "bundled": true, - "requires": { - "arrify": "^1.0.1", - "indent-string": "^3.2.0", - "js-yaml": "^3.10.0", - "serialize-error": "^2.1.0", - "strip-ansi": "^4.0.0" - }, - "dependencies": { - "ansi-regex": { - "version": "3.0.0", - "bundled": true - }, - "strip-ansi": { - "version": "4.0.0", - "bundled": true, - "requires": { - "ansi-regex": "^3.0.0" - } - } - } - }, - "supports-color": { - "version": "5.5.0", - "bundled": true, - "requires": { - "has-flag": "^3.0.0" - }, - "dependencies": { - "has-flag": { - "version": "3.0.0", - "bundled": true - } - } - }, - "symbol-observable": { - "version": "1.2.0", - "bundled": true - }, - "table": { - "version": "4.0.2", - "bundled": true, - "requires": { - "ajv": "^5.2.3", - "ajv-keywords": "^2.1.0", - "chalk": "^2.1.0", - "lodash": "^4.17.4", - "slice-ansi": "1.0.0", - "string-width": "^2.1.1" - }, - "dependencies": { - "ajv": { - "version": "5.5.2", - "bundled": true, - "requires": { - "co": "^4.6.0", - "fast-deep-equal": "^1.0.0", - "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.3.0" - } - }, - "ansi-regex": { - "version": "3.0.0", - "bundled": true - }, - "fast-deep-equal": { - "version": "1.1.0", - "bundled": true - }, - "is-fullwidth-code-point": { - "version": "2.0.0", - "bundled": true - }, - "json-schema-traverse": { - "version": "0.3.1", - "bundled": true - }, - "string-width": { - "version": "2.1.1", - "bundled": true, - "requires": { - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^4.0.0" - } - }, - "strip-ansi": { - "version": "4.0.0", - "bundled": true, - "requires": { - "ansi-regex": "^3.0.0" - } - } - } - }, - "tar": { - "version": "2.2.1", - "bundled": true, - "requires": { - "block-stream": "*", - "fstream": "^1.0.2", - "inherits": "2" - } - }, - "temp-dir": { - "version": "1.0.0", - "bundled": true - }, - "tempy": { - "version": "0.2.1", - "bundled": true, - "requires": { - "temp-dir": "^1.0.0", - "unique-string": "^1.0.0" - } - }, - "term-size": { - "version": "1.2.0", - "bundled": true, - "requires": { - "execa": "^0.7.0" - } - }, - "text-table": { - "version": "0.2.0", - "bundled": true - }, - "through": { - "version": "2.3.8", - "bundled": true - }, - "through2": { - "version": "2.0.5", - "bundled": true, - "requires": { - "readable-stream": "~2.3.6", - "xtend": "~4.0.1" - } - }, - "time-zone": { - "version": "1.0.0", - "bundled": true - }, - "timed-out": { - "version": "4.0.1", - "bundled": true - }, - "tmp": { - "version": "0.0.33", - "bundled": true, - "requires": { - "os-tmpdir": "~1.0.2" - } - }, - "to-fast-properties": { - "version": "1.0.3", - "bundled": true - }, - "to-object-path": { - "version": "0.3.0", - "bundled": true, - "requires": { - "kind-of": "^3.0.2" - } - }, - "to-regex": { - "version": "3.0.2", - "bundled": true, - "requires": { - "define-property": "^2.0.2", - "extend-shallow": "^3.0.2", - "regex-not": "^1.0.2", - "safe-regex": "^1.1.0" - } - }, - "to-regex-range": { - "version": "2.1.1", - "bundled": true, - "requires": { - "is-number": "^3.0.0", - "repeat-string": "^1.6.1" - }, - "dependencies": { - "is-number": { - "version": "3.0.0", - "bundled": true, - "requires": { - "kind-of": "^3.0.2" - } - } - } - }, - "tough-cookie": { - "version": "2.4.3", - "bundled": true, - "requires": { - "psl": "^1.1.24", - "punycode": "^1.4.1" - }, - "dependencies": { - "punycode": { - "version": "1.4.1", - "bundled": true - } - } - }, - "trim-newlines": { - "version": "1.0.0", - "bundled": true - }, - "trim-off-newlines": { - "version": "1.0.1", - "bundled": true - }, - "trim-right": { - "version": "1.0.1", - "bundled": true - }, - "tunnel-agent": { - "version": "0.6.0", - "bundled": true, - "requires": { - "safe-buffer": "^5.0.1" - } - }, - "tweetnacl": { - "version": "0.14.5", - "bundled": true - }, - "type-check": { - "version": "0.3.2", - "bundled": true, - "requires": { - "prelude-ls": "~1.1.2" - } - }, - "typedarray": { - "version": "0.0.6", - "bundled": true - }, - "uid2": { - "version": "0.0.3", - "bundled": true - }, - "union-value": { - "version": "1.0.0", - "bundled": true, - "requires": { - "arr-union": "^3.1.0", - "get-value": "^2.0.6", - "is-extendable": "^0.1.1", - "set-value": "^0.4.3" - }, - "dependencies": { - "extend-shallow": { - "version": "2.0.1", - "bundled": true, - "requires": { - "is-extendable": "^0.1.0" - } - }, - "set-value": { - "version": "0.4.3", - "bundled": true, - "requires": { - "extend-shallow": "^2.0.1", - "is-extendable": "^0.1.1", - "is-plain-object": "^2.0.1", - "to-object-path": "^0.3.0" - } - } - } - }, - "uniq": { - "version": "1.0.1", - "bundled": true - }, - "unique-string": { - "version": "1.0.0", - "bundled": true, - "requires": { - "crypto-random-string": "^1.0.0" - } - }, - "unique-temp-dir": { - "version": "1.0.0", - "bundled": true, - "requires": { - "mkdirp": "^0.5.1", - "os-tmpdir": "^1.0.1", - "uid2": "0.0.3" - } - }, - "unset-value": { - "version": "1.0.0", - "bundled": true, - "requires": { - "has-value": "^0.3.1", - "isobject": "^3.0.0" - }, - "dependencies": { - "has-value": { - "version": "0.3.1", - "bundled": true, - "requires": { - "get-value": "^2.0.3", - "has-values": "^0.1.4", - "isobject": "^2.0.0" - }, - "dependencies": { - "isobject": { - "version": "2.1.0", - "bundled": true, - "requires": { - "isarray": "1.0.0" - } - } - } - }, - "has-values": { - "version": "0.1.4", - "bundled": true - }, - "isobject": { - "version": "3.0.1", - "bundled": true - } - } - }, - "unzip-response": { - "version": "2.0.1", - "bundled": true - }, - "update-notifier": { - "version": "2.5.0", - "bundled": true, - "requires": { - "boxen": "^1.2.1", - "chalk": "^2.0.1", - "configstore": "^3.0.0", - "import-lazy": "^2.1.0", - "is-ci": "^1.0.10", - "is-installed-globally": "^0.1.0", - "is-npm": "^1.0.0", - "latest-version": "^3.0.0", - "semver-diff": "^2.0.0", - "xdg-basedir": "^3.0.0" - } - }, - "uri-js": { - "version": "4.2.2", - "bundled": true, - "requires": { - "punycode": "^2.1.0" - } - }, - "urix": { - "version": "0.1.0", - "bundled": true - }, - "url-parse-lax": { - "version": "1.0.0", - "bundled": true, - "requires": { - "prepend-http": "^1.0.1" - } - }, - "use": { - "version": "3.1.1", - "bundled": true - }, - "util-deprecate": { - "version": "1.0.2", - "bundled": true - }, - "uuid": { - "version": "3.3.2", - "bundled": true - }, - "validate-npm-package-license": { - "version": "3.0.4", - "bundled": true, - "requires": { - "spdx-correct": "^3.0.0", - "spdx-expression-parse": "^3.0.0" - } - }, - "verror": { - "version": "1.10.0", - "bundled": true, - "requires": { - "assert-plus": "^1.0.0", - "core-util-is": "1.0.2", - "extsprintf": "^1.2.0" - } - }, - "well-known-symbols": { - "version": "1.0.0", - "bundled": true - }, - "which": { - "version": "1.3.1", - "bundled": true, - "requires": { - "isexe": "^2.0.0" - } - }, - "wide-align": { - "version": "1.1.3", - "bundled": true, - "requires": { - "string-width": "^1.0.2 || 2" - } - }, - "widest-line": { - "version": "2.0.1", - "bundled": true, - "requires": { - "string-width": "^2.1.1" - }, - "dependencies": { - "ansi-regex": { - "version": "3.0.0", - "bundled": true - }, - "is-fullwidth-code-point": { - "version": "2.0.0", - "bundled": true - }, - "string-width": { - "version": "2.1.1", - "bundled": true, - "requires": { - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^4.0.0" - } - }, - "strip-ansi": { - "version": "4.0.0", - "bundled": true, - "requires": { - "ansi-regex": "^3.0.0" - } - } - } - }, - "wordwrap": { - "version": "1.0.0", - "bundled": true - }, - "wrappy": { - "version": "1.0.2", - "bundled": true - }, - "write": { - "version": "0.2.1", - "bundled": true, - "requires": { - "mkdirp": "^0.5.1" - } - }, - "write-file-atomic": { - "version": "2.3.0", - "bundled": true, - "requires": { - "graceful-fs": "^4.1.11", - "imurmurhash": "^0.1.4", - "signal-exit": "^3.0.2" - } - }, - "write-json-file": { - "version": "2.3.0", - "bundled": true, - "requires": { - "detect-indent": "^5.0.0", - "graceful-fs": "^4.1.2", - "make-dir": "^1.0.0", - "pify": "^3.0.0", - "sort-keys": "^2.0.0", - "write-file-atomic": "^2.0.0" - }, - "dependencies": { - "detect-indent": { - "version": "5.0.0", - "bundled": true - }, - "pify": { - "version": "3.0.0", - "bundled": true - } - } - }, - "write-pkg": { - "version": "3.2.0", - "bundled": true, - "requires": { - "sort-keys": "^2.0.0", - "write-json-file": "^2.2.0" - } - }, - "xdg-basedir": { - "version": "3.0.0", - "bundled": true - }, - "xtend": { - "version": "4.0.1", - "bundled": true - }, - "yallist": { - "version": "2.1.2", - "bundled": true - } + "bindings": "^1.3.1", + "nan": "^2.11.1", + "node-gyp": "^4.0.0" + } + }, + "inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "requires": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + }, + "is-fullwidth-code-point": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", + "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", + "requires": { + "number-is-nan": "^1.0.0" + } + }, + "is-typedarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", + "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=" + }, + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" + }, + "isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=" + }, + "isstream": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", + "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=" + }, + "jsbn": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", + "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=" + }, + "json-schema": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", + "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=" + }, + "json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==" + }, + "json-stringify-safe": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", + "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=" + }, + "jsprim": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", + "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", + "requires": { + "assert-plus": "1.0.0", + "extsprintf": "1.3.0", + "json-schema": "0.2.3", + "verror": "1.10.0" + } + }, + "mime-db": { + "version": "1.40.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.40.0.tgz", + "integrity": "sha512-jYdeOMPy9vnxEqFRRo6ZvTZ8d9oPb+k18PKoYNYUe2stVEBPPwsln/qWzdbmaIvnhZ9v2P+CuecK+fpUfsV2mA==" + }, + "mime-types": { + "version": "2.1.24", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.24.tgz", + "integrity": "sha512-WaFHS3MCl5fapm3oLxU4eYDw77IQM2ACcxQ9RIxfaC3ooc6PFuBMGZZsYpvoXS5D5QTWPieo1jjLdAm3TBP3cQ==", + "requires": { + "mime-db": "1.40.0" + } + }, + "minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "requires": { + "brace-expansion": "^1.1.7" } }, "minimist": { @@ -5486,6 +420,23 @@ "resolved": "http://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=" }, + "minipass": { + "version": "2.3.5", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-2.3.5.tgz", + "integrity": "sha512-Gi1W4k059gyRbyVUZQ4mEqLm0YIUiGYfvxhF6SIlk3ui1WVxMTGfGdQ2SInh3PDrRTVvPKgULkpJtT4RH10+VA==", + "requires": { + "safe-buffer": "^5.1.2", + "yallist": "^3.0.0" + } + }, + "minizlib": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-1.2.1.tgz", + "integrity": "sha512-7+4oTUOWKg7AuL3vloEWekXY2/D20cevzsrNT2kGWm+39J9hGTCBv8VI5Pm5lXZ/o3/mdR4f8rflAPhnQb8mPA==", + "requires": { + "minipass": "^2.2.1" + } + }, "mkdirp": { "version": "0.5.1", "resolved": "http://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", @@ -5493,6 +444,333 @@ "requires": { "minimist": "0.0.8" } + }, + "nan": { + "version": "2.14.0", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.14.0.tgz", + "integrity": "sha512-INOFj37C7k3AfaNTtX8RhsTw7qRy7eLET14cROi9+5HAVbbHuIWUHEauBv5qT4Av2tWasiTY1Jw6puUNqRJXQg==" + }, + "node-gyp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/node-gyp/-/node-gyp-4.0.0.tgz", + "integrity": "sha512-2XiryJ8sICNo6ej8d0idXDEMKfVfFK7kekGCtJAuelGsYHQxhj13KTf95swTCN2dZ/4lTfZ84Fu31jqJEEgjWA==", + "requires": { + "glob": "^7.0.3", + "graceful-fs": "^4.1.2", + "mkdirp": "^0.5.0", + "nopt": "2 || 3", + "npmlog": "0 || 1 || 2 || 3 || 4", + "osenv": "0", + "request": "^2.87.0", + "rimraf": "2", + "semver": "~5.3.0", + "tar": "^4.4.8", + "which": "1" + } + }, + "nopt": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/nopt/-/nopt-3.0.6.tgz", + "integrity": "sha1-xkZdvwirzU2zWTF/eaxopkayj/k=", + "requires": { + "abbrev": "1" + } + }, + "npmlog": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/npmlog/-/npmlog-4.1.2.tgz", + "integrity": "sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg==", + "requires": { + "are-we-there-yet": "~1.1.2", + "console-control-strings": "~1.1.0", + "gauge": "~2.7.3", + "set-blocking": "~2.0.0" + } + }, + "number-is-nan": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", + "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=" + }, + "oauth-sign": { + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", + "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==" + }, + "object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=" + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "requires": { + "wrappy": "1" + } + }, + "os-homedir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", + "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=" + }, + "os-tmpdir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", + "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=" + }, + "osenv": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/osenv/-/osenv-0.1.5.tgz", + "integrity": "sha512-0CWcCECdMVc2Rw3U5w9ZjqX6ga6ubk1xDVKxtBQPK7wis/0F2r9T6k4ydGYhecl7YUBxBVxhL5oisPsNxAPe2g==", + "requires": { + "os-homedir": "^1.0.0", + "os-tmpdir": "^1.0.0" + } + }, + "path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=" + }, + "performance-now": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", + "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=" + }, + "process-nextick-args": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", + "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==" + }, + "psl": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/psl/-/psl-1.3.0.tgz", + "integrity": "sha512-avHdspHO+9rQTLbv1RO+MPYeP/SzsCoxofjVnHanETfQhTJrmB0HlDoW+EiN/R+C0BZ+gERab9NY0lPN2TxNag==" + }, + "punycode": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", + "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==" + }, + "qs": { + "version": "6.5.2", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", + "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==" + }, + "readable-stream": { + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "request": { + "version": "2.88.0", + "resolved": "https://registry.npmjs.org/request/-/request-2.88.0.tgz", + "integrity": "sha512-NAqBSrijGLZdM0WZNsInLJpkJokL72XYjUpnB0iwsRgxh7dB6COrHnTBNwN0E+lHDAJzu7kLAkDeY08z2/A0hg==", + "requires": { + "aws-sign2": "~0.7.0", + "aws4": "^1.8.0", + "caseless": "~0.12.0", + "combined-stream": "~1.0.6", + "extend": "~3.0.2", + "forever-agent": "~0.6.1", + "form-data": "~2.3.2", + "har-validator": "~5.1.0", + "http-signature": "~1.2.0", + "is-typedarray": "~1.0.0", + "isstream": "~0.1.2", + "json-stringify-safe": "~5.0.1", + "mime-types": "~2.1.19", + "oauth-sign": "~0.9.0", + "performance-now": "^2.1.0", + "qs": "~6.5.2", + "safe-buffer": "^5.1.2", + "tough-cookie": "~2.4.3", + "tunnel-agent": "^0.6.0", + "uuid": "^3.3.2" + } + }, + "rimraf": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.0.tgz", + "integrity": "sha512-4Liqw7ccABzsWV5BzeZeGRSq7KWIgQYzOcmRDEwSX4WAawlQpcAFXZ1Kid72XYrjSnK5yxOS6Gez/iGusYE/Pw==", + "requires": { + "glob": "^7.1.3" + } + }, + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + }, + "safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" + }, + "semver": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.3.0.tgz", + "integrity": "sha1-myzl094C0XxgEq0yaqa00M9U+U8=" + }, + "set-blocking": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", + "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=" + }, + "signal-exit": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", + "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=" + }, + "sshpk": { + "version": "1.16.1", + "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.16.1.tgz", + "integrity": "sha512-HXXqVUq7+pcKeLqqZj6mHFUMvXtOJt1uoUx09pFW6011inTMxqI8BA8PM95myrIyyKwdnzjdFjLiE6KBPVtJIg==", + "requires": { + "asn1": "~0.2.3", + "assert-plus": "^1.0.0", + "bcrypt-pbkdf": "^1.0.0", + "dashdash": "^1.12.0", + "ecc-jsbn": "~0.1.1", + "getpass": "^0.1.1", + "jsbn": "~0.1.0", + "safer-buffer": "^2.0.2", + "tweetnacl": "~0.14.0" + } + }, + "string-width": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", + "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", + "requires": { + "code-point-at": "^1.0.0", + "is-fullwidth-code-point": "^1.0.0", + "strip-ansi": "^3.0.0" + } + }, + "string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "requires": { + "safe-buffer": "~5.1.0" + } + }, + "strip-ansi": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "requires": { + "ansi-regex": "^2.0.0" + } + }, + "tar": { + "version": "4.4.10", + "resolved": "https://registry.npmjs.org/tar/-/tar-4.4.10.tgz", + "integrity": "sha512-g2SVs5QIxvo6OLp0GudTqEf05maawKUxXru104iaayWA09551tFCTI8f1Asb4lPfkBr91k07iL4c11XO3/b0tA==", + "requires": { + "chownr": "^1.1.1", + "fs-minipass": "^1.2.5", + "minipass": "^2.3.5", + "minizlib": "^1.2.1", + "mkdirp": "^0.5.0", + "safe-buffer": "^5.1.2", + "yallist": "^3.0.3" + } + }, + "tough-cookie": { + "version": "2.4.3", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.4.3.tgz", + "integrity": "sha512-Q5srk/4vDM54WJsJio3XNn6K2sCG+CQ8G5Wz6bZhRZoAe/+TxjWB/GlFAnYEbkYVlON9FMk/fE3h2RLpPXo4lQ==", + "requires": { + "psl": "^1.1.24", + "punycode": "^1.4.1" + }, + "dependencies": { + "punycode": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", + "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=" + } + } + }, + "tunnel-agent": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", + "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", + "requires": { + "safe-buffer": "^5.0.1" + } + }, + "tweetnacl": { + "version": "0.14.5", + "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", + "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=" + }, + "uri-js": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.2.2.tgz", + "integrity": "sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ==", + "requires": { + "punycode": "^2.1.0" + } + }, + "util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" + }, + "uuid": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz", + "integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==" + }, + "verror": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", + "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", + "requires": { + "assert-plus": "^1.0.0", + "core-util-is": "1.0.2", + "extsprintf": "^1.2.0" + } + }, + "which": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", + "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", + "requires": { + "isexe": "^2.0.0" + } + }, + "wide-align": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.3.tgz", + "integrity": "sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA==", + "requires": { + "string-width": "^1.0.2 || 2" + } + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" + }, + "yallist": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.0.3.tgz", + "integrity": "sha512-S+Zk8DEWE6oKpV+vI3qWkaK+jSbIK86pCwe2IF/xwIpQ8jEuxpw9NyaGjmp9+BoJv5FV2piqCDcoCtStppiq2A==" } } } diff --git a/samples/nodejs/package.json b/samples/nodejs/package.json index 774f8de002..2dc216ba73 100644 --- a/samples/nodejs/package.json +++ b/samples/nodejs/package.json @@ -36,7 +36,7 @@ "dependencies": { "cryptiles": "^4.1.1", "home-dir": "^1.0.0", - "indy-sdk": "file:../../wrappers/nodejs", + "indy-sdk": "^1.11.0", "mkdirp": "^0.5.1" } } diff --git a/samples/nodejs/src/anoncredsRevocation.js b/samples/nodejs/src/anoncredsRevocation.js index f3a40aed49..3fd8db85c3 100644 --- a/samples/nodejs/src/anoncredsRevocation.js +++ b/samples/nodejs/src/anoncredsRevocation.js @@ -94,8 +94,9 @@ async function run() { await indy.proverStoreCredential(proverWallet, undefined, credReqMetadata, cred, credDef, revRegDef) // 11. Prover gets Credentials for Proof Request + const nonce = await indy.generateNonce() const proofReq = { - 'nonce': '123432421212', + 'nonce': nonce, 'name': 'proof_req_1', 'version': '0.1', 'requested_attributes': { diff --git a/samples/nodejs/src/anoncredsRevocationScenario.js b/samples/nodejs/src/anoncredsRevocationScenario.js index 966d36264c..99232061c5 100644 --- a/samples/nodejs/src/anoncredsRevocationScenario.js +++ b/samples/nodejs/src/anoncredsRevocationScenario.js @@ -332,8 +332,9 @@ async function run() { await indy.proverStoreCredential(prover.wallet, undefined, prover.credReqMetadata, prover.cred, prover.credDef, prover.revRegDef) logVerifier("Verifier creates proof request") + const nonce = await indy.generateNonce() verifier.proofReq = { - "nonce": "123432421212", + "nonce": nonce, "name": "proof_req_1", "version": "0.1", "requested_attributes": { diff --git a/samples/nodejs/src/gettingStarted.js b/samples/nodejs/src/gettingStarted.js index 592e92309a..7c819b2393 100644 --- a/samples/nodejs/src/gettingStarted.js +++ b/samples/nodejs/src/gettingStarted.js @@ -243,8 +243,9 @@ async function run() { console.log("------------------------------"); console.log("\"Acme\" -> Create \"Job-Application\" Proof Request"); + let nonce = await indy.generateNonce() let jobApplicationProofRequestJson = { - 'nonce': '1432422343242122312411212', + 'nonce': nonce, 'name': 'Job-Application', 'version': '0.1', 'requested_attributes': { @@ -439,8 +440,9 @@ async function run() { console.log("------------------------------"); console.log("\"Thrift\" -> Create \"Loan-Application-Basic\" Proof Request"); + nonce = await indy.generateNonce() let applyLoanProofRequestJson = { - 'nonce': '123432421212', + 'nonce': nonce, 'name': 'Loan-Application-Basic', 'version': '0.1', 'requested_attributes': { @@ -540,8 +542,9 @@ async function run() { console.log("------------------------------"); console.log("\"Thrift\" -> Create \"Loan-Application-KYC\" Proof Request"); + nonce = await indy.generateNonce() let applyLoanKycProofRequestJson = { - 'nonce': '123432421212', + 'nonce': nonce, 'name': 'Loan-Application-KYC', 'version': '0.1', 'requested_attributes': { diff --git a/samples/python/setup.py b/samples/python/setup.py index 3fe2b1e473..8c4d74e169 100644 --- a/samples/python/setup.py +++ b/samples/python/setup.py @@ -8,5 +8,5 @@ author='Artem Ivanov', author_email='artem.ivanov@dsr-company.com', description='This is the sample of usage python wrapper for Hyperledger Indy SDK.', - install_requires=['python3-indy==1.8.1-dev-1039'] + install_requires=['python3-indy==1.11.0'] ) diff --git a/samples/python/src/anoncreds.py b/samples/python/src/anoncreds.py index d5f0ec99bd..368e946c5c 100644 --- a/samples/python/src/anoncreds.py +++ b/samples/python/src/anoncreds.py @@ -10,8 +10,10 @@ from src.utils import run_coroutine, PROTOCOL_VERSION + logger = logging.getLogger(__name__) + async def demo(): logger.info("Anoncreds sample -> started") @@ -97,9 +99,10 @@ async def demo(): await anoncreds.prover_store_credential(prover['wallet'], None, prover['cred_req_metadata'], prover['cred'], prover['cred_def'], None) - # 10. Prover gets Credentials for Proof Request + # 10. Verifier builds Proof Request + nonce = await anoncreds.generate_nonce() verifier['proof_req'] = json.dumps({ - 'nonce': '123432421212', + 'nonce': nonce, 'name': 'proof_req_1', 'version': '0.1', 'requested_attributes': { @@ -111,10 +114,11 @@ async def demo(): }) prover['proof_req'] = verifier['proof_req'] - # Prover gets Credentials for attr1_referent + # Prover gets Credentials for Proof Request prover['cred_search_handle'] = \ await anoncreds.prover_search_credentials_for_proof_req(prover['wallet'], prover['proof_req'], None) + # Prover gets Credentials for attr1_referent creds_for_attr1 = await anoncreds.prover_fetch_credentials_for_proof_req(prover['cred_search_handle'], 'attr1_referent', 10) prover['cred_for_attr1'] = json.loads(creds_for_attr1)[0]['cred_info'] diff --git a/samples/python/src/anoncreds_revocation.py b/samples/python/src/anoncreds_revocation.py index db075649ce..bd369ad2a0 100644 --- a/samples/python/src/anoncreds_revocation.py +++ b/samples/python/src/anoncreds_revocation.py @@ -11,6 +11,7 @@ from src.utils import run_coroutine, path_home, PROTOCOL_VERSION + logger = logging.getLogger(__name__) @@ -128,9 +129,11 @@ async def demo(): await anoncreds.prover_store_credential(prover['wallet'], None, prover['cred_req_metadata'], prover['cred'], prover['cred_def'], prover['rev_reg_def']) - # 11. Prover gets Credentials for Proof Request + # 10. Verifier builds Proof Request + nonce = await anoncreds.generate_nonce() + timestamp = int(time.time()) verifier['proof_req'] = json.dumps({ - 'nonce': '123432421212', + 'nonce': nonce, 'name': 'proof_req_1', 'version': '0.1', 'requested_attributes': { @@ -139,14 +142,15 @@ async def demo(): 'requested_predicates': { 'predicate1_referent': {'name': 'age', 'p_type': '>=', 'p_value': 18} }, - "non_revoked": {"from": 80, "to": 100} + "non_revoked": {"to": timestamp} }) prover['proof_req'] = verifier['proof_req'] - # Prover gets Credentials for attr1_referent + # Prover gets Credentials for Proof Request prover['cred_search_handle'] = \ await anoncreds.prover_search_credentials_for_proof_req(prover['wallet'], prover['proof_req'], None) + # Prover gets Credentials for attr1_referent creds_for_attr1 = await anoncreds.prover_fetch_credentials_for_proof_req(prover['cred_search_handle'], 'attr1_referent', 10) prover['cred_for_attr1'] = json.loads(creds_for_attr1)[0]['cred_info'] @@ -159,7 +163,6 @@ async def demo(): await anoncreds.prover_close_credentials_search_for_proof_req(prover['cred_search_handle']) # 12. Prover creates revocation state - timestamp = 100 prover['tails_reader_config'] = json.dumps({'base_dir': str(path_home().joinpath("tails")), 'uri_pattern': ''}) prover['blob_storage_reader'] = await blob_storage.open_reader('default', prover['tails_reader_config']) diff --git a/samples/python/src/endorser.py b/samples/python/src/endorser.py new file mode 100644 index 0000000000..fdfbc30487 --- /dev/null +++ b/samples/python/src/endorser.py @@ -0,0 +1,136 @@ +import time +import json +import logging + +from src.utils import get_pool_genesis_txn_path, run_coroutine, PROTOCOL_VERSION + + +logger = logging.getLogger(__name__) + +from indy import ledger, did, wallet, pool, anoncreds + + +async def open_pool(target_pool): + target_pool['genesis_txn_path'] = get_pool_genesis_txn_path(target_pool['pool_name']) + target_pool['pool_config'] = json.dumps({"genesis_txn": str(target_pool['genesis_txn_path'])}) + await pool.create_pool_ledger_config(target_pool['pool_name'], target_pool['pool_config']) + target_pool['pool'] = await pool.open_pool_ledger(target_pool['pool_name'], None) + + +async def setup_identity(identity, trustee): + (identity['did'], identity['verkey']) = await did.create_and_store_my_did(identity['wallet'], "{}") + nym_req = await ledger.build_nym_request(trustee['did'], identity['did'], identity['verkey'], None, + identity['role']) + await ledger.sign_and_submit_request(identity['pool'], trustee['wallet'], trustee['did'], nym_req) + + +async def demo(): + logger.info("endorser sample -> started") + + # Set protocol version 2 to work with Indy Node 1.4 + await pool.set_protocol_version(PROTOCOL_VERSION) + + # Open pool + target_pool = { + 'pool_name': 'trustee_pool' + } + + await open_pool(target_pool) + + author = { + 'wallet_config': json.dumps({'id': 'author_wallet'}), + 'wallet_credentials': json.dumps({'key': 'author_wallet_key'}), + 'pool': target_pool['pool'], + 'role': None + } + endorser = { + 'wallet_config': json.dumps({"id": "endorser_wallet"}), + 'wallet_credentials': json.dumps({"key": "endorser_wallet_key"}), + 'pool': target_pool['pool'], + 'role': 'ENDORSER' + } + trustee = { + 'seed': '000000000000000000000000Trustee1', + 'wallet_config': json.dumps({'id': 'trustee_wallet'}), + 'wallet_credentials': json.dumps({'key': 'trustee_wallet_key'}), + 'pool': target_pool['pool'] + } + + await wallet.create_wallet(author['wallet_config'], author['wallet_credentials']) + author['wallet'] = await wallet.open_wallet(author['wallet_config'], author['wallet_credentials']) + + await wallet.create_wallet(endorser['wallet_config'], endorser['wallet_credentials']) + endorser['wallet'] = await wallet.open_wallet(endorser['wallet_config'], endorser['wallet_credentials']) + + await wallet.create_wallet(trustee['wallet_config'], trustee['wallet_credentials']) + trustee['wallet'] = await wallet.open_wallet(trustee['wallet_config'], trustee['wallet_credentials']) + + # Trustee Create DID + (trustee['did'], trustee['verkey']) = \ + await did.create_and_store_my_did(trustee['wallet'], json.dumps({"seed": trustee['seed']})) + + # Author Create DID + await setup_identity(author, trustee) + + # Endorser Create DID + await setup_identity(endorser, trustee) + + # Write SCHEMA from author with endorser + # Endorser Workflow + schema = { + 'name': 'gvt', + 'version': '1.0', + 'attributes': '["age", "sex", "height", "name"]' + } + author['schema_id'], author['schema'] = await anoncreds.issuer_create_schema(author['did'], schema['name'], + schema['version'], + schema['attributes']) + + # 1. Transaction Author builds Schema Request + author['schema_req'] = await ledger.build_schema_request(author['did'], author['schema']) + + # 2. Transaction Author appends Endorser's DID into the request + author['schema_req'] = await ledger.append_request_endorser(author['schema_req'], endorser['did']) + + # 3. Transaction Author signs the request with the added endorser field + author['schema_req'] = await ledger.multi_sign_request(author['wallet'], author['did'], author['schema_req']) + + # 4. Transaction Author sends the request to the Endorser (out of scope). + endorser['schema_req'] = author['schema_req'] + + # 5. Transaction Endorser signs the request + endorser['schema_req'] = await ledger.multi_sign_request(endorser['wallet'], endorser['did'], + endorser['schema_req']) + + # 6. Transaction Endorser sends the request + resp = await ledger.submit_request(target_pool['pool'], endorser['schema_req']) + resp = json.loads(resp) + assert resp['op'] == 'REPLY' + assert resp['result']['txn']['metadata']['endorser'] == endorser['did'] + + time.sleep(1) + + # Author checks that Schema was added + author['get_schema_req'] = await ledger.build_get_schema_request(author['did'], author['schema_id']) + response = await ledger.submit_request(target_pool['pool'], author['get_schema_req']) + response = json.loads(response) + assert response['op'] == 'REPLY' + + await pool.close_pool_ledger(target_pool['pool']) + await pool.delete_pool_ledger_config(target_pool['pool_name']) + + await wallet.close_wallet(trustee['wallet']) + await wallet.delete_wallet(trustee['wallet_config'], trustee['wallet_credentials']) + + await wallet.close_wallet(author['wallet']) + await wallet.delete_wallet(author['wallet_config'], author['wallet_credentials']) + + await wallet.close_wallet(endorser['wallet']) + await wallet.delete_wallet(endorser['wallet_config'], endorser['wallet_credentials']) + + logger.info("endorser sample -> completed") + + +if __name__ == '__main__': + run_coroutine(demo) + time.sleep(1) # FIXME waiting for libindy thread complete diff --git a/samples/python/src/getting_started.py b/samples/python/src/getting_started.py index 8f28bef439..a236946fc5 100644 --- a/samples/python/src/getting_started.py +++ b/samples/python/src/getting_started.py @@ -399,8 +399,9 @@ async def run(): logger.info("------------------------------") logger.info("\"Acme\" -> Create \"Job-Application\" Proof Request") + nonce = await anoncreds.generate_nonce() acme['job_application_proof_request'] = json.dumps({ - 'nonce': '1432422343242122312411212', + 'nonce': nonce, 'name': 'Job-Application', 'version': '0.1', 'requested_attributes': { @@ -648,8 +649,9 @@ async def apply_loan_basic(): logger.info("------------------------------") logger.info("\"Thrift\" -> Create \"Loan-Application-Basic\" Proof Request") + nonce = await anoncreds.generate_nonce() thrift['apply_loan_proof_request'] = json.dumps({ - 'nonce': '123432421212', + 'nonce': nonce, 'name': 'Loan-Application-Basic', 'version': '0.1', 'requested_attributes': { @@ -773,8 +775,9 @@ async def apply_loan_basic(): logger.info("------------------------------") logger.info("\"Thrift\" -> Create \"Loan-Application-KYC\" Proof Request") + nonce = await anoncreds.generate_nonce() thrift['apply_loan_kyc_proof_request'] = json.dumps({ - 'nonce': '123432421212', + 'nonce': nonce, 'name': 'Loan-Application-KYC', 'version': '0.1', 'requested_attributes': { diff --git a/samples/python/src/main.py b/samples/python/src/main.py index 5b978fd46d..7c5eedddab 100644 --- a/samples/python/src/main.py +++ b/samples/python/src/main.py @@ -1,6 +1,6 @@ import time -from src import anoncreds, anoncreds_revocation, crypto, ledger, getting_started, txn_author_agreement +from src import anoncreds, anoncreds_revocation, crypto, ledger, getting_started, txn_author_agreement, endorser from src.utils import run_coroutine @@ -12,6 +12,7 @@ async def main(): await crypto.demo() await ledger.demo() await txn_author_agreement.demo() + await endorser.demo() if __name__ == '__main__': run_coroutine(main) diff --git a/samples/python/src/txn_author_agreement.py b/samples/python/src/txn_author_agreement.py index 53ba53bc6b..219ea7065d 100644 --- a/samples/python/src/txn_author_agreement.py +++ b/samples/python/src/txn_author_agreement.py @@ -9,6 +9,7 @@ logger = logging.getLogger(__name__) + async def demo(): logger.info("Transaction Author Agreement sample -> started") @@ -135,9 +136,15 @@ async def demo(): # Trustee reset Transaction Agreement txn_agreement_req = \ - await ledger.build_txn_author_agreement_request(trustee['did'], '', str(randint(0, 1000))) + await ledger.build_txn_author_agreement_request(trustee['did'], '', str(randint(0, 1000))) await ledger.sign_and_submit_request(trustee['pool'], trustee['wallet'], trustee['did'], txn_agreement_req) + # User sends ATTRIB transaction to Ledger without Transaction Agreement + attr_req = \ + await ledger.build_attrib_request(user['did'], user['did'], None, '{"endpoint":{"ha":"10.0.0.2:5555"}}', None) + resp = json.loads(await ledger.sign_and_submit_request(user['pool'], user['wallet'], user['did'], attr_req)) + assert resp['op'] == 'REPLY' + # Trustee closes and deletes Wallet await wallet.close_wallet(trustee['wallet']) await wallet.delete_wallet(trustee['wallet_config'], trustee['wallet_credentials']) From fc76830e16b43924e9ae7ee21873693dac7b7f09 Mon Sep 17 00:00:00 2001 From: Axel Nennker Date: Wed, 14 Aug 2019 10:39:37 +0200 Subject: [PATCH 202/320] issue WalletEncryptionError on utf failure Signed-off-by: Axel Nennker --- libindy/src/errors/mod.rs | 6 ------ libindy/src/services/wallet/encryption.rs | 6 +++--- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/libindy/src/errors/mod.rs b/libindy/src/errors/mod.rs index ce206ef4b0..e91f4a30c8 100644 --- a/libindy/src/errors/mod.rs +++ b/libindy/src/errors/mod.rs @@ -241,12 +241,6 @@ impl From for IndyError { } } -impl From for IndyError { - fn from(err: std::string::FromUtf8Error) -> Self { - IndyError::from_msg(IndyErrorKind::InvalidStructure, format!("utf8 conversion failed {}", err)) - } -} - impl From> for ErrorCode { fn from(r: Result) -> ErrorCode { match r { diff --git a/libindy/src/services/wallet/encryption.rs b/libindy/src/services/wallet/encryption.rs index a54daae0b5..0d96e5fb0e 100644 --- a/libindy/src/services/wallet/encryption.rs +++ b/libindy/src/services/wallet/encryption.rs @@ -164,13 +164,13 @@ pub(super) fn decrypt_tags(etags: &Option>, tag_name_key: &chacha20poly Tag::PlainText(ref ename, ref value) => { let name = match decrypt_merged(&ename, tag_name_key) { Err(err) => return Err(err.to_indy(IndyErrorKind::WalletEncryptionError, "Unable to decrypt tag name")), - Ok(tag_name_bytes) => format!("~{}", str::from_utf8(&tag_name_bytes).to_indy(IndyErrorKind::WalletEncryptionError, "Tag name is invalid utf8")?) + Ok(tag_name_bytes) => format!("~{}", str::from_utf8(&tag_name_bytes).to_indy(IndyErrorKind::WalletEncryptionError, "Plaintext Tag name is invalid utf8")?) }; (name, value.clone()) } Tag::Encrypted(ref ename, ref evalue) => { - let name = String::from_utf8(decrypt_merged(&ename, tag_name_key)?)?; - let value = String::from_utf8(decrypt_merged(&evalue, tag_value_key)?)?; + let name = String::from_utf8(decrypt_merged(&ename, tag_name_key)?).to_indy(IndyErrorKind::WalletEncryptionError, "Tag name is invalid utf8")?; + let value = String::from_utf8(decrypt_merged(&evalue, tag_value_key)?).to_indy(IndyErrorKind::WalletEncryptionError, "Tag value is invalid utf8")?; (name, value) } }; From 2515fe97e36feb8b500ce91927a1c03b76e6ba9e Mon Sep 17 00:00:00 2001 From: Axel Nennker Date: Wed, 14 Aug 2019 12:01:19 +0200 Subject: [PATCH 203/320] simplified error handling Signed-off-by: Axel Nennker --- .../services/wallet/storage/default/mod.rs | 21 ++++--------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/libindy/src/services/wallet/storage/default/mod.rs b/libindy/src/services/wallet/storage/default/mod.rs index 0cd86410a2..9e4e4b9983 100644 --- a/libindy/src/services/wallet/storage/default/mod.rs +++ b/libindy/src/services/wallet/storage/default/mod.rs @@ -246,15 +246,6 @@ impl SQLiteStorageType { } } -macro_rules! match_res_to_item_id { - ($res:ident) => { - match $res { - Err(err) => return Err(IndyError::from(err)), - Ok(id) => id - } - } -} - impl WalletStorage for SQLiteStorage { /// /// Tries to fetch values and/or tags from the storage. @@ -404,10 +395,8 @@ impl WalletStorage for SQLiteStorage { fn add_tags(&self, type_: &[u8], id: &[u8], tags: &[Tag]) -> IndyResult<()> { let tx: transaction::Transaction = transaction::Transaction::new(&self.conn, rusqlite::TransactionBehavior::Deferred)?; - let res = tx.prepare_cached("SELECT id FROM items WHERE type = ?1 AND name = ?2")? - .query_row(&[&type_.to_vec(), &id.to_vec()], |row| row.get(0)); - - let item_id: i64 = match_res_to_item_id!(res); + let item_id: i64 = tx.prepare_cached("SELECT id FROM items WHERE type = ?1 AND name = ?2")? + .query_row(&[&type_.to_vec(), &id.to_vec()], |row| row.get(0))?; if !tags.is_empty() { let mut enc_tag_insert_stmt = tx.prepare_cached("INSERT OR REPLACE INTO tags_encrypted (item_id, name, value) VALUES (?1, ?2, ?3)")?; @@ -428,10 +417,8 @@ impl WalletStorage for SQLiteStorage { fn update_tags(&self, type_: &[u8], id: &[u8], tags: &[Tag]) -> IndyResult<()> { let tx: transaction::Transaction = transaction::Transaction::new(&self.conn, rusqlite::TransactionBehavior::Deferred)?; - let res = tx.prepare_cached("SELECT id FROM items WHERE type = ?1 AND name = ?2")? - .query_row(&[&type_.to_vec(), &id.to_vec()], |row| row.get(0)); - - let item_id: i64 = match_res_to_item_id!(res); + let item_id: i64 = tx.prepare_cached("SELECT id FROM items WHERE type = ?1 AND name = ?2")? + .query_row(&[&type_.to_vec(), &id.to_vec()], |row| row.get(0))?; tx.execute("DELETE FROM tags_encrypted WHERE item_id = ?1", &[&item_id])?; tx.execute("DELETE FROM tags_plaintext WHERE item_id = ?1", &[&item_id])?; From 6a517bda20bb57850bd57243ae92cbe1c97b1fca Mon Sep 17 00:00:00 2001 From: Axel Nennker Date: Wed, 14 Aug 2019 12:41:16 +0200 Subject: [PATCH 204/320] use iter to create new map with other Item type Signed-off-by: Axel Nennker --- libindy/src/domain/anoncreds/schema.rs | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/libindy/src/domain/anoncreds/schema.rs b/libindy/src/domain/anoncreds/schema.rs index 860bbad071..efab4a3d1b 100644 --- a/libindy/src/domain/anoncreds/schema.rs +++ b/libindy/src/domain/anoncreds/schema.rs @@ -43,13 +43,7 @@ impl From for SchemaV1 { } pub fn schemas_map_to_schemas_v1_map(schemas: HashMap) -> HashMap { - let mut schemas_v1: HashMap = HashMap::new(); - - for (schema_id, schema) in schemas { - schemas_v1.insert(schema_id, SchemaV1::from(schema)); - } - - schemas_v1 + schemas.into_iter().map( |(schema_id, schema)| { (schema_id, SchemaV1::from(schema))}).collect() } pub type AttributeNames = HashSet; \ No newline at end of file From 4874707f05dab57c1bad5d4eb3689825158e3b77 Mon Sep 17 00:00:00 2001 From: Axel Nennker Date: Wed, 14 Aug 2019 13:04:34 +0200 Subject: [PATCH 205/320] use error conversion Signed-off-by: Axel Nennker --- .../services/wallet/storage/default/mod.rs | 30 ++++--------------- 1 file changed, 6 insertions(+), 24 deletions(-) diff --git a/libindy/src/services/wallet/storage/default/mod.rs b/libindy/src/services/wallet/storage/default/mod.rs index 9e4e4b9983..1d6680d52c 100644 --- a/libindy/src/services/wallet/storage/default/mod.rs +++ b/libindy/src/services/wallet/storage/default/mod.rs @@ -284,19 +284,13 @@ impl WalletStorage for SQLiteStorage { }; - let res: Result<(i64, Vec, Vec), rusqlite::Error> = self.conn.query_row( + let item: (i64, Vec, Vec) = self.conn.query_row( "SELECT id, value, key FROM items where type = ?1 AND name = ?2", &[&type_.to_vec(), &id.to_vec()], |row| { Ok((row.get(0)?, row.get(1)?, row.get(2)?)) }, - ); - - let item = match res { - Ok(entity) => entity, - Err(rusqlite::Error::QueryReturnedNoRows) => return Err(err_msg(IndyErrorKind::WalletItemNotFound, "Wallet item not found")), - Err(err) => return Err(IndyError::from(err)) - }; + )?; let value = if options.retrieve_value { Some(EncryptedValue::new(item.1, item.2)) } else { None }; @@ -440,14 +434,8 @@ impl WalletStorage for SQLiteStorage { } fn delete_tags(&self, type_: &[u8], id: &[u8], tag_names: &[TagName]) -> IndyResult<()> { - let res = self.conn.prepare_cached("SELECT id FROM items WHERE type =?1 AND name = ?2")? - .query_row(&[&type_.to_vec(), &id.to_vec()], |row| row.get(0)); - - let item_id: i64 = match res { - Err(rusqlite::Error::QueryReturnedNoRows) => return Err(err_msg(IndyErrorKind::WalletItemNotFound, "Item to delete not found")), - Err(err) => return Err(IndyError::from(err)), - Ok(id) => id - }; + let item_id: i64 = self.conn.prepare_cached("SELECT id FROM items WHERE type =?1 AND name = ?2")? + .query_row(&[&type_.to_vec(), &id.to_vec()], |row| row.get(0))?; let tx: transaction::Transaction = transaction::Transaction::new(&self.conn, rusqlite::TransactionBehavior::Deferred)?; { @@ -506,17 +494,11 @@ impl WalletStorage for SQLiteStorage { } fn get_storage_metadata(&self) -> IndyResult> { - let res: Result, rusqlite::Error> = self.conn.query_row( + self.conn.query_row( "SELECT value FROM metadata", rusqlite::NO_PARAMS, |row| { row.get(0) }, - ); - - match res { - Ok(entity) => Ok(entity), - Err(rusqlite::Error::QueryReturnedNoRows) => Err(err_msg(IndyErrorKind::WalletItemNotFound, "Wallet item not found")), - Err(err) => Err(IndyError::from(err)) - } + ).map_err(IndyError::from) } fn set_storage_metadata(&self, metadata: &[u8]) -> IndyResult<()> { From 27f7d09525f6e91ccd139e51ffdab8b47d632b50 Mon Sep 17 00:00:00 2001 From: "artem.ivanov" Date: Wed, 14 Aug 2019 15:36:00 +0300 Subject: [PATCH 206/320] Pool: Configure the number of nodes to send read requests Signed-off-by: artem.ivanov --- libindy/src/api/pool.rs | 1 + libindy/src/domain/pool.rs | 18 ++-- libindy/src/services/pool/mod.rs | 4 + libindy/src/services/pool/pool.rs | 83 ++++++++++--------- libindy/src/services/pool/request_handler.rs | 30 ++++--- libindy/tests/pool.rs | 24 ++++++ .../ios/libindy-pod/Indy/Wrapper/IndyPool.h | 1 + .../org/hyperledger/indy/sdk/pool/Pool.java | 1 + wrappers/nodejs/README.md | 1 + wrappers/python/indy/pool.py | 1 + wrappers/rust/src/pool.rs | 12 +-- 11 files changed, 117 insertions(+), 59 deletions(-) diff --git a/libindy/src/api/pool.rs b/libindy/src/api/pool.rs index 4e5a11d2aa..79c354be2e 100755 --- a/libindy/src/api/pool.rs +++ b/libindy/src/api/pool.rs @@ -72,6 +72,7 @@ pub extern fn indy_create_pool_ledger_config(command_handle: CommandHandle, /// "preordered_nodes": array - (optional), names of nodes which will have a priority during request sending: /// ["name_of_1st_prior_node", "name_of_2nd_prior_node", .... ] /// Note: Not specified nodes will be placed in a random way. +/// "number_read_nodes": int (optional) - the number of nodes to send read requests (2 by default) /// } /// /// #Returns diff --git a/libindy/src/domain/pool.rs b/libindy/src/domain/pool.rs index c2db70dff8..c4f182dd5f 100644 --- a/libindy/src/domain/pool.rs +++ b/libindy/src/domain/pool.rs @@ -2,6 +2,7 @@ pub const POOL_CON_ACTIVE_TO: i64 = 5; pub const POOL_ACK_TIMEOUT: i64 = 20; pub const POOL_REPLY_TIMEOUT: i64 = 60; pub const MAX_REQ_PER_POOL_CON: usize = 5; +pub const NUMBER_READ_NODES: u8 = 2; #[derive(Debug, Serialize, Deserialize)] pub struct PoolConfig { @@ -18,16 +19,18 @@ impl PoolConfig { #[derive(Clone, Debug, Serialize, Deserialize)] pub struct PoolOpenConfig { - #[serde(default="PoolOpenConfig::default_timeout")] + #[serde(default = "PoolOpenConfig::default_timeout")] pub timeout: i64, - #[serde(default="PoolOpenConfig::default_extended_timeout")] + #[serde(default = "PoolOpenConfig::default_extended_timeout")] pub extended_timeout: i64, - #[serde(default="PoolOpenConfig::default_conn_limit")] + #[serde(default = "PoolOpenConfig::default_conn_limit")] pub conn_limit: usize, - #[serde(default="PoolOpenConfig::default_conn_active_timeout")] + #[serde(default = "PoolOpenConfig::default_conn_active_timeout")] pub conn_active_timeout: i64, - #[serde(default="PoolOpenConfig::default_preordered_nodes")] + #[serde(default = "PoolOpenConfig::default_preordered_nodes")] pub preordered_nodes: Vec, + #[serde(default = "PoolOpenConfig::default_number_read_nodes")] + pub number_read_nodes: u8, } impl Default for PoolOpenConfig { @@ -37,7 +40,8 @@ impl Default for PoolOpenConfig { extended_timeout: PoolOpenConfig::default_extended_timeout(), conn_limit: PoolOpenConfig::default_conn_limit(), conn_active_timeout: PoolOpenConfig::default_conn_active_timeout(), - preordered_nodes: PoolOpenConfig::default_preordered_nodes() + preordered_nodes: PoolOpenConfig::default_preordered_nodes(), + number_read_nodes: PoolOpenConfig::default_number_read_nodes(), } } } @@ -62,4 +66,6 @@ impl PoolOpenConfig { fn default_preordered_nodes() -> Vec { Vec::new() } + + fn default_number_read_nodes() -> u8 { NUMBER_READ_NODES } } diff --git a/libindy/src/services/pool/mod.rs b/libindy/src/services/pool/mod.rs index 701e58be26..d729a24fd1 100644 --- a/libindy/src/services/pool/mod.rs +++ b/libindy/src/services/pool/mod.rs @@ -149,6 +149,10 @@ impl PoolService { let config = config.unwrap_or_default(); + if config.number_read_nodes == 0 { + return Err(err_msg(IndyErrorKind::InvalidStructure, "The value of `number_read_nodes` must be greater than 0")) + } + let pool_handle: PoolHandle = next_pool_handle(); let mut new_pool = Pool::new(name, pool_handle, config); diff --git a/libindy/src/services/pool/pool.rs b/libindy/src/services/pool/pool.rs index ef710b8d95..0e2dd7f22f 100644 --- a/libindy/src/services/pool/pool.rs +++ b/libindy/src/services/pool/pool.rs @@ -34,6 +34,7 @@ struct PoolSM> { id: PoolHandle, timeout: i64, extended_timeout: i64, + number_read_nodes: u8, state: PoolState, } @@ -84,20 +85,21 @@ struct TerminatedState { struct ClosedState {} impl> PoolSM { - pub fn new(networker: Rc>, pname: &str, id: PoolHandle, timeout: i64, extended_timeout: i64) -> PoolSM { + pub fn new(networker: Rc>, pname: &str, id: PoolHandle, timeout: i64, extended_timeout: i64, number_read_nodes: u8) -> PoolSM { PoolSM { pool_name: pname.to_string(), id, timeout, extended_timeout, + number_read_nodes, state: PoolState::Initialization(InitializationState { networker }), } } - pub fn step(pool_name: String, id: PoolHandle, timeout: i64, extended_timeout: i64, state: PoolState) -> Self { - PoolSM { pool_name, id, timeout, extended_timeout, state } + pub fn step(pool_name: String, id: PoolHandle, timeout: i64, extended_timeout: i64, number_read_nodes: u8, state: PoolState) -> Self { + PoolSM { pool_name, id, timeout, extended_timeout, number_read_nodes, state } } } @@ -266,7 +268,7 @@ impl From> for ClosedState { impl> PoolSM { pub fn handle_event(self, pe: PoolEvent) -> Self { - let PoolSM { pool_name, id, state, timeout, extended_timeout } = self; + let PoolSM { pool_name, id, state, timeout, extended_timeout, number_read_nodes } = self; let state = match state { PoolState::Initialization(state) => match pe { PoolEvent::CheckCache(cmd_id) => { @@ -276,7 +278,7 @@ impl> PoolSM { // PoolWrapper::Active(pool.into()) unimplemented!() } else { - match _get_request_handler_with_ledger_status_sent(state.networker.clone(), &pool_name, timeout, extended_timeout) { + match _get_request_handler_with_ledger_status_sent(state.networker.clone(), &pool_name, timeout, extended_timeout, number_read_nodes) { Ok(request_handler) => PoolState::GettingCatchupTarget((request_handler, cmd_id, state).into()), Err(err) => { CommandExecutor::instance().send( @@ -309,7 +311,7 @@ impl> PoolSM { PoolEvent::CatchupRestart(merkle_tree) => { if let Ok((nodes, remotes)) = _get_nodes_and_remotes(&merkle_tree) { state.networker.borrow_mut().process_event(Some(NetworkerEvent::NodesStateUpdated(remotes))); - state.request_handler = R::new(state.networker.clone(), _get_f(nodes.len()), &vec![], &nodes, &pool_name, timeout, extended_timeout); + state.request_handler = R::new(state.networker.clone(), _get_f(nodes.len()), &vec![], &nodes, &pool_name, timeout, extended_timeout, number_read_nodes); let ls = _ledger_status(&merkle_tree); state.request_handler.process_event(Some(RequestEvent::LedgerStatus(ls, None, Some(merkle_tree)))); PoolState::GettingCatchupTarget(state) @@ -320,7 +322,7 @@ impl> PoolSM { PoolEvent::CatchupTargetFound(target_mt_root, target_mt_size, merkle_tree) => { if let Ok((nodes, remotes)) = _get_nodes_and_remotes(&merkle_tree) { state.networker.borrow_mut().process_event(Some(NetworkerEvent::NodesStateUpdated(remotes))); - let mut request_handler = R::new(state.networker.clone(), _get_f(nodes.len()), &vec![], &nodes, &pool_name, timeout, extended_timeout); + let mut request_handler = R::new(state.networker.clone(), _get_f(nodes.len()), &vec![], &nodes, &pool_name, timeout, extended_timeout, number_read_nodes); request_handler.process_event(Some(RequestEvent::CatchupReq(merkle_tree, target_mt_size, target_mt_root))); PoolState::SyncCatchup((request_handler, state).into()) } else { @@ -346,7 +348,7 @@ impl> PoolSM { PoolState::Closed(state.into()) } PoolEvent::Refresh(cmd_id) => { - if let Ok(request_handler) = _get_request_handler_with_ledger_status_sent(state.networker.clone(), &pool_name, timeout, extended_timeout) { + if let Ok(request_handler) = _get_request_handler_with_ledger_status_sent(state.networker.clone(), &pool_name, timeout, extended_timeout, number_read_nodes) { PoolState::GettingCatchupTarget((state, request_handler, cmd_id).into()) } else { PoolState::Terminated(state) @@ -372,7 +374,7 @@ impl> PoolSM { PoolState::Closed(state.into()) } PoolEvent::Refresh(cmd_id) => { - if let Ok(request_handler) = _get_request_handler_with_ledger_status_sent(state.networker.clone(), &pool_name, timeout, extended_timeout) { + if let Ok(request_handler) = _get_request_handler_with_ledger_status_sent(state.networker.clone(), &pool_name, timeout, extended_timeout, number_read_nodes) { PoolState::GettingCatchupTarget((state, request_handler, cmd_id).into()) } else { PoolState::Terminated(state.into()) @@ -383,7 +385,7 @@ impl> PoolSM { let re: Option = pe.into(); match re.as_ref().map(|r| r.get_req_id()) { Some(req_id) => { - let mut request_handler = R::new(state.networker.clone(), _get_f(state.nodes.len()), &vec![cmd_id], &state.nodes, &pool_name, timeout, extended_timeout); + let mut request_handler = R::new(state.networker.clone(), _get_f(state.nodes.len()), &vec![cmd_id], &state.nodes, &pool_name, timeout, extended_timeout, number_read_nodes); request_handler.process_event(re); state.request_handlers.insert(req_id.to_string(), request_handler); //FIXME check already exists } @@ -448,7 +450,7 @@ impl> PoolSM { } } }; - PoolSM::step(pool_name, id, timeout, extended_timeout, state) + PoolSM::step(pool_name, id, timeout, extended_timeout, number_read_nodes, state) } pub fn is_terminal(&self) -> bool { @@ -473,6 +475,7 @@ pub struct Pool> { active_timeout: i64, conn_limit: usize, preordered_nodes: Vec, + number_read_nodes: u8, } impl> Pool { @@ -488,6 +491,7 @@ impl> Pool { active_timeout: config.conn_active_timeout, conn_limit: config.conn_limit, preordered_nodes: config.preordered_nodes, + number_read_nodes: config.number_read_nodes, } } @@ -499,11 +503,13 @@ impl> Pool { let active_timeout = self.active_timeout; let conn_limit = self.conn_limit; let preordered_nodes = self.preordered_nodes.clone(); + let number_read_nodes = self.number_read_nodes.clone(); self.worker = Some(thread::spawn(move || { let mut pool_thread: PoolThread = PoolThread::new(cmd_socket, name, id, timeout, extended_timeout, active_timeout, conn_limit, - preordered_nodes); + preordered_nodes, + number_read_nodes); pool_thread.work(); })); } @@ -525,10 +531,10 @@ struct PoolThread> { } impl> PoolThread { - pub fn new(cmd_socket: zmq::Socket, name: String, id: PoolHandle, timeout: i64, extended_timeout: i64, active_timeout: i64, conn_limit: usize, preordered_nodes: Vec) -> Self { + pub fn new(cmd_socket: zmq::Socket, name: String, id: PoolHandle, timeout: i64, extended_timeout: i64, active_timeout: i64, conn_limit: usize, preordered_nodes: Vec, number_read_nodes: u8) -> Self { let networker = Rc::new(RefCell::new(S::new(active_timeout, conn_limit, preordered_nodes))); PoolThread { - pool_sm: Some(PoolSM::new(networker.clone(), &name, id, timeout, extended_timeout)), + pool_sm: Some(PoolSM::new(networker.clone(), &name, id, timeout, extended_timeout, number_read_nodes)), events: VecDeque::new(), commander: Commander::new(cmd_socket), networker, @@ -604,7 +610,8 @@ fn _get_request_handler_with_ledger_status_sent>, pool_name: &str, timeout: i64, - extended_timeout: i64) -> IndyResult + extended_timeout: i64, + number_read_nodes: u8) -> IndyResult { let mut merkle = merkle_tree_factory::create(pool_name)?; @@ -621,7 +628,7 @@ fn _get_request_handler_with_ledger_status_sent = PoolSM::new(Rc::new(RefCell::new(MockNetworker::new(0, 0, vec![]))), "name", next_pool_handle(), 0, 0); + let _p: PoolSM = PoolSM::new(Rc::new(RefCell::new(MockNetworker::new(0, 0, vec![]))), "name", next_pool_handle(), 0, 0, NUMBER_READ_NODES); } #[test] @@ -812,7 +820,7 @@ mod tests { ProtocolVersion::set(2); _write_genesis_txns("pool_wrapper_check_cache_works"); - let p: PoolSM = PoolSM::new(Rc::new(RefCell::new(MockNetworker::new(0, 0, vec![]))), "pool_wrapper_check_cache_works", next_pool_handle(), 0, 0); + let p: PoolSM = PoolSM::new(Rc::new(RefCell::new(MockNetworker::new(0, 0, vec![]))), "pool_wrapper_check_cache_works", next_pool_handle(), 0, 0, NUMBER_READ_NODES); let cmd_id: CommandHandle = next_command_handle(); let p = p.handle_event(PoolEvent::CheckCache(cmd_id)); assert_match!(PoolState::GettingCatchupTarget(_), p.state); @@ -824,7 +832,7 @@ mod tests { pub fn pool_wrapper_check_cache_works_for_no_pool_created() { let p: PoolSM = PoolSM::new(Rc::new(RefCell::new(MockNetworker::new(0, 0, vec![]))), - "pool_wrapper_check_cache_works_for_no_pool_created", next_pool_handle(), 0, 0); + "pool_wrapper_check_cache_works_for_no_pool_created", next_pool_handle(), 0, 0, NUMBER_READ_NODES); let cmd_id: CommandHandle = next_command_handle(); let p = p.handle_event(PoolEvent::CheckCache(cmd_id)); assert_match!(PoolState::Terminated(_), p.state); @@ -832,7 +840,7 @@ mod tests { #[test] pub fn pool_wrapper_terminated_close_works() { - let p: PoolSM = PoolSM::new(Rc::new(RefCell::new(MockNetworker::new(0, 0, vec![]))), "pool_wrapper_terminated_close_works", next_pool_handle(), 0, 0); + let p: PoolSM = PoolSM::new(Rc::new(RefCell::new(MockNetworker::new(0, 0, vec![]))), "pool_wrapper_terminated_close_works", next_pool_handle(), 0, 0, NUMBER_READ_NODES); let cmd_id: CommandHandle = next_command_handle(); let p = p.handle_event(PoolEvent::CheckCache(cmd_id)); let cmd_id: CommandHandle = next_command_handle(); @@ -843,7 +851,7 @@ mod tests { #[test] pub fn pool_wrapper_terminated_refresh_works() { test::cleanup_pool("pool_wrapper_terminated_refresh_works"); - let p: PoolSM = PoolSM::new(Rc::new(RefCell::new(MockNetworker::new(0, 0, vec![]))), "pool_wrapper_terminated_refresh_works", next_pool_handle(), 0, 0); + let p: PoolSM = PoolSM::new(Rc::new(RefCell::new(MockNetworker::new(0, 0, vec![]))), "pool_wrapper_terminated_refresh_works", next_pool_handle(), 0, 0, NUMBER_READ_NODES); let cmd_id: CommandHandle = next_command_handle(); let p = p.handle_event(PoolEvent::CheckCache(cmd_id)); @@ -866,6 +874,7 @@ mod tests { }), timeout: 0, extended_timeout: 0, + number_read_nodes: NUMBER_READ_NODES, }; let p = p.handle_event(PoolEvent::Timeout("".to_string(), "".to_string())); @@ -882,7 +891,7 @@ mod tests { #[test] pub fn pool_wrapper_cloe_works_from_initialization() { - let p: PoolSM = PoolSM::new(Rc::new(RefCell::new(MockNetworker::new(0, 0, vec![]))), "pool_wrapper_cloe_works_from_initialization", next_pool_handle(), 0, 0); + let p: PoolSM = PoolSM::new(Rc::new(RefCell::new(MockNetworker::new(0, 0, vec![]))), "pool_wrapper_cloe_works_from_initialization", next_pool_handle(), 0, 0, NUMBER_READ_NODES); let cmd_id: CommandHandle = next_command_handle(); let p = p.handle_event(PoolEvent::Close(cmd_id)); assert_match!(PoolState::Closed(_), p.state); @@ -896,7 +905,7 @@ mod tests { _write_genesis_txns("pool_wrapper_close_works_from_getting_catchup_target"); let p: PoolSM = - PoolSM::new(Rc::new(RefCell::new(MockNetworker::new(0, 0, vec![]))), "pool_wrapper_close_works_from_getting_catchup_target", next_pool_handle(), 0, 0); + PoolSM::new(Rc::new(RefCell::new(MockNetworker::new(0, 0, vec![]))), "pool_wrapper_close_works_from_getting_catchup_target", next_pool_handle(), 0, 0, NUMBER_READ_NODES); let cmd_id: CommandHandle = next_command_handle(); let p = p.handle_event(PoolEvent::CheckCache(cmd_id)); let cmd_id: CommandHandle = next_command_handle(); @@ -914,7 +923,7 @@ mod tests { _write_genesis_txns("pool_wrapper_catchup_target_not_found_works"); let p: PoolSM = - PoolSM::new(Rc::new(RefCell::new(MockNetworker::new(0, 0, vec![]))), "pool_wrapper_catchup_target_not_found_works", next_pool_handle(), 0, 0); + PoolSM::new(Rc::new(RefCell::new(MockNetworker::new(0, 0, vec![]))), "pool_wrapper_catchup_target_not_found_works", next_pool_handle(), 0, 0, NUMBER_READ_NODES); let cmd_id: CommandHandle = next_command_handle(); let p = p.handle_event(PoolEvent::CheckCache(cmd_id)); let p = p.handle_event(PoolEvent::CatchupTargetNotFound(err_msg(IndyErrorKind::PoolTimeout, "Pool timeout"))); @@ -931,7 +940,7 @@ mod tests { _write_genesis_txns("pool_wrapper_getting_catchup_target_synced_works"); let p: PoolSM = - PoolSM::new(Rc::new(RefCell::new(MockNetworker::new(0, 0, vec![]))), "pool_wrapper_getting_catchup_target_synced_works", next_pool_handle(), 0, 0); + PoolSM::new(Rc::new(RefCell::new(MockNetworker::new(0, 0, vec![]))), "pool_wrapper_getting_catchup_target_synced_works", next_pool_handle(), 0, 0, NUMBER_READ_NODES); let cmd_id: CommandHandle = next_command_handle(); let p = p.handle_event(PoolEvent::CheckCache(cmd_id)); let p = p.handle_event(PoolEvent::Synced(MerkleTree::from_vec(vec![]).unwrap())); @@ -954,7 +963,7 @@ mod tests { "pool_wrapper_getting_catchup_target_synced_works_for_node_state_error", next_pool_handle(), 0, - 0); + 0, NUMBER_READ_NODES); let cmd_id: CommandHandle = next_command_handle(); let p = p.handle_event(PoolEvent::CheckCache(cmd_id)); ProtocolVersion::set(1); @@ -981,7 +990,7 @@ mod tests { "pool_wrapper_getting_catchup_target_catchup_target_found_works", next_pool_handle(), 0, - 0); + 0, NUMBER_READ_NODES); let cmd_id: CommandHandle = next_command_handle(); let p = p.handle_event(PoolEvent::CheckCache(cmd_id)); let p = p.handle_event(PoolEvent::CatchupTargetFound(mt.root_hash().to_vec(), mt.count, mt)); @@ -1005,7 +1014,7 @@ mod tests { "pool_wrapper_getting_catchup_target_catchup_target_found_works_for_node_state_error", next_pool_handle(), 0, - 0); + 0, NUMBER_READ_NODES); let cmd_id: CommandHandle = next_command_handle(); let p = p.handle_event(PoolEvent::CheckCache(cmd_id)); ProtocolVersion::set(1); @@ -1033,7 +1042,7 @@ mod tests { "pool_wrapper_sync_catchup_close_works", next_pool_handle(), 0, - 0); + 0, NUMBER_READ_NODES); let cmd_id: CommandHandle = next_command_handle(); let p = p.handle_event(PoolEvent::CheckCache(cmd_id)); let p = p.handle_event(PoolEvent::CatchupTargetFound(mt.root_hash().to_vec(), mt.count, mt)); @@ -1061,7 +1070,7 @@ mod tests { "pool_wrapper_sync_catchup_synced_works", next_pool_handle(), 0, - 0); + 0, NUMBER_READ_NODES); let cmd_id: CommandHandle = next_command_handle(); let p = p.handle_event(PoolEvent::CheckCache(cmd_id)); let p = p.handle_event(PoolEvent::CatchupTargetFound(mt.root_hash().to_vec(), mt.count, mt)); @@ -1088,7 +1097,7 @@ mod tests { "pool_wrapper_sync_catchup_synced_works_for_node_state_error", next_pool_handle(), 0, - 0); + 0, NUMBER_READ_NODES); let cmd_id: CommandHandle = next_command_handle(); let p = p.handle_event(PoolEvent::CheckCache(cmd_id)); let p = p.handle_event(PoolEvent::CatchupTargetFound(mt.root_hash().to_vec(), mt.count, mt)); @@ -1120,7 +1129,7 @@ mod tests { "pool_wrapper_active_send_request_works", next_pool_handle(), 0, - 0); + 0, NUMBER_READ_NODES); let cmd_id: CommandHandle = next_command_handle(); let p = p.handle_event(PoolEvent::CheckCache(cmd_id)); let p = p.handle_event(PoolEvent::Synced(MerkleTree::from_vec(vec![]).unwrap())); @@ -1160,7 +1169,7 @@ mod tests { "pool_wrapper_active_send_request_works_for_no_req_id", next_pool_handle(), 0, - 0); + 0, NUMBER_READ_NODES); let cmd_id: CommandHandle = next_command_handle(); let p = p.handle_event(PoolEvent::CheckCache(cmd_id)); let p = p.handle_event(PoolEvent::Synced(MerkleTree::from_vec(vec![]).unwrap())); @@ -1213,7 +1222,7 @@ mod tests { "pool_wrapper_active_node_reply_works", next_pool_handle(), 0, - 0); + 0, NUMBER_READ_NODES); let cmd_id: CommandHandle = next_command_handle(); let p = p.handle_event(PoolEvent::CheckCache(cmd_id)); let p = p.handle_event(PoolEvent::Synced(MerkleTree::from_vec(vec![]).unwrap())); @@ -1251,7 +1260,7 @@ mod tests { 0, vec![]))), "pool_wrapper_sends_requests_to_two_nodes", - next_pool_handle(), 0, 0); + next_pool_handle(), 0, 0, NUMBER_READ_NODES); let cmd_id: CommandHandle = next_command_handle(); let p = p.handle_event(PoolEvent::CheckCache(cmd_id)); let p = p.handle_event(PoolEvent::Synced(MerkleTree::from_vec(vec![]).unwrap())); @@ -1303,7 +1312,7 @@ mod tests { "pool_wrapper_active_node_reply_works_for_no_request", next_pool_handle(), 0, - 0); + 0, NUMBER_READ_NODES); let cmd_id: CommandHandle = next_command_handle(); let p = p.handle_event(PoolEvent::CheckCache(cmd_id)); let p = p.handle_event(PoolEvent::Synced(MerkleTree::from_vec(vec![]).unwrap())); @@ -1346,7 +1355,7 @@ mod tests { "pool_wrapper_active_node_reply_works_for_invalid_reply", next_pool_handle(), 0, - 0); + 0, NUMBER_READ_NODES); let cmd_id: CommandHandle = next_command_handle(); let p = p.handle_event(PoolEvent::CheckCache(cmd_id)); let p = p.handle_event(PoolEvent::Synced(MerkleTree::from_vec(vec![]).unwrap())); diff --git a/libindy/src/services/pool/request_handler.rs b/libindy/src/services/pool/request_handler.rs index 1fb8f18949..e40a36b9c2 100644 --- a/libindy/src/services/pool/request_handler.rs +++ b/libindy/src/services/pool/request_handler.rs @@ -43,6 +43,7 @@ struct RequestSM { pool_name: String, timeout: i64, extended_timeout: i64, + number_read_nodes: u8, state: RequestState, } @@ -71,8 +72,8 @@ impl RequestSM { f: usize, cmd_ids: &[CommandHandle], nodes: &HashMap>, - pool_name: &str, timeout: i64, extended_timeout: i64) -> Self { - let generator : Generator = Generator::from_bytes(&DEFAULT_GENERATOR.from_base58().unwrap()).unwrap(); + pool_name: &str, timeout: i64, extended_timeout: i64, number_read_nodes: u8) -> Self { + let generator: Generator = Generator::from_bytes(&DEFAULT_GENERATOR.from_base58().unwrap()).unwrap(); RequestSM { f, cmd_ids: cmd_ids.to_owned(), @@ -81,6 +82,7 @@ impl RequestSM { pool_name: pool_name.to_string(), timeout, extended_timeout, + number_read_nodes, state: RequestState::Start(StartState { networker }), @@ -94,6 +96,7 @@ impl RequestSM { pool_name: String, timeout: i64, extended_timeout: i64, + number_read_nodes: u8, state: RequestState) -> Self { RequestSM { f, @@ -103,6 +106,7 @@ impl RequestSM { pool_name, timeout, extended_timeout, + number_read_nodes, state, } } @@ -244,7 +248,7 @@ impl Hash for NodeResponse { impl RequestSM { fn handle_event(self, re: RequestEvent) -> (Self, Option) { - let RequestSM { state, f, cmd_ids, nodes, generator, pool_name, timeout, extended_timeout } = self; + let RequestSM { state, f, cmd_ids, nodes, generator, pool_name, timeout, extended_timeout, number_read_nodes } = self; let (state, event) = match state { RequestState::Start(state) => { match re { @@ -274,7 +278,11 @@ impl RequestSM { } RequestEvent::CustomSingleRequest(msg, req_id, sp_key, timestamps) => { state.networker.borrow_mut().process_event(Some(NetworkerEvent::SendOneRequest(msg.clone(), req_id.clone(), timeout))); - state.networker.borrow_mut().process_event(Some(NetworkerEvent::Resend(req_id, timeout))); + + for _ in 0..number_read_nodes - 1 { + state.networker.borrow_mut().process_event(Some(NetworkerEvent::Resend(req_id.clone(), timeout))); + } + (RequestState::Single((state, sp_key, timestamps).into()), None) } RequestEvent::CustomFullRequest(msg, req_id, local_timeout, nodes_to_send) => { @@ -498,7 +506,7 @@ impl RequestSM { } RequestState::Finish(state) => (RequestState::Finish(state), None) }; - (RequestSM::step(f, cmd_ids, nodes, generator, pool_name, timeout, extended_timeout, state), event) + (RequestSM::step(f, cmd_ids, nodes, generator, pool_name, timeout, extended_timeout, number_read_nodes, state), event) } fn is_terminal(&self) -> bool { @@ -601,7 +609,7 @@ impl RequestSM { } pub trait RequestHandler { - fn new(networker: Rc>, f: usize, cmd_ids: &[CommandHandle], nodes: &HashMap>, pool_name: &str, timeout: i64, extended_timeout: i64) -> Self; + fn new(networker: Rc>, f: usize, cmd_ids: &[CommandHandle], nodes: &HashMap>, pool_name: &str, timeout: i64, extended_timeout: i64, number_read_nodes: u8) -> Self; fn process_event(&mut self, ore: Option) -> Option; fn is_terminal(&self) -> bool; } @@ -611,9 +619,9 @@ pub struct RequestHandlerImpl { } impl RequestHandler for RequestHandlerImpl { - fn new(networker: Rc>, f: usize, cmd_ids: &[CommandHandle], nodes: &HashMap>, pool_name: &str, timeout: i64, extended_timeout: i64) -> Self { + fn new(networker: Rc>, f: usize, cmd_ids: &[CommandHandle], nodes: &HashMap>, pool_name: &str, timeout: i64, extended_timeout: i64, number_read_nodes: u8) -> Self { RequestHandlerImpl { - request_wrapper: Some(RequestSM::new(networker, f, cmd_ids, nodes, pool_name, timeout, extended_timeout)), + request_wrapper: Some(RequestSM::new(networker, f, cmd_ids, nodes, pool_name, timeout, extended_timeout, number_read_nodes)), } } @@ -832,6 +840,7 @@ pub mod tests { use services::pool::types::{ConsistencyProof, LedgerStatus, Reply, ReplyResultV1, ReplyTxnV1, ReplyV1, Response, ResponseMetadata, ResponseV1}; use utils::test; use utils::test::test_pool_create_poolfile; + use domain::pool::NUMBER_READ_NODES; use super::*; use std::io::Write; @@ -850,7 +859,7 @@ pub mod tests { pub struct MockRequestHandler {} impl RequestHandler for MockRequestHandler { - fn new(_networker: Rc>, _f: usize, _cmd_ids: &[CommandHandle], _nodes: &HashMap>, _pool_name: &str, _timeout: i64, _extended_timeout: i64) -> Self { + fn new(_networker: Rc>, _f: usize, _cmd_ids: &[CommandHandle], _nodes: &HashMap>, _pool_name: &str, _timeout: i64, _extended_timeout: i64, _number_read_nodes: u8) -> Self { MockRequestHandler {} } @@ -930,7 +939,8 @@ pub mod tests { &nodes, pool_name, 0, - 0) + 0, + NUMBER_READ_NODES) } // required because of dumping txns to cache diff --git a/libindy/tests/pool.rs b/libindy/tests/pool.rs index be27ea8931..3969a60958 100644 --- a/libindy/tests/pool.rs +++ b/libindy/tests/pool.rs @@ -527,6 +527,30 @@ mod medium_cases { utils::tear_down("open_pool_ledger_works_for_wrong_ips"); } + + #[test] + #[cfg(feature = "local_nodes_pool")] + fn open_pool_ledger_works_for_config_read_nodes_count() { + utils::setup("open_pool_ledger_works_for_config_read_nodes_count"); + + pool::set_protocol_version(PROTOCOL_VERSION).unwrap(); + + let pool_name = "open_pool_ledger_works_for_config_read_nodes_count"; + let config = json!({"read_nodes_count": 3}).to_string(); + + let txn_file_path = pool::create_genesis_txn_file_for_test_pool(pool_name, None, None); + let pool_config = pool::pool_config_json(txn_file_path.as_path()); + pool::create_pool_ledger_config(pool_name, Some(pool_config.as_str())).unwrap(); + + let pool_handle = pool::open_pool_ledger(pool_name, Some(&config)).unwrap(); + + let request = ledger::build_get_nym_request(None, DID_TRUSTEE).unwrap(); + let _ = ledger::submit_request(pool_handle, &request).unwrap(); + + pool::close(pool_handle).unwrap(); + + utils::tear_down("open_pool_ledger_works_for_config_read_nodes_count"); + } } mod close { diff --git a/wrappers/ios/libindy-pod/Indy/Wrapper/IndyPool.h b/wrappers/ios/libindy-pod/Indy/Wrapper/IndyPool.h index 78c862aaf4..882adc83dd 100644 --- a/wrappers/ios/libindy-pod/Indy/Wrapper/IndyPool.h +++ b/wrappers/ios/libindy-pod/Indy/Wrapper/IndyPool.h @@ -45,6 +45,7 @@ "preordered_nodes": array (optional), Names of nodes which will have a priority during request sending: [ "name_of_1st_prior_node", "name_of_2nd_prior_node", .... ] Note: Not specified nodes will be placed in a random way. + "number_read_nodes": int (optional) - the number of nodes to send read requests (2 by default) } @endcode diff --git a/wrappers/java/src/main/java/org/hyperledger/indy/sdk/pool/Pool.java b/wrappers/java/src/main/java/org/hyperledger/indy/sdk/pool/Pool.java index 3bb3bef108..4a625af2b1 100644 --- a/wrappers/java/src/main/java/org/hyperledger/indy/sdk/pool/Pool.java +++ b/wrappers/java/src/main/java/org/hyperledger/indy/sdk/pool/Pool.java @@ -118,6 +118,7 @@ public static CompletableFuture createPoolLedgerConfig( * "preordered_nodes": array[string] - (optional), names of nodes which will have a priority during request sending: * [ "name_of_1st_prior_node", "name_of_2nd_prior_node", .... ] * Note: Not specified nodes will be placed in a random way. + * "number_read_nodes": int (optional) - the number of nodes to send read requests (2 by default) * } * * @return A future that resolves to an opened Pool instance. diff --git a/wrappers/nodejs/README.md b/wrappers/nodejs/README.md index 77921579d1..60b172b5a2 100644 --- a/wrappers/nodejs/README.md +++ b/wrappers/nodejs/README.md @@ -2681,6 +2681,7 @@ if NULL, then default config will be used. Example: "preordered_nodes": array - (optional), names of nodes which will have a priority during request sending: ["name_of_1st_prior_node", "name_of_2nd_prior_node", .... ] Note: Not specified nodes will be placed in a random way. + "number_read_nodes": int (optional) - the number of nodes to send read requests (2 by default) } ```` diff --git a/wrappers/python/indy/pool.py b/wrappers/python/indy/pool.py index 29bf342aee..4b03a1e271 100755 --- a/wrappers/python/indy/pool.py +++ b/wrappers/python/indy/pool.py @@ -60,6 +60,7 @@ async def open_pool_ledger(config_name: str, "preordered_nodes": array - (optional), names of nodes which will have a priority during request sending: ["name_of_1st_prior_node", "name_of_2nd_prior_node", .... ] Note: Not specified nodes will be placed in a random way. + "number_read_nodes": int (optional) - the number of nodes to send read requests (2 by default) } :return: Handle to opened pool to use in methods that require pool connection. """ diff --git a/wrappers/rust/src/pool.rs b/wrappers/rust/src/pool.rs index 39ec5886a9..f451424536 100644 --- a/wrappers/rust/src/pool.rs +++ b/wrappers/rust/src/pool.rs @@ -47,12 +47,12 @@ fn _create_pool_ledger_config(command_handle: CommandHandle, pool_name: &str, po /// * `config` (optional)- Runtime pool configuration json. /// if NULL, then default config will be used. Example: /// { -/// "refresh_on_open": bool (optional), Forces pool ledger to be refreshed immediately after opening. -/// Defaults to true. -/// "auto_refresh_time": int (optional), After this time in minutes pool ledger will be automatically refreshed. -/// Use 0 to disable automatic refresh. Defaults to 24*60. -/// "network_timeout": int (optional), Network timeout for communication with nodes in milliseconds. -/// Defaults to 20000. +/// "timeout": int (optional), timeout for network request (in sec). +/// "extended_timeout": int (optional), extended timeout for network request (in sec). +/// "preordered_nodes": array - (optional), names of nodes which will have a priority during request sending: +/// ["name_of_1st_prior_node", "name_of_2nd_prior_node", .... ] +/// Note: Not specified nodes will be placed in a random way. +/// "number_read_nodes": int (optional) - the number of nodes to send read requests (2 by default) /// } /// /// # Returns From 2967bae9466e4d3cd16cf190c78698189f388c86 Mon Sep 17 00:00:00 2001 From: "artem.ivanov" Date: Wed, 14 Aug 2019 16:05:08 +0300 Subject: [PATCH 207/320] Updated Config.md document Signed-off-by: artem.ivanov --- docs/configuration.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/configuration.md b/docs/configuration.md index 0500d51911..b125a8036d 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -44,6 +44,7 @@ This function accepts a `config` parameter that defines the behavior of the clie "preordered_nodes": array - (optional), names of nodes which will have priority during request sending. This can be useful if a user prefers querying specific nodes. Note: Nodes not specified will be placed randomly. + "number_read_nodes": int (optional) - the number of nodes to send read requests (2 by default) } ``` From 140601040a8f987a00b2ac5a63e024872344e046 Mon Sep 17 00:00:00 2001 From: "artem.ivanov" Date: Wed, 14 Aug 2019 16:39:01 +0300 Subject: [PATCH 208/320] IS-1351: fixed field name Signed-off-by: artem.ivanov --- libindy/src/commands/ledger.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libindy/src/commands/ledger.rs b/libindy/src/commands/ledger.rs index 47eb805edb..501629b8c7 100644 --- a/libindy/src/commands/ledger.rs +++ b/libindy/src/commands/ledger.rs @@ -1164,7 +1164,7 @@ impl LedgerCommandExecutor { let mut request: serde_json::Value = serde_json::from_str(request_json) .map_err(|err| IndyError::from_msg(IndyErrorKind::InvalidStructure, format!("Cannot deserialize request: {:?}", err)))?; - request["taa_acceptance"] = json!(Some(self.ledger_service.prepare_acceptance_data(text, version, taa_digest, acc_mech_type, time)?)); + request["taaAcceptance"] = json!(Some(self.ledger_service.prepare_acceptance_data(text, version, taa_digest, acc_mech_type, time)?)); let res: String = serde_json::to_string(&request) .to_indy(IndyErrorKind::InvalidState, "Can't serialize request after adding author agreement acceptance data")?; From ff6a77464971837d84803d199eca9c2869e57e83 Mon Sep 17 00:00:00 2001 From: Axel Nennker Date: Wed, 14 Aug 2019 16:33:52 +0200 Subject: [PATCH 209/320] split optimization Signed-off-by: Axel Nennker --- libindy/src/domain/anoncreds/credential_definition.rs | 2 +- libindy/src/domain/anoncreds/schema.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libindy/src/domain/anoncreds/credential_definition.rs b/libindy/src/domain/anoncreds/credential_definition.rs index a631a907f1..f60288dc72 100644 --- a/libindy/src/domain/anoncreds/credential_definition.rs +++ b/libindy/src/domain/anoncreds/credential_definition.rs @@ -83,7 +83,7 @@ impl CredentialDefinition { } pub fn issuer_did(cred_def_id: &str) -> Option { - cred_def_id.split(':').collect::>().get(0).and_then(|s| Some(s.to_string())) + cred_def_id.split(':').next().map(String::from) } } diff --git a/libindy/src/domain/anoncreds/schema.rs b/libindy/src/domain/anoncreds/schema.rs index 860bbad071..cc7497ff1f 100644 --- a/libindy/src/domain/anoncreds/schema.rs +++ b/libindy/src/domain/anoncreds/schema.rs @@ -30,7 +30,7 @@ impl Schema { } pub fn issuer_did(schema_id: &str) -> Option { - schema_id.split(':').collect::>().get(0).and_then(|s| Some(s.to_string())) + schema_id.split(':').next().map(String::from) } } From 10c2d4025fdf4d876698ca8dddb18ad66520f766 Mon Sep 17 00:00:00 2001 From: Axel Nennker Date: Wed, 14 Aug 2019 16:34:23 +0200 Subject: [PATCH 210/320] additional functions regarding verkey Signed-off-by: Axel Nennker --- libindy/src/services/crypto/mod.rs | 65 ++++------------------ libindy/src/utils/crypto/verkey_builder.rs | 19 +++++++ 2 files changed, 29 insertions(+), 55 deletions(-) diff --git a/libindy/src/services/crypto/mod.rs b/libindy/src/services/crypto/mod.rs index 88a05451d4..8f6be0d9d7 100644 --- a/libindy/src/services/crypto/mod.rs +++ b/libindy/src/services/crypto/mod.rs @@ -12,7 +12,7 @@ use utils::crypto::ed25519_box; use utils::crypto::chacha20poly1305_ietf; use utils::crypto::chacha20poly1305_ietf::{ gen_nonce_and_encrypt_detached}; use utils::crypto::ed25519_sign; -use utils::crypto::verkey_builder::build_full_verkey; +use utils::crypto::verkey_builder::{build_full_verkey, split_verkey, verkey_get_cryptoname}; use self::ed25519::ED25519CryptoType; use self::hex::FromHex; @@ -142,12 +142,7 @@ impl CryptoService { pub fn sign(&self, my_key: &Key, doc: &[u8]) -> IndyResult> { trace!("sign >>> my_key: {:?}, doc: {:?}", my_key, doc); - let crypto_type_name = if my_key.verkey.contains(':') { - let splits: Vec<&str> = my_key.verkey.split(':').collect(); - splits[1] - } else { - DEFAULT_CRYPTO_TYPE - }; + let crypto_type_name = verkey_get_cryptoname(&my_key.verkey); if !self.crypto_types.contains_key(crypto_type_name) { return Err(err_msg(IndyErrorKind::UnknownCrypto, format!("Trying to sign message with unknown crypto: {}", crypto_type_name))); @@ -166,12 +161,7 @@ impl CryptoService { pub fn verify(&self, their_vk: &str, msg: &[u8], signature: &[u8]) -> IndyResult { trace!("verify >>> their_vk: {:?}, msg: {:?}, signature: {:?}", their_vk, msg, signature); - let (their_vk, crypto_type_name) = if their_vk.contains(':') { - let splits: Vec<&str> = their_vk.split(':').collect(); - (splits[0], splits[1]) - } else { - (their_vk, DEFAULT_CRYPTO_TYPE) - }; + let (their_vk, crypto_type_name) = split_verkey(their_vk); if !self.crypto_types.contains_key(crypto_type_name) { return Err(err_msg(IndyErrorKind::UnknownCrypto, format!("Trying to verify message with unknown crypto: {}", crypto_type_name))); @@ -208,19 +198,9 @@ impl CryptoService { pub fn crypto_box(&self, my_key: &Key, their_vk: &str, doc: &[u8]) -> IndyResult<(Vec, Vec)> { trace!("crypto_box >>> my_key: {:?}, their_vk: {:?}, doc: {:?}", my_key, their_vk, doc); - let (_my_vk, crypto_type_name) = if my_key.verkey.contains(':') { - let splits: Vec<&str> = my_key.verkey.split(':').collect(); - (splits[0], splits[1]) - } else { - (my_key.verkey.as_str(), DEFAULT_CRYPTO_TYPE) - }; + let crypto_type_name = verkey_get_cryptoname(&my_key.verkey); - let (their_vk, their_crypto_type_name) = if their_vk.contains(':') { - let splits: Vec<&str> = their_vk.split(':').collect(); - (splits[0], splits[1]) - } else { - (their_vk, DEFAULT_CRYPTO_TYPE) - }; + let (their_vk, their_crypto_type_name) = split_verkey(their_vk); if !self.crypto_types.contains_key(&crypto_type_name) { return Err(err_msg(IndyErrorKind::UnknownCrypto, format!("Trying to crypto_box message with unknown crypto: {}", crypto_type_name))); @@ -251,19 +231,9 @@ impl CryptoService { pub fn crypto_box_open(&self, my_key: &Key, their_vk: &str, doc: &[u8], nonce: &[u8]) -> IndyResult> { trace!("crypto_box_open >>> my_key: {:?}, their_vk: {:?}, doc: {:?}, nonce: {:?}", my_key, their_vk, doc, nonce); - let (_my_vk, crypto_type_name) = if my_key.verkey.contains(':') { - let splits: Vec<&str> = my_key.verkey.split(':').collect(); - (splits[0], splits[1]) - } else { - (my_key.verkey.as_str(), DEFAULT_CRYPTO_TYPE) - }; + let crypto_type_name = verkey_get_cryptoname(&my_key.verkey); - let (their_vk, their_crypto_type_name) = if their_vk.contains(':') { - let splits: Vec<&str> = their_vk.split(':').collect(); - (splits[0], splits[1]) - } else { - (their_vk, DEFAULT_CRYPTO_TYPE) - }; + let (their_vk, their_crypto_type_name) = split_verkey(their_vk); if !self.crypto_types.contains_key(&crypto_type_name) { return Err(err_msg(IndyErrorKind::UnknownCrypto, @@ -294,12 +264,7 @@ impl CryptoService { pub fn crypto_box_seal(&self, their_vk: &str, doc: &[u8]) -> IndyResult> { trace!("crypto_box_seal >>> their_vk: {:?}, doc: {:?}", their_vk, doc); - let (their_vk, crypto_type_name) = if their_vk.contains(':') { - let splits: Vec<&str> = their_vk.split(':').collect(); - (splits[0], splits[1]) - } else { - (their_vk, DEFAULT_CRYPTO_TYPE) - }; + let (their_vk, crypto_type_name) = split_verkey(their_vk); if !self.crypto_types.contains_key(&crypto_type_name) { return Err(err_msg(IndyErrorKind::UnknownCrypto, format!("Trying to encrypt sealed message with unknown crypto: {}", crypto_type_name))); @@ -319,12 +284,7 @@ impl CryptoService { pub fn crypto_box_seal_open(&self, my_key: &Key, doc: &[u8]) -> IndyResult> { trace!("crypto_box_seal_open >>> my_key: {:?}, doc: {:?}", my_key, doc); - let (my_vk, crypto_type_name) = if my_key.verkey.contains(':') { - let splits: Vec<&str> = my_key.verkey.split(':').collect(); - (splits[0], splits[1]) - } else { - (my_key.verkey.as_str(), DEFAULT_CRYPTO_TYPE) - }; + let (my_vk, crypto_type_name) = split_verkey(&my_key.verkey); if !self.crypto_types.contains_key(&crypto_type_name) { return Err(err_msg(IndyErrorKind::UnknownCrypto, @@ -387,12 +347,7 @@ impl CryptoService { pub fn validate_key(&self, vk: &str) -> IndyResult<()> { trace!("validate_key >>> vk: {:?}", vk); - let (vk, crypto_type_name) = if vk.contains(':') { - let splits: Vec<&str> = vk.split(':').collect(); - (splits[0], splits[1]) - } else { - (vk, DEFAULT_CRYPTO_TYPE) - }; + let (vk, crypto_type_name) = split_verkey(vk); if !self.crypto_types.contains_key(&crypto_type_name) { return Err(err_msg(IndyErrorKind::UnknownCrypto, format!("Trying to use key with unknown crypto: {}", crypto_type_name))); diff --git a/libindy/src/utils/crypto/verkey_builder.rs b/libindy/src/utils/crypto/verkey_builder.rs index 779ac3069e..c0ae85b972 100644 --- a/libindy/src/utils/crypto/verkey_builder.rs +++ b/libindy/src/utils/crypto/verkey_builder.rs @@ -1,5 +1,6 @@ use errors::prelude::*; use rust_base58::{FromBase58, ToBase58}; +use services::crypto::DEFAULT_CRYPTO_TYPE; pub fn build_full_verkey(dest: &str, verkey: Option<&str>) -> Result { @@ -32,3 +33,21 @@ pub fn build_full_verkey(dest: &str, verkey: Option<&str>) -> Result (&str, &str) { + if verkey.contains(':') { + let splits: Vec<&str> = verkey.split(':').collect(); + (splits[0], splits[1]) + } else { + (verkey, DEFAULT_CRYPTO_TYPE) + } +} + +pub fn verkey_get_cryptoname(verkey: &str) -> &str { + if verkey.contains(':') { + let splits: Vec<&str> = verkey.split(':').collect(); + splits[1] + } else { + DEFAULT_CRYPTO_TYPE + } +} \ No newline at end of file From c89f19ff0f99a59b666fa2ff9014a8346d6d2ccb Mon Sep 17 00:00:00 2001 From: Axel Nennker Date: Wed, 14 Aug 2019 19:55:48 +0200 Subject: [PATCH 211/320] push_str is fastest, also with_capacity Signed-off-by: Axel Nennker --- libindy/src/services/wallet/storage/default/query.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/libindy/src/services/wallet/storage/default/query.rs b/libindy/src/services/wallet/storage/default/query.rs index 9f9f6777f3..d7fd5bad5d 100644 --- a/libindy/src/services/wallet/storage/default/query.rs +++ b/libindy/src/services/wallet/storage/default/query.rs @@ -10,12 +10,17 @@ pub fn wql_to_sql<'a>(class: &'a Vec, op: &'a Operator, _options: Option<&st let mut arguments: Vec<&ToSql> = Vec::new(); arguments.push(class); let clause_string = operator_to_sql(op, &mut arguments)?; - let mut query_string = "SELECT i.id, i.name, i.value, i.key, i.type FROM items as i WHERE i.type = ?".to_string(); + const BASE: &str = "SELECT i.id, i.name, i.value, i.key, i.type FROM items as i WHERE i.type = ?"; if !clause_string.is_empty() { + let mut query_string = String::with_capacity(BASE.len() + 5 + clause_string.len()); + query_string.push_str(BASE); query_string.push_str(" AND "); query_string.push_str(&clause_string); + Ok((query_string, arguments)) + } else { + Ok((BASE.to_string(), arguments)) } - Ok((query_string, arguments)) + } From b8fe5ba7040e371618e381f7b5cfe3a51716c4ab Mon Sep 17 00:00:00 2001 From: "artem.ivanov" Date: Thu, 15 Aug 2019 07:54:55 +0300 Subject: [PATCH 212/320] Fixed affected Libvcx test Signed-off-by: artem.ivanov --- vcx/libvcx/src/credential_def.rs | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/vcx/libvcx/src/credential_def.rs b/vcx/libvcx/src/credential_def.rs index da57914675..e9821b8a38 100644 --- a/vcx/libvcx/src/credential_def.rs +++ b/vcx/libvcx/src/credential_def.rs @@ -521,14 +521,12 @@ pub mod tests { "tag_1".to_string(), r#"{"support_revocation":false}"#.to_string()).unwrap(); - let rc = create_and_publish_credentialdef("1".to_string(), - "name".to_string(), - my_did, - schema_id, - "tag_1".to_string(), - r#"{"support_revocation":false}"#.to_string()); - - assert_eq!(rc.unwrap_err().kind(), VcxErrorKind::CredDefAlreadyCreated); + create_and_publish_credentialdef("1".to_string(), + "name".to_string(), + my_did, + schema_id, + "tag_1".to_string(), + r#"{"support_revocation":false}"#.to_string()).unwrap(); } #[test] From f0c07710f0eb589e58916e0fca422d644f5013cd Mon Sep 17 00:00:00 2001 From: "artem.ivanov" Date: Thu, 15 Aug 2019 08:16:04 +0300 Subject: [PATCH 213/320] Update libindy/src/commands/ledger.rs Signed-off-by: artem.ivanov Co-Authored-By: Sergey Minaev --- libindy/src/commands/ledger.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libindy/src/commands/ledger.rs b/libindy/src/commands/ledger.rs index 501629b8c7..00dadbc84d 100644 --- a/libindy/src/commands/ledger.rs +++ b/libindy/src/commands/ledger.rs @@ -1164,7 +1164,7 @@ impl LedgerCommandExecutor { let mut request: serde_json::Value = serde_json::from_str(request_json) .map_err(|err| IndyError::from_msg(IndyErrorKind::InvalidStructure, format!("Cannot deserialize request: {:?}", err)))?; - request["taaAcceptance"] = json!(Some(self.ledger_service.prepare_acceptance_data(text, version, taa_digest, acc_mech_type, time)?)); + request["taaAcceptance"] = json!(self.ledger_service.prepare_acceptance_data(text, version, taa_digest, acc_mech_type, time)?); let res: String = serde_json::to_string(&request) .to_indy(IndyErrorKind::InvalidState, "Can't serialize request after adding author agreement acceptance data")?; From 0d350931c545d8cc11801d56459d489d936cf79e Mon Sep 17 00:00:00 2001 From: "artem.ivanov" Date: Thu, 15 Aug 2019 08:28:56 +0300 Subject: [PATCH 214/320] Restored removed parts Signed-off-by: artem.ivanov --- Jenkinsfile.ci | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Jenkinsfile.ci b/Jenkinsfile.ci index f009d66e8c..c9ba03df53 100644 --- a/Jenkinsfile.ci +++ b/Jenkinsfile.ci @@ -484,6 +484,7 @@ def linuxLibindyBuild(file, env_name, network_name) { sh ''' cd libindy RUST_BACKTRACE=1 cargo test -j 1 --no-run --features sodium_static + RUST_BACKTRACE=1 RUST_LOG=indy::=debug,zmq=trace RUST_TEST_THREADS=1 TEST_POOL_IP=10.0.0.2 cargo test --features sodium_static ''' } @@ -492,6 +493,7 @@ def linuxLibindyBuild(file, env_name, network_name) { sh ''' cd libnullpay LIBRARY_PATH=./ RUST_BACKTRACE=1 cargo test --no-run + LD_LIBRARY_PATH=./:${LD_LIBRARY_PATH} RUST_BACKTRACE=1 RUST_LOG=indy::=debug,zmq=trace RUST_TEST_THREADS=1 TEST_POOL_IP=10.0.0.2 cargo test ''' } } @@ -694,6 +696,7 @@ def linuxCLITesting(env_name, network_name, testEnv) { cd cli LIBRARY_PATH=./ RUST_BACKTRACE=1 cargo build --features fatal_warnings LIBRARY_PATH=./ RUST_BACKTRACE=1 cargo test --features "nullpay_plugin" --no-run + LD_LIBRARY_PATH=./:${LD_LIBRARY_PATH} RUST_BACKTRACE=1 RUST_LOG=indy::=debug,zmq=trace RUST_TEST_THREADS=1 TEST_POOL_IP=10.0.0.2 cargo test --features "nullpay_plugin" ''' } } From 532c1bbfa78b7d7894a80c33e68666292ec40817 Mon Sep 17 00:00:00 2001 From: "artem.ivanov" Date: Thu, 15 Aug 2019 11:55:21 +0300 Subject: [PATCH 215/320] Liibndy tests refactoring Signed-off-by: artem.ivanov --- libindy/tests/crypto.rs | 387 ++++++------------- libindy/tests/payments.rs | 686 ++++++++++------------------------ libindy/tests/utils/did.rs | 19 +- libindy/tests/utils/mod.rs | 120 ++++++ libindy/tests/utils/wallet.rs | 10 + 5 files changed, 466 insertions(+), 756 deletions(-) diff --git a/libindy/tests/crypto.rs b/libindy/tests/crypto.rs index 0894e7bed8..04fac33da5 100644 --- a/libindy/tests/crypto.rs +++ b/libindy/tests/crypto.rs @@ -32,6 +32,7 @@ mod utils; use utils::{wallet, crypto, did}; use utils::constants::*; +use utils::Setup; use self::indy::ErrorCode; @@ -40,12 +41,6 @@ use api::INVALID_WALLET_HANDLE; pub const ENCRYPTED_MESSAGE: &'static [u8; 45] = &[187, 227, 10, 29, 46, 178, 12, 179, 197, 69, 171, 70, 228, 204, 52, 22, 199, 54, 62, 13, 115, 5, 216, 66, 20, 131, 121, 29, 251, 224, 253, 201, 75, 73, 225, 237, 219, 133, 35, 217, 131, 135, 232, 129, 32]; pub const SIGNATURE: &'static [u8; 64] = &[169, 215, 8, 225, 7, 107, 110, 9, 193, 162, 202, 214, 162, 66, 238, 211, 63, 209, 12, 196, 8, 211, 55, 27, 120, 94, 204, 147, 53, 104, 103, 61, 60, 249, 237, 127, 103, 46, 220, 223, 10, 95, 75, 53, 245, 210, 241, 151, 191, 41, 48, 30, 9, 16, 78, 252, 157, 206, 210, 145, 125, 133, 109, 11]; -fn setup_with_key(name: &str) -> (i32, String, String) { - let (wallet_handle, wallet_config) = utils::setup_with_wallet(name); - let verkey = crypto::create_key(wallet_handle, None).unwrap(); - (wallet_handle, verkey, wallet_config) -} - mod high_cases { use super::*; @@ -55,32 +50,23 @@ mod high_cases { #[test] fn indy_create_key_works_for_seed() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("indy_create_key_works_for_seed"); - - let verkey = crypto::create_key(wallet_handle, Some(MY1_SEED)).unwrap(); + let setup = Setup::wallet(); + let verkey = crypto::create_key(setup.wallet_handle, Some(MY1_SEED)).unwrap(); assert_eq!(verkey.from_base58().unwrap().len(), 32); - - utils::tear_down_with_wallet(wallet_handle, "indy_create_key_works_for_seed", &wallet_config); } #[test] fn indy_create_key_works_without_seed() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("indy_create_key_works_without_seed"); - - let verkey = crypto::create_key(wallet_handle, None).unwrap(); + let setup = Setup::wallet(); + let verkey = crypto::create_key(setup.wallet_handle, None).unwrap(); assert_eq!(verkey.from_base58().unwrap().len(), 32); - - utils::tear_down_with_wallet(wallet_handle, "indy_create_key_works_without_seed", &wallet_config); } #[test] fn indy_create_key_works_for_invalid_wallet_handle() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("indy_create_key_works_for_invalid_wallet_handle"); - + let _ = Setup::empty(); let res = crypto::create_key(INVALID_WALLET_HANDLE, None); assert_code!(ErrorCode::WalletInvalidHandle, res); - - utils::tear_down_with_wallet(wallet_handle, "indy_create_key_works_for_invalid_wallet_handle", &wallet_config); } } @@ -89,57 +75,43 @@ mod high_cases { #[test] fn indy_set_key_metadata_works() { - let (wallet_handle, verkey, wallet_config) = setup_with_key("indy_set_key_metadata_works"); - - crypto::set_key_metadata(wallet_handle, &verkey, METADATA).unwrap(); - - utils::tear_down_with_wallet(wallet_handle, "indy_set_key_metadata_works", &wallet_config); + let setup = Setup::did(); + crypto::set_key_metadata(setup.wallet_handle, &setup.verkey, METADATA).unwrap(); } #[test] fn indy_set_key_metadata_works_for_replace() { - let (wallet_handle, verkey, wallet_config) = setup_with_key("indy_set_key_metadata_works_for_replace"); + let setup = Setup::did(); - crypto::set_key_metadata(wallet_handle, &verkey, METADATA).unwrap(); - let metadata = crypto::get_key_metadata(wallet_handle, &verkey).unwrap(); + crypto::set_key_metadata(setup.wallet_handle, &setup.verkey, METADATA).unwrap(); + let metadata = crypto::get_key_metadata(setup.wallet_handle, &setup.verkey).unwrap(); assert_eq!(METADATA.to_string(), metadata); let new_metadata = "updated metadata"; - crypto::set_key_metadata(wallet_handle, &verkey, new_metadata).unwrap(); - let updated_metadata = crypto::get_key_metadata(wallet_handle, &verkey).unwrap(); + crypto::set_key_metadata(setup.wallet_handle, &setup.verkey, new_metadata).unwrap(); + let updated_metadata = crypto::get_key_metadata(setup.wallet_handle, &setup.verkey).unwrap(); assert_eq!(new_metadata, updated_metadata); - - utils::tear_down_with_wallet(wallet_handle, "indy_set_key_metadata_works_for_replace", &wallet_config); } #[test] fn indy_set_key_metadata_works_for_invalid_handle() { - let (wallet_handle, verkey, wallet_config) = setup_with_key("indy_set_key_metadata_works_for_invalid_handle"); - - let res = crypto::set_key_metadata(INVALID_WALLET_HANDLE, &verkey, METADATA); + let setup = Setup::did(); + let res = crypto::set_key_metadata(INVALID_WALLET_HANDLE, &setup.verkey, METADATA); assert_code!(ErrorCode::WalletInvalidHandle, res); - - utils::tear_down_with_wallet(wallet_handle, "indy_set_key_metadata_works_for_invalid_handle", &wallet_config); } #[test] fn indy_set_key_metadata_works_for_empty_string() { - let (wallet_handle, verkey, wallet_config) = setup_with_key("indy_set_key_metadata_works_for_empty_string"); - - crypto::set_key_metadata(wallet_handle, &verkey, "").unwrap(); - - utils::tear_down_with_wallet(wallet_handle, "indy_set_key_metadata_works_for_empty_string", &wallet_config); + let setup = Setup::did(); + crypto::set_key_metadata(setup.wallet_handle, &setup.verkey, "").unwrap(); } #[test] fn indy_set_key_metadata_works_for_invalid_key() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("indy_set_key_metadata_works_for_invalid_key"); - - let res = crypto::set_key_metadata(wallet_handle, INVALID_BASE58_VERKEY, METADATA); + let setup = Setup::did(); + let res = crypto::set_key_metadata(setup.wallet_handle, INVALID_BASE58_VERKEY, METADATA); assert_code!(ErrorCode::CommonInvalidStructure, res); - - utils::tear_down_with_wallet(wallet_handle, "indy_set_key_metadata_works_for_invalid_key", &wallet_config); } } @@ -148,48 +120,40 @@ mod high_cases { #[test] fn indy_get_key_metadata_works() { - let (wallet_handle, verkey, wallet_config) = setup_with_key("indy_get_key_metadata_works"); + let setup = Setup::did(); - crypto::set_key_metadata(wallet_handle, &verkey, METADATA).unwrap(); + crypto::set_key_metadata(setup.wallet_handle, &setup.verkey, METADATA).unwrap(); - let metadata = crypto::get_key_metadata(wallet_handle, &verkey).unwrap(); + let metadata = crypto::get_key_metadata(setup.wallet_handle, &setup.verkey).unwrap(); assert_eq!(METADATA.to_string(), metadata); - - utils::tear_down_with_wallet(wallet_handle, "indy_get_key_metadata_works", &wallet_config); } #[test] fn indy_get_key_metadata_works_for_empty_string() { - let (wallet_handle, verkey, wallet_config) = setup_with_key("indy_get_key_metadata_works_for_empty_string"); + let setup = Setup::did(); - crypto::set_key_metadata(wallet_handle, &verkey, "").unwrap(); + crypto::set_key_metadata(setup.wallet_handle, &setup.verkey, "").unwrap(); - let metadata = crypto::get_key_metadata(wallet_handle, &verkey).unwrap(); + let metadata = crypto::get_key_metadata(setup.wallet_handle, &setup.verkey).unwrap(); assert_eq!("", metadata); - - utils::tear_down_with_wallet(wallet_handle, "indy_get_key_metadata_works_for_empty_string", &wallet_config); } #[test] fn indy_get_key_metadata_works_for_no_metadata() { - let (wallet_handle, verkey, wallet_config) = setup_with_key("indy_get_key_metadata_works_for_no_metadata"); + let setup = Setup::did(); - let res = crypto::get_key_metadata(wallet_handle, &verkey); + let res = crypto::get_key_metadata(setup.wallet_handle, &setup.verkey); assert_code!(ErrorCode::WalletItemNotFound, res); - - utils::tear_down_with_wallet(wallet_handle, "indy_get_key_metadata_works_for_no_metadata", &wallet_config); } #[test] fn indy_get_key_metadata_works_for_invalid_handle() { - let (wallet_handle, verkey, wallet_config) = setup_with_key("indy_get_key_metadata_works_for_invalid_handle"); + let setup = Setup::did(); - crypto::set_key_metadata(wallet_handle, &verkey, METADATA).unwrap(); + crypto::set_key_metadata(setup.wallet_handle, &setup.verkey, METADATA).unwrap(); - let res = crypto::get_key_metadata(INVALID_WALLET_HANDLE, &verkey); + let res = crypto::get_key_metadata(INVALID_WALLET_HANDLE, &setup.verkey); assert_code!(ErrorCode::WalletInvalidHandle, res); - - utils::tear_down_with_wallet(wallet_handle, "indy_get_key_metadata_works_for_invalid_handle", &wallet_config); } } @@ -198,34 +162,26 @@ mod high_cases { #[test] fn indy_crypto_sign_works() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("indy_crypto_sign_works"); + let setup = Setup::wallet(); - let my_vk = crypto::create_key(wallet_handle, Some(MY1_SEED)).unwrap(); + let my_vk = crypto::create_key(setup.wallet_handle, Some(MY1_SEED)).unwrap(); - let signature = crypto::sign(wallet_handle, &my_vk, MESSAGE.as_bytes()).unwrap(); + let signature = crypto::sign(setup.wallet_handle, &my_vk, MESSAGE.as_bytes()).unwrap(); assert_eq!(SIGNATURE.to_vec(), signature); - - utils::tear_down_with_wallet(wallet_handle, "indy_crypto_sign_works", &wallet_config); } #[test] fn indy_crypto_sign_works_for_unknown_signer() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("indy_crypto_sign_works_for_unknown_signer"); - - let res = crypto::sign(wallet_handle, VERKEY, MESSAGE.as_bytes()); + let setup = Setup::wallet(); + let res = crypto::sign(setup.wallet_handle, VERKEY, MESSAGE.as_bytes()); assert_code!(ErrorCode::WalletItemNotFound, res); - - utils::tear_down_with_wallet(wallet_handle, "indy_crypto_sign_works_for_unknown_signer", &wallet_config); } #[test] fn indy_crypto_sign_works_for_invalid_wallet_handle() { - let (wallet_handle, verkey, wallet_config) = setup_with_key("indy_crypto_sign_works_for_invalid_wallet_handle"); - - let res = crypto::sign(INVALID_WALLET_HANDLE, &verkey, MESSAGE.as_bytes()); + let setup = Setup::did(); + let res = crypto::sign(INVALID_WALLET_HANDLE, &setup.verkey, MESSAGE.as_bytes()); assert_code!(ErrorCode::WalletInvalidHandle, res); - - utils::tear_down_with_wallet(wallet_handle, "indy_crypto_sign_works_for_invalid_wallet_handle", &wallet_config); } } @@ -272,63 +228,43 @@ mod high_cases { #[test] fn indy_crypto_auth_crypt_works_for_created_key() { - let (wallet_handle, verkey, wallet_config) = setup_with_key("indy_crypto_auth_crypt_works_for_created_key"); - - crypto::auth_crypt(wallet_handle, &verkey, VERKEY_MY2, MESSAGE.as_bytes()).unwrap(); - - utils::tear_down_with_wallet(wallet_handle, "indy_crypto_auth_crypt_works_for_created_key", &wallet_config); + let setup = Setup::wallet(); + let verkey = crypto::create_key(setup.wallet_handle, Some(MY1_SEED)).unwrap(); + crypto::auth_crypt(setup.wallet_handle, &verkey, VERKEY_MY2, MESSAGE.as_bytes()).unwrap(); } #[test] fn indy_crypto_auth_crypt_works_for_created_did() { - let (sender_wallet_handle, wallet_config) = utils::setup_with_wallet("indy_crypto_auth_crypt_works_for_created_did"); - - let (_, verkey) = did::create_and_store_my_did(sender_wallet_handle, Some(MY1_SEED)).unwrap(); - - crypto::auth_crypt(sender_wallet_handle, &verkey, VERKEY_MY2, MESSAGE.as_bytes()).unwrap(); - - utils::tear_down_with_wallet(sender_wallet_handle, "indy_crypto_auth_crypt_works_for_created_did", &wallet_config); + let setup = Setup::did(); + crypto::auth_crypt(setup.wallet_handle, &setup.verkey, VERKEY_MY2, MESSAGE.as_bytes()).unwrap(); } #[test] fn indy_crypto_auth_crypt_works_for_created_did_as_cid() { - let (sender_wallet_handle, sender_wallet_config) = utils::setup_with_wallet("indy_crypto_auth_crypt_works_for_created_did_as_cid"); - - let (_, verkey) = did::create_my_did(sender_wallet_handle, &json!({ "seed": MY1_SEED, "cid": true }).to_string()).unwrap(); - - crypto::auth_crypt(sender_wallet_handle, &verkey, VERKEY_MY2, MESSAGE.as_bytes()).unwrap(); - - utils::tear_down_with_wallet(sender_wallet_handle, "indy_crypto_auth_crypt_works_for_created_did_as_cid", &sender_wallet_config); + let setup = Setup::wallet(); + let (_, verkey) = did::create_my_did(setup.wallet_handle, &json!({ "seed": MY1_SEED, "cid": true }).to_string()).unwrap(); + crypto::auth_crypt(setup.wallet_handle, &verkey, VERKEY_MY2, MESSAGE.as_bytes()).unwrap(); } #[test] fn indy_crypto_auth_crypt_works_for_unknown_sender_verkey() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("indy_crypto_auth_crypt_works_for_unknown_sender_verkey"); - - let res = crypto::auth_crypt(wallet_handle, VERKEY_MY2, VERKEY, MESSAGE.as_bytes()); + let setup = Setup::wallet(); + let res = crypto::auth_crypt(setup.wallet_handle, VERKEY_MY2, VERKEY, MESSAGE.as_bytes()); assert_code!(ErrorCode::WalletItemNotFound, res); - - utils::tear_down_with_wallet(wallet_handle, "indy_crypto_auth_crypt_works_for_unknown_sender_verkey", &wallet_config); } #[test] fn indy_crypto_auth_crypt_works_for_invalid_wallet_handle() { - let (wallet_handle, verkey, wallet_config) = setup_with_key("indy_crypto_auth_crypt_works_for_invalid_wallet_handle"); - - let res = crypto::auth_crypt(INVALID_WALLET_HANDLE, &verkey, VERKEY, MESSAGE.as_bytes()); + let setup = Setup::did(); + let res = crypto::auth_crypt(INVALID_WALLET_HANDLE, &setup.verkey, VERKEY, MESSAGE.as_bytes()); assert_code!(ErrorCode::WalletInvalidHandle, res); - - utils::tear_down_with_wallet(wallet_handle, "indy_crypto_auth_crypt_works_for_invalid_wallet_handle", &wallet_config); } #[test] fn indy_crypto_auth_crypt_works_for_invalid_recipient_vk() { - let (wallet_handle, verkey, wallet_config) = setup_with_key("indy_crypto_auth_crypt_works_for_invalid_recipient_vk"); - - let res = crypto::auth_crypt(wallet_handle, &verkey, INVALID_BASE58_VERKEY, MESSAGE.as_bytes()); + let setup = Setup::did(); + let res = crypto::auth_crypt(setup.wallet_handle, &setup.verkey, INVALID_BASE58_VERKEY, MESSAGE.as_bytes()); assert_code!(ErrorCode::CommonInvalidStructure, res); - - utils::tear_down_with_wallet(wallet_handle, "indy_crypto_auth_crypt_works_for_invalid_recipient_vk", &wallet_config); } } @@ -337,66 +273,49 @@ mod high_cases { #[test] fn indy_crypto_auth_decrypt_works() { - let (sender_wallet_handle, sender_vk, sender_wallet_config) = setup_with_key("indy_crypto_auth_decrypt_works"); + let sender_setup = Setup::key(); + let recipient_setup = Setup::key(); - let (recipient_wallet_handle, recipient_config) = wallet::create_and_open_default_wallet("indy_crypto_auth_decrypt_works").unwrap(); - let recipient_vk = crypto::create_key(recipient_wallet_handle, None).unwrap(); + let encrypted_msg = crypto::auth_crypt(sender_setup.wallet_handle, &sender_setup.verkey, &recipient_setup.verkey, MESSAGE.as_bytes()).unwrap(); - let encrypted_msg = crypto::auth_crypt(sender_wallet_handle, &sender_vk, &recipient_vk, MESSAGE.as_bytes()).unwrap(); - - let (vk, msg) = crypto::auth_decrypt(recipient_wallet_handle, &recipient_vk, &encrypted_msg).unwrap(); + let (vk, msg) = crypto::auth_decrypt(recipient_setup.wallet_handle, &recipient_setup.verkey, &encrypted_msg).unwrap(); assert_eq!(MESSAGE.as_bytes().to_vec(), msg); - assert_eq!(sender_vk, vk); - - wallet::close_wallet(recipient_wallet_handle).unwrap(); - wallet::delete_wallet(&recipient_config, WALLET_CREDENTIALS).unwrap(); - utils::tear_down_with_wallet(sender_wallet_handle, "indy_crypto_auth_decrypt_works", &sender_wallet_config); + assert_eq!(sender_setup.verkey, vk); } #[test] fn indy_crypto_auth_decrypt_works_for_invalid_msg() { - let (sender_wallet_handle, sender_wallet_config) = utils::setup_with_wallet("indy_crypto_auth_decrypt_works_for_invalid_msg"); - let (recipient_wallet_handle, recipient_wallet_config) = wallet::create_and_open_default_wallet("indy_crypto_auth_decrypt_works_for_invalid_msg").unwrap(); + let sender_setup = Setup::key(); + let recipient_setup = Setup::did(); - let (recipient_did, recipient_vk) = did::create_and_store_my_did(recipient_wallet_handle, Some(MY2_SEED)).unwrap(); - did::store_their_did_from_parts(sender_wallet_handle, &recipient_did, &recipient_vk).unwrap(); + did::store_their_did_from_parts(sender_setup.wallet_handle, &recipient_setup.did, &recipient_setup.verkey).unwrap(); let encrypted_msg = format!(r#"{{"nonce":"Th7MpTaRZVRYnPiabds81Y12","sender":"{:?}","msg":"{:?}"}}"#, VERKEY, ENCRYPTED_MESSAGE.to_vec()); - let res = crypto::auth_decrypt(recipient_wallet_handle, &recipient_vk, &encrypted_msg.as_bytes()); + let res = crypto::auth_decrypt(recipient_setup.wallet_handle, &recipient_setup.verkey, &encrypted_msg.as_bytes()); assert_code!(ErrorCode::CommonInvalidStructure, res); - wallet::close_wallet(recipient_wallet_handle).unwrap(); - wallet::delete_wallet(&recipient_wallet_config, WALLET_CREDENTIALS).unwrap(); - wallet::close_wallet(sender_wallet_handle).unwrap(); - wallet::delete_wallet(&sender_wallet_config, WALLET_CREDENTIALS).unwrap(); } #[test] fn indy_crypto_auth_decrypt_works_for_unknown_recipient_vk() { - let (wallet_handle, sender_vk, wallet_config) = setup_with_key("indy_crypto_auth_decrypt_works_for_unknown_recipient_vk"); + let setup = Setup::key(); - let encrypted_msg = crypto::auth_crypt(wallet_handle, &sender_vk, &VERKEY_TRUSTEE, MESSAGE.as_bytes()).unwrap(); + let encrypted_msg = crypto::auth_crypt(setup.wallet_handle, &setup.verkey, &VERKEY_TRUSTEE, MESSAGE.as_bytes()).unwrap(); - let res = crypto::anon_decrypt(wallet_handle, &VERKEY_TRUSTEE, &encrypted_msg); + let res = crypto::anon_decrypt(setup.wallet_handle, &VERKEY_TRUSTEE, &encrypted_msg); assert_code!(ErrorCode::WalletItemNotFound, res); - - utils::tear_down_with_wallet(wallet_handle, "indy_crypto_auth_decrypt_works_for_unknown_recipient_vk", &wallet_config); } #[test] fn indy_crypto_auth_decrypt_works_invalid_handle() { - let (sender_wallet_handle, sender_vk, sender_wallet_config) = setup_with_key("indy_crypto_auth_decrypt_works_invalid_handle"); - let (recipient_wallet_handle, recipient_wallet_config) = wallet::create_and_open_default_wallet("indy_crypto_auth_decrypt_works_invalid_handle").unwrap(); - let recipient_vk = crypto::create_key(recipient_wallet_handle, None).unwrap(); + let sender_setup = Setup::key(); + let recipient_setup = Setup::key(); - let encrypted_msg = crypto::auth_crypt(sender_wallet_handle, &sender_vk, &recipient_vk, MESSAGE.as_bytes()).unwrap(); + let encrypted_msg = crypto::auth_crypt(sender_setup.wallet_handle, &sender_setup.verkey, &recipient_setup.verkey, MESSAGE.as_bytes()).unwrap(); - let res = crypto::auth_decrypt(recipient_wallet_handle + 1, &recipient_vk, &encrypted_msg); + let res = crypto::auth_decrypt(INVALID_WALLET_HANDLE, &recipient_setup.verkey, &encrypted_msg); assert_code!(ErrorCode::WalletInvalidHandle, res); - - wallet::close_and_delete_wallet(recipient_wallet_handle, &recipient_wallet_config).unwrap(); - wallet::close_and_delete_wallet(sender_wallet_handle, &sender_wallet_config).unwrap(); } } @@ -405,24 +324,19 @@ mod high_cases { #[test] fn indy_anon_crypt_works() { - utils::setup("indy_anon_crypt_works"); - + let _ = Setup::empty(); crypto::anon_crypt(VERKEY_MY2, &MESSAGE.as_bytes()).unwrap(); - - utils::tear_down("indy_anon_crypt_works"); } #[test] fn indy_anon_crypt_works_for_invalid_their_vk() { - utils::setup("indy_anon_crypt_works_for_invalid_their_vk"); + let _ = Setup::empty(); let res = crypto::anon_crypt(INVALID_VERKEY_LENGTH, &MESSAGE.as_bytes()); assert_code!(ErrorCode::CommonInvalidStructure, res); let res = crypto::anon_crypt(INVALID_BASE58_VERKEY, &MESSAGE.as_bytes()); assert_code!(ErrorCode::CommonInvalidStructure, res); - - utils::tear_down("indy_anon_crypt_works_for_invalid_their_vk"); } } @@ -431,53 +345,40 @@ mod high_cases { #[test] fn indy_crypto_anon_decrypt_works() { - let (sender_wallet_handle, _, wallet_config) = setup_with_key("indy_crypto_anon_decrypt_works"); - let (recipient_wallet_handle, recipient_wallet_config) = wallet::create_and_open_default_wallet("indy_crypto_anon_decrypt_works").unwrap(); - let recipient_vk = crypto::create_key(recipient_wallet_handle, None).unwrap(); + let setup = Setup::key(); - let encrypted_msg = crypto::anon_crypt(&recipient_vk, MESSAGE.as_bytes()).unwrap(); + let encrypted_msg = crypto::anon_crypt(&setup.verkey, MESSAGE.as_bytes()).unwrap(); - let msg = crypto::anon_decrypt(recipient_wallet_handle, &recipient_vk, &encrypted_msg).unwrap(); + let msg = crypto::anon_decrypt(setup.wallet_handle, &setup.verkey, &encrypted_msg).unwrap(); assert_eq!(MESSAGE.as_bytes().to_vec(), msg); - - wallet::close_wallet(sender_wallet_handle).unwrap(); - wallet::delete_wallet(&wallet_config, WALLET_CREDENTIALS).unwrap(); - wallet::close_wallet(recipient_wallet_handle).unwrap(); - wallet::delete_wallet(&recipient_wallet_config, WALLET_CREDENTIALS).unwrap(); } #[test] fn indy_crypto_anon_decrypt_works_for_invalid_msg() { - let (wallet_handle, verkey, wallet_config) = setup_with_key("indy_crypto_anon_decrypt_works_for_invalid_msg"); + let setup = Setup::key(); - let res = crypto::anon_decrypt(wallet_handle, &verkey, &"unencrypted message".as_bytes()); + let res = crypto::anon_decrypt(setup.wallet_handle, &setup.verkey, &"unencrypted message".as_bytes()); assert_code!(ErrorCode::CommonInvalidStructure, res); - - utils::tear_down_with_wallet(wallet_handle, "indy_crypto_anon_decrypt_works_for_invalid_msg", &wallet_config); } #[test] fn indy_crypto_anon_decrypt_works_for_unknown_verkey() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("indy_crypto_anon_decrypt_works_for_unknown_verkey"); + let setup = Setup::wallet(); let encrypted_msg = crypto::anon_crypt(&VERKEY_TRUSTEE, MESSAGE.as_bytes()).unwrap(); - let res = crypto::anon_decrypt(wallet_handle, &VERKEY_TRUSTEE, &encrypted_msg); + let res = crypto::anon_decrypt(setup.wallet_handle, &VERKEY_TRUSTEE, &encrypted_msg); assert_code!(ErrorCode::WalletItemNotFound, res); - - utils::tear_down_with_wallet(wallet_handle, "indy_crypto_anon_decrypt_works_for_unknown_verkey", &wallet_config); } #[test] fn indy_crypto_anon_decrypt_works_invalid_handle() { - let (wallet_handle, verkey, wallet_config) = setup_with_key("indy_crypto_anon_decrypt_works_invalid_handle"); + let setup = Setup::key(); - let encrypted_msg = crypto::anon_crypt(&verkey, MESSAGE.as_bytes()).unwrap(); + let encrypted_msg = crypto::anon_crypt(&setup.verkey, MESSAGE.as_bytes()).unwrap(); - let res = crypto::anon_decrypt(INVALID_WALLET_HANDLE, &verkey, &encrypted_msg); + let res = crypto::anon_decrypt(INVALID_WALLET_HANDLE, &setup.verkey, &encrypted_msg); assert_code!(ErrorCode::WalletInvalidHandle, res); - - utils::tear_down_with_wallet(wallet_handle, "indy_crypto_anon_decrypt_works_invalid_handle", &wallet_config); } } @@ -486,58 +387,52 @@ mod high_cases { #[test] fn indy_pack_message_authcrypt_works() { - let (wallet_handle, verkey, wallet_config) = setup_with_key("indy_pack_message_authcrypt_works"); + let setup = Setup::key(); let rec_key_vec = vec![VERKEY_MY1, VERKEY_MY2, VERKEY_TRUSTEE]; let receiver_keys = serde_json::to_string(&rec_key_vec).unwrap(); let message = "Hello World".as_bytes(); - let res = crypto::pack_message(wallet_handle, message, &receiver_keys, Some(&verkey)); + let res = crypto::pack_message(setup.wallet_handle, message, &receiver_keys, Some(&setup.verkey)); assert!(res.is_ok()); - utils::tear_down_with_wallet(wallet_handle, "indy_pack_message_authcrypt_works", &wallet_config); } #[test] fn indy_pack_message_authcrypt_fails_empty_message() { - let (wallet_handle, verkey, wallet_config) = setup_with_key("indy_pack_message_authcrypt_fails_empty_message"); + let setup = Setup::key(); let rec_key_vec = vec![VERKEY_MY1, VERKEY_MY2, VERKEY_TRUSTEE]; let receiver_keys = serde_json::to_string(&rec_key_vec).unwrap(); let message = "".as_bytes(); - let res = crypto::pack_message(wallet_handle, message, &receiver_keys, Some(&verkey)); + let res = crypto::pack_message(setup.wallet_handle, message, &receiver_keys, Some(&setup.verkey)); assert_code!(ErrorCode::CommonInvalidParam3, res); - utils::tear_down_with_wallet(wallet_handle, "indy_pack_message_authcrypt_fails_empty_message", &wallet_config); } #[test] fn indy_pack_message_authcrypt_fails_no_receivers() { - let (wallet_handle, verkey, wallet_config) = setup_with_key("indy_pack_message_authcrypt_fails_no_receivers"); + let setup = Setup::key(); let receiver_keys = "[]"; let message = "Hello World".as_bytes(); - let res = crypto::pack_message(wallet_handle, message, &receiver_keys, Some(&verkey)); + let res = crypto::pack_message(setup.wallet_handle, message, &receiver_keys, Some(&setup.verkey)); assert_code!(ErrorCode::CommonInvalidParam4, res); - utils::tear_down_with_wallet(wallet_handle, "indy_pack_message_authcrypt_fails_no_receivers", &wallet_config); } #[test] fn indy_pack_message_authcrypt_fails_bad_wallet_handle() { - let (wallet_handle, verkey, wallet_config) = setup_with_key("indy_pack_message_authcrypt_fails_bad_wallet_handle"); + let setup = Setup::key(); let rec_key_vec = vec![VERKEY_MY1, VERKEY_MY2, VERKEY_TRUSTEE]; let receiver_keys = serde_json::to_string(&rec_key_vec).unwrap(); let message = "Hello World".as_bytes(); - let res = crypto::pack_message(INVALID_WALLET_HANDLE, message, &receiver_keys, Some(&verkey)); + let res = crypto::pack_message(INVALID_WALLET_HANDLE, message, &receiver_keys, Some(&setup.verkey)); assert_code!(ErrorCode::WalletInvalidHandle, res); - utils::tear_down_with_wallet(wallet_handle, "indy_pack_message_authcrypt_fails_bad_wallet_handle", &wallet_config); } #[test] fn indy_pack_message_authcrypt_fails_invalid_verkey() { - let (wallet_handle, _, wallet_config) = setup_with_key("indy_pack_message_authcrypt_fails_invalid_verkey"); + let setup = Setup::wallet(); let rec_key_vec = vec![VERKEY_MY1, VERKEY_MY2, VERKEY_TRUSTEE]; let receiver_keys = serde_json::to_string(&rec_key_vec).unwrap(); let message = "Hello World".as_bytes(); - let res = crypto::pack_message(wallet_handle, message, &receiver_keys, Some(INVALID_BASE58_VERKEY)); + let res = crypto::pack_message(setup.wallet_handle, message, &receiver_keys, Some(INVALID_BASE58_VERKEY)); assert_code!(ErrorCode::CommonInvalidStructure, res); - utils::tear_down_with_wallet(wallet_handle, "indy_pack_message_authcrypt_fails_invalid_verkey", &wallet_config); } - } mod pack_message_anoncrypt { @@ -545,34 +440,31 @@ mod high_cases { #[test] fn indy_pack_message_anon_works() { - let (wallet_handle, _ , wallet_config) = setup_with_key("indy_pack_message_anon_works"); + let setup = Setup::wallet(); let rec_key_vec = vec![VERKEY_MY1, VERKEY_MY2, VERKEY_TRUSTEE]; let receiver_keys = serde_json::to_string(&rec_key_vec).unwrap(); let message = "Hello World".as_bytes(); - let res = crypto::pack_message(wallet_handle, message, &receiver_keys, None); + let res = crypto::pack_message(setup.wallet_handle, message, &receiver_keys, None); assert!(res.is_ok()); - utils::tear_down_with_wallet(wallet_handle, "indy_pack_message_anon_works", &wallet_config); } #[test] fn indy_pack_message_anoncrypt_fails_empty_message() { - let (wallet_handle, _, wallet_config ) = setup_with_key("indy_pack_message_anoncrypt_fails_empty_message"); + let setup = Setup::wallet(); let rec_key_vec = vec![VERKEY_MY1, VERKEY_MY2, VERKEY_TRUSTEE]; let receiver_keys = serde_json::to_string(&rec_key_vec).unwrap(); let message = "".as_bytes(); - let res = crypto::pack_message(wallet_handle, message, &receiver_keys, None); + let res = crypto::pack_message(setup.wallet_handle, message, &receiver_keys, None); assert_code!(ErrorCode::CommonInvalidParam3, res); - utils::tear_down_with_wallet(wallet_handle, "indy_pack_message_anoncrypt_fails_empty_message", &wallet_config); } #[test] fn indy_pack_message_anoncrypt_fails_no_receivers() { - let (wallet_handle, _ , wallet_config) = setup_with_key("indy_pack_message_anoncrypt_fails_no_receivers"); + let setup = Setup::wallet(); let receiver_keys = "[]"; let message = "Hello World".as_bytes(); - let res = crypto::pack_message(wallet_handle, message, &receiver_keys, None); + let res = crypto::pack_message(setup.wallet_handle, message, &receiver_keys, None); assert_code!(ErrorCode::CommonInvalidParam4, res); - utils::tear_down_with_wallet(wallet_handle, "indy_pack_message_anoncrypt_fails_no_receivers", &wallet_config); } #[test] @@ -581,10 +473,9 @@ mod high_cases { let receiver_keys = serde_json::to_string(&rec_key_vec).unwrap(); let message = "Hello World".as_bytes(); //The wallet_handle and sender aren't used in this case, so any wallet_handle whether inited or not will work - let res = crypto::pack_message(1, message, &receiver_keys, None); + let res = crypto::pack_message(INVALID_WALLET_HANDLE, message, &receiver_keys, None); assert!(res.is_ok()); } - } mod unpack_message_authcrypt { @@ -600,52 +491,38 @@ mod high_cases { #[test] fn indy_unpack_message_authcrypt_works() { //Test setup - let (wallet_handle_sender, sender_verkey, wallet_config_sender) = setup_with_key("indy_unpack_message_authcrypt_works"); - let (wallet_handle_receiver, wallet_config_receiver) = wallet::create_and_open_default_wallet("indy_unpack_message_authcrypt_works").unwrap(); - let receiver_verkey = crypto::create_key(wallet_handle_receiver, None).unwrap(); - let rec_key_vec = vec![VERKEY_TRUSTEE, &receiver_verkey]; + let sender_setup = Setup::key(); + let receiver_setup = Setup::key(); + + let rec_key_vec = vec![VERKEY_TRUSTEE, &receiver_setup.verkey]; let receiver_keys = serde_json::to_string(&rec_key_vec).unwrap(); - let pack_message = crypto::pack_message(wallet_handle_sender, AGENT_MESSAGE.as_bytes(), &receiver_keys, Some(&sender_verkey)).unwrap(); + let pack_message = crypto::pack_message(sender_setup.wallet_handle, AGENT_MESSAGE.as_bytes(), &receiver_keys, Some(&sender_setup.verkey)).unwrap(); //execute function - let res = crypto::unpack_message(wallet_handle_receiver, pack_message.as_slice()).unwrap(); - let res_serialized : UnpackMessage = serde_json::from_slice(res.as_slice()).unwrap(); + let res = crypto::unpack_message(receiver_setup.wallet_handle, pack_message.as_slice()).unwrap(); + let res_serialized: UnpackMessage = serde_json::from_slice(res.as_slice()).unwrap(); //verify unpack ran correctly assert_eq!(res_serialized.message, AGENT_MESSAGE.to_string()); - assert_eq!(res_serialized.sender_verkey, sender_verkey); - assert_eq!(res_serialized.recipient_verkey, receiver_verkey); - - //teardown - wallet::close_wallet(wallet_handle_sender).unwrap(); - wallet::delete_wallet(&wallet_config_sender, WALLET_CREDENTIALS).unwrap(); - wallet::close_wallet(wallet_handle_receiver).unwrap(); - wallet::delete_wallet(&wallet_config_receiver, WALLET_CREDENTIALS).unwrap(); + assert_eq!(res_serialized.sender_verkey, sender_setup.verkey); + assert_eq!(res_serialized.recipient_verkey, receiver_setup.verkey); } #[test] fn indy_unpack_message_authcrypt_fails_no_matching_key() { //Test Setup - let (wallet_handle_sender, sender_verkey, wallet_config_sender) = setup_with_key("indy_unpack_message_authcrypt_fails_no_matching_key"); - let (wallet_handle_receiver, wallet_config_receiver) = wallet::create_and_open_default_wallet("indy_unpack_message_authcrypt_fails_no_matching_key").unwrap(); - crypto::create_key(wallet_handle_receiver, None).unwrap(); + let sender_setup = Setup::key(); + let receiver_setup = Setup::key(); + let rec_key_vec = vec![VERKEY_TRUSTEE]; let receiver_keys = serde_json::to_string(&rec_key_vec).unwrap(); let message = "Hello World".as_bytes(); - let pack_message = crypto::pack_message(wallet_handle_sender, message, &receiver_keys, Some(&sender_verkey)).unwrap(); + let pack_message = crypto::pack_message(sender_setup.wallet_handle, message, &receiver_keys, Some(&sender_setup.verkey)).unwrap(); //execute function - let res = crypto::unpack_message(wallet_handle_receiver, pack_message.as_slice()); - + let res = crypto::unpack_message(receiver_setup.wallet_handle, pack_message.as_slice()); assert_code!(ErrorCode::WalletItemNotFound, res); - - //teardown - wallet::close_wallet(wallet_handle_sender).unwrap(); - wallet::delete_wallet(&wallet_config_sender, WALLET_CREDENTIALS).unwrap(); - wallet::close_wallet(wallet_handle_receiver).unwrap(); - wallet::delete_wallet(&wallet_config_receiver, WALLET_CREDENTIALS).unwrap(); } - } mod unpack_message_anoncrypt { @@ -659,48 +536,34 @@ mod high_cases { #[test] fn indy_unpack_message_anoncrypt_works() { - let (wallet_handle_sender, _, wallet_config_sender) = setup_with_key("indy_unpack_message_anoncrypt_works"); - let (wallet_handle_receiver, wallet_config_receiver) = wallet::create_and_open_default_wallet("indy_unpack_message_anoncrypt_works").unwrap(); - let receiver_verkey = crypto::create_key(wallet_handle_receiver, None).unwrap(); - let rec_key_vec = vec![VERKEY_TRUSTEE, &receiver_verkey]; + let sender_setup = Setup::key(); + let receiver_setup = Setup::key(); + + let rec_key_vec = vec![VERKEY_TRUSTEE, &receiver_setup.verkey]; let receiver_keys = serde_json::to_string(&rec_key_vec).unwrap(); - let pack_message = crypto::pack_message(wallet_handle_sender, AGENT_MESSAGE.as_bytes(), &receiver_keys, None).unwrap(); - let res = crypto::unpack_message(wallet_handle_receiver, pack_message.as_slice()).unwrap(); - let res_serialized : UnpackMessage = serde_json::from_slice(res.as_slice()).unwrap(); + let pack_message = crypto::pack_message(sender_setup.wallet_handle, AGENT_MESSAGE.as_bytes(), &receiver_keys, None).unwrap(); + let res = crypto::unpack_message(receiver_setup.wallet_handle, pack_message.as_slice()).unwrap(); + let res_serialized: UnpackMessage = serde_json::from_slice(res.as_slice()).unwrap(); assert_eq!(res_serialized.message, AGENT_MESSAGE.to_string()); - assert_eq!(res_serialized.recipient_verkey, receiver_verkey); - - //teardown - wallet::close_wallet(wallet_handle_sender).unwrap(); - wallet::delete_wallet(&wallet_config_sender, WALLET_CREDENTIALS).unwrap(); - wallet::close_wallet(wallet_handle_receiver).unwrap(); - wallet::delete_wallet(&wallet_config_receiver, WALLET_CREDENTIALS).unwrap(); + assert_eq!(res_serialized.recipient_verkey, receiver_setup.verkey); } #[test] fn indy_unpack_message_anoncrypt_fails_no_matching_key() { //Test Setup - let (wallet_handle_sender, _, wallet_config_sender) = setup_with_key("indy_unpack_message_anoncrypt_fails_no_matching_key"); - let (wallet_handle_receiver, wallet_config_receiver) = wallet::create_and_open_default_wallet("indy_unpack_message_anoncrypt_fails_no_matching_key").unwrap(); - crypto::create_key(wallet_handle_receiver, None).unwrap(); + let sender_setup = Setup::key(); + let receiver_setup = Setup::key(); + let rec_key_vec = vec![VERKEY_TRUSTEE]; let receiver_keys = serde_json::to_string(&rec_key_vec).unwrap(); let message = "Hello World".as_bytes(); - let pack_message = crypto::pack_message(wallet_handle_sender, message, &receiver_keys, None).unwrap(); + let pack_message = crypto::pack_message(sender_setup.wallet_handle, message, &receiver_keys, None).unwrap(); //execute function - let res = crypto::unpack_message(wallet_handle_receiver, pack_message.as_slice()); - + let res = crypto::unpack_message(receiver_setup.wallet_handle, pack_message.as_slice()); assert_code!(ErrorCode::WalletItemNotFound, res); - - //teardown - wallet::close_wallet(wallet_handle_sender).unwrap(); - wallet::delete_wallet(&wallet_config_sender, WALLET_CREDENTIALS).unwrap(); - wallet::close_wallet(wallet_handle_receiver).unwrap(); - wallet::delete_wallet(&wallet_config_receiver, WALLET_CREDENTIALS).unwrap(); } - } } @@ -728,7 +591,7 @@ mod load { */ #[test] fn parallel_auth_encrypt() { - utils::setup("parallel_auth_encrypt"); + let _ = Setup::empty(); let agent_cnt = std::env::var("AGENTS_CNT").ok().and_then(|s| s.parse::().ok()).unwrap_or(AGENT_CNT); let data_sz = std::env::var("DATA_SZ").ok().and_then(|s| s.parse::().ok()).unwrap_or(DATA_SZ); @@ -791,7 +654,5 @@ mod load { Sum pending: \t{:?}\n\ Total duration:\t{:?}", time_diff_max, agent_cnt * operations_cnt, time_sum_diff, total_duration); - - utils::tear_down("parallel_auth_encrypt"); } } diff --git a/libindy/tests/payments.rs b/libindy/tests/payments.rs index c3c729fa2c..3415c2268b 100644 --- a/libindy/tests/payments.rs +++ b/libindy/tests/payments.rs @@ -31,6 +31,7 @@ mod utils; use self::indy::ErrorCode; use utils::payments; use utils::constants::*; +use utils::Setup; use api::INVALID_WALLET_HANDLE; @@ -55,12 +56,6 @@ static TEST_RES_STRING: &str = "test"; static CORRECT_PAYMENT_ADDRESS: &str = "pay:null:test"; static EXTRA: &str = "extra_1"; -fn setup(name: &str) -> (i32, String) { - let (wallet_handle, wallet_config) = utils::setup_with_wallet(name); - payments::mock_method::init(); - (wallet_handle, wallet_config) -} - mod high_cases { use super::*; @@ -69,7 +64,7 @@ mod high_cases { #[test] fn register_payment_method_works() { - utils::setup("register_payment_method_works"); + let _ = Setup::empty(); let _res = payments::register_payment_method("register_payment_method_works", Some(payments::mock_method::create_payment_address::handle), @@ -88,8 +83,6 @@ mod high_cases { Some(payments::mock_method::sign_with_address::handle), Some(payments::mock_method::verify_with_address::handle) ).unwrap(); - - utils::tear_down("register_payment_method_works"); } } @@ -98,15 +91,12 @@ mod high_cases { #[test] fn create_payment_address_works() { - let (wallet_handle, wallet_config) = setup("create_payment_address_works"); + let setup = Setup::payment_wallet(); payments::mock_method::create_payment_address::inject_mock(ErrorCode::Success, TEST_RES_STRING); - let res_plugin = payments::create_payment_address(wallet_handle, EMPTY_OBJECT, PAYMENT_METHOD_NAME).unwrap(); - + let res_plugin = payments::create_payment_address(setup.wallet_handle, EMPTY_OBJECT, PAYMENT_METHOD_NAME).unwrap(); assert_eq!(res_plugin, TEST_RES_STRING); - - utils::tear_down_with_wallet(wallet_handle, "create_payment_address_works", &wallet_config); } } @@ -115,19 +105,17 @@ mod high_cases { #[test] fn list_payment_address_works() { - let (wallet_handle, wallet_config) = setup("list_payment_address_works"); + let setup = Setup::payment_wallet(); payments::mock_method::create_payment_address::inject_mock(ErrorCode::Success, TEST_RES_STRING); - payments::create_payment_address(wallet_handle, EMPTY_OBJECT, PAYMENT_METHOD_NAME).unwrap(); + payments::create_payment_address(setup.wallet_handle, EMPTY_OBJECT, PAYMENT_METHOD_NAME).unwrap(); - let all_addresses = payments::list_payment_addresses(wallet_handle).unwrap(); + let all_addresses = payments::list_payment_addresses(setup.wallet_handle).unwrap(); let vec: Vec = serde_json::from_str(&all_addresses).unwrap(); assert_eq!(vec.len(), 1); assert!(vec.contains(&TEST_RES_STRING.to_string())); - - utils::tear_down_with_wallet(wallet_handle, "list_payment_address_works", &wallet_config); } } @@ -136,11 +124,11 @@ mod high_cases { #[test] fn add_request_fees_works() { - let (wallet_handle, wallet_config) = setup("add_request_fees_works"); + let setup = Setup::payment_wallet(); payments::mock_method::add_request_fees::inject_mock(ErrorCode::Success, TEST_RES_STRING); - let (req, payment_method) = payments::add_request_fees(wallet_handle, + let (req, payment_method) = payments::add_request_fees(setup.wallet_handle, Some(IDENTIFIER), EMPTY_OBJECT, CORRECT_INPUTS, @@ -150,17 +138,15 @@ mod high_cases { assert_eq!(req, TEST_RES_STRING.to_string()); assert_eq!(payment_method, PAYMENT_METHOD_NAME); - - utils::tear_down_with_wallet(wallet_handle, "add_request_fees_works", &wallet_config); } #[test] fn add_request_fees_works_for_empty_outputs() { - let (wallet_handle, wallet_config) = setup("add_request_fees_works_for_empty_outputs"); + let setup = Setup::payment_wallet(); payments::mock_method::add_request_fees::inject_mock(ErrorCode::Success, TEST_RES_STRING); - let (txn, method) = payments::add_request_fees(wallet_handle, + let (txn, method) = payments::add_request_fees(setup.wallet_handle, Some(IDENTIFIER), EMPTY_OBJECT, CORRECT_INPUTS, @@ -170,17 +156,15 @@ mod high_cases { assert_eq!(method, PAYMENT_METHOD_NAME); assert_eq!(txn, TEST_RES_STRING); - - utils::tear_down_with_wallet(wallet_handle, "add_request_fees_works_for_empty_outputs", &wallet_config); } #[test] fn add_request_fees_works_for_extra() { - let (wallet_handle, wallet_config) = setup("add_request_fees_works_for_extra"); + let setup = Setup::payment_wallet(); payments::mock_method::add_request_fees::inject_mock(ErrorCode::Success, TEST_RES_STRING); - let (req, payment_method) = payments::add_request_fees(wallet_handle, + let (req, payment_method) = payments::add_request_fees(setup.wallet_handle, Some(IDENTIFIER), EMPTY_OBJECT, CORRECT_INPUTS, @@ -190,17 +174,15 @@ mod high_cases { assert_eq!(req, TEST_RES_STRING.to_string()); assert_eq!(payment_method, PAYMENT_METHOD_NAME); - - utils::tear_down_with_wallet(wallet_handle, "add_request_fees_works_for_extra", &wallet_config); } #[test] fn add_request_fees_works_for_empty_submitter_did() { - let (wallet_handle, wallet_config) = setup("add_request_fees_works_for_empty_submitter_did"); + let setup = Setup::payment_wallet(); payments::mock_method::add_request_fees::inject_mock(ErrorCode::Success, TEST_RES_STRING); - let (req, payment_method) = payments::add_request_fees(wallet_handle, + let (req, payment_method) = payments::add_request_fees(setup.wallet_handle, None, EMPTY_OBJECT, CORRECT_INPUTS, @@ -210,8 +192,6 @@ mod high_cases { assert_eq!(req, TEST_RES_STRING.to_string()); assert_eq!(payment_method, PAYMENT_METHOD_NAME); - - utils::tear_down_with_wallet(wallet_handle, "add_request_fees_works_for_empty_submitter_did", &wallet_config); } } @@ -220,15 +200,13 @@ mod high_cases { #[test] fn parse_response_with_fees_works() { - let (wallet_handle, wallet_config) = setup("parse_response_with_fees_works"); + Setup::payment(); payments::mock_method::parse_response_with_fees::inject_mock(ErrorCode::Success, TEST_RES_STRING); let res_plugin = payments::parse_response_with_fees(PAYMENT_METHOD_NAME, EMPTY_OBJECT).unwrap(); assert_eq!(res_plugin, TEST_RES_STRING); - - utils::tear_down_with_wallet(wallet_handle, "parse_response_with_fees_works", &wallet_config); } } @@ -237,30 +215,26 @@ mod high_cases { #[test] fn build_get_payment_sources_request_works() { - let (wallet_handle, wallet_config) = setup("build_get_payment_sources_request_works"); + let setup = Setup::payment_wallet(); payments::mock_method::build_get_payment_sources_request::inject_mock(ErrorCode::Success, TEST_RES_STRING); - let (req, payment_method) = payments::build_get_payment_sources_request(wallet_handle, Some(IDENTIFIER), CORRECT_PAYMENT_ADDRESS).unwrap(); + let (req, payment_method) = payments::build_get_payment_sources_request(setup.wallet_handle, Some(IDENTIFIER), CORRECT_PAYMENT_ADDRESS).unwrap(); assert_eq!(req, TEST_RES_STRING.to_string()); assert_eq!(PAYMENT_METHOD_NAME, payment_method); - - utils::tear_down_with_wallet(wallet_handle, "build_get_payment_sources_request_works", &wallet_config); } #[test] fn build_get_payment_sources_request_works_for_empty_submitter_did() { - let (wallet_handle, wallet_config) = setup("build_get_payment_sources_request_works_for_empty_submitter_did"); + let setup = Setup::payment_wallet(); payments::mock_method::build_get_payment_sources_request::inject_mock(ErrorCode::Success, TEST_RES_STRING); - let (req, payment_method) = payments::build_get_payment_sources_request(wallet_handle, None, CORRECT_PAYMENT_ADDRESS).unwrap(); + let (req, payment_method) = payments::build_get_payment_sources_request(setup.wallet_handle, None, CORRECT_PAYMENT_ADDRESS).unwrap(); assert_eq!(req, TEST_RES_STRING.to_string()); assert_eq!(PAYMENT_METHOD_NAME, payment_method); - - utils::tear_down_with_wallet(wallet_handle, "build_get_payment_sources_request_works_for_empty_submitter_did", &wallet_config); } } @@ -269,45 +243,39 @@ mod high_cases { #[test] fn build_get_payment_sources_with_from_request_works() { - let (wallet_handle, wallet_config) = setup("build_get_payment_sources_with_from_request_works"); + let setup = Setup::payment_wallet(); payments::mock_method::build_get_payment_sources_request::inject_mock(ErrorCode::Success, TEST_RES_STRING); - let (req, payment_method) = payments::build_get_payment_sources_with_from_request(wallet_handle, Some(IDENTIFIER), CORRECT_PAYMENT_ADDRESS, Some(1)).unwrap(); + let (req, payment_method) = payments::build_get_payment_sources_with_from_request(setup.wallet_handle, Some(IDENTIFIER), CORRECT_PAYMENT_ADDRESS, Some(1)).unwrap(); assert_eq!(req, TEST_RES_STRING.to_string()); assert_eq!(PAYMENT_METHOD_NAME, payment_method); - - utils::tear_down_with_wallet(wallet_handle, "build_get_payment_sources_with_from_request_works", &wallet_config); } #[test] fn build_get_payment_sources_with_from_request_works_for_no_from() { - let (wallet_handle, wallet_config) = setup("build_get_payment_sources_with_from_request_works"); + let setup = Setup::payment_wallet(); payments::mock_method::build_get_payment_sources_request::inject_mock(ErrorCode::Success, TEST_RES_STRING); - let (req, payment_method) = payments::build_get_payment_sources_with_from_request(wallet_handle, Some(IDENTIFIER), CORRECT_PAYMENT_ADDRESS, None).unwrap(); + let (req, payment_method) = payments::build_get_payment_sources_with_from_request(setup.wallet_handle, Some(IDENTIFIER), CORRECT_PAYMENT_ADDRESS, None).unwrap(); assert_eq!(req, TEST_RES_STRING.to_string()); assert_eq!(PAYMENT_METHOD_NAME, payment_method); - - utils::tear_down_with_wallet(wallet_handle, "build_get_payment_sources_with_from_request_works", &wallet_config); } #[test] fn build_get_payment_sources_request_works_with_from_for_empty_submitter_did() { - let (wallet_handle, wallet_config) = setup("build_get_payment_sources_request_with_from_works_for_empty_submitter_did"); + let setup = Setup::payment_wallet(); payments::mock_method::build_get_payment_sources_request::inject_mock(ErrorCode::Success, TEST_RES_STRING); - let (req, payment_method) = payments::build_get_payment_sources_with_from_request(wallet_handle, None, CORRECT_PAYMENT_ADDRESS, Some(1)).unwrap(); + let (req, payment_method) = payments::build_get_payment_sources_with_from_request(setup.wallet_handle, None, CORRECT_PAYMENT_ADDRESS, Some(1)).unwrap(); assert_eq!(req, TEST_RES_STRING.to_string()); assert_eq!(PAYMENT_METHOD_NAME, payment_method); - - utils::tear_down_with_wallet(wallet_handle, "build_get_payment_sources_request_with_from_works_for_empty_submitter_did", &wallet_config); } } @@ -316,15 +284,13 @@ mod high_cases { #[test] fn parse_get_payment_sources_response_works() { - let (wallet_handle, wallet_config) = setup("parse_get_payment_sources_response_works"); + Setup::payment(); payments::mock_method::parse_get_payment_sources_response::inject_mock(ErrorCode::Success, TEST_RES_STRING, -1); let res_plugin = payments::parse_get_payment_sources_response(PAYMENT_METHOD_NAME, EMPTY_OBJECT).unwrap(); assert_eq!(res_plugin, TEST_RES_STRING); - - utils::tear_down_with_wallet(wallet_handle, "parse_get_payment_sources_response_works", &wallet_config); } } @@ -333,7 +299,7 @@ mod high_cases { #[test] fn parse_get_payment_sources_with_from_response_works() { - let (wallet_handle, wallet_config) = setup("parse_get_payment_sources_with_from_response_works"); + Setup::payment(); payments::mock_method::parse_get_payment_sources_response::inject_mock(ErrorCode::Success, TEST_RES_STRING, -1); @@ -341,14 +307,12 @@ mod high_cases { assert_eq!(res_plugin, TEST_RES_STRING); assert_eq!(num, None); - - utils::tear_down_with_wallet(wallet_handle, "parse_get_payment_sources_response_works", &wallet_config); } #[test] fn parse_get_payment_sources_with_from_response_works_has_next() { - let (wallet_handle, wallet_config) = setup("parse_get_payment_sources_with_from_response_works"); + Setup::payment(); payments::mock_method::parse_get_payment_sources_response::inject_mock(ErrorCode::Success, TEST_RES_STRING, 1); @@ -356,8 +320,6 @@ mod high_cases { assert_eq!(res_plugin, TEST_RES_STRING); assert_eq!(num, Some(1)); - - utils::tear_down_with_wallet(wallet_handle, "parse_get_payment_sources_response_works", &wallet_config); } } @@ -366,11 +328,11 @@ mod high_cases { #[test] fn build_payment_req_works() { - let (wallet_handle, wallet_config) = setup("build_payment_req_works"); + let setup = Setup::payment_wallet(); payments::mock_method::build_payment_req::inject_mock(ErrorCode::Success, TEST_RES_STRING); - let (req, payment_method) = payments::build_payment_req(wallet_handle, + let (req, payment_method) = payments::build_payment_req(setup.wallet_handle, Some(IDENTIFIER), CORRECT_INPUTS, CORRECT_OUTPUTS, @@ -379,17 +341,15 @@ mod high_cases { assert_eq!(req, TEST_RES_STRING.to_string()); assert_eq!(PAYMENT_METHOD_NAME, payment_method); - - utils::tear_down_with_wallet(wallet_handle, "build_payment_req_works", &wallet_config); } #[test] fn build_payment_req_works_for_extra() { - let (wallet_handle, wallet_config) = setup("build_payment_req_works_for_extra"); + let setup = Setup::payment_wallet(); payments::mock_method::build_payment_req::inject_mock(ErrorCode::Success, TEST_RES_STRING); - let (req, payment_method) = payments::build_payment_req(wallet_handle, + let (req, payment_method) = payments::build_payment_req(setup.wallet_handle, Some(IDENTIFIER), CORRECT_INPUTS, CORRECT_OUTPUTS, @@ -398,17 +358,15 @@ mod high_cases { assert_eq!(req, TEST_RES_STRING.to_string()); assert_eq!(PAYMENT_METHOD_NAME, payment_method); - - utils::tear_down_with_wallet(wallet_handle, "build_payment_req_works_for_extra", &wallet_config); } #[test] fn build_payment_req_works_for_empty_submitter_did() { - let (wallet_handle, wallet_config) = setup("build_payment_req_works_for_empty_submitter_did"); + let setup = Setup::payment_wallet(); payments::mock_method::build_payment_req::inject_mock(ErrorCode::Success, TEST_RES_STRING); - let (req, payment_method) = payments::build_payment_req(wallet_handle, + let (req, payment_method) = payments::build_payment_req(setup.wallet_handle, None, CORRECT_INPUTS, CORRECT_OUTPUTS, @@ -417,8 +375,6 @@ mod high_cases { assert_eq!(req, TEST_RES_STRING.to_string()); assert_eq!(PAYMENT_METHOD_NAME, payment_method); - - utils::tear_down_with_wallet(wallet_handle, "build_payment_req_works_for_empty_submitter_did", &wallet_config); } } @@ -427,15 +383,13 @@ mod high_cases { #[test] fn parse_payment_response_works() { - let (wallet_handle, wallet_config) = setup("parse_payment_response_works"); + Setup::payment(); payments::mock_method::parse_payment_response::inject_mock(ErrorCode::Success, TEST_RES_STRING); let res_plugin = payments::parse_payment_response(PAYMENT_METHOD_NAME, EMPTY_OBJECT).unwrap(); assert_eq!(res_plugin, TEST_RES_STRING); - - utils::tear_down_with_wallet(wallet_handle, "parse_payment_response_works", &wallet_config); } } @@ -462,7 +416,7 @@ mod high_cases { #[test] fn indy_prepare_payment_extra_with_acceptance_data_works_for_text_version() { - let (wallet_handle, wallet_config) = setup("indy_prepare_payment_extra_with_acceptance_data_works_for_text_version"); + Setup::payment(); let extra = payments::prepare_extra_with_acceptance_data(None, Some(TEXT), @@ -471,13 +425,11 @@ mod high_cases { ACCEPTANCE_MECH_TYPE, TIME_OF_ACCEPTANCE).unwrap(); _check_request_meta(&extra); - - utils::tear_down_with_wallet(wallet_handle, "indy_prepare_payment_extra_with_acceptance_data_works_for_text_version", &wallet_config); } #[test] fn indy_prepare_payment_extra_with_acceptance_data_works_for_hash() { - let (wallet_handle, wallet_config) = setup("indy_prepare_payment_extra_with_acceptance_data_works_for_hash"); + Setup::payment(); let extra = payments::prepare_extra_with_acceptance_data(None, None, @@ -486,14 +438,10 @@ mod high_cases { ACCEPTANCE_MECH_TYPE, TIME_OF_ACCEPTANCE).unwrap(); _check_request_meta(&extra); - - utils::tear_down_with_wallet(wallet_handle, "indy_prepare_payment_extra_with_acceptance_data_works_for_hash", &wallet_config); } #[test] fn indy_prepare_payment_extra_with_acceptance_data_works_for_text_version_and_hash() { - let (wallet_handle, wallet_config) = setup("indy_prepare_payment_extra_with_acceptance_data_works_for_text_version_and_hash"); - let extra = payments::prepare_extra_with_acceptance_data(None, Some(TEXT), Some(VERSION), @@ -501,13 +449,11 @@ mod high_cases { ACCEPTANCE_MECH_TYPE, TIME_OF_ACCEPTANCE).unwrap(); _check_request_meta(&extra); - - utils::tear_down_with_wallet(wallet_handle, "indy_prepare_payment_extra_with_acceptance_data_works_for_text_version_and_hash", &wallet_config); } #[test] fn indy_prepare_payment_extra_with_acceptance_data_works_for_text_version_not_correspond_to_hash() { - let (wallet_handle, wallet_config) = setup("indy_prepare_payment_extra_with_acceptance_data_works_for_text_version_not_correspond_to_hash"); + Setup::payment(); let res = payments::prepare_extra_with_acceptance_data(None, Some("other text"), @@ -516,13 +462,11 @@ mod high_cases { ACCEPTANCE_MECH_TYPE, TIME_OF_ACCEPTANCE); assert_code!(ErrorCode::CommonInvalidStructure, res); - - utils::tear_down_with_wallet(wallet_handle, "indy_prepare_payment_extra_with_acceptance_data_works_for_text_version_not_correspond_to_hash", &wallet_config); } #[test] fn indy_prepare_payment_extra_with_acceptance_data_works_for_invalid_request() { - let (wallet_handle, wallet_config) = setup("indy_prepare_payment_extra_with_acceptance_data_works_for_invalid_request"); + Setup::payment(); let res = payments::prepare_extra_with_acceptance_data(Some("Invalid extra string"), None, @@ -531,8 +475,6 @@ mod high_cases { ACCEPTANCE_MECH_TYPE, TIME_OF_ACCEPTANCE); assert_code!(ErrorCode::CommonInvalidStructure, res); - - utils::tear_down_with_wallet(wallet_handle, "indy_prepare_payment_extra_with_acceptance_data_works_for_invalid_request", &wallet_config); } } @@ -541,11 +483,11 @@ mod high_cases { #[test] fn build_mint_req_works() { - let (wallet_handle, wallet_config) = setup("build_mint_req_works"); + let setup = Setup::payment_wallet(); payments::mock_method::build_mint_req::inject_mock(ErrorCode::Success, TEST_RES_STRING); - let (req, payment_method) = payments::build_mint_req(wallet_handle, + let (req, payment_method) = payments::build_mint_req(setup.wallet_handle, Some(IDENTIFIER), CORRECT_OUTPUTS, None, @@ -553,17 +495,15 @@ mod high_cases { assert_eq!(req, TEST_RES_STRING.to_string()); assert_eq!(PAYMENT_METHOD_NAME, payment_method); - - utils::tear_down_with_wallet(wallet_handle, "build_mint_req_works", &wallet_config); } #[test] fn build_mint_req_works_for_extra() { - let (wallet_handle, wallet_config) = setup("build_mint_req_works_for_extra"); + let setup = Setup::payment_wallet(); payments::mock_method::build_mint_req::inject_mock(ErrorCode::Success, TEST_RES_STRING); - let (req, payment_method) = payments::build_mint_req(wallet_handle, + let (req, payment_method) = payments::build_mint_req(setup.wallet_handle, Some(IDENTIFIER), CORRECT_OUTPUTS, Some(EXTRA), @@ -571,17 +511,15 @@ mod high_cases { assert_eq!(req, TEST_RES_STRING.to_string()); assert_eq!(PAYMENT_METHOD_NAME, payment_method); - - utils::tear_down_with_wallet(wallet_handle, "build_mint_req_works_for_extra", &wallet_config); } #[test] fn build_mint_req_works_for_empty_submitter_did() { - let (wallet_handle, wallet_config) = setup("build_mint_req_works_for_empty_submitter_did"); + let setup = Setup::payment_wallet(); payments::mock_method::build_mint_req::inject_mock(ErrorCode::Success, TEST_RES_STRING); - let (req, payment_method) = payments::build_mint_req(wallet_handle, + let (req, payment_method) = payments::build_mint_req(setup.wallet_handle, None, CORRECT_OUTPUTS, None, @@ -589,8 +527,6 @@ mod high_cases { assert_eq!(req, TEST_RES_STRING.to_string()); assert_eq!(PAYMENT_METHOD_NAME, payment_method); - - utils::tear_down_with_wallet(wallet_handle, "build_mint_req_works_for_empty_submitter_did", &wallet_config); } } @@ -599,36 +535,32 @@ mod high_cases { #[test] fn build_set_txn_fees_request_works() { - let (wallet_handle, wallet_config) = setup("build_set_txn_fees_request_works"); + let setup = Setup::payment_wallet(); payments::mock_method::build_set_txn_fees_req::inject_mock(ErrorCode::Success, TEST_RES_STRING); - let req = payments::build_set_txn_fees_req(wallet_handle, + let req = payments::build_set_txn_fees_req(setup.wallet_handle, Some(IDENTIFIER), PAYMENT_METHOD_NAME, CORRECT_FEES, ).unwrap(); assert_eq!(req, TEST_RES_STRING.to_string()); - - utils::tear_down_with_wallet(wallet_handle, "build_set_txn_fees_request_works", &wallet_config); } #[test] fn build_set_txn_fees_request_works_for_empty_submitter_did() { - let (wallet_handle, wallet_config) = setup("build_set_txn_fees_request_works_for_empty_submitter_did"); + let setup = Setup::payment_wallet(); payments::mock_method::build_set_txn_fees_req::inject_mock(ErrorCode::Success, TEST_RES_STRING); - let req = payments::build_set_txn_fees_req(wallet_handle, + let req = payments::build_set_txn_fees_req(setup.wallet_handle, None, PAYMENT_METHOD_NAME, CORRECT_FEES, ).unwrap(); assert_eq!(req, TEST_RES_STRING.to_string()); - - utils::tear_down_with_wallet(wallet_handle, "build_set_txn_fees_request_works_for_empty_submitter_did", &wallet_config); } } @@ -637,34 +569,30 @@ mod high_cases { #[test] fn build_get_txn_fees_request_for_generic_result() { - let (wallet_handle, wallet_config) = setup("build_get_txn_fees_request_for_generic_result"); + let setup = Setup::payment_wallet(); payments::mock_method::build_get_txn_fees_req::inject_mock(ErrorCode::Success, TEST_RES_STRING); - let req = payments::build_get_txn_fees_req(wallet_handle, + let req = payments::build_get_txn_fees_req(setup.wallet_handle, Some(IDENTIFIER), PAYMENT_METHOD_NAME, ).unwrap(); assert_eq!(req, TEST_RES_STRING.to_string()); - - utils::tear_down_with_wallet(wallet_handle, "build_get_txn_fees_request_for_generic_result", &wallet_config); } #[test] fn build_get_txn_fees_request_for_empty_submitter_did() { - let (wallet_handle, wallet_config) = setup("build_get_txn_fees_request_for_empty_submitter_did"); + let setup = Setup::payment_wallet(); payments::mock_method::build_get_txn_fees_req::inject_mock(ErrorCode::Success, TEST_RES_STRING); - let req = payments::build_get_txn_fees_req(wallet_handle, + let req = payments::build_get_txn_fees_req(setup.wallet_handle, None, PAYMENT_METHOD_NAME, ).unwrap(); assert_eq!(req, TEST_RES_STRING.to_string()); - - utils::tear_down_with_wallet(wallet_handle, "build_get_txn_fees_request_for_empty_submitter_did", &wallet_config); } } @@ -673,15 +601,13 @@ mod high_cases { #[test] fn parse_get_txn_fees_response_works() { - let (wallet_handle, wallet_config) = setup("parse_get_txn_fees_response_works"); + Setup::payment(); payments::mock_method::parse_get_txn_fees_response::inject_mock(ErrorCode::Success, TEST_RES_STRING); let res_plugin = payments::parse_get_txn_fees_response(PAYMENT_METHOD_NAME, EMPTY_OBJECT).unwrap(); assert_eq!(res_plugin, TEST_RES_STRING); - - utils::tear_down_with_wallet(wallet_handle, "parse_get_txn_fees_response_works", &wallet_config); } } @@ -690,30 +616,26 @@ mod high_cases { #[test] pub fn build_verify_payment_req_works() { - let (wallet_handle, wallet_config) = setup("build_verify_payment_req_works"); + let setup = Setup::payment_wallet(); payments::mock_method::build_verify_payment_req::inject_mock(ErrorCode::Success, TEST_RES_STRING); - let (req, pm) = payments::build_verify_payment_req(wallet_handle, Some(IDENTIFIER), "pay:null:test").unwrap(); + let (req, pm) = payments::build_verify_payment_req(setup.wallet_handle, Some(IDENTIFIER), "pay:null:test").unwrap(); assert_eq!(req, TEST_RES_STRING); assert_eq!(pm, PAYMENT_METHOD_NAME); - - utils::tear_down_with_wallet(wallet_handle, "build_verify_payment_req_works", &wallet_config); } #[test] pub fn build_verify_payment_req_works_for_empty_submitter_did() { - let (wallet_handle, wallet_config) = setup("build_verify_payment_req_works_for_empty_submitter_did"); + let setup = Setup::payment_wallet(); payments::mock_method::build_verify_payment_req::inject_mock(ErrorCode::Success, TEST_RES_STRING); - let (req, pm) = payments::build_verify_payment_req(wallet_handle, None, "pay:null:test").unwrap(); + let (req, pm) = payments::build_verify_payment_req(setup.wallet_handle, None, "pay:null:test").unwrap(); assert_eq!(req, TEST_RES_STRING); assert_eq!(pm, PAYMENT_METHOD_NAME); - - utils::tear_down_with_wallet(wallet_handle, "build_verify_payment_req_works_for_empty_submitter_did", &wallet_config); } } @@ -722,15 +644,13 @@ mod high_cases { #[test] fn parse_verify_payment_response_works() { - let (wallet_handle, wallet_config) = setup("parse_verify_payment_response_works"); + Setup::payment(); payments::mock_method::parse_verify_payment_response::inject_mock(ErrorCode::Success, TEST_RES_STRING); let res_plugin = payments::parse_verify_payment_response(PAYMENT_METHOD_NAME, EMPTY_OBJECT).unwrap(); assert_eq!(res_plugin, TEST_RES_STRING); - - utils::tear_down_with_wallet(wallet_handle, "parse_verify_payment_response_works", &wallet_config); } } @@ -783,7 +703,7 @@ mod high_cases { #[test] fn indy_get_request_info_for_requester_match_to_constraint() { - utils::setup("indy_get_request_info_for_requester_match_to_constraint"); + let _ = Setup::empty(); let req_info = payments::get_request_info(&_auth_rule(), &_requester_info(), &_fees()).unwrap(); let req_info: serde_json::Value = serde_json::from_str(&req_info).unwrap(); @@ -798,13 +718,11 @@ mod high_cases { }); assert_eq!(expected_req_info, req_info); - - utils::tear_down("indy_get_request_info_for_requester_match_to_constraint"); } #[test] fn indy_get_request_info_for_requester_not_match_to_constraint() { - utils::setup("indy_get_request_info_for_requester_not_match_to_constraint"); + let _ = Setup::empty(); let requester_info = json!({ "role": "101", @@ -814,13 +732,11 @@ mod high_cases { let res = payments::get_request_info(&_auth_rule(), &requester_info, &_fees()); assert_code!(ErrorCode::TransactionNotAllowed, res); - - utils::tear_down("indy_get_request_info_for_requester_not_match_to_constraint"); } #[test] fn indy_get_request_info_for_no_fee() { - utils::setup("indy_get_request_info_for_no_fee"); + let _ = Setup::empty(); let req_info = payments::get_request_info(&_auth_rule(), &_requester_info(), "{}").unwrap(); let req_info: serde_json::Value = serde_json::from_str(&req_info).unwrap(); @@ -835,8 +751,6 @@ mod high_cases { }); assert_eq!(expected_req_info, req_info); - - utils::tear_down("indy_get_request_info_for_no_fee"); } } @@ -846,21 +760,19 @@ mod high_cases { #[test] fn sign_with_address_works() { - let (wallet_handle, wallet_config) = setup("sign_with_address_works"); + let setup = Setup::payment_wallet(); let test_vec = vec![0u8; 32]; let test_sig = sha2::Sha256::digest(test_vec.as_slice()).as_slice().to_vec(); payments::mock_method::create_payment_address::inject_mock(ErrorCode::Success, PAYMENT_METHOD_NAME); - payments::create_payment_address(wallet_handle, EMPTY_OBJECT, PAYMENT_METHOD_NAME).unwrap(); + payments::create_payment_address(setup.wallet_handle, EMPTY_OBJECT, PAYMENT_METHOD_NAME).unwrap(); payments::mock_method::sign_with_address::inject_mock(ErrorCode::Success, test_sig); - let res = payments::sign_with_address(wallet_handle, CORRECT_PAYMENT_ADDRESS, test_vec.as_slice()).unwrap(); + let res = payments::sign_with_address(setup.wallet_handle, CORRECT_PAYMENT_ADDRESS, test_vec.as_slice()).unwrap(); assert_eq!(res, vec![ 102, 104, 122, 173, 248, 98, 189, 119, 108, 143, 193, 139, 142, 159, 142, 32, 8, 151, 20, 133, 110, 226, 51, 179, 144, 42, 89, 29, 13, 95, 41, 37 ]); - - utils::tear_down_with_wallet(wallet_handle, "sign_with_address_works", &wallet_config); } } } @@ -873,7 +785,7 @@ mod medium_cases { #[test] fn register_payment_method_works_for_no_first_method() { - utils::setup("register_payment_method_works_for_no_first_method"); + let _ = Setup::empty(); let err = payments::register_payment_method(PAYMENT_METHOD_NAME, None, @@ -894,8 +806,6 @@ mod medium_cases { ).unwrap_err(); assert_eq!(ErrorCode::CommonInvalidParam3, err); - - utils::tear_down("register_payment_method_works_for_no_first_method"); } } @@ -904,26 +814,20 @@ mod medium_cases { #[test] fn create_payment_address_works_for_non_existent_plugin() { - let (wallet_handle, wallet_config) = setup("create_payment_address_works_for_non_existent_plugin"); - - let res = payments::create_payment_address(wallet_handle, EMPTY_OBJECT, WRONG_PAYMENT_METHOD_NAME); + let setup = Setup::payment_wallet(); + let res = payments::create_payment_address(setup.wallet_handle, EMPTY_OBJECT, WRONG_PAYMENT_METHOD_NAME); assert_code!(ErrorCode::UnknownPaymentMethod, res); - - utils::tear_down_with_wallet(wallet_handle, "create_payment_address_works_for_non_existent_plugin", &wallet_config); } #[test] fn create_payment_address_works_for_generic_error() { - let (wallet_handle, wallet_config) = setup("create_payment_address_works_for_generic_error"); + let setup = Setup::payment_wallet(); payments::mock_method::create_payment_address::inject_mock(ErrorCode::WalletAccessFailed, ""); - let err = payments::create_payment_address(wallet_handle, EMPTY_OBJECT, PAYMENT_METHOD_NAME); - + let err = payments::create_payment_address(setup.wallet_handle, EMPTY_OBJECT, PAYMENT_METHOD_NAME); assert_code!(ErrorCode::WalletAccessFailed, err); - - utils::tear_down_with_wallet(wallet_handle, "create_payment_address_works_for_generic_error", &wallet_config); } } @@ -932,13 +836,10 @@ mod medium_cases { #[test] fn list_payment_addresses_works_for_nonexistent_wallet() { - let (wallet_handle, wallet_config) = setup("list_payment_addresses_works_for_nonexistent_wallet"); + Setup::payment(); let err = payments::list_payment_addresses(INVALID_WALLET_HANDLE); - assert_code!(ErrorCode::WalletInvalidHandle, err); - - utils::tear_down_with_wallet(wallet_handle, "list_payment_addresses_works_for_nonexistent_wallet", &wallet_config); } } @@ -947,41 +848,35 @@ mod medium_cases { #[test] fn add_request_fees_works_for_non_existent_plugin_name() { - let (wallet_handle, wallet_config) = setup("add_request_fees_works_for_non_existent_plugin_name"); - let err = payments::add_request_fees(wallet_handle, + let setup = Setup::payment_wallet(); + let err = payments::add_request_fees(setup.wallet_handle, Some(IDENTIFIER), EMPTY_OBJECT, INPUTS_UNKNOWN_METHOD, EMPTY_ARRAY, None, ); - assert_code!(ErrorCode::UnknownPaymentMethod, err); - - utils::tear_down_with_wallet(wallet_handle, "add_request_fees_works_for_non_existent_plugin_name", &wallet_config); } #[test] fn add_request_fees_works_for_empty_inputs() { - let (wallet_handle, wallet_config) = setup("add_request_fees_works_for_empty_inputs"); + let setup = Setup::payment_wallet(); - let err = payments::add_request_fees(wallet_handle, + let err = payments::add_request_fees(setup.wallet_handle, Some(IDENTIFIER), EMPTY_OBJECT, EMPTY_ARRAY, CORRECT_OUTPUTS, None, ); - assert_code!( ErrorCode::CommonInvalidStructure, err); - - utils::tear_down_with_wallet(wallet_handle, "add_request_fees_works_for_empty_inputs", &wallet_config); } #[test] fn add_request_fees_works_for_no_method() { - let (wallet_handle, wallet_config) = setup("add_request_fees_works_for_no_method"); - let err = payments::add_request_fees(wallet_handle, + let setup = Setup::payment_wallet(); + let err = payments::add_request_fees(setup.wallet_handle, Some(IDENTIFIER), EMPTY_OBJECT, r#"["pay"]"#, @@ -990,14 +885,12 @@ mod medium_cases { ); assert_code!(ErrorCode::CommonInvalidStructure, err); - - utils::tear_down_with_wallet(wallet_handle, "add_request_fees_works_for_no_method", &wallet_config); } #[test] fn add_request_fees_works_for_several_methods_in_outputs() { - let (wallet_handle, wallet_config) = setup("add_request_fees_works_for_several_methods_in_outputs"); - let err = payments::add_request_fees(wallet_handle, + let setup = Setup::payment_wallet(); + let err = payments::add_request_fees(setup.wallet_handle, Some(IDENTIFIER), EMPTY_OBJECT, CORRECT_INPUTS, @@ -1006,14 +899,12 @@ mod medium_cases { ); assert_code!(ErrorCode::IncompatiblePaymentError, err); - - utils::tear_down_with_wallet(wallet_handle, "add_request_fees_works_for_several_methods_in_outputs", &wallet_config); } #[test] fn add_request_fees_works_for_several_methods_in_inputs() { - let (wallet_handle, wallet_config) = setup("add_request_fees_works_for_several_methods_in_inputs"); - let err = payments::add_request_fees(wallet_handle, + let setup = Setup::payment_wallet(); + let err = payments::add_request_fees(setup.wallet_handle, Some(IDENTIFIER), EMPTY_OBJECT, INCOMPATIBLE_INPUTS, @@ -1022,15 +913,13 @@ mod medium_cases { ); assert_code!(ErrorCode::IncompatiblePaymentError, err); - - utils::tear_down_with_wallet(wallet_handle, "add_request_fees_works_for_several_methods_in_inputs", &wallet_config); } #[test] fn add_request_fees_works_for_several_methods_with_inputs_and_outputs() { - let (wallet_handle, wallet_config) = setup("add_request_fees_works_for_several_methods_with_inputs_and_outputs"); + let setup = Setup::payment_wallet(); - let err = payments::add_request_fees(wallet_handle, + let err = payments::add_request_fees(setup.wallet_handle, Some(IDENTIFIER), EMPTY_OBJECT, r#"["pay:null1:1"]"#, @@ -1039,15 +928,13 @@ mod medium_cases { ); assert_code!(ErrorCode::IncompatiblePaymentError, err); - - utils::tear_down_with_wallet(wallet_handle, "add_request_fees_works_for_several_methods_with_inputs_and_outputs", &wallet_config); } #[test] fn add_request_fees_works_for_malformed_input() { - let (wallet_handle, wallet_config) = setup("add_request_fees_works_for_malformed_input"); + let setup = Setup::payment_wallet(); - let err = payments::add_request_fees(wallet_handle, + let err = payments::add_request_fees(setup.wallet_handle, Some(IDENTIFIER), EMPTY_OBJECT, r#"["pay:null1:1", 1]"#, @@ -1056,32 +943,27 @@ mod medium_cases { ); assert_code!(ErrorCode::CommonInvalidStructure, err); - - utils::tear_down_with_wallet(wallet_handle, "add_request_fees_works_for_malformed_input", &wallet_config); } #[test] fn add_request_fees_works_for_incorrect_payment_address() { - let (wallet_handle, wallet_config) = setup("add_request_fees_works_for_incorrect_payment_address"); + let setup = Setup::payment_wallet(); - let err = payments::add_request_fees(wallet_handle, + let err = payments::add_request_fees(setup.wallet_handle, Some(IDENTIFIER), EMPTY_OBJECT, r#"["pay:null1"]"#, EMPTY_ARRAY, None, ); - assert_code!(ErrorCode::CommonInvalidStructure, err); - - utils::tear_down_with_wallet(wallet_handle, "add_request_fees_works_for_incorrect_payment_address", &wallet_config); } #[test] fn add_request_fees_works_for_invalid_submitter_did() { - let (wallet_handle, wallet_config) = setup("add_request_fees_works_for_invalid_submitter_did"); + let setup = Setup::payment_wallet(); - let err = payments::add_request_fees(wallet_handle, + let err = payments::add_request_fees(setup.wallet_handle, Some(INVALID_IDENTIFIER), EMPTY_OBJECT, CORRECT_INPUTS, @@ -1090,15 +972,13 @@ mod medium_cases { ); assert_code!(ErrorCode::CommonInvalidStructure, err); - - utils::tear_down_with_wallet(wallet_handle, "add_request_fees_works_for_invalid_submitter_did", &wallet_config); } #[test] fn add_request_fees_works_for_several_equal_inputs() { - let (wallet_handle, wallet_config) = setup("add_request_fees_works_for_several_equal_inputs"); - let err = payments::add_request_fees(wallet_handle, + let setup = Setup::payment_wallet(); + let err = payments::add_request_fees(setup.wallet_handle, Some(IDENTIFIER), EMPTY_OBJECT, EQUAL_INPUTS, @@ -1107,33 +987,28 @@ mod medium_cases { ); assert_code!(ErrorCode::CommonInvalidStructure, err); - - utils::tear_down_with_wallet(wallet_handle, "add_request_fees_works_for_several_equal_inputs", &wallet_config); } #[test] fn add_request_fees_works_for_several_equal_outputs() { - let (wallet_handle, wallet_config) = setup("add_request_fees_works_for_several_equal_outputs"); - let err = payments::add_request_fees(wallet_handle, + let setup = Setup::payment_wallet(); + let err = payments::add_request_fees(setup.wallet_handle, Some(IDENTIFIER), EMPTY_OBJECT, CORRECT_INPUTS, EQUAL_OUTPUTS, None, ); - assert_code!(ErrorCode::CommonInvalidStructure, err); - - utils::tear_down_with_wallet(wallet_handle, "add_request_fees_works_for_several_equal_outputs", &wallet_config); } #[test] fn add_request_fees_works_for_generic_error() { - let (wallet_handle, wallet_config) = setup("add_request_fees_works_for_generic_error"); + let setup = Setup::payment_wallet(); payments::mock_method::add_request_fees::inject_mock(ErrorCode::WalletAccessFailed, ""); - let err = payments::add_request_fees(wallet_handle, + let err = payments::add_request_fees(setup.wallet_handle, Some(IDENTIFIER), EMPTY_OBJECT, CORRECT_INPUTS, @@ -1141,8 +1016,6 @@ mod medium_cases { None); assert_code!(ErrorCode::WalletAccessFailed, err); - - utils::tear_down_with_wallet(wallet_handle, "add_request_fees_works_for_generic_error", &wallet_config); } } @@ -1151,27 +1024,20 @@ mod medium_cases { #[test] pub fn parse_response_with_fees_works_for_nonexistent_plugin() { - utils::setup("parse_response_with_fees_works_for_nonexistent_plugin"); - payments::mock_method::init(); + Setup::payment(); let err = payments::parse_response_with_fees(WRONG_PAYMENT_METHOD_NAME, CORRECT_OUTPUTS); - assert_code!(ErrorCode::UnknownPaymentMethod, err); - - utils::tear_down("parse_response_with_fees_works_for_nonexistent_plugin"); } #[test] fn parse_response_with_fees_works_for_generic_error() { - let (wallet_handle, wallet_config) = setup("parse_response_with_fees_works_for_generic_error"); + Setup::payment(); payments::mock_method::parse_response_with_fees::inject_mock(ErrorCode::WalletAccessFailed, ""); let err = payments::parse_response_with_fees(PAYMENT_METHOD_NAME, EMPTY_OBJECT); - assert_code!(ErrorCode::WalletAccessFailed, err); - - utils::tear_down_with_wallet(wallet_handle, "parse_response_with_fees_works_for_generic_error", &wallet_config); } } @@ -1180,51 +1046,40 @@ mod medium_cases { #[test] pub fn build_get_payment_sources_request_works_for_nonexistent_plugin() { - let (wallet_handle, wallet_config) = setup("build_get_payment_sources_request_works_for_nonexistent_plugin"); - - let err = payments::build_get_payment_sources_request(wallet_handle, Some(IDENTIFIER), "pay:null1:test"); + let setup = Setup::payment_wallet(); + let err = payments::build_get_payment_sources_request(setup.wallet_handle, Some(IDENTIFIER), "pay:null1:test"); assert_code!(ErrorCode::UnknownPaymentMethod, err); - - utils::tear_down_with_wallet(wallet_handle, "build_get_payment_sources_request_works_for_nonexistent_plugin", &wallet_config); } #[test] pub fn build_get_payment_sources_request_works_for_malformed_payment_address() { - let (wallet_handle, wallet_config) = setup("build_get_payment_sources_request_works_for_malformed_payment_address"); - - let err = payments::build_get_payment_sources_request(wallet_handle, Some(IDENTIFIER), "pay:null1"); + let setup = Setup::payment_wallet(); + let err = payments::build_get_payment_sources_request(setup.wallet_handle, Some(IDENTIFIER), "pay:null1"); assert_code!(ErrorCode::IncompatiblePaymentError, err); - - utils::tear_down_with_wallet(wallet_handle, "build_get_payment_sources_request_works_for_malformed_payment_address", &wallet_config); } #[test] pub fn build_get_payment_sources_request_works_for_invalid_submitter_did() { - let (wallet_handle, wallet_config) = setup("build_get_payment_sources_request_works_for_invalid_submitter_did"); - - let err = payments::build_get_payment_sources_request(wallet_handle, Some(INVALID_IDENTIFIER), CORRECT_PAYMENT_ADDRESS); + let setup = Setup::payment_wallet(); + let err = payments::build_get_payment_sources_request(setup.wallet_handle, Some(INVALID_IDENTIFIER), CORRECT_PAYMENT_ADDRESS); assert_code!(ErrorCode::CommonInvalidStructure, err); - - utils::tear_down_with_wallet(wallet_handle, "build_get_payment_sources_request_works_for_invalid_submitter_did", &wallet_config); } #[test] fn build_get_payment_sources_request_works_for_generic_error() { - let (wallet_handle, wallet_config) = setup("build_get_payment_sources_request_works_for_generic_error"); + let setup = Setup::payment_wallet(); payments::mock_method::build_get_payment_sources_request::inject_mock(ErrorCode::WalletAccessFailed, ""); - let err = payments::build_get_payment_sources_request(wallet_handle, + let err = payments::build_get_payment_sources_request(setup.wallet_handle, Some(IDENTIFIER), CORRECT_PAYMENT_ADDRESS, ); assert_code!(ErrorCode::WalletAccessFailed, err); - - utils::tear_down_with_wallet(wallet_handle, "build_get_payment_sources_request_works_for_generic_error", &wallet_config); } } @@ -1233,64 +1088,51 @@ mod medium_cases { #[test] pub fn build_get_payment_sources_with_from_request_works_for_nonexistent_plugin() { - let (wallet_handle, wallet_config) = setup("build_get_payment_sources_with_from_request_works_for_nonexistent_plugin"); - - let err = payments::build_get_payment_sources_with_from_request(wallet_handle, Some(IDENTIFIER), "pay:null1:test", Some(1)); + let setup = Setup::payment_wallet(); + let err = payments::build_get_payment_sources_with_from_request(setup.wallet_handle, Some(IDENTIFIER), "pay:null1:test", Some(1)); assert_code!(ErrorCode::UnknownPaymentMethod, err); - - utils::tear_down_with_wallet(wallet_handle, "build_get_payment_sources_with_from_request_works_for_nonexistent_plugin", &wallet_config); } #[test] pub fn build_get_payment_sources_with_from_request_works_for_malformed_payment_address() { - let (wallet_handle, wallet_config) = setup("build_get_payment_sources_with_from_request_works_for_malformed_payment_address"); + let setup = Setup::payment_wallet(); - let err = payments::build_get_payment_sources_with_from_request(wallet_handle, Some(IDENTIFIER), "pay:null1", Some(1)); + let err = payments::build_get_payment_sources_with_from_request(setup.wallet_handle, Some(IDENTIFIER), "pay:null1", Some(1)); assert_code!(ErrorCode::IncompatiblePaymentError, err); - - utils::tear_down_with_wallet(wallet_handle, "build_get_payment_sources_with_from_request_works_for_malformed_payment_address", &wallet_config); } #[test] pub fn build_get_payment_sources_with_from_request_works_for_invalid_wallet_handle() { - let (wallet_handle, wallet_config) = setup("build_get_payment_sources_with_from_request_works_for_invalid_wallet_handle"); + Setup::payment(); payments::mock_method::build_get_payment_sources_request::inject_mock(ErrorCode::WalletInvalidHandle, ""); let err = payments::build_get_payment_sources_with_from_request(INVALID_WALLET_HANDLE, Some(IDENTIFIER), CORRECT_PAYMENT_ADDRESS, Some(1)); assert_code!(ErrorCode::WalletInvalidHandle, err); - - utils::tear_down_with_wallet(wallet_handle, "build_get_payment_sources_with_from_request_works_for_invalid_wallet_handle", &wallet_config); } #[test] pub fn build_get_payment_sources_with_from_request_works_for_invalid_submitter_did() { - let (wallet_handle, wallet_config) = setup("build_get_payment_sources_with_from_request_works_for_invalid_submitter_did"); - - let err = payments::build_get_payment_sources_with_from_request(wallet_handle, Some(INVALID_IDENTIFIER), CORRECT_PAYMENT_ADDRESS, Some(1)); + let setup = Setup::payment_wallet(); + let err = payments::build_get_payment_sources_with_from_request(setup.wallet_handle, Some(INVALID_IDENTIFIER), CORRECT_PAYMENT_ADDRESS, Some(1)); assert_code!(ErrorCode::CommonInvalidStructure, err); - - utils::tear_down_with_wallet(wallet_handle, "build_get_payment_sources_with_from_request_works_for_invalid_submitter_did", &wallet_config); } #[test] fn build_get_payment_sources_with_from_request_works_for_generic_error() { - let (wallet_handle, wallet_config) = setup("build_get_payment_sources_with_from_request_works_for_generic_error"); + let setup = Setup::payment_wallet(); payments::mock_method::build_get_payment_sources_request::inject_mock(ErrorCode::WalletAccessFailed, ""); - let err = payments::build_get_payment_sources_with_from_request(wallet_handle, + let err = payments::build_get_payment_sources_with_from_request(setup.wallet_handle, Some(IDENTIFIER), CORRECT_PAYMENT_ADDRESS, Some(1), ); - assert_code!(ErrorCode::WalletAccessFailed, err); - - utils::tear_down_with_wallet(wallet_handle, "build_get_payment_sources_with_from_request_works_for_generic_error", &wallet_config); } } @@ -1299,27 +1141,20 @@ mod medium_cases { #[test] pub fn parse_get_payment_sources_response_works_for_nonexistent_plugin() { - utils::setup("parse_get_payment_sources_response_works_for_nonexistent_plugin"); - payments::mock_method::init(); + Setup::payment(); let err = payments::parse_get_payment_sources_response(WRONG_PAYMENT_METHOD_NAME, CORRECT_OUTPUTS); - assert_code!(ErrorCode::UnknownPaymentMethod, err); - - utils::tear_down("parse_get_payment_sources_response_works_for_nonexistent_plugin"); } #[test] fn parse_get_payment_sources_response_works_for_generic_error() { - let (wallet_handle, wallet_config) = setup("parse_get_payment_sources_response_works_for_generic_error"); + Setup::payment(); payments::mock_method::parse_get_payment_sources_response::inject_mock(ErrorCode::WalletAccessFailed, "", -1); let err = payments::parse_get_payment_sources_response(PAYMENT_METHOD_NAME, EMPTY_OBJECT); - assert_code!(ErrorCode::WalletAccessFailed, err); - - utils::tear_down_with_wallet(wallet_handle, "parse_get_payment_sources_response_works_for_generic_error", &wallet_config); } } @@ -1328,27 +1163,22 @@ mod medium_cases { #[test] pub fn parse_get_payment_sources_with_from_response_works_for_nonexistent_plugin() { - utils::setup("parse_get_payment_sources_with_from_response_works_for_nonexistent_plugin"); - payments::mock_method::init(); + Setup::payment(); let err = payments::parse_get_payment_sources_with_from_response(WRONG_PAYMENT_METHOD_NAME, CORRECT_OUTPUTS); assert_code!(ErrorCode::UnknownPaymentMethod, err); - - utils::tear_down("parse_get_payment_sources_with_from_response_works_for_nonexistent_plugin"); } #[test] fn parse_get_payment_sources_with_from_response_works_for_generic_error() { - let (wallet_handle, wallet_config) = setup("parse_get_payment_sources_with_from_response_works_for_generic_error"); + Setup::payment(); payments::mock_method::parse_get_payment_sources_response::inject_mock(ErrorCode::WalletAccessFailed, "", -1); let err = payments::parse_get_payment_sources_with_from_response(PAYMENT_METHOD_NAME, EMPTY_OBJECT); assert_code!(ErrorCode::WalletAccessFailed, err); - - utils::tear_down_with_wallet(wallet_handle, "parse_get_payment_sources_with_from_response_works_for_generic_error", &wallet_config); } } @@ -1357,194 +1187,164 @@ mod medium_cases { #[test] fn build_payment_request_works_for_invalid_submitter_did() { - let (wallet_handle, wallet_config) = setup("build_payment_request_works_for_invalid_submitter_did"); + let setup = Setup::payment_wallet(); - let res = payments::build_payment_req(wallet_handle, + let res = payments::build_payment_req(setup.wallet_handle, Some(INVALID_IDENTIFIER), CORRECT_INPUTS, CORRECT_OUTPUTS, None); assert_code!(ErrorCode::CommonInvalidStructure, res); - - utils::tear_down_with_wallet(wallet_handle, "build_payment_request_works_for_invalid_submitter_did", &wallet_config); } #[test] fn build_payment_request_works_for_empty_inputs() { - let (wallet_handle, wallet_config) = setup("build_payment_request_works_for_empty_inputs"); + let setup = Setup::payment_wallet(); - let err = payments::build_payment_req(wallet_handle, + let err = payments::build_payment_req(setup.wallet_handle, Some(IDENTIFIER), EMPTY_ARRAY, CORRECT_OUTPUTS, None, ); - assert_code!(ErrorCode::CommonInvalidStructure, err); - - utils::tear_down_with_wallet(wallet_handle, "build_payment_request_works_for_empty_inputs", &wallet_config); } #[test] fn build_payment_request_works_for_empty_outputs() { - let (wallet_handle, wallet_config) = setup("build_payment_request_works_for_empty_outputs"); + let setup = Setup::payment_wallet(); - let err = payments::build_payment_req(wallet_handle, + let err = payments::build_payment_req(setup.wallet_handle, Some(IDENTIFIER), CORRECT_INPUTS, EMPTY_ARRAY, None, ); - assert_code!(ErrorCode::CommonInvalidStructure, err); - - utils::tear_down_with_wallet(wallet_handle, "build_payment_request_works_for_empty_outputs", &wallet_config); } #[test] fn build_payment_request_works_for_unknown_payment_method() { - let (wallet_handle, wallet_config) = setup("build_payment_request_works_for_unknown_payment_method"); + let setup = Setup::payment_wallet(); - let res = payments::build_payment_req(wallet_handle, + let res = payments::build_payment_req(setup.wallet_handle, Some(IDENTIFIER), INPUTS_UNKNOWN_METHOD, OUTPUTS_UNKNOWN_METHOD, None); assert_code!(ErrorCode::UnknownPaymentMethod, res); - - utils::tear_down_with_wallet(wallet_handle, "build_payment_request_works_for_unknown_payment_method", &wallet_config); } #[test] fn build_payment_request_works_for_invalid_input_payment_address() { - let (wallet_handle, wallet_config) = setup("build_payment_request_works_for_invalid_input_payment_address"); + let setup = Setup::payment_wallet(); let inputs = r#"["pay:null"]"#; - let res = payments::build_payment_req(wallet_handle, + let res = payments::build_payment_req(setup.wallet_handle, Some(IDENTIFIER), inputs, CORRECT_OUTPUTS, None); assert_code!(ErrorCode::CommonInvalidStructure, res); - - utils::tear_down_with_wallet(wallet_handle, "build_payment_request_works_for_invalid_input_payment_address", &wallet_config); } #[test] fn build_payment_request_works_for_incompatible_input_payment_methods() { - let (wallet_handle, wallet_config) = setup("build_payment_request_works_for_incompatible_input_payment_methods"); + let setup = Setup::payment_wallet(); - let res = payments::build_payment_req(wallet_handle, + let res = payments::build_payment_req(setup.wallet_handle, Some(IDENTIFIER), INCOMPATIBLE_INPUTS, CORRECT_OUTPUTS, None); assert_code!(ErrorCode::IncompatiblePaymentError, res); - - utils::tear_down_with_wallet(wallet_handle, "build_payment_request_works_for_incompatible_input_payment_methods", &wallet_config); } #[test] fn build_payment_request_works_for_incompatible_output_payment_methods() { - let (wallet_handle, wallet_config) = setup("build_payment_request_works_for_incompatible_output_payment_methods"); + let setup = Setup::payment_wallet(); - let res = payments::build_payment_req(wallet_handle, + let res = payments::build_payment_req(setup.wallet_handle, Some(IDENTIFIER), CORRECT_INPUTS, INCOMPATIBLE_OUTPUTS, None); assert_code!(ErrorCode::IncompatiblePaymentError, res); - - utils::tear_down_with_wallet(wallet_handle, "build_payment_request_works_for_incompatible_output_payment_methods", &wallet_config); } #[test] fn build_payment_request_works_for_incompatible_input_output_payment_methods() { - let (wallet_handle, wallet_config) = setup("build_payment_request_works_for_incompatible_input_output_payment_methods"); + let setup = Setup::payment_wallet(); let inputs = r#"["pay:PAYMENT_METHOD_1:1"]"#; let outputs = r#"[{"recipient": "pay:PAYMENT_METHOD_2:1", "amount": 1}]"#; - let res = payments::build_payment_req(wallet_handle, + let res = payments::build_payment_req(setup.wallet_handle, Some(IDENTIFIER), inputs, outputs, None); - assert_code!(ErrorCode::IncompatiblePaymentError, res); - - utils::tear_down_with_wallet(wallet_handle, "build_payment_request_works_for_incompatible_input_output_payment_methods", &wallet_config); } #[test] fn build_payment_request_works_for_invalid_inputs_format() { - let (wallet_handle, wallet_config) = setup("build_payment_request_works_for_invalid_inputs_format"); + let setup = Setup::payment_wallet(); - let res = payments::build_payment_req(wallet_handle, + let res = payments::build_payment_req(setup.wallet_handle, Some(IDENTIFIER), INPUTS_INVALID_FORMAT, CORRECT_OUTPUTS, None); - assert_code!(ErrorCode::CommonInvalidStructure, res); - - utils::tear_down_with_wallet(wallet_handle, "build_payment_request_works_for_invalid_inputs_format", &wallet_config); } #[test] fn build_payment_request_works_for_invalid_outputs_format() { - let (wallet_handle, wallet_config) = setup("build_payment_request_works_for_invalid_outputs_format"); + let setup = Setup::payment_wallet(); - let res = payments::build_payment_req(wallet_handle, + let res = payments::build_payment_req(setup.wallet_handle, Some(IDENTIFIER), CORRECT_INPUTS, OUTPUTS_INVALID_FORMAT, None); - assert_code!(ErrorCode::CommonInvalidStructure, res); - - utils::tear_down_with_wallet(wallet_handle, "build_payment_request_works_for_invalid_outputs_format", &wallet_config); } #[test] fn build_payment_request_works_for_several_equal_inputs() { - let (wallet_handle, wallet_config) = setup("build_payment_request_works_for_several_equal_inputs"); + let setup = Setup::payment_wallet(); - let res = payments::build_payment_req(wallet_handle, + let res = payments::build_payment_req(setup.wallet_handle, Some(IDENTIFIER), EQUAL_INPUTS, CORRECT_OUTPUTS, None, ); - assert_code!(ErrorCode::CommonInvalidStructure, res); - utils::tear_down_with_wallet(wallet_handle, "build_payment_request_works_for_several_equal_inputs", &wallet_config); } #[test] fn build_payment_request_works_for_several_equal_outputs() { - let (wallet_handle, wallet_config) = setup("build_payment_request_works_for_several_equal_outputs"); + let setup = Setup::payment_wallet(); - let res = payments::build_payment_req(wallet_handle, + let res = payments::build_payment_req(setup.wallet_handle, Some(IDENTIFIER), CORRECT_INPUTS, EQUAL_OUTPUTS, None, ); - assert_code!(ErrorCode::CommonInvalidStructure, res); - - utils::tear_down_with_wallet(wallet_handle, "build_payment_request_works_for_several_equal_outputs", &wallet_config); } #[test] fn build_payment_request_works_for_generic_error() { - let (wallet_handle, wallet_config) = setup("build_payment_request_works_for_generic_error"); + let setup = Setup::payment_wallet(); payments::mock_method::build_payment_req::inject_mock(ErrorCode::WalletAccessFailed, ""); - let err = payments::build_payment_req(wallet_handle, + let err = payments::build_payment_req(setup.wallet_handle, Some(IDENTIFIER), CORRECT_INPUTS, CORRECT_OUTPUTS, @@ -1552,8 +1352,6 @@ mod medium_cases { ); assert_code!(ErrorCode::WalletAccessFailed, err); - - utils::tear_down_with_wallet(wallet_handle, "build_payment_request_works_for_generic_error", &wallet_config); } } @@ -1562,28 +1360,21 @@ mod medium_cases { #[test] fn parse_payment_response_works_for_unknown_payment_method() { - utils::setup("parse_payment_response_works_for_unknown_payment_method"); - payments::mock_method::init(); + Setup::payment(); let res = payments::parse_payment_response(WRONG_PAYMENT_METHOD_NAME, PAYMENT_RESPONSE); - assert_code!(ErrorCode::UnknownPaymentMethod, res); - - utils::tear_down("parse_payment_response_works_for_unknown_payment_method"); } #[test] fn parse_payment_response_works_for_generic_error() { - let (wallet_handle, wallet_config) = setup("parse_payment_response_works_for_generic_error"); + Setup::payment(); payments::mock_method::parse_payment_response::inject_mock(ErrorCode::WalletAccessFailed, ""); let err = payments::parse_payment_response(PAYMENT_METHOD_NAME, EMPTY_OBJECT); - assert_code!(ErrorCode::WalletAccessFailed, err); - - utils::tear_down_with_wallet(wallet_handle, "parse_payment_response_works_for_generic_error", &wallet_config); } } @@ -1592,115 +1383,98 @@ mod medium_cases { #[test] fn build_mint_request_works_for_empty_outputs() { - let (wallet_handle, wallet_config) = setup("build_mint_request_works_for_empty_outputs"); + let setup = Setup::payment_wallet(); - let res = payments::build_mint_req(wallet_handle, + let res = payments::build_mint_req(setup.wallet_handle, Some(IDENTIFIER), EMPTY_ARRAY, None); assert_code!(ErrorCode::CommonInvalidStructure, res); - - utils::tear_down_with_wallet(wallet_handle, "build_mint_request_works_for_empty_outputs", &wallet_config); } #[test] fn build_mint_request_works_for_unknown_payment_method() { - let (wallet_handle, wallet_config) = setup("build_mint_request_works_for_unknown_payment_method"); + let setup = Setup::payment_wallet(); - let res = payments::build_mint_req(wallet_handle, + let res = payments::build_mint_req(setup.wallet_handle, Some(IDENTIFIER), OUTPUTS_UNKNOWN_METHOD, None); assert_code!(ErrorCode::UnknownPaymentMethod, res); - - utils::tear_down_with_wallet(wallet_handle, "build_mint_request_works_for_unknown_payment_method", &wallet_config); } #[test] fn build_mint_request_works_for_invalid_submitter_did() { - let (wallet_handle, wallet_config) = setup("build_mint_request_works_for_invalid_submitter_did"); + let setup = Setup::payment_wallet(); - let res = payments::build_mint_req(wallet_handle, + let res = payments::build_mint_req(setup.wallet_handle, Some(INVALID_IDENTIFIER), CORRECT_OUTPUTS, None); assert_code!(ErrorCode::CommonInvalidStructure, res); - - utils::tear_down_with_wallet(wallet_handle, "build_mint_request_works_for_invalid_submitter_did", &wallet_config); } #[test] fn build_mint_request_works_for_invalid_outputs_format() { - let (wallet_handle, wallet_config) = setup("build_mint_request_works_for_invalid_outputs_format"); + let setup = Setup::payment_wallet(); - let res = payments::build_mint_req(wallet_handle, + let res = payments::build_mint_req(setup.wallet_handle, Some(IDENTIFIER), OUTPUTS_INVALID_FORMAT, None); assert_code!(ErrorCode::CommonInvalidStructure, res); - - utils::tear_down_with_wallet(wallet_handle, "build_mint_request_works_for_invalid_outputs_format", &wallet_config); } #[test] fn build_mint_request_works_for_invalid_output_payment_address() { - let (wallet_handle, wallet_config) = setup("build_mint_request_works_for_invalid_output_payment_address"); + let setup = Setup::payment_wallet(); let outputs = r#"[{"recipient": "pay:null", "amount":1, "extra":"1"}]"#; - let res = payments::build_mint_req(wallet_handle, + let res = payments::build_mint_req(setup.wallet_handle, Some(IDENTIFIER), outputs, None); assert_code!(ErrorCode::CommonInvalidStructure, res); - - utils::tear_down_with_wallet(wallet_handle, "build_mint_request_works_for_invalid_output_payment_address", &wallet_config); } #[test] fn build_mint_request_works_for_several_equal_outputs() { - let (wallet_handle, wallet_config) = setup("build_mint_request_works_for_several_equal_outputs"); + let setup = Setup::payment_wallet(); - let res = payments::build_mint_req(wallet_handle, + let res = payments::build_mint_req(setup.wallet_handle, Some(IDENTIFIER), EQUAL_OUTPUTS, None); assert_code!(ErrorCode::CommonInvalidStructure, res); - - utils::tear_down_with_wallet(wallet_handle, "build_mint_request_works_for_several_equal_outputs", &wallet_config); } #[test] fn build_mint_request_works_for_incompatible_output_payment_methods() { - let (wallet_handle, wallet_config) = setup("build_mint_request_works_for_incompatible_output_payment_methods"); - let res = payments::build_mint_req(wallet_handle, + let setup = Setup::payment_wallet(); + let err = payments::build_mint_req(setup.wallet_handle, Some(IDENTIFIER), INCOMPATIBLE_OUTPUTS, None); - - assert_code!(ErrorCode::IncompatiblePaymentError, res); - - utils::tear_down_with_wallet(wallet_handle, "build_mint_request_works_for_incompatible_output_payment_methods", &wallet_config); + assert_code!(ErrorCode::IncompatiblePaymentError, err); } #[test] fn build_mint_request_works_for_generic_error() { - let (wallet_handle, wallet_config) = setup("build_mint_request_works_for_generic_error"); + let setup = Setup::payment_wallet(); payments::mock_method::build_mint_req::inject_mock(ErrorCode::WalletAccessFailed, ""); - let err = payments::build_mint_req(wallet_handle, + let err = payments::build_mint_req(setup.wallet_handle, Some(IDENTIFIER), CORRECT_OUTPUTS, None, ); assert_code!(ErrorCode::WalletAccessFailed, err); - - utils::tear_down_with_wallet(wallet_handle, "build_mint_request_works_for_generic_error", &wallet_config); } } @@ -1709,62 +1483,54 @@ mod medium_cases { #[test] fn build_set_txn_fees_request_works_for_unknown_payment_method() { - let (wallet_handle, wallet_config) = setup("build_set_txn_fees_request_works_for_unknown_payment_method"); + let setup = Setup::payment_wallet(); - let res = payments::build_set_txn_fees_req(wallet_handle, + let res = payments::build_set_txn_fees_req(setup.wallet_handle, Some(IDENTIFIER), WRONG_PAYMENT_METHOD_NAME, CORRECT_FEES); assert_code!(ErrorCode::UnknownPaymentMethod, res); - - utils::tear_down_with_wallet(wallet_handle, "build_set_txn_fees_request_works_for_unknown_payment_method", &wallet_config); } #[test] fn build_set_txn_fees_request_works_for_invalid_submitter_did() { - let (wallet_handle, wallet_config) = setup("build_set_txn_fees_request_works_for_invalid_submitter_did"); + let setup = Setup::payment_wallet(); - let res = payments::build_set_txn_fees_req(wallet_handle, + let res = payments::build_set_txn_fees_req(setup.wallet_handle, Some(INVALID_IDENTIFIER), PAYMENT_METHOD_NAME, CORRECT_FEES); assert_code!(ErrorCode::CommonInvalidStructure, res); - - utils::tear_down_with_wallet(wallet_handle, "build_set_txn_fees_request_works_for_invalid_submitter_did", &wallet_config); } #[test] fn build_set_txn_fees_request_works_for_invalid_fees_format() { - let (wallet_handle, wallet_config) = setup("build_set_txn_fees_request_works_for_invalid_fees_format"); + let setup = Setup::payment_wallet(); let fees = r#"[txnType1:1, txnType2:2]"#; - let res = payments::build_set_txn_fees_req(wallet_handle, + let res = payments::build_set_txn_fees_req(setup.wallet_handle, Some(IDENTIFIER), PAYMENT_METHOD_NAME, fees); assert_code!(ErrorCode::CommonInvalidStructure, res); - - utils::tear_down_with_wallet(wallet_handle, "build_set_txn_fees_request_works_for_invalid_fees_format", &wallet_config); } #[test] fn build_set_txn_fees_request_works_for_generic_error() { - let (wallet_handle, wallet_config) = setup("build_set_txn_fees_request_works_for_generic_error"); + let setup = Setup::payment_wallet(); payments::mock_method::build_set_txn_fees_req::inject_mock(ErrorCode::WalletAccessFailed, ""); - let err = payments::build_set_txn_fees_req(wallet_handle, + let err = payments::build_set_txn_fees_req(setup.wallet_handle, Some(IDENTIFIER), PAYMENT_METHOD_NAME, CORRECT_FEES, ); assert_code!(ErrorCode::WalletAccessFailed, err); - - utils::tear_down_with_wallet(wallet_handle, "build_set_txn_fees_request_works_for_generic_error", &wallet_config); } } @@ -1773,44 +1539,38 @@ mod medium_cases { #[test] fn build_get_txn_fees_request_works_for_invalid_submitter_did() { - let (wallet_handle, wallet_config) = setup("build_get_txn_fees_request_works_for_invalid_submitter_did"); + let setup = Setup::payment_wallet(); - let res = payments::build_get_txn_fees_req(wallet_handle, + let res = payments::build_get_txn_fees_req(setup.wallet_handle, Some(INVALID_IDENTIFIER), PAYMENT_METHOD_NAME); assert_code!(ErrorCode::CommonInvalidStructure, res); - - utils::tear_down_with_wallet(wallet_handle, "build_get_txn_fees_request_works_for_invalid_submitter_did", &wallet_config); } #[test] fn build_get_txn_fees_request_works_for_unknown_payment_method() { - let (wallet_handle, wallet_config) = setup("build_get_txn_fees_request_works_for_unknown_payment_method"); + let setup = Setup::payment_wallet(); - let res = payments::build_get_txn_fees_req(wallet_handle, + let res = payments::build_get_txn_fees_req(setup.wallet_handle, Some(IDENTIFIER), WRONG_PAYMENT_METHOD_NAME); assert_code!(ErrorCode::UnknownPaymentMethod, res); - - utils::tear_down_with_wallet(wallet_handle, "build_get_txn_fees_request_works_for_unknown_payment_method", &wallet_config); } #[test] fn build_get_txn_fees_request_works_for_generic_error() { - let (wallet_handle, wallet_config) = setup("build_get_txn_fees_request_works_for_generic_error"); + let setup = Setup::payment_wallet(); payments::mock_method::build_get_txn_fees_req::inject_mock(ErrorCode::WalletAccessFailed, ""); - let err = payments::build_get_txn_fees_req(wallet_handle, + let err = payments::build_get_txn_fees_req(setup.wallet_handle, Some(IDENTIFIER), PAYMENT_METHOD_NAME, ); assert_code!(ErrorCode::WalletAccessFailed, err); - - utils::tear_down_with_wallet(wallet_handle, "build_get_txn_fees_request_works_for_generic_error", &wallet_config); } } @@ -1819,28 +1579,23 @@ mod medium_cases { #[test] fn parse_get_txn_fees_response_works_for_unknown_payment_method() { - utils::setup("parse_get_txn_fees_response_works_for_unknown_payment_method"); - payments::mock_method::init(); + Setup::payment(); let res = payments::parse_get_txn_fees_response(WRONG_PAYMENT_METHOD_NAME, GET_TXN_FEES_RESPONSE); assert_code!(ErrorCode::UnknownPaymentMethod, res); - - utils::tear_down("parse_get_txn_fees_response_works_for_unknown_payment_method"); } #[test] fn parse_get_txn_fees_response_works_for_generic_error() { - let (wallet_handle, wallet_config) = setup("parse_get_txn_fees_response_works_for_generic_error"); + Setup::payment(); payments::mock_method::parse_get_txn_fees_response::inject_mock(ErrorCode::WalletAccessFailed, ""); let err = payments::parse_get_txn_fees_response(PAYMENT_METHOD_NAME, EMPTY_OBJECT); assert_code!(ErrorCode::WalletAccessFailed, err); - - utils::tear_down_with_wallet(wallet_handle, "parse_get_txn_fees_response_works_for_generic_error", &wallet_config); } } @@ -1849,55 +1604,47 @@ mod medium_cases { #[test] pub fn build_verify_payment_req_works_for_incorrect_payment_method() { - let (wallet_handle, wallet_config) = setup("build_verify_payment_req_works_for_incorrect_payment_method"); + let setup = Setup::payment_wallet(); payments::mock_method::build_verify_payment_req::inject_mock(ErrorCode::Success, TEST_RES_STRING); - let ec = payments::build_verify_payment_req(wallet_handle, Some(IDENTIFIER), "pay:null1:test"); + let ec = payments::build_verify_payment_req(setup.wallet_handle, Some(IDENTIFIER), "pay:null1:test"); assert_code!(ErrorCode::UnknownPaymentMethod, ec); - - utils::tear_down_with_wallet(wallet_handle, "build_verify_payment_req_works_for_incorrect_payment_method", &wallet_config); } #[test] pub fn build_verify_payment_req_works_for_incorrect_payment_address() { - let (wallet_handle, wallet_config) = setup("build_verify_payment_req_works_for_incorrect_payment_address"); + let setup = Setup::payment_wallet(); payments::mock_method::build_verify_payment_req::inject_mock(ErrorCode::Success, TEST_RES_STRING); - let ec = payments::build_verify_payment_req(wallet_handle, Some(IDENTIFIER), "pay:null1"); + let ec = payments::build_verify_payment_req(setup.wallet_handle, Some(IDENTIFIER), "pay:null1"); assert_code!(ErrorCode::IncompatiblePaymentError, ec); - - utils::tear_down_with_wallet(wallet_handle, "build_verify_payment_req_works_for_incorrect_payment_address", &wallet_config); } #[test] pub fn build_verify_payment_req_works_for_invalid_submitter_did() { - let (wallet_handle, wallet_config) = setup("build_verify_payment_req_works_for_invalid_submitter_did"); + let setup = Setup::payment_wallet(); - let err = payments::build_verify_payment_req(wallet_handle, Some(INVALID_IDENTIFIER), CORRECT_PAYMENT_ADDRESS); + let err = payments::build_verify_payment_req(setup.wallet_handle, Some(INVALID_IDENTIFIER), CORRECT_PAYMENT_ADDRESS); assert_code!(ErrorCode::CommonInvalidStructure, err); - - utils::tear_down_with_wallet(wallet_handle, "build_verify_payment_req_works_for_invalid_submitter_did", &wallet_config); } #[test] fn build_verify_payment_req_works_for_generic_error() { - let (wallet_handle, wallet_config) = setup("build_verify_payment_req_works_for_generic_error"); + Setup::payment(); payments::mock_method::build_verify_payment_req::inject_mock(ErrorCode::WalletAccessFailed, ""); - let err = payments::build_verify_payment_req(wallet_handle, + let err = payments::build_verify_payment_req(INVALID_WALLET_HANDLE, Some(IDENTIFIER), CORRECT_PAYMENT_ADDRESS, ); assert_code!(ErrorCode::WalletAccessFailed, err); - - utils::tear_down_with_wallet(wallet_handle, "build_verify_payment_req_works_for_generic_error", &wallet_config); } } @@ -1906,27 +1653,22 @@ mod medium_cases { #[test] pub fn parse_verify_payment_response_works_for_nonexistent_plugin() { - utils::setup("parse_verify_payment_response_works_for_nonexistent_plugin"); - payments::mock_method::init(); + Setup::payment(); let err = payments::parse_verify_payment_response(WRONG_PAYMENT_METHOD_NAME, CORRECT_OUTPUTS); assert_code!(ErrorCode::UnknownPaymentMethod, err); - - utils::tear_down("parse_verify_payment_response_works_for_nonexistent_plugin"); } #[test] fn parse_verify_payment_response_works_for_generic_error() { - let (wallet_handle, wallet_config) = setup("parse_verify_payment_response_works_for_generic_error"); + Setup::payment(); payments::mock_method::parse_verify_payment_response::inject_mock(ErrorCode::WalletAccessFailed, ""); let err = payments::parse_verify_payment_response(PAYMENT_METHOD_NAME, EMPTY_OBJECT); assert_code!(ErrorCode::WalletAccessFailed, err); - - utils::tear_down_with_wallet(wallet_handle, "parse_verify_payment_response_works_for_generic_error", &wallet_config); } } @@ -1935,49 +1677,38 @@ mod medium_cases { #[test] pub fn sign_with_address_fails_for_nonexistent_plugin() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("sign_with_address_fails_for_nonexistent_plugin"); - payments::mock_method::init(); + let setup = Setup::payment_wallet(); - let err = payments::sign_with_address(wallet_handle, "pay:123:kill", vec![33].as_slice()); + let err = payments::sign_with_address(setup.wallet_handle, "pay:123:kill", vec![33].as_slice()); assert_code!(ErrorCode::UnknownPaymentMethod, err); - - utils::tear_down_with_wallet(wallet_handle, "sign_with_address_fails_for_nonexistent_plugin", &wallet_config); } #[test] pub fn sign_with_address_fails_for_no_payment_address() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("sign_with_address_fails_for_no_payment_address"); - payments::mock_method::init(); + let setup = Setup::payment_wallet(); - let err = payments::sign_with_address(wallet_handle, "", vec![33].as_slice()); + let err = payments::sign_with_address(setup.wallet_handle, "", vec![33].as_slice()); assert_code!(ErrorCode::CommonInvalidParam3, err); - - utils::tear_down_with_wallet(wallet_handle, "sign_with_address_fails_for_no_payment_address", &wallet_config); } #[test] pub fn sign_with_address_fails_for_no_message() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("sign_with_address_fails_for_no_addressn"); - payments::mock_method::init(); + let setup = Setup::payment_wallet(); - let err = payments::sign_with_address(wallet_handle, CORRECT_PAYMENT_ADDRESS, vec![].as_slice()); + let err = payments::sign_with_address(setup.wallet_handle, CORRECT_PAYMENT_ADDRESS, vec![].as_slice()); assert_code!(ErrorCode::CommonInvalidParam5, err); - - utils::tear_down_with_wallet(wallet_handle, "sign_with_address_fails_for_no_addressn", &wallet_config); } #[test] pub fn sign_with_address_for_incorrect_payment_address() { - let (wallet_handle, wallet_config) = setup("sign_with_address_for_incorrect_payment_address"); + let setup = Setup::payment_wallet(); - let ec = payments::sign_with_address(wallet_handle, "pay:null1", vec![33].as_slice()); + let ec = payments::sign_with_address(setup.wallet_handle, "pay:null1", vec![33].as_slice()); assert_code!(ErrorCode::IncompatiblePaymentError, ec); - - utils::tear_down_with_wallet(wallet_handle, "sign_with_address_for_incorrect_payment_address", &wallet_config); } } @@ -1986,66 +1717,55 @@ mod medium_cases { #[test] pub fn verify_with_address_fails_for_nonexistent_plugin() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("verify_with_address_fails_for_nonexistent_plugin"); - payments::mock_method::init(); + Setup::payment(); let err = payments::verify_with_address("pay:123:kill", vec![33].as_slice(), vec![33].as_slice()); assert_code!(ErrorCode::UnknownPaymentMethod, err); - - utils::tear_down_with_wallet(wallet_handle, "verify_with_address_fails_for_nonexistent_plugin", &wallet_config); } #[test] pub fn verify_with_address_for_incorrect_payment_address() { - let (wallet_handle, wallet_config) = setup("verify_with_address_for_incorrect_payment_address"); + Setup::payment(); payments::mock_method::verify_with_address::inject_mock(ErrorCode::Success, true); let ec = payments::verify_with_address("pay:null1", vec![33].as_slice(), vec![33].as_slice()); assert_code!(ErrorCode::IncompatiblePaymentError, ec); - - utils::tear_down_with_wallet(wallet_handle, "verify_with_address_for_incorrect_payment_address", &wallet_config); } #[test] pub fn verify_with_address_for_no_payment_address() { - let (wallet_handle, wallet_config) = setup("verify_with_address_for_no_payment_address"); + Setup::payment(); payments::mock_method::verify_with_address::inject_mock(ErrorCode::Success, true); let ec = payments::verify_with_address("", vec![33].as_slice(), vec![33].as_slice()); assert_code!(ErrorCode::CommonInvalidParam2, ec); - - utils::tear_down_with_wallet(wallet_handle, "verify_with_address_for_no_payment_address", &wallet_config); } #[test] pub fn verify_with_address_for_no_message() { - let (wallet_handle, wallet_config) = setup("verify_with_address_for_no_message"); + Setup::payment(); payments::mock_method::verify_with_address::inject_mock(ErrorCode::Success, true); let ec = payments::verify_with_address(CORRECT_PAYMENT_ADDRESS, vec![].as_slice(), vec![33].as_slice()); assert_code!(ErrorCode::CommonInvalidParam4, ec); - - utils::tear_down_with_wallet(wallet_handle, "verify_with_address_for_no_message", &wallet_config); } #[test] pub fn verify_with_address_for_no_signature() { - let (wallet_handle, wallet_config) = setup("verify_with_address_for_no_signature"); + Setup::payment(); payments::mock_method::verify_with_address::inject_mock(ErrorCode::Success, true); let ec = payments::verify_with_address(CORRECT_PAYMENT_ADDRESS, vec![33].as_slice(), vec![].as_slice()); assert_code!(ErrorCode::CommonInvalidParam6, ec); - - utils::tear_down_with_wallet(wallet_handle, "verify_with_address_for_no_signature", &wallet_config); } } } diff --git a/libindy/tests/utils/did.rs b/libindy/tests/utils/did.rs index 28097e8b11..4ebdec5dc9 100644 --- a/libindy/tests/utils/did.rs +++ b/libindy/tests/utils/did.rs @@ -9,22 +9,21 @@ use utils::types::ResponseType; use api::PoolHandle; -pub fn create_store_and_publish_my_did_from_trustee(wallet_handle: i32, pool_handle: PoolHandle) -> Result<(String, String), IndyError> { +pub fn create_store_and_publish_did(wallet_handle: i32, pool_handle: PoolHandle, role: &str) -> Result<(String, String), IndyError> { let (trustee_did, _) = create_and_store_my_did(wallet_handle, Some(::utils::constants::TRUSTEE_SEED))?; - let (my_did, my_vk) = create_and_store_my_did(wallet_handle, None)?; - let nym = ledger::build_nym_request(&trustee_did, &my_did, Some(&my_vk), None, Some("TRUSTEE"))?; + let (did, vk) = create_and_store_my_did(wallet_handle, None)?; + let nym = ledger::build_nym_request(&trustee_did, &did, Some(&vk), None, Some(role))?; let response = ledger::sign_and_submit_request(pool_handle, wallet_handle, &trustee_did, &nym)?; pool::check_response_type(&response, ResponseType::REPLY); - Ok((my_did, my_vk)) + Ok((did, vk)) +} + +pub fn create_store_and_publish_my_did_from_trustee(wallet_handle: i32, pool_handle: PoolHandle) -> Result<(String, String), IndyError> { + create_store_and_publish_did(wallet_handle, pool_handle, "TRUSTEE") } pub fn create_store_and_publish_my_did_from_steward(wallet_handle: i32, pool_handle: PoolHandle) -> Result<(String, String), IndyError> { - let (trustee_did, _) = create_and_store_my_did(wallet_handle, Some(::utils::constants::TRUSTEE_SEED))?; - let (my_did, my_vk) = create_and_store_my_did(wallet_handle, None)?; - let nym = ledger::build_nym_request(&trustee_did, &my_did, Some(&my_vk), None, Some("STEWARD"))?; - let response = ledger::sign_and_submit_request(pool_handle, wallet_handle, &trustee_did, &nym)?; - pool::check_response_type(&response, ResponseType::REPLY); - Ok((my_did, my_vk)) + create_store_and_publish_did(wallet_handle, pool_handle, "STEWARD") } pub fn create_and_store_my_did(wallet_handle: i32, seed: Option<&str>) -> Result<(String, String), IndyError> { diff --git a/libindy/tests/utils/mod.rs b/libindy/tests/utils/mod.rs index ee75277726..e98757cfdd 100644 --- a/libindy/tests/utils/mod.rs +++ b/libindy/tests/utils/mod.rs @@ -52,6 +52,13 @@ pub fn setup(name: &str) { logger::set_default_logger(); } +pub fn setup_() -> String { + let name = ::utils::rand_utils::get_rand_string(10); + test::cleanup_storage(&name); + logger::set_default_logger(); + name +} + pub fn tear_down_delete_wallet(wallet_config: &str) { wallet::delete_wallet(wallet_config, WALLET_CREDENTIALS).unwrap(); } @@ -69,6 +76,119 @@ pub fn setup_with_wallet(name: &str) -> (i32, String) { wallet::create_and_open_default_wallet(name).unwrap() } +pub struct Setup { + pub name: String, + pub wallet_config: String, + pub wallet_handle: i32, + pub pool_handle: i32, + pub did: String, + pub verkey: String +} + +impl Setup { + pub fn empty() -> Setup { + let name = setup_(); + Setup { name, wallet_config: String::new(), wallet_handle: 0, pool_handle: 0, did: String::new(), verkey: String::new() } + } + + pub fn wallet() -> Setup { + let name = setup_(); + let (wallet_handle, wallet_config) = wallet::create_and_open_default_wallet(&name).unwrap(); + Setup { name, wallet_config, wallet_handle, pool_handle: 0, did: String::new(), verkey: String::new() } + } + + pub fn plugged_wallet() -> Setup { + let name = setup_(); + let (wallet_handle, wallet_config) = wallet::create_and_open_plugged_wallet().unwrap(); + Setup { name, wallet_config, wallet_handle, pool_handle: 0, did: String::new(), verkey: String::new() } + } + + pub fn pool() -> Setup { + let name = setup_(); + let pool_handle = pool::create_and_open_pool_ledger(&name).unwrap(); + Setup { name, wallet_config: String::new(), wallet_handle: 0, pool_handle, did: String::new(), verkey: String::new() } + } + + pub fn wallet_and_pool() -> Setup { + let name = setup_(); + let (wallet_handle, wallet_config) = wallet::create_and_open_default_wallet(&name).unwrap(); + let pool_handle = pool::create_and_open_pool_ledger(&name).unwrap(); + Setup { name, wallet_config, wallet_handle, pool_handle, did: String::new(), verkey: String::new() } + } + + pub fn trustee() -> Setup { + let name = setup_(); + let (wallet_handle, wallet_config) = wallet::create_and_open_default_wallet(&name).unwrap(); + let pool_handle = pool::create_and_open_pool_ledger(&name).unwrap(); + let (did, verkey) = did::create_and_store_my_did(wallet_handle, Some(constants::TRUSTEE_SEED)).unwrap(); + Setup { name, wallet_config, wallet_handle, pool_handle, did, verkey } + } + + pub fn steward() -> Setup { + let name = setup_(); + let (wallet_handle, wallet_config) = wallet::create_and_open_default_wallet(&name).unwrap(); + let pool_handle = pool::create_and_open_pool_ledger(&name).unwrap(); + let (did, verkey) = did::create_and_store_my_did(wallet_handle, Some(constants::STEWARD_SEED)).unwrap(); + Setup { name, wallet_config, wallet_handle, pool_handle, did, verkey } + } + + pub fn endorser() -> Setup { + let name = setup_(); + let (wallet_handle, wallet_config) = wallet::create_and_open_default_wallet(&name).unwrap(); + let pool_handle = pool::create_and_open_pool_ledger(&name).unwrap(); + let (did, verkey) = did::create_store_and_publish_did(wallet_handle, pool_handle, "ENDORSER").unwrap(); + Setup { name, wallet_config, wallet_handle, pool_handle, did, verkey } + } + + pub fn new_identity() -> Setup { + let name = setup_(); + let (wallet_handle, wallet_config) = wallet::create_and_open_default_wallet(&name).unwrap(); + let pool_handle = pool::create_and_open_pool_ledger(&name).unwrap(); + let (did, verkey) = did::create_store_and_publish_did(wallet_handle, pool_handle, "TRUSTEE").unwrap(); + Setup { name, wallet_config, wallet_handle, pool_handle, did, verkey } + } + + pub fn did() -> Setup { + let name = setup_(); + let (wallet_handle, wallet_config) = wallet::create_and_open_default_wallet(&name).unwrap(); + let (did, verkey) = did::create_and_store_my_did(wallet_handle, None).unwrap(); + Setup { name, wallet_config, wallet_handle, pool_handle: 0, did, verkey } + } + + pub fn key() -> Setup { + let name = setup_(); + let (wallet_handle, wallet_config) = wallet::create_and_open_default_wallet(&name).unwrap(); + let verkey = crypto::create_key(wallet_handle, None).unwrap(); + Setup { name, wallet_config, wallet_handle, pool_handle: 0, did: String::new(), verkey } + } + + pub fn payment() -> Setup { + let name = setup_(); + payments::mock_method::init(); + Setup { name, wallet_config: String::new(), wallet_handle: 0, pool_handle: 0, did: String::new(), verkey: String::new() } + } + + pub fn payment_wallet() -> Setup { + let name = setup_(); + let (wallet_handle, wallet_config) = wallet::create_and_open_default_wallet(&name).unwrap(); + payments::mock_method::init(); + Setup { name, wallet_config, wallet_handle, pool_handle: 0, did: String::new(), verkey: String::new() } + } +} + +impl Drop for Setup { + fn drop(&mut self) { + if self.wallet_handle != 0 { + wallet::close_and_delete_wallet(self.wallet_handle, &self.wallet_config).unwrap(); + } + if self.pool_handle != 0 { + pool::close(self.pool_handle).unwrap(); + } + tear_down(&self.name) + } +} + + pub fn setup_with_plugged_wallet(name: &str) -> (i32, String) { setup(name); wallet::create_and_open_plugged_wallet().unwrap() diff --git a/libindy/tests/utils/wallet.rs b/libindy/tests/utils/wallet.rs index ae02bf3ba0..1fb12b3580 100644 --- a/libindy/tests/utils/wallet.rs +++ b/libindy/tests/utils/wallet.rs @@ -81,6 +81,16 @@ pub fn open_wallet(config: &str, credentials: &str) -> Result Result<(WalletHandle, String), IndyError> { + let config = json!({ + "id": format!("{}-{}", ::utils::rand_utils::get_rand_string(10), sequence::get_next_id()), + }).to_string(); + + create_wallet(&config, WALLET_CREDENTIALS)?; + let wallet_handle = open_wallet(&config, WALLET_CREDENTIALS).unwrap(); + Ok((wallet_handle, config)) +} + pub fn create_and_open_wallet(storage_type: Option<&str>) -> Result<(WalletHandle, String), IndyError> { let config = json!({ "id": format!("default-wallet_id-{}", sequence::get_next_id()), From 30202e02920db38b5e493a65e05db8e1292e0142 Mon Sep 17 00:00:00 2001 From: "artem.ivanov" Date: Thu, 15 Aug 2019 12:55:35 +0300 Subject: [PATCH 216/320] Fixed typo Signed-off-by: artem.ivanov --- Jenkinsfile.cd | 22 +++++++++++----------- Jenkinsfile.ci | 12 ++++++------ 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/Jenkinsfile.cd b/Jenkinsfile.cd index 173fef10a9..d6ce15b180 100644 --- a/Jenkinsfile.cd +++ b/Jenkinsfile.cd @@ -14,13 +14,13 @@ properties([ ]] ]); -Ununtu16 = "Ubuntu 16.04" -Ununtu18 = "Ubuntu 18.04" +Ubuntu16 = "Ubuntu 16.04" +Ubuntu18 = "Ubuntu 18.04" RedHat = "RedHat" -libindyBuildFinished = [(Ununtu16): false, (Ununtu18): false, (RedHat): false] -libvcxBuildFinished = [(Ununtu16): false, (Ununtu18): false, (RedHat): false] -ubuntuPakageTypes = [(Ununtu16): "xenial", (Ununtu18): "bionic"] +libindyBuildFinished = [(Ubuntu16): false, (Ubuntu18): false, (RedHat): false] +libvcxBuildFinished = [(Ubuntu16): false, (Ubuntu18): false, (RedHat): false] +ubuntuPakageTypes = [(Ubuntu16): "xenial", (Ubuntu18): "bionic"] gitHubUserCredId = env.GITHUB_BOT_USER ?: 'sovbot-github' sovrinPackagingRepo = env.SOVRIN_PACKAGING_REPO ?: 'https://github.com/sovrin-foundation/sovrin-packaging' @@ -703,10 +703,10 @@ def ubuntuTesting() { stage('Ubuntu Test') { parallel([ "ubuntu:16.04": { - linuxTesting("ci/ubuntu.dockerfile ci", Ununtu16, "pool_network", true, true) + linuxTesting("ci/ubuntu.dockerfile ci", Ubuntu16, "pool_network", true, true) }, "ubuntu:18.04": { - linuxTesting("ci/ubuntu18.dockerfile ci", Ununtu18, "pool_network", true, false) + linuxTesting("ci/ubuntu18.dockerfile ci", Ubuntu18, "pool_network", true, false) } ]) } @@ -931,8 +931,8 @@ def rhelPublishing() { def ubuntuPublishing() { stage('Ubuntu Publishing') { - def libindyVersion = linuxPublishing("ci/ubuntu.dockerfile ci", Ununtu16, true) - linuxPublishing("ci/ubuntu18.dockerfile ci", Ununtu18, false) + def libindyVersion = linuxPublishing("ci/ubuntu.dockerfile ci", Ubuntu16, true) + linuxPublishing("ci/ubuntu18.dockerfile ci", Ubuntu18, false) return libindyVersion } } @@ -1356,7 +1356,7 @@ def publishingRCtoStable() { def libnullpayVersion = getSrcVersion("libnullpay") def libvcxVersion = getSrcVersion("vcx/libvcx") - def env_name = Ununtu16 + def env_name = Ubuntu16 echo 'Moving Windows RC artifacts to Stable: libindy' publishLibindyWindowsFilesRCtoStable(libindyVersion) @@ -1433,7 +1433,7 @@ def publishingRCtoStable() { echo 'Moving RC artifacts to Stable: Build docker image for wrappers publishing' testEnv = dockerHelpers.build('indy-sdk', 'libindy/ci/ubuntu18.dockerfile libindy/ci') - env_name = Ununtu18 + env_name = Ubuntu18 echo "Moving ${env_name} RC artifacts to Stable: libindy" publishLibindyDebRCtoStable(testEnv, libindyVersion, env_name) diff --git a/Jenkinsfile.ci b/Jenkinsfile.ci index f44c5aa6e1..98df3da113 100644 --- a/Jenkinsfile.ci +++ b/Jenkinsfile.ci @@ -1,12 +1,12 @@ #!groovy -Ununtu16 = "Ubuntu 16.04" -Ununtu18 = "Ubuntu 18.04" +Ubuntu16 = "Ubuntu 16.04" +Ubuntu18 = "Ubuntu 18.04" RedHat = "RedHat" -libindyBuildFinished = [(Ununtu16): false, (Ununtu18): false, (RedHat): false] -libvcxBuildFinished = [(Ununtu16): false, (Ununtu18): false, (RedHat): false] +libindyBuildFinished = [(Ubuntu16): false, (Ubuntu18): false, (RedHat): false] +libvcxBuildFinished = [(Ubuntu16): false, (Ubuntu18): false, (RedHat): false] testing() @@ -345,10 +345,10 @@ def ubuntuTesting() { stage('Ubuntu Test') { parallel([ "ubuntu:16.04": { - linuxTesting("ci/ubuntu.dockerfile ci", Ununtu16, "pool_network", true) + linuxTesting("ci/ubuntu.dockerfile ci", Ubuntu16, "pool_network", true) }, "ubuntu:18.04": { - linuxTesting("ci/ubuntu18.dockerfile ci", Ununtu18, "pool_network", false) + linuxTesting("ci/ubuntu18.dockerfile ci", Ubuntu18, "pool_network", false) } ]) } From bbea2633383ecd2a09c4e23675cb4252c764c195 Mon Sep 17 00:00:00 2001 From: Axel Nennker Date: Thu, 15 Aug 2019 12:42:53 +0200 Subject: [PATCH 217/320] use with_capacity is possible Signed-off-by: Axel Nennker --- libindy/src/services/pool/state_proof/node.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/libindy/src/services/pool/state_proof/node.rs b/libindy/src/services/pool/state_proof/node.rs index c7d5694c09..a966154891 100644 --- a/libindy/src/services/pool/state_proof/node.rs +++ b/libindy/src/services/pool/state_proof/node.rs @@ -168,7 +168,7 @@ impl Node { let node_and_prefix = prefix.map(|prf| self.get_node(db, &prf)).unwrap_or_else(|| Ok(Some((self, vec![]))))?; if let Some((node, prf)) = node_and_prefix { let vals = node._get_all_values(db, prf)?; - let mut res: Vec<(String, String)> = vec![]; + let mut res: Vec<(String, String)> = Vec::with_capacity(vals.len()); for (key, val) in vals { res.push((Node::_nibbles_to_str(&key)?, val)) } @@ -193,7 +193,7 @@ impl Node { return Ok(Some((self, seen_path.to_vec()))); } if let Some(ref next) = node.nodes[path[0] as usize] { - let mut new_seen_path = vec![]; + let mut new_seen_path = Vec::with_capacity(seen_path.len() + path[..1].len()); new_seen_path.extend_from_slice(seen_path); new_seen_path.extend_from_slice(&path[..1]); return next._get_node(db, &path[1..], new_seen_path.as_slice()); @@ -233,7 +233,7 @@ impl Node { trace!("current extension node path: {:?}", pair_path); if path.starts_with(&pair_path) { - let mut new_seen_path = vec![]; + let mut new_seen_path = Vec::with_capacity(seen_path.len() + pair_path.len()); new_seen_path.extend_from_slice(seen_path); new_seen_path.extend_from_slice(pair_path.as_slice()); pair.next._get_node(db, &path[pair_path.len()..], new_seen_path.as_slice()) @@ -373,7 +373,7 @@ impl Node { } fn path_to_nibbles(path: &[u8]) -> Vec { - let mut nibble_path: Vec = Vec::new(); + let mut nibble_path: Vec = Vec::with_capacity(2*path.len()); for s in path { nibble_path.push(s >> 4); @@ -385,7 +385,7 @@ impl Node { fn _nibbles_to_str(nibbles: &[u8]) -> IndyResult { trace!("Node::_nibbles_to_str >> nibbles: {:?}", nibbles); - let mut res: Vec = vec![]; + let mut res: Vec = Vec::with_capacity(nibbles.len() / 2); for x in (0..nibbles.len()).step_by(2) { let h: u8 = (nibbles[x] << 4) + nibbles[x+1]; res.push(h) From c857c92db5d8471e2dd6749123b664ac1fd114ea Mon Sep 17 00:00:00 2001 From: Axel Nennker Date: Thu, 15 Aug 2019 13:50:07 +0200 Subject: [PATCH 218/320] use with_capacity is possible Signed-off-by: Axel Nennker --- libindy/src/services/anoncreds/prover.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libindy/src/services/anoncreds/prover.rs b/libindy/src/services/anoncreds/prover.rs index 045048f83d..8ec970c76a 100644 --- a/libindy/src/services/anoncreds/prover.rs +++ b/libindy/src/services/anoncreds/prover.rs @@ -126,7 +126,6 @@ impl Prover { let mut proof_builder = CryptoProver::new_proof_builder()?; proof_builder.add_common_attribute("master_secret")?; - let mut identifiers: Vec = Vec::new(); let mut requested_proof = RequestedProof::default(); requested_proof.self_attested_attrs = requested_credentials.self_attested_attributes.clone(); @@ -135,6 +134,7 @@ impl Prover { let mut sub_proof_index = 0; let non_credential_schema = build_non_credential_schema()?; + let mut identifiers: Vec = Vec::with_capacity(credentials_for_proving.len()); for (cred_key, (req_attrs_for_cred, req_predicates_for_cred)) in credentials_for_proving { let credential: &Credential = credentials.get(cred_key.cred_id.as_str()) .ok_or(err_msg(IndyErrorKind::InvalidStructure, format!("Credential not found by id: {:?}", cred_key.cred_id)))?; From d9ed25ef6afd8a48158682b13198b5930aa362f1 Mon Sep 17 00:00:00 2001 From: Axel Nennker Date: Thu, 15 Aug 2019 13:50:28 +0200 Subject: [PATCH 219/320] use with_capacity is possible Signed-off-by: Axel Nennker --- libindy/src/services/pool/networker.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libindy/src/services/pool/networker.rs b/libindy/src/services/pool/networker.rs index 3a40b9d969..99c2cf7a19 100644 --- a/libindy/src/services/pool/networker.rs +++ b/libindy/src/services/pool/networker.rs @@ -190,7 +190,7 @@ impl PoolConnection { }); } - let mut sockets: Vec> = Vec::new(); + let mut sockets: Vec> = Vec::with_capacity(nodes.len()); for _ in 0..nodes.len() { sockets.push(None); } From d84a15527fb0db12455f8996de2426fc05b2c7bc Mon Sep 17 00:00:00 2001 From: Axel Nennker Date: Thu, 15 Aug 2019 13:50:45 +0200 Subject: [PATCH 220/320] use with_capacity is possible Signed-off-by: Axel Nennker --- libindy/src/services/pool/state_proof/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libindy/src/services/pool/state_proof/mod.rs b/libindy/src/services/pool/state_proof/mod.rs index d1cc9c444e..c1f69e4c9f 100644 --- a/libindy/src/services/pool/state_proof/mod.rs +++ b/libindy/src/services/pool/state_proof/mod.rs @@ -559,7 +559,7 @@ fn _verify_proof_signature(signature: &str, gen: &Generator) -> IndyResult { trace!("verify_proof_signature: >>> signature: {:?}, participants: {:?}, pool_state_root: {:?}", signature, participants, value); - let mut ver_keys: Vec<&VerKey> = Vec::new(); + let mut ver_keys: Vec<&VerKey> = Vec::with_capacity(nodes.len()); for (name, verkey) in nodes { if participants.contains(&name.as_str()) { From 2666d1483e364b0f029d98f29503f5092228199f Mon Sep 17 00:00:00 2001 From: Axel Nennker Date: Thu, 15 Aug 2019 13:51:10 +0200 Subject: [PATCH 221/320] use with_capacity is possible Signed-off-by: Axel Nennker --- libindy/src/services/wallet/language.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/libindy/src/services/wallet/language.rs b/libindy/src/services/wallet/language.rs index a7600db7b2..588d460c0a 100644 --- a/libindy/src/services/wallet/language.rs +++ b/libindy/src/services/wallet/language.rs @@ -104,7 +104,7 @@ impl Operator { } fn transform_list_operators(operators: Vec, f: &Fn(Operator) -> IndyResult) -> IndyResult> { - let mut transformed = Vec::new(); + let mut transformed = Vec::with_capacity(operators.len()); for operator in operators { let transformed_operator = Operator::transform(operator, f)?; @@ -190,7 +190,7 @@ pub fn parse_from_json(json: &str) -> IndyResult { fn parse(map: serde_json::Map) -> IndyResult { - let mut operators: Vec = Vec::new(); + let mut operators: Vec = Vec::with_capacity(map.len()); for (key, value) in map.into_iter() { let suboperator = parse_operator(key, value)?; @@ -205,7 +205,7 @@ fn parse(map: serde_json::Map) -> IndyResult IndyResult { match (&*key, value) { ("$and", serde_json::Value::Array(values)) => { - let mut operators: Vec = Vec::new(); + let mut operators: Vec = Vec::with_capacity(values.len()); for value in values.into_iter() { if let serde_json::Value::Object(map) = value { @@ -220,7 +220,7 @@ fn parse_operator(key: String, value: serde_json::Value) -> IndyResult } ("$and", _) => Err(err_msg(IndyErrorKind::WalletQueryError, "$and must be array of JSON objects")), ("$or", serde_json::Value::Array(values)) => { - let mut operators: Vec = Vec::new(); + let mut operators: Vec = Vec::with_capacity(values.len()); for value in values.into_iter() { if let serde_json::Value::Object(map) = value { @@ -297,7 +297,7 @@ fn parse_single_operator(operator_name: String, key: String, value: serde_json:: } ("$like", _) => Err(err_msg(IndyErrorKind::WalletQueryError, "$like must be used with string")), ("$in", serde_json::Value::Array(values)) => { - let mut target_values: Vec = Vec::new(); + let mut target_values: Vec = Vec::with_capacity(values.len()); for v in values.into_iter() { if let serde_json::Value::String(s) = v { From dd6ea1c6fa3697a89cc23a30dae68a42ed1cb9bc Mon Sep 17 00:00:00 2001 From: Axel Nennker Date: Thu, 15 Aug 2019 13:51:30 +0200 Subject: [PATCH 222/320] use with_capacity is possible Signed-off-by: Axel Nennker --- libindy/src/services/wallet/query_encryption.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libindy/src/services/wallet/query_encryption.rs b/libindy/src/services/wallet/query_encryption.rs index 4c1154eaae..b5b0691ce3 100644 --- a/libindy/src/services/wallet/query_encryption.rs +++ b/libindy/src/services/wallet/query_encryption.rs @@ -54,7 +54,7 @@ fn encrypt_operator(op: Operator, keys: &Keys) -> Result { TagName::PlainTagName(encrypted_name) } }; - let mut encrypted_values: Vec = Vec::new(); + let mut encrypted_values: Vec = Vec::with_capacity(values.len()); for value in values { encrypted_values.push(encrypt_name_value(&name, value, keys)?.1); From 9137305523b61a4dc0d4d6ae8208bc8c27ff74f3 Mon Sep 17 00:00:00 2001 From: Axel Nennker Date: Thu, 15 Aug 2019 13:52:16 +0200 Subject: [PATCH 223/320] use iter Signed-off-by: Axel Nennker --- .../src/services/wallet/storage/plugged/mod.rs | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/libindy/src/services/wallet/storage/plugged/mod.rs b/libindy/src/services/wallet/storage/plugged/mod.rs index 3ba1388655..a8a63a1cd5 100644 --- a/libindy/src/services/wallet/storage/plugged/mod.rs +++ b/libindy/src/services/wallet/storage/plugged/mod.rs @@ -305,7 +305,7 @@ fn _tags_from_json(json: &str) -> IndyResult> { let string_tags: HashMap = serde_json::from_str(json) .to_indy(IndyErrorKind::InvalidState, "Unable to deserialize tags from json")?; - let mut tags = Vec::new(); + let mut tags = Vec::with_capacity(string_tags.len()); for (k, v) in string_tags { if k.starts_with('~') { @@ -330,16 +330,11 @@ fn _tags_from_json(json: &str) -> IndyResult> { } fn _tags_names_to_json(tag_names: &[TagName]) -> IndyResult { - let mut tags: Vec = Vec::new(); - - for tag_name in tag_names { - tags.push( - match *tag_name { - TagName::OfEncrypted(ref tag_name) => base64::encode(tag_name), - TagName::OfPlain(ref tag_name) => format!("~{}", base64::encode(tag_name)) - } - ) - } + let tags : Vec = tag_names.iter().map(|tag_name| + match *tag_name { + TagName::OfEncrypted(ref tag_name) => base64::encode(tag_name), + TagName::OfPlain(ref tag_name) => format!("~{}", base64::encode(tag_name)) + }).collect(); serde_json::to_string(&tags) .to_indy(IndyErrorKind::InvalidState, "Unable to serialize tag names as json") From ad139e681e08de54ac3babcb1c0bfda8906bcaae Mon Sep 17 00:00:00 2001 From: Sergey Minaev Date: Thu, 15 Aug 2019 15:53:15 +0300 Subject: [PATCH 224/320] Update README.md about Ubuntu 18.04 artifacts. Signed-off-by: Sergey Minaev --- README.md | 5 +++-- cli/README.md | 2 +- libnullpay/README.md | 4 ++-- vcx/README.md | 7 ++++--- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 44d8c805d8..7da7b29440 100644 --- a/README.md +++ b/README.md @@ -109,15 +109,16 @@ The Indy SDK release process defines the following release channels: Please refer to our [release workflow](docs/contributors/release-workflow.md) for more details. -### Ubuntu based distributions (Ubuntu 16.04) +### Ubuntu based distributions (Ubuntu 16.04 and 18.04) It is recommended to install the SDK packages with APT: sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys CE7709D068DB5E88 - sudo add-apt-repository "deb https://repo.sovrin.org/sdk/deb xenial {release channel}" + sudo add-apt-repository "deb https://repo.sovrin.org/sdk/deb (xenial|bionic) {release channel}" sudo apt-get update sudo apt-get install -y libindy {release channel} must be replaced with master, rc or stable to define corresponded release channel. +(xenial|bionic) xenial for 16.04 Ubuntu and bionic for 18.04 Ubuntu Please See the section "Release channels" above for more details. ### Windows diff --git a/cli/README.md b/cli/README.md index 5b29e636d3..a3af096da1 100644 --- a/cli/README.md +++ b/cli/README.md @@ -15,7 +15,7 @@ Pre-Built binaries can be downloaded from https://repo.sovrin.org/: On Ubuntu it is recommended to install packages with APT (change stable to `master` or `rc` if needed): ``` sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys CE7709D068DB5E88 -sudo add-apt-repository "deb https://repo.sovrin.org/sdk/deb xenial stable" +sudo add-apt-repository "deb https://repo.sovrin.org/sdk/deb (xenial|bionic) stable" sudo apt-get update sudo apt-get install -y indy-cli ``` diff --git a/libnullpay/README.md b/libnullpay/README.md index 683adc2eb2..68d00cdc14 100644 --- a/libnullpay/README.md +++ b/libnullpay/README.md @@ -15,11 +15,11 @@ Pre-Built binaries can be downloaded from https://repo.sovrin.org/: On Ubuntu it is recommended to install packages with APT (change stable to `master` or `rc` if needed): ``` sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys CE7709D068DB5E88 -sudo add-apt-repository "deb https://repo.sovrin.org/sdk/deb xenial master" +sudo add-apt-repository "deb https://repo.sovrin.org/sdk/deb (xenial|bionic) stable" sudo apt-get update sudo apt-get install -y libnullpay ``` ### Logs Null Payment plugin doesn't the ability to set or configure own logger. -It inheritances Libindy logger implementation during plugin initialization. \ No newline at end of file +It inheritances Libindy logger implementation during plugin initialization. diff --git a/vcx/README.md b/vcx/README.md index f6372f64a1..83c193fe81 100644 --- a/vcx/README.md +++ b/vcx/README.md @@ -12,15 +12,16 @@ infrastructure. * VCX requires some payment plugin. [Here](https://github.com/hyperledger/indy-sdk/tree/master/libnullpay/README.md) is the simple plugin that can be used. -### Ubuntu based distributions (Ubuntu 16.04) +### Ubuntu based distributions (Ubuntu 16.04 and 18.04) It is recommended to install the VCX packages with APT: sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys CE7709D068DB5E88 - sudo add-apt-repository "deb https://repo.sovrin.org/sdk/deb xenial {release channel}" + sudo add-apt-repository "deb https://repo.sovrin.org/sdk/deb (xenial|bionic) {release channel}" sudo apt-get update sudo apt-get install -y libvcx {release channel} must be replaced with master, rc or stable to define corresponded release channel. +(xenial|bionic) xenial for 16.04 Ubuntu and bionic for 18.04 Ubuntu Please See the section [Release channels](../README.md/#release-channels) for more details. ### Windows @@ -177,4 +178,4 @@ The documents that provide necessary information for Libvcx migrations. * [v0.1.x → v0.2.0](docs/migration-guide-0.1.x-0.2.0.md) * [v0.2.x → v0.3.0](docs/migration-guide-0.2.x-0.3.0.md) -* [v0.3.x → v0.4.0](docs/migration-guide-0.3.x-0.4.0.md) \ No newline at end of file +* [v0.3.x → v0.4.0](docs/migration-guide-0.3.x-0.4.0.md) From 4eb8af73c1ac58337ef9d60a830bda532f86af46 Mon Sep 17 00:00:00 2001 From: Sergey Minaev Date: Thu, 15 Aug 2019 16:33:53 +0300 Subject: [PATCH 225/320] Fix formatting in README Signed-off-by: Sergey Minaev --- README.md | 4 ++-- vcx/README.md | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 7da7b29440..ae99fd86a2 100644 --- a/README.md +++ b/README.md @@ -117,8 +117,8 @@ It is recommended to install the SDK packages with APT: sudo apt-get update sudo apt-get install -y libindy -{release channel} must be replaced with master, rc or stable to define corresponded release channel. -(xenial|bionic) xenial for 16.04 Ubuntu and bionic for 18.04 Ubuntu +* (xenial|bionic) xenial for 16.04 Ubuntu and bionic for 18.04 Ubuntu. +* {release channel} must be replaced with master, rc or stable to define corresponded release channel. Please See the section "Release channels" above for more details. ### Windows diff --git a/vcx/README.md b/vcx/README.md index 83c193fe81..e98bf93ada 100644 --- a/vcx/README.md +++ b/vcx/README.md @@ -20,8 +20,8 @@ It is recommended to install the VCX packages with APT: sudo apt-get update sudo apt-get install -y libvcx -{release channel} must be replaced with master, rc or stable to define corresponded release channel. -(xenial|bionic) xenial for 16.04 Ubuntu and bionic for 18.04 Ubuntu +* (xenial|bionic) xenial for 16.04 Ubuntu and bionic for 18.04 Ubuntu. +* {release channel} must be replaced with master, rc or stable to define corresponded release channel. Please See the section [Release channels](../README.md/#release-channels) for more details. ### Windows From d8e1192d5506e5c8b0b8bdb4331a2385b27a222e Mon Sep 17 00:00:00 2001 From: "artem.ivanov" Date: Thu, 15 Aug 2019 17:12:28 +0300 Subject: [PATCH 226/320] IS-1345 Added `feature` to reduce the number of Libindy integration tests run by default Signed-off-by: artem.ivanov --- Jenkinsfile.cd | 24 +++++++++++------------ Jenkinsfile.ci | 28 +++++++++++++-------------- libindy/Cargo.toml | 1 + libindy/tests/anoncreds.rs | 8 +++++--- libindy/tests/anoncreds_demos.rs | 33 ++++++++++++++++---------------- libindy/tests/ledger.rs | 4 +++- libindy/tests/non_secrets.rs | 2 +- libindy/tests/payments.rs | 27 +++++++++++++------------- libindy/tests/pool.rs | 1 + libindy/tests/wallet.rs | 7 ++++--- 10 files changed, 72 insertions(+), 63 deletions(-) diff --git a/Jenkinsfile.cd b/Jenkinsfile.cd index 244efe61a4..9dc0495d54 100644 --- a/Jenkinsfile.cd +++ b/Jenkinsfile.cd @@ -212,12 +212,12 @@ String getSrcVersion(folder) { } } -def linuxTesting(file, env_name, network_name, stashBuildResults, test_wrappers) { +def linuxTesting(file, env_name, network_name, stashBuildResults, full_testing) { parallel([ failFast : true, "${env_name} Test: build and test libindy": { node('ubuntu') { - linuxLibindyBuild(file, env_name, network_name, stashBuildResults) + linuxLibindyBuild(file, env_name, network_name, stashBuildResults, full_testing) } }, "${env_name} Test: test other components" : { @@ -229,10 +229,10 @@ def linuxTesting(file, env_name, network_name, stashBuildResults, test_wrappers) linuxModuleTesting(file, env_name, network_name, this.&linuxCLITesting, stashBuildResults) }, "${env_name}-vcx-test": { - vcxTesting(file, env_name, network_name, stashBuildResults, test_wrappers) + vcxTesting(file, env_name, network_name, stashBuildResults, full_testing) } ] - if (test_wrappers) { + if (full_testing) { jobs["${env_name}-rust-test"] = { linuxModuleTesting(file, env_name, network_name, this.&linuxRustTesting, stashBuildResults) } @@ -251,7 +251,7 @@ def linuxTesting(file, env_name, network_name, stashBuildResults, test_wrappers) ]) } -def vcxTesting(file, env_name, network_name, stashBuildResults, test_wrappers) { +def vcxTesting(file, env_name, network_name, stashBuildResults, full_testing) { parallel([ failFast : true, "${env_name} Test: build and test libvcx" : { @@ -260,7 +260,7 @@ def vcxTesting(file, env_name, network_name, stashBuildResults, test_wrappers) { } }, "${env_name} Test: test other vcx components": { - if (test_wrappers) { + if (full_testing) { waitUntil { libvcxBuildFinished[env_name] } @@ -282,7 +282,7 @@ def vcxTesting(file, env_name, network_name, stashBuildResults, test_wrappers) { ]) } -def linuxLibindyBuild(file, env_name, network_name, stashBuildResults) { +def linuxLibindyBuild(file, env_name, network_name, stashBuildResults, full_testing) { def poolInst try { echo "${env_name} Test: Checkout csm" @@ -350,11 +350,11 @@ def linuxLibindyBuild(file, env_name, network_name, stashBuildResults) { echo "${env_name} Libindy Test: Test" testEnv.inside("--network=${network_name}") { - sh ''' - cd libindy - RUST_BACKTRACE=1 cargo test --release -j 1 --no-run --features sodium_static - RUST_BACKTRACE=1 RUST_LOG=indy::=debug,zmq=trace RUST_TEST_THREADS=1 TEST_POOL_IP=10.0.0.2 cargo test --release -j 1 --features sodium_static - ''' + def features_args = full_testing ? '--features sodium_static' : '--features "sodium_static only_high_cases"' + + sh "cd libindy && " + + "RUST_BACKTRACE=1 cargo test --release -j 1 --no-run ${features_args} &&" + + "RUST_BACKTRACE=1 RUST_LOG=indy::=debug,zmq=trace RUST_TEST_THREADS=1 TEST_POOL_IP=10.0.0.2 cargo test --release -j 1 ${features_args}" } echo "${env_name} Libnullpay Test: Test" diff --git a/Jenkinsfile.ci b/Jenkinsfile.ci index 30029993b8..88559671aa 100644 --- a/Jenkinsfile.ci +++ b/Jenkinsfile.ci @@ -84,7 +84,7 @@ def windowsTesting() { "RUST_BACKTRACE=1" ]) { bat "cargo build --features fatal_warnings" - bat "cargo test --no-run" + bat 'cargo test --no-run --features "only_high_cases"' echo "Windows Libindy before Test: Deleting %TEMP\\indy_client" bat "DEL /S /Q /F %TEMP%\\indy_client" @@ -96,7 +96,7 @@ def windowsTesting() { "RUST_LOG=indy::=debug,zmq=trace", "TEST_POOL_IP=$INDY_SDK_SERVER_IP" ]) { - bat "cargo test" + bat 'cargo test --features "only_high_cases"' } echo "Windows Libindy after Test: Deleting %TEMP\\indy_client" @@ -360,12 +360,12 @@ def rhelTesting() { } } -def linuxTesting(file, env_name, network_name, test_wrappers) { +def linuxTesting(file, env_name, network_name, full_testing) { parallel([ failFast : true, "${env_name} Test: build and test libindy": { node('ubuntu') { - linuxLibindyBuild(file, env_name, network_name) + linuxLibindyBuild(file, env_name, network_name, full_testing) } }, "${env_name} Test: test other components" : { @@ -377,10 +377,10 @@ def linuxTesting(file, env_name, network_name, test_wrappers) { linuxModuleTesting(file, env_name, network_name, this.&linuxCLITesting) }, "${env_name}-vcx-test" : { - vcxTesting(file, env_name, network_name, test_wrappers) + vcxTesting(file, env_name, network_name, full_testing) } ] - if (test_wrappers) { + if (full_testing) { jobs["${env_name}-nodejs-test"] = { linuxModuleTesting(file, env_name, network_name, this.&linuxNodejsTesting) } @@ -402,7 +402,7 @@ def linuxTesting(file, env_name, network_name, test_wrappers) { ]) } -def vcxTesting(file, env_name, network_name, test_wrappers) { +def vcxTesting(file, env_name, network_name, full_testing) { parallel([ failFast : true, "${env_name} Test: build and test libvcx" : { @@ -411,7 +411,7 @@ def vcxTesting(file, env_name, network_name, test_wrappers) { } }, "${env_name} Test: test other vcx components": { - if (test_wrappers) { + if (full_testing) { waitUntil { libvcxBuildFinished[env_name] } @@ -432,7 +432,7 @@ def vcxTesting(file, env_name, network_name, test_wrappers) { ]) } -def linuxLibindyBuild(file, env_name, network_name) { +def linuxLibindyBuild(file, env_name, network_name, full_testing) { def poolInst try { echo "${env_name} Test: Checkout csm" @@ -492,11 +492,11 @@ def linuxLibindyBuild(file, env_name, network_name) { echo "${env_name} Libindy Test: Test" testEnv.inside("--network=${network_name}") { - sh ''' - cd libindy - RUST_BACKTRACE=1 cargo test -j 1 --no-run --features sodium_static - RUST_BACKTRACE=1 RUST_LOG=indy::=debug,zmq=trace RUST_TEST_THREADS=1 TEST_POOL_IP=10.0.0.2 cargo test -j 1 --features sodium_static - ''' + def features_args = full_testing ? '--features sodium_static' : '--features "sodium_static only_high_cases"' + + sh "cd libindy && " + + "RUST_BACKTRACE=1 cargo test -j 1 --no-run ${features_args} &&" + + "RUST_BACKTRACE=1 RUST_LOG=indy::=debug,zmq=trace RUST_TEST_THREADS=1 TEST_POOL_IP=10.0.0.2 cargo test -j 1 ${features_args}" } echo "${env_name} Libnullpay Test: Test" diff --git a/libindy/Cargo.toml b/libindy/Cargo.toml index 76d85ec09b..81e0784f6a 100644 --- a/libindy/Cargo.toml +++ b/libindy/Cargo.toml @@ -39,6 +39,7 @@ sodium_static = [] hmacsha256_sodium = ["sodiumoxide"] memzero_sodium = ["sodiumoxide"] randombytes_sodium = ["sodiumoxide"] +only_high_cases = [] # Causes the build to fail on all warnings fatal_warnings = [] diff --git a/libindy/tests/anoncreds.rs b/libindy/tests/anoncreds.rs index e5511cae14..ebeef81c43 100644 --- a/libindy/tests/anoncreds.rs +++ b/libindy/tests/anoncreds.rs @@ -34,14 +34,12 @@ use utils::anoncreds::{COMMON_MASTER_SECRET, CREDENTIAL1_ID, ANONCREDS_WALLET_CO use indy::ErrorCode; use utils::constants::*; -use utils::domain::anoncreds::schema::{Schema, AttributeNames, MAX_ATTRIBUTES_COUNT}; +use utils::domain::anoncreds::schema::{Schema}; use utils::domain::anoncreds::credential_definition::CredentialDefinition; use utils::domain::anoncreds::credential::CredentialInfo; use utils::domain::anoncreds::credential_for_proof_request::{CredentialsForProofRequest, RequestedCredential}; use utils::domain::anoncreds::proof::Proof; -use utils::domain::anoncreds::proof_request::{AttributeInfo, ProofRequest}; -use std::collections::HashSet; mod high_cases { use super::*; @@ -3538,8 +3536,12 @@ mod high_cases { } } +#[cfg(not(feature="only_high_cases"))] mod medium_cases { use super::*; + use std::collections::HashSet; + use utils::domain::anoncreds::schema::{AttributeNames, MAX_ATTRIBUTES_COUNT}; + use utils::domain::anoncreds::proof_request::{AttributeInfo, ProofRequest}; mod issuer_create_schema { use super::*; diff --git a/libindy/tests/anoncreds_demos.rs b/libindy/tests/anoncreds_demos.rs index 621c3794a1..458056c7ca 100644 --- a/libindy/tests/anoncreds_demos.rs +++ b/libindy/tests/anoncreds_demos.rs @@ -27,24 +27,25 @@ extern crate serde; #[macro_use] mod utils; -use utils::{wallet, anoncreds}; -use utils::anoncreds::{COMMON_MASTER_SECRET, CREDENTIAL1_ID, CREDENTIAL2_ID, CREDENTIAL3_ID}; - -use indy::ErrorCode; -use utils::inmem_wallet::InmemWallet; -use utils::constants::*; - -use utils::domain::anoncreds::schema::Schema; -use utils::domain::anoncreds::credential_definition::CredentialDefinition; -use utils::domain::anoncreds::credential_attr_tag_policy::CredentialAttrTagPolicy; -use utils::domain::anoncreds::revocation_registry_definition::RevocationRegistryDefinition; -use utils::domain::anoncreds::credential_for_proof_request::{CredentialsForProofRequest}; -use utils::domain::anoncreds::proof::Proof; -use utils::domain::anoncreds::revocation_state::RevocationState; -use utils::domain::anoncreds::revocation_registry::RevocationRegistry; - +#[cfg(not(feature="only_high_cases"))] mod demos { use super::*; + + use utils::{wallet, anoncreds}; + use utils::anoncreds::{COMMON_MASTER_SECRET, CREDENTIAL1_ID, CREDENTIAL2_ID, CREDENTIAL3_ID}; + + use indy::ErrorCode; + use utils::inmem_wallet::InmemWallet; + use utils::constants::*; + + use utils::domain::anoncreds::schema::Schema; + use utils::domain::anoncreds::credential_definition::CredentialDefinition; + use utils::domain::anoncreds::credential_attr_tag_policy::CredentialAttrTagPolicy; + use utils::domain::anoncreds::revocation_registry_definition::RevocationRegistryDefinition; + use utils::domain::anoncreds::credential_for_proof_request::{CredentialsForProofRequest}; + use utils::domain::anoncreds::proof::Proof; + use utils::domain::anoncreds::revocation_state::RevocationState; + use utils::domain::anoncreds::revocation_registry::RevocationRegistry; #[test] fn anoncreds_works_for_single_issuer_single_prover() { diff --git a/libindy/tests/ledger.rs b/libindy/tests/ledger.rs index 6be9efa792..565cf08481 100644 --- a/libindy/tests/ledger.rs +++ b/libindy/tests/ledger.rs @@ -43,7 +43,7 @@ use self::rand::distributions::Alphanumeric; use utils::domain::ledger::constants; use utils::domain::ledger::request::DEFAULT_LIBIDY_DID; -use utils::domain::anoncreds::schema::{Schema, SchemaV1}; +use utils::domain::anoncreds::schema::{SchemaV1}; use utils::domain::anoncreds::credential_definition::CredentialDefinitionV1; use utils::domain::anoncreds::revocation_registry_definition::RevocationRegistryDefinitionV1; use utils::domain::anoncreds::revocation_registry::RevocationRegistryV1; @@ -3126,8 +3126,10 @@ mod high_cases { } } +#[cfg(not(feature="only_high_cases"))] mod medium_cases { use super::*; + use utils::domain::anoncreds::schema::{Schema}; mod requests { use super::*; diff --git a/libindy/tests/non_secrets.rs b/libindy/tests/non_secrets.rs index 9e24ac11a4..d90ab180e7 100644 --- a/libindy/tests/non_secrets.rs +++ b/libindy/tests/non_secrets.rs @@ -1336,7 +1336,7 @@ mod high_cases { } } - +#[cfg(not(feature="only_high_cases"))] mod medium_cases { use super::*; diff --git a/libindy/tests/payments.rs b/libindy/tests/payments.rs index c3c729fa2c..4f6f805fb0 100644 --- a/libindy/tests/payments.rs +++ b/libindy/tests/payments.rs @@ -32,25 +32,12 @@ use self::indy::ErrorCode; use utils::payments; use utils::constants::*; -use api::INVALID_WALLET_HANDLE; - static EMPTY_OBJECT: &str = "{}"; static EMPTY_ARRAY: &str = "[]"; static PAYMENT_METHOD_NAME: &str = "null"; -static WRONG_PAYMENT_METHOD_NAME: &str = "null_payment_handler"; static CORRECT_INPUTS: &str = r#"["pay:null:1", "pay:null:2"]"#; static CORRECT_OUTPUTS: &str = r#"[{"recipient": "pay:null:1", "amount":1}, {"recipient": "pay:null:2", "amount":2}]"#; -static INPUTS_UNKNOWN_METHOD: &str = r#"["pay:unknown_payment_method:1"]"#; -static OUTPUTS_UNKNOWN_METHOD: &str = r#"[{"recipient": "pay:unknown_payment_method:1", "amount":1}]"#; -static INPUTS_INVALID_FORMAT: &str = r#"pay:null:1"#; -static OUTPUTS_INVALID_FORMAT: &str = r#"["pay:null:1",1]"#; -static INCOMPATIBLE_INPUTS: &str = r#"["pay:PAYMENT_METHOD_1:1", "pay:PAYMENT_METHOD_2:1"]"#; -static INCOMPATIBLE_OUTPUTS: &str = r#"[{"recipient": "pay:PAYMENT_METHOD_1:1", "amount":1}, {"recipient": "pay:PAYMENT_METHOD_2:1", "amount":1}]"#; -static EQUAL_INPUTS: &str = r#"["pay:null1:1", "pay:null1:1", "pay:null1:2"]"#; -static EQUAL_OUTPUTS: &str = r#"[{"paymentAddress": "pay:null:1", "amount":1}, {"paymentAddress": "pay:null:1", "amount":2}, {"paymentAddress": "pay:null:2", "amount":2, "extra":"2"}]"#; static CORRECT_FEES: &str = r#"{"txnType1":1, "txnType2":2}"#; -static PAYMENT_RESPONSE: &str = r#"{"reqId":1, "sources":[{"input": "pay:null:1", "amount":1}, {"input": "pay:null:2", "amount":2}]}"#; -static GET_TXN_FEES_RESPONSE: &str = r#"{"reqId":1, fees:{"txnType1":1, "txnType2":2}}"#; static TEST_RES_STRING: &str = "test"; static CORRECT_PAYMENT_ADDRESS: &str = "pay:null:test"; static EXTRA: &str = "extra_1"; @@ -64,6 +51,7 @@ fn setup(name: &str) -> (i32, String) { mod high_cases { use super::*; + mod register_payment_method { use super::*; @@ -865,8 +853,21 @@ mod high_cases { } } +#[cfg(not(feature="only_high_cases"))] mod medium_cases { use super::*; + use api::INVALID_WALLET_HANDLE; + static WRONG_PAYMENT_METHOD_NAME: &str = "null_payment_handler"; + static INPUTS_UNKNOWN_METHOD: &str = r#"["pay:unknown_payment_method:1"]"#; + static OUTPUTS_UNKNOWN_METHOD: &str = r#"[{"recipient": "pay:unknown_payment_method:1", "amount":1}]"#; + static INPUTS_INVALID_FORMAT: &str = r#"pay:null:1"#; + static OUTPUTS_INVALID_FORMAT: &str = r#"["pay:null:1",1]"#; + static INCOMPATIBLE_INPUTS: &str = r#"["pay:PAYMENT_METHOD_1:1", "pay:PAYMENT_METHOD_2:1"]"#; + static INCOMPATIBLE_OUTPUTS: &str = r#"[{"recipient": "pay:PAYMENT_METHOD_1:1", "amount":1}, {"recipient": "pay:PAYMENT_METHOD_2:1", "amount":1}]"#; + static EQUAL_INPUTS: &str = r#"["pay:null1:1", "pay:null1:1", "pay:null1:2"]"#; + static EQUAL_OUTPUTS: &str = r#"[{"paymentAddress": "pay:null:1", "amount":1}, {"paymentAddress": "pay:null:1", "amount":2}, {"paymentAddress": "pay:null:2", "amount":2, "extra":"2"}]"#; + static PAYMENT_RESPONSE: &str = r#"{"reqId":1, "sources":[{"input": "pay:null:1", "amount":1}, {"input": "pay:null:2", "amount":2}]}"#; + static GET_TXN_FEES_RESPONSE: &str = r#"{"reqId":1, fees:{"txnType1":1, "txnType2":2}}"#; mod register_payment_method { use super::*; diff --git a/libindy/tests/pool.rs b/libindy/tests/pool.rs index 3969a60958..5b94382acd 100644 --- a/libindy/tests/pool.rs +++ b/libindy/tests/pool.rs @@ -354,6 +354,7 @@ mod high_cases { } } +#[cfg(not(feature="only_high_cases"))] mod medium_cases { use super::*; diff --git a/libindy/tests/wallet.rs b/libindy/tests/wallet.rs index e70486015d..3fd1cf677c 100644 --- a/libindy/tests/wallet.rs +++ b/libindy/tests/wallet.rs @@ -32,7 +32,6 @@ use utils::{environment, wallet, test, did}; use utils::constants::*; use self::indy::ErrorCode; -use api::INVALID_WALLET_HANDLE; use std::path::PathBuf; use std::fs; @@ -44,8 +43,6 @@ fn cleanup_file(path: &PathBuf) { } } -use utils::test::cleanup_wallet; - mod high_cases { use super::*; @@ -395,12 +392,16 @@ mod high_cases { } } +#[cfg(not(feature="only_high_cases"))] mod medium_cases { extern crate libc; use super::*; use std::ffi::CString; + use api::INVALID_WALLET_HANDLE; + use utils::test::cleanup_wallet; + mod register_wallet_type { use super::*; From ea6a6bd37bf3b47e81ac16c34e645d1450bcb756 Mon Sep 17 00:00:00 2001 From: Nikita Khateev Date: Thu, 15 Aug 2019 19:27:00 +0300 Subject: [PATCH 227/320] IS-1316 -- Add state proof verification and parsing Signed-off-by: Nikita Khateev --- libindy/src/services/pool/state_proof/mod.rs | 370 ++++++++++++++++++- libindy/src/services/pool/types.rs | 4 +- 2 files changed, 358 insertions(+), 16 deletions(-) diff --git a/libindy/src/services/pool/state_proof/mod.rs b/libindy/src/services/pool/state_proof/mod.rs index b5a39ea56d..2bfe78f497 100644 --- a/libindy/src/services/pool/state_proof/mod.rs +++ b/libindy/src/services/pool/state_proof/mod.rs @@ -3,6 +3,8 @@ extern crate rmp_serde; use std::collections::HashMap; use std::ffi::{CStr, CString}; +use utils::crypto::hash::{Hash}; +use rust_base58::ToBase58; use base64; use rlp::UntrustedRlp; @@ -119,6 +121,14 @@ pub fn verify_parsed_sp(parsed_sps: Vec, return false; } } + KeyValueSimpleDataVerificationType::MerkleTree(length) => { + if !_verify_merkle_tree(proof_nodes.as_slice(), + root_hash.as_slice(), + &kvs.kvs, + length){ + return false; + } + } } } //TODO IS-713 support KeyValuesInSP::SubTrie @@ -248,6 +258,14 @@ pub fn parse_key_from_request_for_builtin_sp(json_msg: &SJsonValue) -> Option { + if let Some(seq_no) = json_msg["data"].as_u64() { + format!("{}", seq_no) + } else { + error!("parse_key_from_request_for_builtin_sp: <<< GET_TXN has no seq_no, skip AuditProof logic"); + return None; + } + } _ => { trace!("TransactionHandler::parse_reply_for_builtin_sp: <<< Unsupported transaction"); return None; @@ -370,15 +388,11 @@ fn _parse_reply_for_sp(json_msg: &SJsonValue, data: Option<&str>, parsed_data: & let proof = if let Some(proof) = json_msg["state_proof"]["proof_nodes"].as_str() { trace!("TransactionHandler::parse_reply_for_builtin_sp: proof: {:?}", proof); - proof - } else if let Some(proof) = json_msg["data"]["audit_path"].as_str() { - if xtype == constants::GET_TXN { - trace!("TransactionHandler::parse_reply_for_builtin_sp: proof: {:?}", proof); - //TODO: talk with alex about format - proof - } else { - return Err("Wrong txn type for such proof".to_string()) - } + proof.to_string() + } else if parsed_data["audit_path"].is_array() && xtype == constants::GET_TXN { + let path = unwrap_or_return!(serde_json::to_string(&parsed_data["audit_path"]), Err("Parsing error".to_string())); + trace!("TransactionHandler::parse_reply_for_builtin_sp: proof: {:?}", path); + base64::encode(&path) } else { return Err("No proof".to_string()); }; @@ -386,10 +400,10 @@ fn _parse_reply_for_sp(json_msg: &SJsonValue, data: Option<&str>, parsed_data: & let root_hash = if let Some(root_hash) = json_msg["state_proof"]["root_hash"].as_str() { trace!("TransactionHandler::parse_reply_for_builtin_sp: root_hash: {:?}", root_hash); root_hash - } else if Some(root_hash) = constants::GET_TXN && json_msg["data"]["root_hash"].as_str() { + } else if let Some(root_hash) = parsed_data["root_hash"].as_str() { if xtype == constants::GET_TXN { trace!("TransactionHandler::parse_reply_for_builtin_sp: root_hash: {:?}", root_hash); - json_msg["root_hash"].ok_or() + root_hash } else { return Err("Wrong txn type for such root hash".to_string()) } @@ -397,7 +411,6 @@ fn _parse_reply_for_sp(json_msg: &SJsonValue, data: Option<&str>, parsed_data: & return Err("No root hash".to_string()); }; - // TODO: find out how to parse a key from an existing data let value: Option = match _parse_reply_for_proof_value(json_msg, data, parsed_data, xtype, sp_key) { Ok(value) => value, Err(err_str) => { @@ -410,10 +423,20 @@ fn _parse_reply_for_sp(json_msg: &SJsonValue, data: Option<&str>, parsed_data: & Ok(ParsedSP { root_hash: root_hash.to_owned(), proof_nodes: proof.to_owned(), - multi_signature: if xtype == constants::GET_TXN {json_msg["state_proof"]["multi_signature"].clone()} else {json_msg["data"]["multi_signature"].clone()}, + multi_signature: if xtype != constants::GET_TXN {json_msg["state_proof"]["multi_signature"].clone()} else {parsed_data["multi_signature"].clone()}, kvs_to_verify: KeyValuesInSP::Simple(KeyValueSimpleData { kvs: vec![(base64::encode(sp_key), value)], - verification_type: KeyValueSimpleDataVerificationType::Simple, + verification_type: if xtype == constants::GET_TXN { + let len = if let Some(len) = parsed_data["ledger_size"].as_u64() { + trace!("Ledger length: {}", len); + len + } else { + return Err("No ledger length for this proof".to_string()) + }; + KeyValueSimpleDataVerificationType::MerkleTree(len) + } else { + KeyValueSimpleDataVerificationType::Simple + }, }), }) } @@ -491,6 +514,101 @@ fn _parse_reply_for_proof_signature_checking(json_msg: &SJsonValue) -> Option<(& } } +fn _verify_merkle_tree(proof_nodes: &[u8], root_hash: &[u8], kvs: &[(String, Option)], length: u64) -> bool { + let nodes = match std::str::from_utf8(proof_nodes) { + Ok(res) => res, + Err(err) => { + error!("Wrong state during mapping bytes to string: {:?}", err); + return false; + } + }; + trace!("_verify_merkle_tree >> nodes: {:?}", nodes); + let hashes: Vec = match serde_json::from_str(nodes) { + Ok(vec) => vec, + Err(err) => { + error!("Errors during deserialization: {:?}", err); + return false; + } + }; + + trace!("_verify_merkle_tree >> hashes: {:?}", hashes); + + let (key, value) = &kvs[0]; + let seq_no = match key.parse::() { + Ok(num) => num, + Err(err) => { + error!("Error while parsing seq_no: {:?}", err); + return false; + } + }; + + let turns = _calculate_turns(length, seq_no); + trace!("_verify_merkle_tree >> turns: {:?}", turns); + + if hashes.len() != turns.len() { + error!("Different count of hashes and turns, unable to verify"); + return false; + } + + let hashes_with_turns = hashes.iter().zip(turns).collect::>(); + + let _value = match value{ + Some(val) => val, + None => {return false;} + }; + + trace!("Value to hash: {}", _value); + + let mut hash = match Hash::hash_leaf(&_value) { + Ok(hash) => hash, + Err(err) => { + error!("Error while hashing: {:?}", err); + return false; + } + }; + + trace!("Hashed leaf in b58: {}", hash.to_base58()); + + for (next_hash, turn_right) in hashes_with_turns { + let _next_hash = unwrap_or_return!(next_hash.from_base58(), false); + hash = match { + if turn_right { + Hash::hash_nodes(&hash, &_next_hash) + } else { + Hash::hash_nodes(&_next_hash, &hash) + } + } { + Ok(hash) => hash, + Err(err) => { + error!("Error while hashing: {:?}", err); + return false; + } + } + } + + let result = hash.as_slice() == root_hash; + trace!("_verify_merkle_tree << res: {}, hash: {:?}, root_hash: {:?}", result, hash, root_hash); + + result +} + +// true is right +// false is left +fn _calculate_turns(length: u64, idx: u64) -> Vec { + let mut _idx: usize = (idx - 1) as usize; + let mut _length: usize = length as usize; + let mut result: Vec = vec![]; + while _length != 1 { + let middle = _length.next_power_of_two()/2; + let right = _idx < middle; + result.push(right); + _idx = if right {_idx} else {_idx - middle}; + _length = if right {middle} else {_length - middle}; + } + result.reverse(); + result +} + fn _verify_proof(proofs_rlp: &[u8], root_hash: &[u8], key: &[u8], expected_value: Option<&str>) -> bool { debug!("verify_proof >> key {:?}, expected_value {:?}", key, expected_value); let nodes: Vec = UntrustedRlp::new(proofs_rlp).as_list().unwrap_or_default(); //default will cause error below @@ -639,8 +757,14 @@ fn _parse_reply_for_proof_value(json_msg: &SJsonValue, data: Option<&str>, parse } match xtype { - //TODO constants::GET_TXN => check ledger MerkleTree proofs? //TODO constants::GET_DDO => support DDO + constants::GET_TXN => { + value = if !parsed_data["txn"].is_null() { + parsed_data["txn"].clone() + } else { + return Ok(None) + } + } constants::GET_NYM => { value["identifier"] = parsed_data["identifier"].clone(); value["role"] = parsed_data["role"].clone(); @@ -731,6 +855,105 @@ mod tests { use hex::FromHex; use libc::c_char; + /// For audit proofs tree looks like this + /// 12345 + /// / \ + /// 1234 5 + /// / \ + /// 12 34 + /// / \ / \ + /// 1 2 3 4 + + #[test] + fn audit_proof_verify_works() { + let nodes = json!( + [ + "2ComdvG2GQbsGh6DntnUoxRFDCuWz6iSQdKfdd35jrUj", + "GfWc7bRJj7S4HpwCAzGCLXCftvyJzZkjFDS1cmrPnQFE", + "6bjZk9jK6G368qqpVog8A9JNj48EYZTrNszMzMkwRUho" + ] + ).to_string(); + let kvs = vec![("3".to_string(), Some("3".to_string()))]; + let node_bytes = &nodes; + let root_hash = "G9QooEDKSmEtLGNyTwafQiPfGHMqw3A3Fjcj2eLRG4GS".from_base58().unwrap(); + assert!(_verify_merkle_tree(node_bytes.as_bytes(), root_hash.as_slice(), kvs.as_slice(), 5)); + } + + #[test] + fn audit_proof_verify_works_for_invalid_proof() { + let nodes = json!( + [ + "2ComdvG2GQbsGh6DntnUoxRFDCuWz6iSQdKfdd35jrUa", // wrong hash in this value + "GfWc7bRJj7S4HpwCAzGCLXCftvyJzZkjFDS1cmrPnQFE", + "6bjZk9jK6G368qqpVog8A9JNj48EYZTrNszMzMkwRUho" + ] + ).to_string(); + let kvs = vec![("3".to_string(), Some("3".to_string()))]; + let node_bytes = &nodes; + let root_hash = "G9QooEDKSmEtLGNyTwafQiPfGHMqw3A3Fjcj2eLRG4GS".from_base58().unwrap(); + assert!(!_verify_merkle_tree(node_bytes.as_bytes(), root_hash.as_slice(), kvs.as_slice(), 5)); + } + + #[test] + fn audit_proof_verify_works_for_invalid_root_hash() { + let nodes = json!( + [ + "2ComdvG2GQbsGh6DntnUoxRFDCuWz6iSQdKfdd35jrUj", // wrong hash in this value + "GfWc7bRJj7S4HpwCAzGCLXCftvyJzZkjFDS1cmrPnQFE", + "6bjZk9jK6G368qqpVog8A9JNj48EYZTrNszMzMkwRUho" + ] + ).to_string(); + let kvs = vec![("3".to_string(), Some("3".to_string()))]; + let node_bytes = &nodes; + let root_hash = "G9QooEDKSmEtLGNyTwafQiPfGHMqw3A3Fjcj2eLRG4G1".from_base58().unwrap(); + assert!(!_verify_merkle_tree(node_bytes.as_bytes(), root_hash.as_slice(), kvs.as_slice(), 5)); + } + + #[test] + fn audit_proof_verify_works_for_invalid_ledger_length() { + let nodes = json!( + [ + "2ComdvG2GQbsGh6DntnUoxRFDCuWz6iSQdKfdd35jrUj", // wrong hash in this value + "GfWc7bRJj7S4HpwCAzGCLXCftvyJzZkjFDS1cmrPnQFE", + "6bjZk9jK6G368qqpVog8A9JNj48EYZTrNszMzMkwRUho" + ] + ).to_string(); + let kvs = vec![("3".to_string(), Some("3".to_string()))]; + let node_bytes = &nodes; + let root_hash = "G9QooEDKSmEtLGNyTwafQiPfGHMqw3A3Fjcj2eLRG4GS".from_base58().unwrap(); + assert!(!_verify_merkle_tree(node_bytes.as_bytes(), root_hash.as_slice(), kvs.as_slice(), 9)); + } + + #[test] + fn audit_proof_verify_works_for_invalid_value() { + let nodes = json!( + [ + "2ComdvG2GQbsGh6DntnUoxRFDCuWz6iSQdKfdd35jrUj", // wrong hash in this value + "GfWc7bRJj7S4HpwCAzGCLXCftvyJzZkjFDS1cmrPnQFE", + "6bjZk9jK6G368qqpVog8A9JNj48EYZTrNszMzMkwRUho" + ] + ).to_string(); + let kvs = vec![("3".to_string(), Some("4".to_string()))]; + let node_bytes = &nodes; + let root_hash = "G9QooEDKSmEtLGNyTwafQiPfGHMqw3A3Fjcj2eLRG4GS".from_base58().unwrap(); + assert!(!_verify_merkle_tree(node_bytes.as_bytes(), root_hash.as_slice(), kvs.as_slice(), 5)); + } + + #[test] + fn audit_proof_verify_works_for_invalid_seqno() { + let nodes = json!( + [ + "2ComdvG2GQbsGh6DntnUoxRFDCuWz6iSQdKfdd35jrUj", // wrong hash in this value + "GfWc7bRJj7S4HpwCAzGCLXCftvyJzZkjFDS1cmrPnQFE", + "6bjZk9jK6G368qqpVog8A9JNj48EYZTrNszMzMkwRUho" + ] + ).to_string(); + let kvs = vec![("4".to_string(), Some("3".to_string()))]; + let node_bytes = &nodes; + let root_hash = "G9QooEDKSmEtLGNyTwafQiPfGHMqw3A3Fjcj2eLRG4GS".from_base58().unwrap(); + assert!(!_verify_merkle_tree(node_bytes.as_bytes(), root_hash.as_slice(), kvs.as_slice(), 5)); + } + #[test] fn state_proof_nodes_parse_and_get_works() { /* @@ -1220,6 +1443,123 @@ mod tests { assert_eq!(_verify_proof(proofs.as_slice(), &[0x00], "".as_bytes(), None), false); } + #[test] + fn transaction_handler_parse_generic_reply_for_proof_checking_works_for_get_txn() { + let json_msg = &json!({ + "type": constants::GET_TXN, + "data": { + "audit_path": ["1", "2"], + "ledger_size": 2, + "root_hash": "123", + "txn": {"test1": "test2", "seqNo": 2}, + "multi_signature": "ms" + } + }); + + let nodes_str = base64::encode(&json!(["1", "2"]).to_string()); + + let mut parsed_sps = super::parse_generic_reply_for_proof_checking(json_msg, + "", + Some("2".as_bytes())) + .unwrap(); + + assert_eq!(parsed_sps.len(), 1); + let parsed_sp = parsed_sps.remove(0); + assert_eq!(parsed_sp.root_hash, "123"); + assert_eq!(parsed_sp.multi_signature, "ms"); + assert_eq!(parsed_sp.proof_nodes, nodes_str); + assert_eq!(parsed_sp.kvs_to_verify, + KeyValuesInSP::Simple(KeyValueSimpleData { + kvs: vec![(base64::encode("2"), Some(json!({"test1": "test2", "seqNo": 2}).to_string()))], + verification_type: KeyValueSimpleDataVerificationType::MerkleTree(2), + })); + } + + + #[test] + fn transaction_handler_parse_generic_reply_for_proof_checking_works_for_get_txn_no_multi_signature() { + let json_msg = &json!({ + "type": constants::GET_TXN, + "data": { + "audit_path": ["1", "2"], + "ledger_size": 2, + "root_hash": "123", + "txn": {"test1": "test2", "seqNo": 2}, +// "multi_signature": "ms" + } + }); + + let nodes_str = base64::encode(&json!(["1", "2"]).to_string()); + + let mut parsed_sps = super::parse_generic_reply_for_proof_checking(json_msg, + "", + Some("2".as_bytes())) + .unwrap(); + + assert_eq!(parsed_sps.len(), 1); + let parsed_sp = parsed_sps.remove(0); + assert_eq!(parsed_sp.root_hash, "123"); + assert!(parsed_sp.multi_signature.is_null()); + assert_eq!(parsed_sp.proof_nodes, nodes_str); + assert_eq!(parsed_sp.kvs_to_verify, + KeyValuesInSP::Simple(KeyValueSimpleData { + kvs: vec![(base64::encode("2"), Some(json!({"test1": "test2", "seqNo": 2}).to_string()))], + verification_type: KeyValueSimpleDataVerificationType::MerkleTree(2), + })); + } + + #[test] + fn transaction_handler_parse_generic_reply_for_proof_checking_works_for_get_txn_no_ledger_length() { + let json_msg = &json!({ + "type": constants::GET_TXN, + "data": { + "audit_path": ["1", "2"], +// "ledger_size": 2, + "root_hash": "123", + "txn": {"test1": "test2", "seqNo": 2}, + "multi_signature": "ms" + } + }); + + let nodes_str = base64::encode(&json!(["1", "2"]).to_string()); + + assert!(super::parse_generic_reply_for_proof_checking(json_msg, + "", + Some("2".as_bytes())).is_none()); + } + + #[test] + fn transaction_handler_parse_generic_reply_for_proof_checking_works_for_get_txn_no_txn() { + let json_msg = &json!({ + "type": constants::GET_TXN, + "data": { + "audit_path": ["1", "2"], + "ledger_size": 2, + "root_hash": "123", +// "txn": {"test1": "test2", "seqNo": 2}, + "multi_signature": "ms" + } + }); + + let nodes_str = base64::encode(&json!(["1", "2"]).to_string()); + + let mut parsed_sps = super::parse_generic_reply_for_proof_checking(json_msg, + "", + Some("2".as_bytes())) + .unwrap(); + + assert_eq!(parsed_sps.len(), 1); + let parsed_sp = parsed_sps.remove(0); + assert_eq!(parsed_sp.root_hash, "123"); + assert_eq!(parsed_sp.multi_signature, "ms"); + assert_eq!(parsed_sp.proof_nodes, nodes_str); + assert_eq!(parsed_sp.kvs_to_verify, + KeyValuesInSP::Simple(KeyValueSimpleData { + kvs: vec![(base64::encode("2"), None)], + verification_type: KeyValueSimpleDataVerificationType::MerkleTree(2), + })); + } + #[test] fn transaction_handler_parse_generic_reply_for_proof_checking_works_for_plugged() { extern fn parse(msg: *const c_char, parsed: *mut *const c_char) -> ErrorCode { diff --git a/libindy/src/services/pool/types.rs b/libindy/src/services/pool/types.rs index 718d1dc633..92c5f632d7 100644 --- a/libindy/src/services/pool/types.rs +++ b/libindy/src/services/pool/types.rs @@ -445,7 +445,9 @@ pub enum KeyValueSimpleDataVerificationType { /* key should be base64-encoded string */ Simple, /* key should be plain string */ - NumericalSuffixAscendingNoGaps(NumericalSuffixAscendingNoGapsData) + NumericalSuffixAscendingNoGaps(NumericalSuffixAscendingNoGapsData), + /* nodes are from a simple merkle tree */ + MerkleTree(u64) } impl Default for KeyValueSimpleDataVerificationType { From bf7ad0f0059fae8daa9580456c631430911df0fc Mon Sep 17 00:00:00 2001 From: Axel Nennker Date: Thu, 15 Aug 2019 20:16:48 +0200 Subject: [PATCH 228/320] trait without dyn is deprecated in rustc 1.37 Signed-off-by: Axel Nennker --- libindy/src/commands/anoncreds/issuer.rs | 30 +++--- libindy/src/commands/anoncreds/prover.rs | 36 +++---- libindy/src/commands/anoncreds/tails.rs | 2 +- libindy/src/commands/anoncreds/verifier.rs | 4 +- libindy/src/commands/blob_storage.rs | 4 +- libindy/src/commands/cache.rs | 14 +-- libindy/src/commands/crypto.rs | 22 ++-- libindy/src/commands/did.rs | 30 +++--- libindy/src/commands/ledger.rs | 100 +++++++++--------- libindy/src/commands/non_secrets.rs | 20 ++-- libindy/src/commands/pairwise.rs | 10 +- libindy/src/commands/payments.rs | 86 +++++++-------- libindy/src/commands/pool.rs | 26 ++--- libindy/src/commands/wallet.rs | 34 +++--- libindy/src/errors/mod.rs | 2 +- .../services/blob_storage/default_reader.rs | 4 +- .../services/blob_storage/default_writer.rs | 4 +- libindy/src/services/blob_storage/mod.rs | 24 ++--- libindy/src/services/crypto/mod.rs | 4 +- libindy/src/services/payments.rs | 24 ++--- libindy/src/services/wallet/export_import.rs | 4 +- libindy/src/services/wallet/iterator.rs | 4 +- libindy/src/services/wallet/language.rs | 4 +- libindy/src/services/wallet/mod.rs | 12 +-- .../services/wallet/storage/default/mod.rs | 12 +-- .../services/wallet/storage/default/query.rs | 34 +++--- libindy/src/services/wallet/storage/mod.rs | 6 +- .../services/wallet/storage/plugged/mod.rs | 14 +-- libindy/src/services/wallet/wallet.rs | 4 +- libindy/tests/utils/callback.rs | 26 ++--- libindy/tests/utils/logger.rs | 2 +- 31 files changed, 301 insertions(+), 301 deletions(-) diff --git a/libindy/src/commands/anoncreds/issuer.rs b/libindy/src/commands/anoncreds/issuer.rs index 0c90c31832..d629f0f8b0 100644 --- a/libindy/src/commands/anoncreds/issuer.rs +++ b/libindy/src/commands/anoncreds/issuer.rs @@ -61,7 +61,7 @@ pub enum IssuerCommand { String, // name String, // version AttributeNames, // attribute names - Box) + Send>), + Box) + Send>), CreateAndStoreCredentialDefinition( WalletHandle, String, // issuer did @@ -69,7 +69,7 @@ pub enum IssuerCommand { String, // tag Option, // type Option, // config - Box) + Send>), + Box) + Send>), CreateAndStoreCredentialDefinitionContinue( WalletHandle, SchemaV1, // credentials @@ -85,7 +85,7 @@ pub enum IssuerCommand { WalletHandle, String, // cred def id Option, // config - Box) + Send>), + Box) + Send>), RotateCredentialDefinitionStartComplete( WalletHandle, String, @@ -99,7 +99,7 @@ pub enum IssuerCommand { RotateCredentialDefinitionApply( WalletHandle, String, // cred def did - Box) + Send>), + Box) + Send>), CreateAndStoreRevocationRegistry( WalletHandle, String, // issuer did @@ -108,11 +108,11 @@ pub enum IssuerCommand { String, // credential definition id RevocationRegistryConfig, // config i32, // tails writer handle - Box) + Send>), + Box) + Send>), CreateCredentialOffer( WalletHandle, String, // credential definition id - Box) + Send>), + Box) + Send>), CreateCredential( WalletHandle, CredentialOffer, // credential offer @@ -120,23 +120,23 @@ pub enum IssuerCommand { HashMap, // credential values Option, // revocation registry id Option, // blob storage reader config handle - Box, Option)>) + Send>), + Box, Option)>) + Send>), RevokeCredential( WalletHandle, i32, // blob storage reader config handle String, //revocation revoc id String, //credential revoc id - Box) + Send>), + Box) + Send>), /* RecoverCredential( WalletHandle, i32, // blob storage reader config handle String, //revocation revoc id String, //credential revoc id - Box) + Send>),*/ + Box) + Send>),*/ MergeRevocationRegistryDeltas( RevocationRegistryDelta, //revocation registry delta RevocationRegistryDelta, //other revocation registry delta - Box) + Send>), + Box) + Send>), } pub struct IssuerCommandExecutor { @@ -145,8 +145,8 @@ pub struct IssuerCommandExecutor { pub pool_service: Rc, pub wallet_service: Rc, pub crypto_service: Rc, - pending_str_str_callbacks: RefCell) + Send>>>, - pending_str_callbacks: RefCell) + Send>>>, + pending_str_str_callbacks: RefCell) + Send>>>, + pending_str_callbacks: RefCell) + Send>>>, } impl IssuerCommandExecutor { @@ -267,7 +267,7 @@ impl IssuerCommandExecutor { tag: &str, type_: Option<&str>, config: Option<&CredentialDefinitionConfig>, - cb: Box) + Send>) { + cb: Box) + Send>) { debug!("create_and_store_credential_definition >>> wallet_handle: {:?}, issuer_did: {:?}, schema: {:?}, tag: {:?}, \ type_: {:?}, config: {:?}", wallet_handle, issuer_did, schema, tag, type_, config); @@ -307,7 +307,7 @@ impl IssuerCommandExecutor { fn _create_credential_definition(&self, attr_names: &AttributeNames, support_revocation: bool, - cb: Box) + Send>) { let attr_names = attr_names.clone(); @@ -406,7 +406,7 @@ impl IssuerCommandExecutor { wallet_handle: WalletHandle, cred_def_id: &str, cred_def_config: Option<&CredentialDefinitionConfig>, - cb: Box) + Send>) { + cb: Box) + Send>) { debug!("rotate_credential_definition_start >>> wallet_handle: {:?}, cred_def_id: {:?}, cred_def_config: {:?}", wallet_handle, cred_def_id, cred_def_config); diff --git a/libindy/src/commands/anoncreds/prover.rs b/libindy/src/commands/anoncreds/prover.rs index 24b7e9fc4c..c75518b300 100644 --- a/libindy/src/commands/anoncreds/prover.rs +++ b/libindy/src/commands/anoncreds/prover.rs @@ -34,24 +34,24 @@ pub enum ProverCommand { CreateMasterSecret( WalletHandle, Option, // master secret id - Box) + Send>), + Box) + Send>), CreateCredentialRequest( WalletHandle, String, // prover did CredentialOffer, // credential offer CredentialDefinition, // credential def String, // master secret name - Box) + Send>), + Box) + Send>), SetCredentialAttrTagPolicy( WalletHandle, String, // credential definition id Option, // credential attr tag policy bool, // retroactive - Box) + Send>), + Box) + Send>), GetCredentialAttrTagPolicy( WalletHandle, String, // credential definition id - Box) + Send>), + Box) + Send>), StoreCredential( WalletHandle, Option, // credential id @@ -59,47 +59,47 @@ pub enum ProverCommand { Credential, // credentials CredentialDefinition, // credential definition Option, // revocation registry definition - Box) + Send>), + Box) + Send>), GetCredentials( WalletHandle, Option, // filter json - Box) + Send>), + Box) + Send>), GetCredential( WalletHandle, String, // credential id - Box) + Send>), + Box) + Send>), DeleteCredential( WalletHandle, String, // credential id - Box) + Send>), + Box) + Send>), SearchCredentials( WalletHandle, Option, // query json - Box) + Send>), + Box) + Send>), FetchCredentials( i32, // search handle usize, // count - Box) + Send>), + Box) + Send>), CloseCredentialsSearch( i32, // search handle - Box) + Send>), + Box) + Send>), GetCredentialsForProofReq( WalletHandle, ProofRequest, // proof request - Box) + Send>), + Box) + Send>), SearchCredentialsForProofReq( WalletHandle, ProofRequest, // proof request Option, // extra query - Box) + Send>), + Box) + Send>), FetchCredentialForProofReq( i32, // search handle String, // item referent usize, // count - Box) + Send>), + Box) + Send>), CloseCredentialsSearchForProofReq( i32, // search handle - Box) + Send>), + Box) + Send>), CreateProof( WalletHandle, ProofRequest, // proof request @@ -108,14 +108,14 @@ pub enum ProverCommand { HashMap, // schemas HashMap, // credential defs HashMap>, // revocation states - Box) + Send>), + Box) + Send>), CreateRevocationState( i32, // blob storage reader handle RevocationRegistryDefinition, // revocation registry definition RevocationRegistryDelta, // revocation registry delta u64, //timestamp String, //credential revocation id - Box) + Send>), + Box) + Send>), UpdateRevocationState( i32, // tails reader _handle RevocationState, // revocation state @@ -123,7 +123,7 @@ pub enum ProverCommand { RevocationRegistryDelta, // revocation registry delta u64, //timestamp String, //credential revocation id - Box) + Send>) + Box) + Send>) } struct SearchForProofRequest { diff --git a/libindy/src/commands/anoncreds/tails.rs b/libindy/src/commands/anoncreds/tails.rs index b9e4416bd9..de12554a2c 100644 --- a/libindy/src/commands/anoncreds/tails.rs +++ b/libindy/src/commands/anoncreds/tails.rs @@ -46,7 +46,7 @@ impl Drop for SDKTailsAccessor { } impl RevocationTailsAccessor for SDKTailsAccessor { - fn access_tail(&self, tail_id: u32, accessor: &mut FnMut(&Tail)) -> Result<(), UrsaCryptoError> { + fn access_tail(&self, tail_id: u32, accessor: &mut dyn FnMut(&Tail)) -> Result<(), UrsaCryptoError> { debug!("access_tail >>> tail_id: {:?}", tail_id); let tail_bytes = self.tails_service diff --git a/libindy/src/commands/anoncreds/verifier.rs b/libindy/src/commands/anoncreds/verifier.rs index 6a92d93628..8a0064cb89 100644 --- a/libindy/src/commands/anoncreds/verifier.rs +++ b/libindy/src/commands/anoncreds/verifier.rs @@ -18,9 +18,9 @@ pub enum VerifierCommand { HashMap, // credential defs HashMap, // rev reg defs HashMap>, // rev reg entries - Box) + Send>), + Box) + Send>), GenerateNonce( - Box) + Send>) + Box) + Send>) } pub struct VerifierCommandExecutor { diff --git a/libindy/src/commands/blob_storage.rs b/libindy/src/commands/blob_storage.rs index 9e8339721a..9347f067b1 100644 --- a/libindy/src/commands/blob_storage.rs +++ b/libindy/src/commands/blob_storage.rs @@ -7,11 +7,11 @@ pub enum BlobStorageCommand { OpenReader( String, // type String, // config - Box) + Send>), + Box) + Send>), OpenWriter( String, // writer type String, // writer config JSON - Box) + Send>), + Box) + Send>), } pub struct BlobStorageCommandExecutor { diff --git a/libindy/src/commands/cache.rs b/libindy/src/commands/cache.rs index 08c2276fc4..9bcb8f766f 100644 --- a/libindy/src/commands/cache.rs +++ b/libindy/src/commands/cache.rs @@ -21,7 +21,7 @@ pub enum CacheCommand { String, // submitter_did String, // id String, // options_json - Box) + Send>), + Box) + Send>), GetSchemaContinue( WalletHandle, IndyResult<(String, String)>, // ledger_response @@ -33,7 +33,7 @@ pub enum CacheCommand { String, // submitter_did String, // id String, // options_json - Box) + Send>), + Box) + Send>), GetCredDefContinue( WalletHandle, IndyResult<(String, String)>, // ledger_response @@ -42,16 +42,16 @@ pub enum CacheCommand { ), PurgeSchemaCache(WalletHandle, String, // options json - Box) + Send>), + Box) + Send>), PurgeCredDefCache(WalletHandle, String, // options json - Box) + Send>), + Box) + Send>), } pub struct CacheCommandExecutor { wallet_service: Rc, - pending_callbacks: RefCell)>>>, + pending_callbacks: RefCell)>>>, } macro_rules! check_cache { @@ -118,7 +118,7 @@ impl CacheCommandExecutor { submitter_did: &str, id: &str, options_json: &str, - cb: Box) + Send>) { + cb: Box) + Send>) { trace!("get_schema >>> pool_handle: {:?}, wallet_handle: {:?}, submitter_did: {:?}, id: {:?}, options_json: {:?}", pool_handle, wallet_handle, submitter_did, id, options_json); @@ -202,7 +202,7 @@ impl CacheCommandExecutor { submitter_did: &str, id: &str, options_json: &str, - cb: Box) + Send>) { + cb: Box) + Send>) { trace!("get_cred_def >>> pool_handle: {:?}, wallet_handle: {:?}, submitter_did: {:?}, id: {:?}, options_json: {:?}", pool_handle, wallet_handle, submitter_did, id, options_json); diff --git a/libindy/src/commands/crypto.rs b/libindy/src/commands/crypto.rs index 72d08221bb..ae3648c2b2 100644 --- a/libindy/src/commands/crypto.rs +++ b/libindy/src/commands/crypto.rs @@ -22,66 +22,66 @@ pub enum CryptoCommand { CreateKey( WalletHandle, KeyInfo, // key info - Box) + Send>, + Box) + Send>, ), SetKeyMetadata( WalletHandle, String, // verkey String, // metadata - Box) + Send>, + Box) + Send>, ), GetKeyMetadata( WalletHandle, String, // verkey - Box) + Send>, + Box) + Send>, ), CryptoSign( WalletHandle, String, // my vk Vec, // msg - Box>) + Send>, + Box>) + Send>, ), CryptoVerify( String, // their vk Vec, // msg Vec, // signature - Box) + Send>, + Box) + Send>, ), AuthenticatedEncrypt( WalletHandle, String, // my vk String, // their vk Vec, // msg - Box>) + Send>, + Box>) + Send>, ), AuthenticatedDecrypt( WalletHandle, String, // my vk Vec, // encrypted msg - Box)>) + Send>, + Box)>) + Send>, ), AnonymousEncrypt( String, // their vk Vec, // msg - Box>) + Send>, + Box>) + Send>, ), AnonymousDecrypt( WalletHandle, String, // my vk Vec, // msg - Box>) + Send>, + Box>) + Send>, ), PackMessage( Vec, // plaintext message Vec, // list of receiver's keys Option, // senders verkey WalletHandle, - Box>) + Send>, + Box>) + Send>, ), UnpackMessage( JWE, WalletHandle, - Box>) + Send>, + Box>) + Send>, ), } diff --git a/libindy/src/commands/did.rs b/libindy/src/commands/did.rs index 4437eb07e7..03aed87508 100644 --- a/libindy/src/commands/did.rs +++ b/libindy/src/commands/did.rs @@ -23,59 +23,59 @@ pub enum DidCommand { CreateAndStoreMyDid( WalletHandle, MyDidInfo, // my did info - Box) + Send>), + Box) + Send>), ReplaceKeysStart( WalletHandle, KeyInfo, // key info String, // did - Box) + Send>), + Box) + Send>), ReplaceKeysApply( WalletHandle, String, // my did - Box) + Send>), + Box) + Send>), StoreTheirDid( WalletHandle, TheirDidInfo, // their did info json - Box) + Send>), + Box) + Send>), GetMyDidWithMeta( WalletHandle, String, // my did - Box) + Send>), + Box) + Send>), ListMyDidsWithMeta( WalletHandle, - Box) + Send>), + Box) + Send>), KeyForDid( PoolHandle, // pool handle WalletHandle, String, // did (my or their) - Box) + Send>), + Box) + Send>), KeyForLocalDid( WalletHandle, String, // did (my or their) - Box) + Send>), + Box) + Send>), SetEndpointForDid( WalletHandle, String, // did Endpoint, // endpoint address and optional verkey - Box) + Send>), + Box) + Send>), GetEndpointForDid( WalletHandle, PoolHandle, // pool handle String, // did - Box)>) + Send>), + Box)>) + Send>), SetDidMetadata( WalletHandle, String, // did String, // metadata - Box) + Send>), + Box) + Send>), GetDidMetadata( WalletHandle, String, // did - Box) + Send>), + Box) + Send>), AbbreviateVerkey( String, // did String, // verkey - Box) + Send>), + Box) + Send>), // Internal commands GetNymAck( WalletHandle, @@ -332,7 +332,7 @@ impl DidCommandExecutor { pool_handle: PoolHandle, wallet_handle: WalletHandle, did: String, - cb: Box) + Send>) { + cb: Box) + Send>) { debug!("key_for_did >>> pool_handle: {:?}, wallet_handle: {:?}, did: {:?}", pool_handle, wallet_handle, did); try_cb!(self.crypto_service.validate_did(&did), cb); @@ -411,7 +411,7 @@ impl DidCommandExecutor { wallet_handle: WalletHandle, pool_handle: PoolHandle, did: String, - cb: Box)>) + Send>) { + cb: Box)>) + Send>) { debug!("get_endpoint_for_did >>> wallet_handle: {:?}, pool_handle: {:?}, did: {:?}", wallet_handle, pool_handle, did); try_cb!(self.crypto_service.validate_did(&did), cb); diff --git a/libindy/src/commands/ledger.rs b/libindy/src/commands/ledger.rs index 00dadbc84d..7157cc0d5e 100644 --- a/libindy/src/commands/ledger.rs +++ b/libindy/src/commands/ledger.rs @@ -34,11 +34,11 @@ pub enum LedgerCommand { WalletHandle, String, // submitter did String, // request json - Box) + Send>), + Box) + Send>), SubmitRequest( PoolHandle, // pool handle String, // request json - Box) + Send>), + Box) + Send>), SubmitAck( CommandHandle, IndyResult, // result json or error @@ -48,91 +48,91 @@ pub enum LedgerCommand { String, // request json Option, // nodes Option, // timeout - Box) + Send>), + Box) + Send>), SignRequest( WalletHandle, String, // submitter did String, // request json - Box) + Send>), + Box) + Send>), MultiSignRequest( WalletHandle, String, // submitter did String, // request json - Box) + Send>), + Box) + Send>), BuildGetDdoRequest( Option, // submitter did String, // target did - Box) + Send>), + Box) + Send>), BuildNymRequest( String, // submitter did String, // target did Option, // verkey Option, // alias Option, // role - Box) + Send>), + Box) + Send>), BuildAttribRequest( String, // submitter did String, // target did Option, // hash Option, // raw Option, // enc - Box) + Send>), + Box) + Send>), BuildGetAttribRequest( Option, // submitter did String, // target did Option, // raw Option, // hash Option, // enc - Box) + Send>), + Box) + Send>), BuildGetNymRequest( Option, // submitter did String, // target did - Box) + Send>), + Box) + Send>), BuildSchemaRequest( String, // submitter did Schema, // data - Box) + Send>), + Box) + Send>), BuildGetSchemaRequest( Option, // submitter did String, // id - Box) + Send>), + Box) + Send>), ParseGetSchemaResponse( String, // get schema response json - Box) + Send>), + Box) + Send>), BuildCredDefRequest( String, // submitter did CredentialDefinition, // data - Box) + Send>), + Box) + Send>), BuildGetCredDefRequest( Option, // submitter did String, // id - Box) + Send>), + Box) + Send>), ParseGetCredDefResponse( String, // get cred definition response - Box) + Send>), + Box) + Send>), BuildNodeRequest( String, // submitter did String, // target_did NodeOperationData, // data - Box) + Send>), + Box) + Send>), BuildGetValidatorInfoRequest( String, // submitter did - Box) + Send>), + Box) + Send>), BuildGetTxnRequest( Option, // submitter did Option, // ledger type i32, // data - Box) + Send>), + Box) + Send>), BuildPoolConfigRequest( String, // submitter did bool, // writes bool, // force - Box) + Send>), + Box) + Send>), BuildPoolRestartRequest( String, //submitter did String, //action Option, //datetime - Box) + Send>), + Box) + Send>), BuildPoolUpgradeRequest( String, // submitter did String, // name @@ -145,49 +145,49 @@ pub enum LedgerCommand { bool, // reinstall bool, // force Option, // package - Box) + Send>), + Box) + Send>), BuildRevocRegDefRequest( String, // submitter did RevocationRegistryDefinition, // data - Box) + Send>), + Box) + Send>), BuildGetRevocRegDefRequest( Option, // submitter did String, // revocation registry definition id - Box) + Send>), + Box) + Send>), ParseGetRevocRegDefResponse( String, // get revocation registry definition response - Box) + Send>), + Box) + Send>), BuildRevocRegEntryRequest( String, // submitter did String, // revocation registry definition id String, // revocation registry definition type RevocationRegistryDelta, // value - Box) + Send>), + Box) + Send>), BuildGetRevocRegRequest( Option, // submitter did String, // revocation registry definition id i64, // timestamp - Box) + Send>), + Box) + Send>), ParseGetRevocRegResponse( String, // get revocation registry response - Box) + Send>), + Box) + Send>), BuildGetRevocRegDeltaRequest( Option, // submitter did String, // revocation registry definition id Option, // from i64, // to - Box) + Send>), + Box) + Send>), ParseGetRevocRegDeltaResponse( String, // get revocation registry delta response - Box) + Send>), + Box) + Send>), RegisterSPParser( String, // txn type CustomTransactionParser, CustomFree, - Box) + Send>), + Box) + Send>), GetResponseMetadata( String, // response - Box) + Send>), + Box) + Send>), BuildAuthRuleRequest( String, // submitter did String, // auth type @@ -196,11 +196,11 @@ pub enum LedgerCommand { Option, // old value Option, // new value String, // constraint - Box) + Send>), + Box) + Send>), BuildAuthRulesRequest( String, // submitter did AuthRules, // auth rules - Box) + Send>), + Box) + Send>), BuildGetAuthRuleRequest( Option, // submitter did Option, // auth type @@ -208,12 +208,12 @@ pub enum LedgerCommand { Option, // field Option, // old value Option, // new value - Box) + Send>), + Box) + Send>), GetSchema( PoolHandle, Option, String, - Box) + Send>, + Box) + Send>, ), GetSchemaContinue( IndyResult, @@ -223,7 +223,7 @@ pub enum LedgerCommand { PoolHandle, Option, String, - Box) + Send>, + Box) + Send>, ), GetCredDefContinue( IndyResult, @@ -233,22 +233,22 @@ pub enum LedgerCommand { String, // submitter did String, // text String, // version - Box) + Send>), + Box) + Send>), BuildGetTxnAuthorAgreementRequest( Option, // submitter did Option, // data - Box) + Send>), + Box) + Send>), BuildAcceptanceMechanismRequests( String, // submitter did AcceptanceMechanisms, // aml String, // version Option, // aml context - Box) + Send>), + Box) + Send>), BuildGetAcceptanceMechanismsRequest( Option, // submitter did Option, // timestamp Option, // version - Box) + Send>), + Box) + Send>), AppendTxnAuthorAgreementAcceptanceToRequest( String, // request json Option, // text @@ -256,11 +256,11 @@ pub enum LedgerCommand { Option, // hash String, // acceptance mechanism type u64, // time of acceptance - Box) + Send>), + Box) + Send>), AppendRequestEndorser( String, // request json String, // endorser did - Box) + Send>), + Box) + Send>), } pub struct LedgerCommandExecutor { @@ -269,8 +269,8 @@ pub struct LedgerCommandExecutor { wallet_service: Rc, ledger_service: Rc, - send_callbacks: RefCell)>>>, - pending_callbacks: RefCell)>>>, + send_callbacks: RefCell)>>>, + pending_callbacks: RefCell)>>>, } impl LedgerCommandExecutor { @@ -522,7 +522,7 @@ impl LedgerCommandExecutor { wallet_handle: WalletHandle, submitter_did: &str, request_json: &str, - cb: Box) + Send>) { + cb: Box) + Send>) { debug!("sign_and_submit_request >>> pool_handle: {:?}, wallet_handle: {:?}, submitter_did: {:?}, request_json: {:?}", pool_handle, wallet_handle, submitter_did, request_json); @@ -582,7 +582,7 @@ impl LedgerCommandExecutor { fn submit_request(&self, handle: PoolHandle, request_json: &str, - cb: Box) + Send>) { + cb: Box) + Send>) { debug!("submit_request >>> handle: {:?}, request_json: {:?}", handle, request_json); let x: IndyResult = self.pool_service.send_tx(handle, request_json); @@ -597,7 +597,7 @@ impl LedgerCommandExecutor { request_json: &str, nodes: Option<&str>, timeout: Option, - cb: Box) + Send>) { + cb: Box) + Send>) { debug!("submit_action >>> handle: {:?}, request_json: {:?}, nodes: {:?}, timeout: {:?}", handle, request_json, nodes, timeout); if let Err(err) = self.ledger_service.validate_action(request_json) { @@ -1201,7 +1201,7 @@ impl LedgerCommandExecutor { } } - fn get_schema(&self, pool_handle: i32, submitter_did: Option<&str>, id: &str, cb: Box) + Send>) { + fn get_schema(&self, pool_handle: i32, submitter_did: Option<&str>, id: &str, cb: Box) + Send>) { let request_json = try_cb!(self.build_get_schema_request(submitter_did, id), cb); let cb_id = next_command_handle(); @@ -1225,7 +1225,7 @@ impl LedgerCommandExecutor { cb(self.parse_get_schema_response(&pool_response)); } - fn get_cred_def(&self, pool_handle: i32, submitter_did: Option<&str>, id: &str, cb: Box) + Send>) { + fn get_cred_def(&self, pool_handle: i32, submitter_did: Option<&str>, id: &str, cb: Box) + Send>) { let request_json = try_cb!(self.build_get_cred_def_request(submitter_did, id), cb); let cb_id = next_command_handle(); diff --git a/libindy/src/commands/non_secrets.rs b/libindy/src/commands/non_secrets.rs index 2c3f854a76..b84a7e1f40 100644 --- a/libindy/src/commands/non_secrets.rs +++ b/libindy/src/commands/non_secrets.rs @@ -15,47 +15,47 @@ pub enum NonSecretsCommand { String, // id String, // value Option, //tags - Box) + Send>), + Box) + Send>), UpdateRecordValue(WalletHandle, String, // type String, // id String, // value - Box) + Send>), + Box) + Send>), UpdateRecordTags(WalletHandle, String, // type String, // id Tags, //tags - Box) + Send>), + Box) + Send>), AddRecordTags(WalletHandle, String, // type String, // id Tags, //tags - Box) + Send>), + Box) + Send>), DeleteRecordTags(WalletHandle, String, // type String, // id String, //tag names json - Box) + Send>), + Box) + Send>), DeleteRecord(WalletHandle, String, // type String, // id - Box) + Send>), + Box) + Send>), GetRecord(WalletHandle, String, // type String, // id String, // options json - Box) + Send>), + Box) + Send>), OpenSearch(WalletHandle, String, // type String, // query json String, // options json - Box) + Send>), + Box) + Send>), FetchSearchNextRecords(WalletHandle, i32, // wallet search handle usize, // count - Box) + Send>), + Box) + Send>), CloseSearch(i32, // wallet search handle - Box) + Send>), + Box) + Send>), } pub struct NonSecretsCommandExecutor { diff --git a/libindy/src/commands/pairwise.rs b/libindy/src/commands/pairwise.rs index 7a401122a7..45addb7599 100644 --- a/libindy/src/commands/pairwise.rs +++ b/libindy/src/commands/pairwise.rs @@ -12,25 +12,25 @@ pub enum PairwiseCommand { PairwiseExists( WalletHandle, String, // their_did - Box) + Send>), + Box) + Send>), CreatePairwise( WalletHandle, String, // their_did String, // my_did Option, // metadata - Box) + Send>), + Box) + Send>), ListPairwise( WalletHandle, - Box) + Send>), + Box) + Send>), GetPairwise( WalletHandle, String, // their_did - Box) + Send>), + Box) + Send>), SetPairwiseMetadata( WalletHandle, String, // their_did Option, // metadata - Box) + Send>) + Box) + Send>) } pub struct PairwiseCommandExecutor { diff --git a/libindy/src/commands/payments.rs b/libindy/src/commands/payments.rs index 24e4c71be7..7f208c6e0b 100644 --- a/libindy/src/commands/payments.rs +++ b/libindy/src/commands/payments.rs @@ -22,19 +22,19 @@ pub enum PaymentsCommand { RegisterMethod( String, //type PaymentsMethodCBs, //method callbacks - Box) + Send>), + Box) + Send>), CreateAddress( WalletHandle, String, //type String, //config - Box) + Send>), + Box) + Send>), CreateAddressAck( CommandHandle, WalletHandle, IndyResult), ListAddresses( WalletHandle, - Box) + Send>), + Box) + Send>), AddRequestFees( WalletHandle, Option, //submitter did @@ -42,14 +42,14 @@ pub enum PaymentsCommand { String, //inputs String, //outputs Option, //extra - Box) + Send>), + Box) + Send>), AddRequestFeesAck( CommandHandle, //handle IndyResult), ParseResponseWithFees( String, //type String, //response - Box) + Send>), + Box) + Send>), ParseResponseWithFeesAck( CommandHandle, //handle IndyResult), @@ -58,14 +58,14 @@ pub enum PaymentsCommand { Option, //submitter did String, //payment address Option, //from - Box) + Send>), + Box) + Send>), BuildGetPaymentSourcesRequestAck( CommandHandle, IndyResult), ParseGetPaymentSourcesResponse( String, //type String, //response - Box) + Send>), + Box) + Send>), ParseGetPaymentSourcesResponseAck( CommandHandle, IndyResult<(String, i64)>), @@ -75,14 +75,14 @@ pub enum PaymentsCommand { String, //inputs String, //outputs Option, //extra - Box) + Send>), + Box) + Send>), BuildPaymentReqAck( CommandHandle, IndyResult), ParsePaymentResponse( String, //payment_method String, //response - Box) + Send>), + Box) + Send>), ParsePaymentResponseAck( CommandHandle, IndyResult), @@ -93,13 +93,13 @@ pub enum PaymentsCommand { Option, // hash String, // acceptance mechanism type u64, // time of acceptance - Box) + Send>), + Box) + Send>), BuildMintReq( WalletHandle, Option, //submitter did String, //outputs Option, //extra - Box) + Send>), + Box) + Send>), BuildMintReqAck( CommandHandle, IndyResult), @@ -108,7 +108,7 @@ pub enum PaymentsCommand { Option, //submitter did String, //method String, //fees - Box) + Send>), + Box) + Send>), BuildSetTxnFeesReqAck( CommandHandle, IndyResult), @@ -116,14 +116,14 @@ pub enum PaymentsCommand { WalletHandle, Option, //submitter did String, //method - Box) + Send>), + Box) + Send>), BuildGetTxnFeesReqAck( CommandHandle, IndyResult), ParseGetTxnFeesResponse( String, //method String, //response - Box) + Send>), + Box) + Send>), ParseGetTxnFeesResponseAck( CommandHandle, IndyResult), @@ -131,14 +131,14 @@ pub enum PaymentsCommand { WalletHandle, Option, //submitter_did String, //receipt - Box) + Send>), + Box) + Send>), BuildVerifyPaymentReqAck( CommandHandle, IndyResult), ParseVerifyPaymentResponse( String, //payment_method String, //resp_json - Box) + Send>), + Box) + Send>), ParseVerifyPaymentResponseAck( CommandHandle, IndyResult), @@ -146,12 +146,12 @@ pub enum PaymentsCommand { String, // get auth rule response json RequesterInfo, //requester info Fees, //fees - Box) + Send>), + Box) + Send>), SignWithAddressReq( WalletHandle, String, //address Vec, //message - Box>) + Send>), + Box>) + Send>), SignWithAddressAck( CommandHandle, IndyResult>), @@ -159,7 +159,7 @@ pub enum PaymentsCommand { String, //address Vec, //message Vec, //signature - Box) + Send>), + Box) + Send>), VerifyWithAddressAck( CommandHandle, IndyResult) @@ -170,10 +170,10 @@ pub struct PaymentsCommandExecutor { wallet_service: Rc, crypto_service: Rc, ledger_service: Rc, - pending_callbacks_str: RefCell) + Send>>>, - pending_callbacks_str_i64: RefCell) + Send>>>, - pending_array_callbacks: RefCell>) + Send>>>, - pending_bool_callbacks: RefCell) + Send>>>, + pending_callbacks_str: RefCell) + Send>>>, + pending_callbacks_str_i64: RefCell) + Send>>>, + pending_array_callbacks: RefCell>) + Send>>>, + pending_bool_callbacks: RefCell) + Send>>>, } impl PaymentsCommandExecutor { @@ -347,7 +347,7 @@ impl PaymentsCommandExecutor { res } - fn create_address(&self, wallet_handle: WalletHandle, type_: &str, config: &str, cb: Box) + Send>) { + fn create_address(&self, wallet_handle: WalletHandle, type_: &str, config: &str, cb: Box) + Send>) { trace!("create_address >>> wallet_handle: {:?}, type_: {:?}, config: {:?}", wallet_handle, type_, config); match self.wallet_service.check(wallet_handle).map_err(map_err_err!()) { @@ -373,7 +373,7 @@ impl PaymentsCommandExecutor { trace!("create_address_ack <<<"); } - fn list_addresses(&self, wallet_handle: WalletHandle, cb: Box) + Send>) { + fn list_addresses(&self, wallet_handle: WalletHandle, cb: Box) + Send>) { trace!("list_addresses >>> wallet_handle: {:?}", wallet_handle); match self.wallet_service.search_records(wallet_handle, &self.wallet_service.add_prefix("PaymentAddress"), "{}", &RecordOptions::id_value()) { @@ -397,7 +397,7 @@ impl PaymentsCommandExecutor { trace!("list_addresses <<<"); } - fn add_request_fees(&self, wallet_handle: WalletHandle, submitter_did: Option<&str>, req: &str, inputs: &str, outputs: &str, extra: Option<&str>, cb: Box) + Send>) { + fn add_request_fees(&self, wallet_handle: WalletHandle, submitter_did: Option<&str>, req: &str, inputs: &str, outputs: &str, extra: Option<&str>, cb: Box) + Send>) { trace!("add_request_fees >>> wallet_handle: {:?}, submitter_did: {:?}, req: {:?}, inputs: {:?}, outputs: {:?}, extra: {:?}", wallet_handle, submitter_did, req, inputs, outputs, extra); if let Some(did) = submitter_did { @@ -437,7 +437,7 @@ impl PaymentsCommandExecutor { trace!("add_request_fees_ack <<<"); } - fn parse_response_with_fees(&self, type_: &str, response: &str, cb: Box) + Send>) { + fn parse_response_with_fees(&self, type_: &str, response: &str, cb: Box) + Send>) { trace!("parse_response_with_fees >>> type_: {:?}, response: {:?}", type_, response); self._process_method_str(cb, &|i| self.payments_service.parse_response_with_fees(i, type_, response)); trace!("parse_response_with_fees <<<"); @@ -449,7 +449,7 @@ impl PaymentsCommandExecutor { trace!("parse_response_with_fees_ack <<<"); } - fn build_get_payment_sources_request(&self, wallet_handle: WalletHandle, submitter_did: Option<&str>, payment_address: &str, next: Option, cb: Box) + Send>) { + fn build_get_payment_sources_request(&self, wallet_handle: WalletHandle, submitter_did: Option<&str>, payment_address: &str, next: Option, cb: Box) + Send>) { trace!("build_get_payment_sources_request >>> wallet_handle: {:?}, submitter_did: {:?}, payment_address: {:?}", wallet_handle, submitter_did, payment_address); if let Some(did) = submitter_did { match self.crypto_service.validate_did(did).map_err(map_err_err!()) { @@ -480,7 +480,7 @@ impl PaymentsCommandExecutor { trace!("build_get_payment_sources_request_ack <<<"); } - fn parse_get_payment_sources_response(&self, type_: &str, response: &str, cb: Box) + Send>) { + fn parse_get_payment_sources_response(&self, type_: &str, response: &str, cb: Box) + Send>) { trace!("parse_get_payment_sources_response >>> response: {:?}", response); self._process_method_str_i64(cb, &|i| self.payments_service.parse_get_payment_sources_response(i, type_, response)); trace!("parse_get_payment_sources_response <<<"); @@ -492,7 +492,7 @@ impl PaymentsCommandExecutor { trace!("parse_get_payment_sources_response_ack <<<"); } - fn build_payment_req(&self, wallet_handle: WalletHandle, submitter_did: Option<&str>, inputs: &str, outputs: &str, extra: Option<&str>, cb: Box) + Send>) { + fn build_payment_req(&self, wallet_handle: WalletHandle, submitter_did: Option<&str>, inputs: &str, outputs: &str, extra: Option<&str>, cb: Box) + Send>) { trace!("build_payment_req >>> wallet_handle: {:?}, submitter_did: {:?}, inputs: {:?}, outputs: {:?}, extra: {:?}", wallet_handle, submitter_did, inputs, outputs, extra); if let Some(did) = submitter_did { match self.crypto_service.validate_did(did).map_err(map_err_err!()) { @@ -551,7 +551,7 @@ impl PaymentsCommandExecutor { trace!("build_payment_req_ack <<<"); } - fn parse_payment_response(&self, payment_method: &str, response: &str, cb: Box) + Send>) { + fn parse_payment_response(&self, payment_method: &str, response: &str, cb: Box) + Send>) { trace!("parse_payment_response >>> response: {:?}", response); self._process_method_str(cb, &|i| self.payments_service.parse_payment_response(i, payment_method, response)); trace!("parse_payment_response <<<"); @@ -563,7 +563,7 @@ impl PaymentsCommandExecutor { trace!("parse_payment_response_ack <<<"); } - fn build_mint_req(&self, wallet_handle: WalletHandle, submitter_did: Option<&str>, outputs: &str, extra: Option<&str>, cb: Box) + Send>) { + fn build_mint_req(&self, wallet_handle: WalletHandle, submitter_did: Option<&str>, outputs: &str, extra: Option<&str>, cb: Box) + Send>) { trace!("build_mint_req >>> wallet_handle: {:?}, submitter_did: {:?}, outputs: {:?}, extra: {:?}", wallet_handle, submitter_did, outputs, extra); if let Some(did) = submitter_did { match self.crypto_service.validate_did(did).map_err(map_err_err!()) { @@ -591,7 +591,7 @@ impl PaymentsCommandExecutor { trace!("build_mint_req_ack <<<"); } - fn build_set_txn_fees_req(&self, wallet_handle: WalletHandle, submitter_did: Option<&str>, type_: &str, fees: &str, cb: Box) + Send>) { + fn build_set_txn_fees_req(&self, wallet_handle: WalletHandle, submitter_did: Option<&str>, type_: &str, fees: &str, cb: Box) + Send>) { trace!("build_set_txn_fees_req >>> wallet_handle: {:?}, submitter_did: {:?}, type_: {:?}, fees: {:?}", wallet_handle, submitter_did, type_, fees); if let Some(did) = submitter_did { match self.crypto_service.validate_did(did).map_err(map_err_err!()) { @@ -616,7 +616,7 @@ impl PaymentsCommandExecutor { trace!("build_set_txn_fees_req_ack <<<"); } - fn build_get_txn_fees_req(&self, wallet_handle: WalletHandle, submitter_did: Option<&str>, type_: &str, cb: Box) + Send>) { + fn build_get_txn_fees_req(&self, wallet_handle: WalletHandle, submitter_did: Option<&str>, type_: &str, cb: Box) + Send>) { trace!("build_get_txn_fees_req >>> wallet_handle: {:?}, submitter_did: {:?}, type_: {:?}", wallet_handle, submitter_did, type_); if let Some(did) = submitter_did { match self.crypto_service.validate_did(did).map_err(map_err_err!()) { @@ -635,7 +635,7 @@ impl PaymentsCommandExecutor { trace!("build_get_txn_fees_req_ack <<<"); } - fn parse_get_txn_fees_response(&self, type_: &str, response: &str, cb: Box) + Send>) { + fn parse_get_txn_fees_response(&self, type_: &str, response: &str, cb: Box) + Send>) { trace!("parse_get_txn_fees_response >>> response: {:?}", response); self._process_method_str(cb, &|i| self.payments_service.parse_get_txn_fees_response(i, type_, response)); trace!("parse_get_txn_fees_response <<<"); @@ -647,7 +647,7 @@ impl PaymentsCommandExecutor { trace!("parse_get_txn_fees_response_ack <<<"); } - fn build_verify_payment_request(&self, wallet_handle: WalletHandle, submitter_did: Option<&str>, receipt: &str, cb: Box) + Send>) { + fn build_verify_payment_request(&self, wallet_handle: WalletHandle, submitter_did: Option<&str>, receipt: &str, cb: Box) + Send>) { trace!("build_verify_payment_request >>> wallet_handle: {:?}, submitter_did: {:?}, receipt: {:?}", wallet_handle, submitter_did, receipt); if let Some(did) = submitter_did { match self.crypto_service.validate_did(did).map_err(map_err_err!()) { @@ -677,7 +677,7 @@ impl PaymentsCommandExecutor { trace!("build_verify_payment_request_ack <<<"); } - fn parse_verify_payment_response(&self, type_: &str, resp_json: &str, cb: Box) + Send>) { + fn parse_verify_payment_response(&self, type_: &str, resp_json: &str, cb: Box) + Send>) { trace!("parse_verify_payment_response >>> response: {:?}", resp_json); self._process_method_str(cb, &|i| self.payments_service.parse_verify_payment_response(i, type_, resp_json)); trace!("parse_verify_payment_response <<<"); @@ -689,7 +689,7 @@ impl PaymentsCommandExecutor { trace!("parse_verify_payment_response_ack <<<"); } - fn sign_with_address(&self, wallet_handle: WalletHandle, address: &str, message: &[u8], cb: Box>) + Send>) { + fn sign_with_address(&self, wallet_handle: WalletHandle, address: &str, message: &[u8], cb: Box>) + Send>) { trace!("sign_with_address >>> address: {:?}, message: {:?}", address, hex::encode(message)); let method = match self.payments_service.parse_method_from_payment_address(address) { Ok(method) => method, @@ -716,7 +716,7 @@ impl PaymentsCommandExecutor { trace!("sign_with_address_ack <<<"); } - fn verify_with_address(&self, address: &str, message: &[u8], signature: &[u8], cb: Box) + Send>) { + fn verify_with_address(&self, address: &str, message: &[u8], signature: &[u8], cb: Box) + Send>) { trace!("sign_with_address >>> address: {:?}, message: {:?}, signature: {:?}", address, hex::encode(message), hex::encode(signature)); let method = match self.payments_service.parse_method_from_payment_address(address) { @@ -747,8 +747,8 @@ impl PaymentsCommandExecutor { // HELPERS - fn _process_method_str(&self, cb: Box) + Send>, - method: &Fn(CommandHandle) -> IndyResult<()>) { + fn _process_method_str(&self, cb: Box) + Send>, + method: &dyn Fn(CommandHandle) -> IndyResult<()>) { let cmd_handle = next_command_handle(); match method(cmd_handle) { Ok(()) => { @@ -758,8 +758,8 @@ impl PaymentsCommandExecutor { } } - fn _process_method_str_i64(&self, cb: Box) + Send>, - method: &Fn(CommandHandle) -> IndyResult<()>) { + fn _process_method_str_i64(&self, cb: Box) + Send>, + method: &dyn Fn(CommandHandle) -> IndyResult<()>) { let cmd_handle = next_command_handle(); match method(cmd_handle) { Ok(()) => { diff --git a/libindy/src/commands/pool.rs b/libindy/src/commands/pool.rs index 95c6932934..5046963095 100644 --- a/libindy/src/commands/pool.rs +++ b/libindy/src/commands/pool.rs @@ -12,39 +12,39 @@ pub enum PoolCommand { Create( String, // name Option, // config - Box) + Send>), + Box) + Send>), Delete( String, // name - Box) + Send>), + Box) + Send>), Open( String, // name Option, // config - Box) + Send>), + Box) + Send>), OpenAck( CommandHandle, // cmd id PoolHandle, // pool handle IndyResult<()>), - List(Box) + Send>), + List(Box) + Send>), Close( PoolHandle, // pool handle - Box) + Send>), + Box) + Send>), CloseAck(CommandHandle, IndyResult<()>), Refresh( PoolHandle, // pool handle - Box) + Send>), + Box) + Send>), RefreshAck(CommandHandle, IndyResult<()>), SetProtocolVersion( usize, // protocol version - Box) + Send>), + Box) + Send>), } pub struct PoolCommandExecutor { pool_service: Rc, - close_callbacks: RefCell)>>>, - refresh_callbacks: RefCell)>>>, - open_callbacks: RefCell)>>>, + close_callbacks: RefCell)>>>, + refresh_callbacks: RefCell)>>>, + open_callbacks: RefCell)>>>, } impl PoolCommandExecutor { @@ -155,7 +155,7 @@ impl PoolCommandExecutor { Ok(()) } - fn open(&self, name: &str, config: Option, cb: Box) + Send>) { + fn open(&self, name: &str, config: Option, cb: Box) + Send>) { debug!("open >>> name: {:?}, config: {:?}", name, config); let result = self.pool_service.open(name, config) @@ -185,7 +185,7 @@ impl PoolCommandExecutor { Ok(res) } - fn close(&self, pool_handle: PoolHandle, cb: Box) + Send>) { + fn close(&self, pool_handle: PoolHandle, cb: Box) + Send>) { debug!("close >>> handle: {:?}", pool_handle); let result = self.pool_service.close(pool_handle) @@ -203,7 +203,7 @@ impl PoolCommandExecutor { debug!("close <<<"); } - fn refresh(&self, handle: PoolHandle, cb: Box) + Send>) { + fn refresh(&self, handle: PoolHandle, cb: Box) + Send>) { debug!("refresh >>> handle: {:?}", handle); let result = self.pool_service.refresh(handle) diff --git a/libindy/src/commands/wallet.rs b/libindy/src/commands/wallet.rs index 4152b77ad7..7ff5ca1e2d 100644 --- a/libindy/src/commands/wallet.rs +++ b/libindy/src/commands/wallet.rs @@ -41,10 +41,10 @@ pub enum WalletCommand { WalletGetSearchTotalCount, // get search total count WalletFetchSearchNextRecord, // fetch search next record WalletFreeSearch, // free search - Box) + Send>), + Box) + Send>), Create(Config, // config Credentials, // credentials - Box) + Send>), + Box) + Send>), CreateContinue(Config, // config Credentials, // credentials KeyDerivationData, @@ -52,15 +52,15 @@ pub enum WalletCommand { CallbackHandle), Open(Config, // config Credentials, // credentials - Box) + Send>), + Box) + Send>), OpenContinue(WalletHandle, DeriveKeyResult<(MasterKey, Option)>, // derive_key_result ), Close(WalletHandle, - Box) + Send>), + Box) + Send>), Delete(Config, // config Credentials, // credentials - Box) + Send>), + Box) + Send>), DeleteContinue(Config, // config Credentials, // credentials Metadata, // credentials @@ -68,7 +68,7 @@ pub enum WalletCommand { CallbackHandle), Export(WalletHandle, ExportConfig, // export config - Box) + Send>), + Box) + Send>), ExportContinue(WalletHandle, ExportConfig, // export config KeyDerivationData, @@ -77,7 +77,7 @@ pub enum WalletCommand { Import(Config, // config Credentials, // credentials ExportConfig, // import config - Box) + Send>), + Box) + Send>), ImportContinue(Config, // config Credentials, // credentials DeriveKeyResult<(MasterKey, MasterKey)>, // derive_key_result @@ -85,9 +85,9 @@ pub enum WalletCommand { CallbackHandle ), GenerateKey(Option, // config - Box) + Send>), + Box) + Send>), DeriveKey(KeyDerivationData, - Box) + Send>), + Box) + Send>), } macro_rules! get_cb { @@ -100,8 +100,8 @@ macro_rules! get_cb { pub struct WalletCommandExecutor { wallet_service: Rc, crypto_service: Rc, - open_callbacks: RefCell) + Send>>>, - pending_callbacks: RefCell) + Send>>> + open_callbacks: RefCell) + Send>>>, + pending_callbacks: RefCell) + Send>>> } impl WalletCommandExecutor { @@ -229,7 +229,7 @@ impl WalletCommandExecutor { fn _create(&self, config: &Config, credentials: &Credentials, - cb: Box) + Send>) { + cb: Box) + Send>) { trace!("_create >>> config: {:?}, credentials: {:?}", config, secret!(credentials)); let key_data = KeyDerivationData::from_passphrase_with_new_salt(&credentials.key, &credentials.key_derivation_method); @@ -273,7 +273,7 @@ impl WalletCommandExecutor { fn _open(&self, config: &Config, credentials: &Credentials, - cb: Box) + Send>) { + cb: Box) + Send>) { trace!("_open >>> config: {:?}, credentials: {:?}", config, secret!(credentials)); let (wallet_handle, key_derivation_data, rekey_data) = try_cb!(self.wallet_service.open_wallet_prepare(config, credentials), cb); @@ -345,7 +345,7 @@ impl WalletCommandExecutor { fn _delete(&self, config: &Config, credentials: &Credentials, - cb: Box) + Send>) { + cb: Box) + Send>) { trace!("_delete >>> config: {:?}, credentials: {:?}", config, secret!(credentials)); let (metadata, key_derivation_data) = try_cb!(self.wallet_service.delete_wallet_prepare(&config, &credentials), cb); @@ -390,7 +390,7 @@ impl WalletCommandExecutor { fn _export(&self, wallet_handle: WalletHandle, export_config: &ExportConfig, - cb: Box) + Send>) { + cb: Box) + Send>) { trace!("_export >>> handle: {:?}, export_config: {:?}", wallet_handle, secret!(export_config)); let key_data = KeyDerivationData::from_passphrase_with_new_salt(&export_config.key, &export_config.key_derivation_method); @@ -433,7 +433,7 @@ impl WalletCommandExecutor { config: &Config, credentials: &Credentials, import_config: &ExportConfig, - cb: Box) + Send>) { + cb: Box) + Send>) { trace!("_import >>> config: {:?}, credentials: {:?}, import_config: {:?}", config, secret!(credentials), secret!(import_config)); @@ -502,7 +502,7 @@ impl WalletCommandExecutor { Ok(res) } - fn _derive_key(&self, key_data: KeyDerivationData, cb: Box) + Send>){ + fn _derive_key(&self, key_data: KeyDerivationData, cb: Box) + Send>){ ::commands::THREADPOOL.lock().unwrap().execute(move || cb(key_data.calc_master_key())); } } diff --git a/libindy/src/errors/mod.rs b/libindy/src/errors/mod.rs index e91f4a30c8..0f087ca358 100644 --- a/libindy/src/errors/mod.rs +++ b/libindy/src/errors/mod.rs @@ -121,7 +121,7 @@ pub struct IndyError { } impl Fail for IndyError { - fn cause(&self) -> Option<&Fail> { + fn cause(&self) -> Option<&dyn Fail> { self.inner.cause() } diff --git a/libindy/src/services/blob_storage/default_reader.rs b/libindy/src/services/blob_storage/default_reader.rs index 52750c748d..096c6b3e85 100644 --- a/libindy/src/services/blob_storage/default_reader.rs +++ b/libindy/src/services/blob_storage/default_reader.rs @@ -20,7 +20,7 @@ struct DefaultReaderConfig { } impl ReaderType for DefaultReaderType { - fn open(&self, config: &str) -> IndyResult> { + fn open(&self, config: &str) -> IndyResult> { let config: DefaultReaderConfig = serde_json::from_str(config) .to_indy(IndyErrorKind::InvalidStructure, "Can't deserialize DefaultReaderConfig")?; @@ -29,7 +29,7 @@ impl ReaderType for DefaultReaderType { } impl Reader for DefaultReaderConfig { - fn open(&self, hash: &[u8], _location: &str) -> IndyResult> { + fn open(&self, hash: &[u8], _location: &str) -> IndyResult> { let mut path = PathBuf::from(&self.base_dir); path.push(hash.to_base58()); let file = File::open(path)?; diff --git a/libindy/src/services/blob_storage/default_writer.rs b/libindy/src/services/blob_storage/default_writer.rs index 8d53da86ed..c4a3f6dc04 100644 --- a/libindy/src/services/blob_storage/default_writer.rs +++ b/libindy/src/services/blob_storage/default_writer.rs @@ -27,7 +27,7 @@ struct DefaultWriterConfig { } impl WriterType for DefaultWriterType { - fn open(&self, config: &str) -> IndyResult> { + fn open(&self, config: &str) -> IndyResult> { let config: DefaultWriterConfig = serde_json::from_str(config) .to_indy(IndyErrorKind::InvalidStructure, "Can't deserialize DefaultWriterConfig")?; @@ -36,7 +36,7 @@ impl WriterType for DefaultWriterType { } impl Writer for DefaultWriterConfig { - fn create(&self, id: i32) -> IndyResult> { + fn create(&self, id: i32) -> IndyResult> { let path = PathBuf::from(&self.base_dir); fs::DirBuilder::new() diff --git a/libindy/src/services/blob_storage/mod.rs b/libindy/src/services/blob_storage/mod.rs index 5aeaf01cc7..9e49fa22af 100644 --- a/libindy/src/services/blob_storage/mod.rs +++ b/libindy/src/services/blob_storage/mod.rs @@ -11,11 +11,11 @@ mod default_writer; mod default_reader; trait WriterType { - fn open(&self, config: &str) -> IndyResult>; + fn open(&self, config: &str) -> IndyResult>; } trait Writer { - fn create(&self, id: i32) -> IndyResult>; + fn create(&self, id: i32) -> IndyResult>; } trait WritableBlob { @@ -24,11 +24,11 @@ trait WritableBlob { } trait ReaderType { - fn open(&self, config: &str) -> IndyResult>; + fn open(&self, config: &str) -> IndyResult>; } trait Reader { - fn open(&self, hash: &[u8], location: &str) -> IndyResult>; + fn open(&self, hash: &[u8], location: &str) -> IndyResult>; } trait ReadableBlob { @@ -38,20 +38,20 @@ trait ReadableBlob { } pub struct BlobStorageService { - writer_types: RefCell>>, - writer_configs: RefCell>>, - writer_blobs: RefCell, Sha256)>>, + writer_types: RefCell>>, + writer_configs: RefCell>>, + writer_blobs: RefCell, Sha256)>>, - reader_types: RefCell>>, - reader_configs: RefCell>>, - reader_blobs: RefCell>>, + reader_types: RefCell>>, + reader_configs: RefCell>>, + reader_blobs: RefCell>>, } impl BlobStorageService { pub fn new() -> BlobStorageService { - let mut writer_types: HashMap> = HashMap::new(); + let mut writer_types: HashMap> = HashMap::new(); writer_types.insert("default".to_owned(), Box::new(default_writer::DefaultWriterType::new())); - let mut reader_types: HashMap> = HashMap::new(); + let mut reader_types: HashMap> = HashMap::new(); reader_types.insert("default".to_owned(), Box::new(default_reader::DefaultReaderType::new())); BlobStorageService { diff --git a/libindy/src/services/crypto/mod.rs b/libindy/src/services/crypto/mod.rs index 88a05451d4..d939b7837d 100644 --- a/libindy/src/services/crypto/mod.rs +++ b/libindy/src/services/crypto/mod.rs @@ -37,12 +37,12 @@ trait CryptoType { } pub struct CryptoService { - crypto_types: HashMap<&'static str, Box> + crypto_types: HashMap<&'static str, Box> } impl CryptoService { pub fn new() -> CryptoService { - let mut crypto_types: HashMap<&str, Box> = HashMap::new(); + let mut crypto_types: HashMap<&str, Box> = HashMap::new(); crypto_types.insert(DEFAULT_CRYPTO_TYPE, Box::new(ED25519CryptoType::new())); CryptoService { diff --git a/libindy/src/services/payments.rs b/libindy/src/services/payments.rs index eafadefdfe..3331c38c15 100644 --- a/libindy/src/services/payments.rs +++ b/libindy/src/services/payments.rs @@ -713,7 +713,7 @@ mod cbs { send_bool_ack(cmd_handle, Box::new(PaymentsCommand::VerifyWithAddressAck)) } - fn send_ack_str(cmd_handle: CommandHandle, builder: Box) -> PaymentsCommand + Send>) -> Option) -> PaymentsCommand + Send>) -> Option ErrorCode> { cbs::_closure_to_cb_str(cmd_handle, Box::new(move |err, mint_req_json| -> ErrorCode { @@ -727,7 +727,7 @@ mod cbs { })) } - fn send_ack_str_i64(cmd_handle: CommandHandle, builder: Box) -> PaymentsCommand + Send>) -> Option) -> PaymentsCommand + Send>) -> Option ErrorCode> { @@ -742,7 +742,7 @@ mod cbs { })) } - fn send_array_ack(cmd_handle: CommandHandle, builder: Box>) -> PaymentsCommand + Send>) -> Option>) -> PaymentsCommand + Send>) -> Option ErrorCode> { @@ -756,7 +756,7 @@ mod cbs { })) } - fn send_bool_ack(cmd_handle: CommandHandle, builder: Box) -> PaymentsCommand + Send>) -> Option) -> PaymentsCommand + Send>) -> Option ErrorCode> { cbs::_closure_to_cb_bool(cmd_handle, Box::new(move |err, v| -> ErrorCode { @@ -769,12 +769,12 @@ mod cbs { })) } - pub fn _closure_to_cb_str(command_handle: CommandHandle, closure: Box ErrorCode + Send>) + pub fn _closure_to_cb_str(command_handle: CommandHandle, closure: Box ErrorCode + Send>) -> Option ErrorCode> { lazy_static! { - static ref CALLBACKS: Mutex < HashMap < CommandHandle, Box < FnMut(ErrorCode, String) -> ErrorCode + Send > >> = Default::default(); + static ref CALLBACKS: Mutex < HashMap < CommandHandle, Box ErrorCode + Send > >> = Default::default(); } extern "C" fn _callback(command_handle_: CommandHandle, err: ErrorCode, c_str: *const c_char) -> ErrorCode { @@ -790,10 +790,10 @@ mod cbs { Some(_callback) } - pub fn _closure_to_cb_byte_array(command_handle: CommandHandle, closure: Box) -> ErrorCode + Send>) + pub fn _closure_to_cb_byte_array(command_handle: CommandHandle, closure: Box) -> ErrorCode + Send>) -> Option ErrorCode>{ lazy_static! { - static ref CALLBACKS: Mutex < HashMap ) -> ErrorCode + Send > >> = Default::default(); + static ref CALLBACKS: Mutex < HashMap ) -> ErrorCode + Send > >> = Default::default(); } extern "C" fn _callback(command_handle: CommandHandle, err: ErrorCode, message_raw: *const u8, message_len: u32) -> ErrorCode { @@ -809,10 +809,10 @@ mod cbs { Some(_callback) } - pub fn _closure_to_cb_bool(command_handle: CommandHandle, closure: Box ErrorCode + Send>) + pub fn _closure_to_cb_bool(command_handle: CommandHandle, closure: Box ErrorCode + Send>) -> Option ErrorCode> { lazy_static! { - static ref CALLBACKS: Mutex < HashMap ErrorCode + Send > >> = Default::default(); + static ref CALLBACKS: Mutex < HashMap ErrorCode + Send > >> = Default::default(); } extern "C" fn _callback(command_handle: CommandHandle, err: ErrorCode, result: u8) -> ErrorCode { @@ -828,13 +828,13 @@ mod cbs { Some(_callback) } - pub fn _closure_to_cb_str_i64(command_handle: CommandHandle, closure: Box ErrorCode + Send>) + pub fn _closure_to_cb_str_i64(command_handle: CommandHandle, closure: Box ErrorCode + Send>) -> Option ErrorCode> { lazy_static! { - static ref CALLBACKS_STR_I64: Mutex < HashMap < i32, Box < FnMut(ErrorCode, String, i64) -> ErrorCode + Send > >> = Default::default(); + static ref CALLBACKS_STR_I64: Mutex < HashMap < i32, Box ErrorCode + Send > >> = Default::default(); } extern "C" fn _callback(command_handle: CommandHandle, err: ErrorCode, c_str: *const c_char, val: i64) -> ErrorCode { diff --git a/libindy/src/services/wallet/export_import.rs b/libindy/src/services/wallet/export_import.rs index 2f5dd7d9e2..20224aa305 100644 --- a/libindy/src/services/wallet/export_import.rs +++ b/libindy/src/services/wallet/export_import.rs @@ -16,7 +16,7 @@ use super::{Wallet, WalletRecord}; const CHUNK_SIZE: usize = 1024; -pub(super) fn export_continue(wallet: &Wallet, writer: &mut Write, version: u32, key: chacha20poly1305_ietf::Key, key_data: &KeyDerivationData) -> IndyResult<()> { +pub(super) fn export_continue(wallet: &Wallet, writer: &mut dyn Write, version: u32, key: chacha20poly1305_ietf::Key, key_data: &KeyDerivationData) -> IndyResult<()> { let nonce = chacha20poly1305_ietf::gen_nonce(); let chunk_size = CHUNK_SIZE; @@ -202,7 +202,7 @@ mod tests { use super::*; - fn export(wallet: &Wallet, writer: &mut Write, passphrase: &str, version: u32, key_derivation_method: &KeyDerivationMethod) -> IndyResult<()> { + fn export(wallet: &Wallet, writer: &mut dyn Write, passphrase: &str, version: u32, key_derivation_method: &KeyDerivationMethod) -> IndyResult<()> { if version != 0 { Err(err_msg(IndyErrorKind::InvalidState, "Unsupported version"))?; } diff --git a/libindy/src/services/wallet/iterator.rs b/libindy/src/services/wallet/iterator.rs index b512492393..0ca124c5bb 100644 --- a/libindy/src/services/wallet/iterator.rs +++ b/libindy/src/services/wallet/iterator.rs @@ -8,13 +8,13 @@ use super::storage::StorageIterator; use super::encryption::{decrypt_storage_record}; pub(super) struct WalletIterator { - storage_iterator: Box, + storage_iterator: Box, keys: Rc, } impl WalletIterator { - pub fn new(storage_iter: Box, keys: Rc) -> Self { + pub fn new(storage_iter: Box, keys: Rc) -> Self { WalletIterator { storage_iterator: storage_iter, keys, diff --git a/libindy/src/services/wallet/language.rs b/libindy/src/services/wallet/language.rs index a7600db7b2..6e49ff1c34 100644 --- a/libindy/src/services/wallet/language.rs +++ b/libindy/src/services/wallet/language.rs @@ -94,7 +94,7 @@ pub enum Operator { impl Operator { - pub fn transform(self, f: &Fn(Operator) -> IndyResult) -> IndyResult { + pub fn transform(self, f: &dyn Fn(Operator) -> IndyResult) -> IndyResult { match self { Operator::And(operators) => Ok(Operator::And(Operator::transform_list_operators(operators, f)?)), Operator::Or(operators) => Ok(Operator::Or(Operator::transform_list_operators(operators, f)?)), @@ -103,7 +103,7 @@ impl Operator { } } - fn transform_list_operators(operators: Vec, f: &Fn(Operator) -> IndyResult) -> IndyResult> { + fn transform_list_operators(operators: Vec, f: &dyn Fn(Operator) -> IndyResult) -> IndyResult> { let mut transformed = Vec::new(); for operator in operators { diff --git a/libindy/src/services/wallet/mod.rs b/libindy/src/services/wallet/mod.rs index e10e990bff..9beb14f683 100644 --- a/libindy/src/services/wallet/mod.rs +++ b/libindy/src/services/wallet/mod.rs @@ -33,16 +33,16 @@ mod export_import; mod wallet; pub struct WalletService { - storage_types: RefCell>>, + storage_types: RefCell>>, wallets: RefCell>>, - pending_for_open: RefCell, Metadata, Option)>>, + pending_for_open: RefCell, Metadata, Option)>>, pending_for_import: RefCell, chacha20poly1305_ietf::Nonce, usize, Vec, KeyDerivationData)>>, } impl WalletService { pub fn new() -> WalletService { let storage_types = { - let mut map: HashMap> = HashMap::new(); + let mut map: HashMap> = HashMap::new(); map.insert("default".to_string(), Box::new(SQLiteStorageType::new())); RefCell::new(map) }; @@ -218,7 +218,7 @@ impl WalletService { Ok(wallet_handle) } - fn _open_storage_and_fetch_metadata(&self, config: &Config, credentials: &Credentials) -> IndyResult<(Box, Metadata, KeyDerivationData)> { + fn _open_storage_and_fetch_metadata(&self, config: &Config, credentials: &Credentials) -> IndyResult<(Box, Metadata, KeyDerivationData)> { let storage = self._open_storage(config, credentials)?; let metadata: Metadata = { let metadata = storage.get_storage_metadata()?; @@ -506,7 +506,7 @@ impl WalletService { res } - fn _get_config_and_cred_for_storage<'a>(config: &Config, credentials: &Credentials, storage_types: &'a HashMap>) -> IndyResult<(&'a Box, Option, Option)> { + fn _get_config_and_cred_for_storage<'a>(config: &Config, credentials: &Credentials, storage_types: &'a HashMap>) -> IndyResult<(&'a Box, Option, Option)> { let storage_type = { let storage_type = config.storage_type .as_ref() @@ -542,7 +542,7 @@ impl WalletService { wallet_id } - fn _open_storage(&self, config: &Config, credentials: &Credentials) -> IndyResult> { + fn _open_storage(&self, config: &Config, credentials: &Credentials) -> IndyResult> { let storage_types = self.storage_types.borrow(); let (storage_type, storage_config, storage_credentials) = WalletService::_get_config_and_cred_for_storage(config, credentials, &storage_types)?; diff --git a/libindy/src/services/wallet/storage/default/mod.rs b/libindy/src/services/wallet/storage/default/mod.rs index 1d6680d52c..810771a0a7 100644 --- a/libindy/src/services/wallet/storage/default/mod.rs +++ b/libindy/src/services/wallet/storage/default/mod.rs @@ -147,7 +147,7 @@ struct SQLiteStorageIterator { impl SQLiteStorageIterator { fn new(stmt: Option, Box>>>, - args: &[&rusqlite::types::ToSql], + args: &[&dyn rusqlite::types::ToSql], options: RecordOptions, tag_retriever: Option, total_count: Option) -> IndyResult { @@ -506,7 +506,7 @@ impl WalletStorage for SQLiteStorage { Ok(()) } - fn get_all(&self) -> IndyResult> { + fn get_all(&self) -> IndyResult> { let statement = self._prepare_statement("SELECT id, name, value, key, type FROM items;")?; let fetch_options = RecordOptions { @@ -521,7 +521,7 @@ impl WalletStorage for SQLiteStorage { Ok(Box::new(storage_iterator)) } - fn search(&self, type_: &[u8], query: &language::Operator, options: Option<&str>) -> IndyResult> { + fn search(&self, type_: &[u8], query: &language::Operator, options: Option<&str>) -> IndyResult> { let type_ = type_.to_vec(); // FIXME let search_options = match options { @@ -711,7 +711,7 @@ impl WalletStorageType for SQLiteStorageType { /// * `IndyError::NotFound` - File with the provided id not found /// * `IOError("IO error during storage operation:...")` - Failed connection or SQL query /// - fn open_storage(&self, id: &str, config: Option<&str>, _credentials: Option<&str>) -> IndyResult> { + fn open_storage(&self, id: &str, config: Option<&str>, _credentials: Option<&str>) -> IndyResult> { let config = config .map(serde_json::from_str::) .map_or(Ok(None), |v| v.map(Some)) @@ -1333,13 +1333,13 @@ mod tests { test::cleanup_storage(name) } - fn _storage(name: &str) -> Box { + fn _storage(name: &str) -> Box { let storage_type = SQLiteStorageType::new(); storage_type.create_storage(name, None, None, &_metadata()).unwrap(); storage_type.open_storage(name, None, None).unwrap() } - fn _storage_custom(name: &str) -> Box { + fn _storage_custom(name: &str) -> Box { let storage_type = SQLiteStorageType::new(); let config = json!({ diff --git a/libindy/src/services/wallet/storage/default/query.rs b/libindy/src/services/wallet/storage/default/query.rs index 9f9f6777f3..fd1b591516 100644 --- a/libindy/src/services/wallet/storage/default/query.rs +++ b/libindy/src/services/wallet/storage/default/query.rs @@ -6,8 +6,8 @@ use services::wallet::language::{Operator, TagName, TargetValue}; // Translates Wallet Query Language to SQL // WQL input is provided as a reference to a top level Operator // Result is a tuple of query string and query arguments -pub fn wql_to_sql<'a>(class: &'a Vec, op: &'a Operator, _options: Option<&str>) -> Result<(String, Vec<&'a ToSql>), IndyError> { - let mut arguments: Vec<&ToSql> = Vec::new(); +pub fn wql_to_sql<'a>(class: &'a Vec, op: &'a Operator, _options: Option<&str>) -> Result<(String, Vec<&'a dyn ToSql>), IndyError> { + let mut arguments: Vec<&dyn ToSql> = Vec::new(); arguments.push(class); let clause_string = operator_to_sql(op, &mut arguments)?; let mut query_string = "SELECT i.id, i.name, i.value, i.key, i.type FROM items as i WHERE i.type = ?".to_string(); @@ -19,8 +19,8 @@ pub fn wql_to_sql<'a>(class: &'a Vec, op: &'a Operator, _options: Option<&st } -pub fn wql_to_sql_count<'a>(class: &'a Vec, op: &'a Operator) -> Result<(String, Vec<&'a ToSql>), IndyError> { - let mut arguments: Vec<&ToSql> = Vec::new(); +pub fn wql_to_sql_count<'a>(class: &'a Vec, op: &'a Operator) -> Result<(String, Vec<&'a dyn ToSql>), IndyError> { + let mut arguments: Vec<&dyn ToSql> = Vec::new(); arguments.push(class); let clause_string = operator_to_sql(op, &mut arguments)?; let mut query_string = "SELECT count(*) FROM items as i WHERE i.type = ?".to_string(); @@ -32,7 +32,7 @@ pub fn wql_to_sql_count<'a>(class: &'a Vec, op: &'a Operator) -> Result<(Str } -fn operator_to_sql<'a>(op: &'a Operator, arguments: &mut Vec<&'a ToSql>) -> IndyResult { +fn operator_to_sql<'a>(op: &'a Operator, arguments: &mut Vec<&'a dyn ToSql>) -> IndyResult { match *op { Operator::Eq(ref tag_name, ref target_value) => eq_to_sql(tag_name, target_value, arguments), Operator::Neq(ref tag_name, ref target_value) => neq_to_sql(tag_name, target_value, arguments), @@ -49,7 +49,7 @@ fn operator_to_sql<'a>(op: &'a Operator, arguments: &mut Vec<&'a ToSql>) -> Indy } -fn eq_to_sql<'a>(name: &'a TagName, value: &'a TargetValue, arguments: &mut Vec<&'a ToSql>) -> IndyResult { +fn eq_to_sql<'a>(name: &'a TagName, value: &'a TargetValue, arguments: &mut Vec<&'a dyn ToSql>) -> IndyResult { match (name, value) { (&TagName::PlainTagName(ref queried_name), &TargetValue::Unencrypted(ref queried_value)) => { arguments.push(queried_name); @@ -66,7 +66,7 @@ fn eq_to_sql<'a>(name: &'a TagName, value: &'a TargetValue, arguments: &mut Vec< } -fn neq_to_sql<'a>(name: &'a TagName, value: &'a TargetValue, arguments: &mut Vec<&'a ToSql>) -> IndyResult { +fn neq_to_sql<'a>(name: &'a TagName, value: &'a TargetValue, arguments: &mut Vec<&'a dyn ToSql>) -> IndyResult { match (name, value) { (&TagName::PlainTagName(ref queried_name), &TargetValue::Unencrypted(ref queried_value)) => { arguments.push(queried_name); @@ -83,7 +83,7 @@ fn neq_to_sql<'a>(name: &'a TagName, value: &'a TargetValue, arguments: &mut Vec } -fn gt_to_sql<'a>(name: &'a TagName, value: &'a TargetValue, arguments: &mut Vec<&'a ToSql>) -> IndyResult { +fn gt_to_sql<'a>(name: &'a TagName, value: &'a TargetValue, arguments: &mut Vec<&'a dyn ToSql>) -> IndyResult { match (name, value) { (&TagName::PlainTagName(ref queried_name), &TargetValue::Unencrypted(ref queried_value)) => { arguments.push(queried_name); @@ -95,7 +95,7 @@ fn gt_to_sql<'a>(name: &'a TagName, value: &'a TargetValue, arguments: &mut Vec< } -fn gte_to_sql<'a>(name: &'a TagName, value: &'a TargetValue, arguments: &mut Vec<&'a ToSql>) -> IndyResult { +fn gte_to_sql<'a>(name: &'a TagName, value: &'a TargetValue, arguments: &mut Vec<&'a dyn ToSql>) -> IndyResult { match (name, value) { (&TagName::PlainTagName(ref queried_name), &TargetValue::Unencrypted(ref queried_value)) => { arguments.push(queried_name); @@ -107,7 +107,7 @@ fn gte_to_sql<'a>(name: &'a TagName, value: &'a TargetValue, arguments: &mut Vec } -fn lt_to_sql<'a>(name: &'a TagName, value: &'a TargetValue, arguments: &mut Vec<&'a ToSql>) -> IndyResult { +fn lt_to_sql<'a>(name: &'a TagName, value: &'a TargetValue, arguments: &mut Vec<&'a dyn ToSql>) -> IndyResult { match (name, value) { (&TagName::PlainTagName(ref queried_name), &TargetValue::Unencrypted(ref queried_value)) => { arguments.push(queried_name); @@ -119,7 +119,7 @@ fn lt_to_sql<'a>(name: &'a TagName, value: &'a TargetValue, arguments: &mut Vec< } -fn lte_to_sql<'a>(name: &'a TagName, value: &'a TargetValue, arguments: &mut Vec<&'a ToSql>) -> IndyResult { +fn lte_to_sql<'a>(name: &'a TagName, value: &'a TargetValue, arguments: &mut Vec<&'a dyn ToSql>) -> IndyResult { match (name, value) { (&TagName::PlainTagName(ref queried_name), &TargetValue::Unencrypted(ref queried_value)) => { arguments.push(queried_name); @@ -131,7 +131,7 @@ fn lte_to_sql<'a>(name: &'a TagName, value: &'a TargetValue, arguments: &mut Vec } -fn like_to_sql<'a>(name: &'a TagName, value: &'a TargetValue, arguments: &mut Vec<&'a ToSql>) -> IndyResult { +fn like_to_sql<'a>(name: &'a TagName, value: &'a TargetValue, arguments: &mut Vec<&'a dyn ToSql>) -> IndyResult { match (name, value) { (&TagName::PlainTagName(ref queried_name), &TargetValue::Unencrypted(ref queried_value)) => { arguments.push(queried_name); @@ -143,7 +143,7 @@ fn like_to_sql<'a>(name: &'a TagName, value: &'a TargetValue, arguments: &mut Ve } -fn in_to_sql<'a>(name: &'a TagName, values: &'a Vec, arguments: &mut Vec<&'a ToSql>) -> IndyResult { +fn in_to_sql<'a>(name: &'a TagName, values: &'a Vec, arguments: &mut Vec<&'a dyn ToSql>) -> IndyResult { let mut in_string = String::new(); match *name { TagName::PlainTagName(ref queried_name) => { @@ -187,23 +187,23 @@ fn in_to_sql<'a>(name: &'a TagName, values: &'a Vec, arguments: &mu } -fn and_to_sql<'a>(suboperators: &'a [Operator], arguments: &mut Vec<&'a ToSql>) -> IndyResult { +fn and_to_sql<'a>(suboperators: &'a [Operator], arguments: &mut Vec<&'a dyn ToSql>) -> IndyResult { join_operators(suboperators, " AND ", arguments) } -fn or_to_sql<'a>(suboperators: &'a [Operator], arguments: &mut Vec<&'a ToSql>) -> IndyResult { +fn or_to_sql<'a>(suboperators: &'a [Operator], arguments: &mut Vec<&'a dyn ToSql>) -> IndyResult { join_operators(suboperators, " OR ", arguments) } -fn not_to_sql<'a>(suboperator: &'a Operator, arguments: &mut Vec<&'a ToSql>) -> IndyResult { +fn not_to_sql<'a>(suboperator: &'a Operator, arguments: &mut Vec<&'a dyn ToSql>) -> IndyResult { let suboperator_string = operator_to_sql(suboperator, arguments)?; Ok("NOT (".to_string() + &suboperator_string + ")") } -fn join_operators<'a>(operators: &'a [Operator], join_str: &str, arguments: &mut Vec<&'a ToSql>) -> IndyResult { +fn join_operators<'a>(operators: &'a [Operator], join_str: &str, arguments: &mut Vec<&'a dyn ToSql>) -> IndyResult { let mut s = String::new(); if !operators.is_empty() { s.push('('); diff --git a/libindy/src/services/wallet/storage/mod.rs b/libindy/src/services/wallet/storage/mod.rs index 42d0280a77..235a0ebee6 100644 --- a/libindy/src/services/wallet/storage/mod.rs +++ b/libindy/src/services/wallet/storage/mod.rs @@ -51,13 +51,13 @@ pub trait WalletStorage { fn delete(&self, type_: &[u8], id: &[u8]) -> Result<(), IndyError>; fn get_storage_metadata(&self) -> Result, IndyError>; fn set_storage_metadata(&self, metadata: &[u8]) -> Result<(), IndyError>; - fn get_all(&self) -> Result, IndyError>; - fn search(&self, type_: &[u8], query: &language::Operator, options: Option<&str>) -> Result, IndyError>; + fn get_all(&self) -> Result, IndyError>; + fn search(&self, type_: &[u8], query: &language::Operator, options: Option<&str>) -> Result, IndyError>; fn close(&mut self) -> Result<(), IndyError>; } pub trait WalletStorageType { fn create_storage(&self, id: &str, config: Option<&str>, credentials: Option<&str>, metadata: &[u8]) -> Result<(), IndyError>; - fn open_storage(&self, id: &str, config: Option<&str>, credentials: Option<&str>) -> Result, IndyError>; + fn open_storage(&self, id: &str, config: Option<&str>, credentials: Option<&str>) -> Result, IndyError>; fn delete_storage(&self, id: &str, config: Option<&str>, credentials: Option<&str>) -> Result<(), IndyError>; } \ No newline at end of file diff --git a/libindy/src/services/wallet/storage/plugged/mod.rs b/libindy/src/services/wallet/storage/plugged/mod.rs index 3ba1388655..7076016d62 100644 --- a/libindy/src/services/wallet/storage/plugged/mod.rs +++ b/libindy/src/services/wallet/storage/plugged/mod.rs @@ -558,7 +558,7 @@ impl WalletStorage for PluggedStorage { Ok(()) } - fn get_all(&self) -> IndyResult> { + fn get_all(&self) -> IndyResult> { let mut search_handle: i32 = -1; let err = (self.search_all_records_handler)(self.handle, &mut search_handle); @@ -582,7 +582,7 @@ impl WalletStorage for PluggedStorage { )) } - fn search(&self, type_: &[u8], query: &language::Operator, options: Option<&str>) -> IndyResult> { + fn search(&self, type_: &[u8], query: &language::Operator, options: Option<&str>) -> IndyResult> { let type_ = CString::new(base64::encode(type_))?; let query = CString::new(query.to_string())?; let options_cstr = CString::new(options.unwrap_or("{}"))?; @@ -742,7 +742,7 @@ impl WalletStorageType for PluggedStorageType { Ok(()) } - fn open_storage(&self, id: &str, config: Option<&str>, credentials: Option<&str>) -> IndyResult> { + fn open_storage(&self, id: &str, config: Option<&str>, credentials: Option<&str>) -> IndyResult> { let mut handle: i32 = -1; let id = CString::new(id)?; @@ -1454,7 +1454,7 @@ mod tests { assert_eq!(&expected_call, debug.get(0).unwrap()); } - fn _open_storage() -> Box { + fn _open_storage() -> Box { // save the current index inside of DEBUG_VEC. let open_index = DEBUG_VEC.read().unwrap().len(); @@ -1931,7 +1931,7 @@ mod tests { { let mut storage_iterator = storage.search(&type_, &query, Some(&options)).unwrap(); - // TODO: solve how to get &PluggedStorage from Box + // TODO: solve how to get &PluggedStorage from Box // let expected_storage_iterator = PluggedStorageIterator{ // storage: &storage.downcast::().unwrap(), @@ -2031,7 +2031,7 @@ mod tests { { let mut storage_iterator = storage.search(&type_, &query, Some(&options)).unwrap(); - // TODO: solve how to get &PluggedStorage from Box + // TODO: solve how to get &PluggedStorage from Box // let expected_storage_iterator = PluggedStorageIterator{ // storage: &storage.downcast::().unwrap(), @@ -2116,7 +2116,7 @@ mod tests { { let mut storage_iterator = storage.get_all().unwrap(); - // TODO: solve how to get &PluggedStorage from Box + // TODO: solve how to get &PluggedStorage from Box // let expected_storage_iterator = PluggedStorageIterator{ // storage: &storage.downcast::().unwrap(), diff --git a/libindy/src/services/wallet/wallet.rs b/libindy/src/services/wallet/wallet.rs index f9e0d193f4..fd884fcdbb 100644 --- a/libindy/src/services/wallet/wallet.rs +++ b/libindy/src/services/wallet/wallet.rs @@ -114,12 +114,12 @@ impl EncryptedValue { pub(super) struct Wallet { id: String, - storage: Box, + storage: Box, keys: Rc, } impl Wallet { - pub fn new(id: String, storage: Box, keys: Rc) -> Wallet { + pub fn new(id: String, storage: Box, keys: Rc) -> Wallet { Wallet { id, storage, keys } } diff --git a/libindy/tests/utils/callback.rs b/libindy/tests/utils/callback.rs index 306ee389e6..21c8921a26 100644 --- a/libindy/tests/utils/callback.rs +++ b/libindy/tests/utils/callback.rs @@ -20,7 +20,7 @@ pub fn _closure_to_cb_ec() -> (Receiver, i32, let (sender, receiver) = channel(); lazy_static! { - static ref CALLBACKS: Mutex>> = Default::default(); + static ref CALLBACKS: Mutex>> = Default::default(); } let closure = Box::new(move |err| { @@ -46,7 +46,7 @@ pub fn _closure_to_cb_ec_i32() -> (Receiver<(ErrorCode, i32)>, i32, let (sender, receiver) = channel(); lazy_static! { - static ref CALLBACKS: Mutex>> = Default::default(); + static ref CALLBACKS: Mutex>> = Default::default(); } let closure = Box::new(move |err, val| { @@ -72,7 +72,7 @@ pub fn _closure_to_cb_ec_i32_usize() -> (Receiver<(ErrorCode, i32, usize)>, i32, let (sender, receiver) = channel(); lazy_static! { - static ref CALLBACKS: Mutex>> = Default::default(); + static ref CALLBACKS: Mutex>> = Default::default(); } let closure = Box::new(move |err, val, val_2| { @@ -98,7 +98,7 @@ pub fn _closure_to_cb_ec_bool() -> (Receiver<(ErrorCode, bool)>, i32, let (sender, receiver) = channel(); lazy_static! { - static ref CALLBACKS: Mutex>> = Default::default(); + static ref CALLBACKS: Mutex>> = Default::default(); } let closure = Box::new(move |err, val| { @@ -125,7 +125,7 @@ pub fn _closure_to_cb_ec_string() -> (Receiver<(ErrorCode, String)>, i32, let (sender, receiver) = channel(); lazy_static! { - static ref CALLBACKS: Mutex < HashMap < i32, Box < FnMut(ErrorCode, String) + Send > >> = Default::default(); + static ref CALLBACKS: Mutex < HashMap < i32, Box >> = Default::default(); } let closure = Box::new(move |err, val| { @@ -154,7 +154,7 @@ pub fn _closure_to_cb_ec_string_string() -> (Receiver<(ErrorCode, String, String let (sender, receiver) = channel(); lazy_static! { - static ref CALLBACKS: Mutex < HashMap < i32, Box < FnMut(ErrorCode, String, String) + Send > >> = Default::default(); + static ref CALLBACKS: Mutex < HashMap < i32, Box >> = Default::default(); } let closure = Box::new(move |err, val1, val2| { @@ -185,7 +185,7 @@ pub fn _closure_to_cb_ec_string_string_string() -> (Receiver<(ErrorCode, String, let (sender, receiver) = channel(); lazy_static! { - static ref CALLBACKS: Mutex < HashMap < i32, Box < FnMut(ErrorCode, String, String, String) + Send > >> = Default::default(); + static ref CALLBACKS: Mutex < HashMap < i32, Box >> = Default::default(); } let closure = Box::new(move |err, val1, val2, val3| { @@ -215,7 +215,7 @@ pub fn _closure_to_cb_ec_opt_string() -> (Receiver<(ErrorCode, Option)>, let (sender, receiver) = channel(); lazy_static! { - static ref CALLBACKS: Mutex < HashMap < i32, Box < FnMut(ErrorCode, Option) + Send > >> = Default::default(); + static ref CALLBACKS: Mutex < HashMap < i32, Box ) + Send > >> = Default::default(); } let closure = Box::new(move |err, val1| { @@ -246,7 +246,7 @@ pub fn _closure_to_cb_ec_string_opt_string() -> (Receiver<(ErrorCode, String, Op let (sender, receiver) = channel(); lazy_static! { - static ref CALLBACKS: Mutex < HashMap < i32, Box < FnMut(ErrorCode, String, Option) + Send > >> = Default::default(); + static ref CALLBACKS: Mutex < HashMap < i32, Box ) + Send > >> = Default::default(); } let closure = Box::new(move |err, val1, val2| { @@ -279,7 +279,7 @@ pub fn _closure_to_cb_ec_string_opt_string_opt_string() -> (Receiver<(ErrorCode, let (sender, receiver) = channel(); lazy_static! { - static ref CALLBACKS: Mutex < HashMap < i32, Box < FnMut(ErrorCode, String, Option, Option) + Send > >> = Default::default(); + static ref CALLBACKS: Mutex < HashMap < i32, Box , Option) + Send > >> = Default::default(); } let closure = Box::new(move |err, val1, val2, val3| { @@ -314,7 +314,7 @@ pub fn _closure_to_cb_ec_vec_u8() -> (Receiver<(ErrorCode, Vec)>, i32, let (sender, receiver) = channel(); lazy_static! { - static ref CALLBACKS: Mutex < HashMap < i32, Box < FnMut(ErrorCode, Vec) + Send > >> = Default::default(); + static ref CALLBACKS: Mutex < HashMap < i32, Box ) + Send > >> = Default::default(); } let closure = Box::new(move |err, val1| { @@ -344,7 +344,7 @@ pub fn _closure_to_cb_ec_string_vec_u8() -> (Receiver<(ErrorCode, String, Vec) + Send > >> = Default::default(); + static ref CALLBACKS: Mutex < HashMap < i32, Box ) + Send > >> = Default::default(); } let closure = Box::new(move |err, val1, val2| { @@ -375,7 +375,7 @@ pub fn _closure_to_cb_ec_string_string_u64() -> (Receiver<(ErrorCode, String, St let (sender, receiver) = channel(); lazy_static! { - static ref CALLBACKS: Mutex < HashMap < i32, Box < FnMut(ErrorCode, String, String, u64) + Send > >> = Default::default(); + static ref CALLBACKS: Mutex < HashMap < i32, Box >> = Default::default(); } let closure = Box::new(move |err, val1, val2, val3| { diff --git a/libindy/tests/utils/logger.rs b/libindy/tests/utils/logger.rs index 6139150769..f329634429 100644 --- a/libindy/tests/utils/logger.rs +++ b/libindy/tests/utils/logger.rs @@ -25,7 +25,7 @@ impl log::Log for SimpleLogger { fn flush(&self) {} } -pub fn set_logger(logger: &'static log::Log) { +pub fn set_logger(logger: &'static dyn log::Log) { logger::set_logger(logger).ok(); } From ae1b9aee60fe74cf817f04d1126e496c834f114a Mon Sep 17 00:00:00 2001 From: Axel Nennker Date: Fri, 16 Aug 2019 09:30:39 +0200 Subject: [PATCH 229/320] tweaks and more tests Signed-off-by: Axel Nennker --- libindy/src/utils/crypto/verkey_builder.rs | 87 +++++++++++++++++++--- 1 file changed, 77 insertions(+), 10 deletions(-) diff --git a/libindy/src/utils/crypto/verkey_builder.rs b/libindy/src/utils/crypto/verkey_builder.rs index c0ae85b972..0f7a98f712 100644 --- a/libindy/src/utils/crypto/verkey_builder.rs +++ b/libindy/src/utils/crypto/verkey_builder.rs @@ -35,19 +35,86 @@ pub fn build_full_verkey(dest: &str, verkey: Option<&str>) -> Result (&str, &str) { - if verkey.contains(':') { - let splits: Vec<&str> = verkey.split(':').collect(); - (splits[0], splits[1]) - } else { - (verkey, DEFAULT_CRYPTO_TYPE) + let position = verkey.find(':'); + match position { + Some(p) => { + let cryptoname = if p + 1 < verkey.len() { + verkey[p + 1..].as_ref() + } else { + DEFAULT_CRYPTO_TYPE + }; + let v = if p > 0 { + verkey[..p].as_ref() + } else { + "" + }; + (v, cryptoname) + }, + None => (verkey, DEFAULT_CRYPTO_TYPE) } } pub fn verkey_get_cryptoname(verkey: &str) -> &str { - if verkey.contains(':') { - let splits: Vec<&str> = verkey.split(':').collect(); - splits[1] - } else { - DEFAULT_CRYPTO_TYPE + let position = verkey.find(':'); + match position { + Some(p) => { + if p + 1 < verkey.len() { + verkey[p + 1..].as_ref() + } else { + DEFAULT_CRYPTO_TYPE + } + }, + None => DEFAULT_CRYPTO_TYPE + } +} + +#[cfg(test)] +mod tests { + use super::*; + + # [test] + fn split_verkey_empty() { + assert_eq!(split_verkey(""), ("", DEFAULT_CRYPTO_TYPE)) + } + + # [test] + fn split_verkey_single_colon() { + assert_eq!(split_verkey(":"), ("", DEFAULT_CRYPTO_TYPE)) + } + + # [test] + fn split_verkey_ends_with_colon() { + assert_eq!(split_verkey("foo:"), ("foo", DEFAULT_CRYPTO_TYPE)) + } + + # [test] + fn split_verkey_starts_with_colon() { + assert_eq!(split_verkey(":bar"), ("", "bar")) } + + # [test] + fn split_verkey_works() { + assert_eq!(split_verkey("foo:bar:baz"), ("foo", "bar:baz")) + } + + # [test] + fn verkey_get_cryptoname_empty() { + assert_eq!(verkey_get_cryptoname(""), DEFAULT_CRYPTO_TYPE) + } + + # [test] + fn verkey_get_cryptoname_single_colon() { + assert_eq!(verkey_get_cryptoname(":"), DEFAULT_CRYPTO_TYPE) + } + + # [test] + fn verkey_get_cryptoname_ends_with_colon() { + assert_eq!(verkey_get_cryptoname("foo:"), DEFAULT_CRYPTO_TYPE) + } + + # [test] + fn verkey_get_cryptoname_works() { + assert_eq!(verkey_get_cryptoname("foo:bar"), "bar") + } + } \ No newline at end of file From b4ef95c2513697b2b79a1f696cf0693d7bbbbbf0 Mon Sep 17 00:00:00 2001 From: Nikita Khateev Date: Fri, 16 Aug 2019 11:57:21 +0300 Subject: [PATCH 230/320] IS-1316 -- Fix codestyle Signed-off-by: Nikita Khateev --- libindy/src/services/pool/state_proof/mod.rs | 81 +++++++++++--------- 1 file changed, 45 insertions(+), 36 deletions(-) diff --git a/libindy/src/services/pool/state_proof/mod.rs b/libindy/src/services/pool/state_proof/mod.rs index 23f40265aa..d97c7ad4a3 100644 --- a/libindy/src/services/pool/state_proof/mod.rs +++ b/libindy/src/services/pool/state_proof/mod.rs @@ -382,29 +382,37 @@ fn _parse_reply_for_builtin_sp(json_msg: &SJsonValue, type_: &str, key: &[u8]) - fn _parse_reply_for_sp(json_msg: &SJsonValue, data: Option<&str>, parsed_data: &SJsonValue, xtype: &str, sp_key: &[u8]) -> Result { trace!("TransactionHandler::_parse_reply_for_sp: data: {:?}, parsed_data: {:?}", data, parsed_data); - let proof = if let Some(proof) = json_msg["state_proof"]["proof_nodes"].as_str() { - trace!("TransactionHandler::parse_reply_for_builtin_sp: proof: {:?}", proof); - proof.to_string() - } else if parsed_data["audit_path"].is_array() && xtype == constants::GET_TXN { - let path = unwrap_or_return!(serde_json::to_string(&parsed_data["audit_path"]), Err("Parsing error".to_string())); - trace!("TransactionHandler::parse_reply_for_builtin_sp: proof: {:?}", path); - base64::encode(&path) + let proof = if xtype != constants::GET_TXN { + if let Some(proof) = json_msg["state_proof"]["proof_nodes"].as_str() { + trace!("TransactionHandler::parse_reply_for_builtin_sp: proof: {:?}", proof); + proof.to_string() + } else { + return Err("No proof".to_string()); + } } else { - return Err("No proof".to_string()); + if let Some(path) = parsed_data["audit_path"].as_array() { + let path_str = json!(path).to_string(); + trace!("TransactionHandler::parse_reply_for_builtin_sp: proof: {:?}", path); + base64::encode(&path_str) + } else { + return Err("No proof".to_string()); + } }; - let root_hash = if let Some(root_hash) = json_msg["state_proof"]["root_hash"].as_str() { - trace!("TransactionHandler::parse_reply_for_builtin_sp: root_hash: {:?}", root_hash); - root_hash - } else if let Some(root_hash) = parsed_data["root_hash"].as_str() { - if xtype == constants::GET_TXN { + let root_hash = if xtype != constants::GET_TXN { + if let Some(root_hash) = json_msg["state_proof"]["root_hash"].as_str() { trace!("TransactionHandler::parse_reply_for_builtin_sp: root_hash: {:?}", root_hash); root_hash } else { - return Err("Wrong txn type for such root hash".to_string()) + return Err("No root hash".to_string()); } } else { - return Err("No root hash".to_string()); + if let Some(root_hash) = parsed_data["root_hash"].as_str() { + trace!("TransactionHandler::parse_reply_for_builtin_sp: root_hash: {:?}", root_hash); + root_hash + } else { + return Err("No root hash".to_string()); + } }; let value: Option = match _parse_reply_for_proof_value(json_msg, data, parsed_data, xtype, sp_key) { @@ -414,25 +422,29 @@ fn _parse_reply_for_sp(json_msg: &SJsonValue, data: Option<&str>, parsed_data: & } }; + let ver_type = if xtype == constants::GET_TXN { + let len = if let Some(len) = parsed_data["ledger_size"].as_u64() { + trace!("Ledger length: {}", len); + len + } else { + return Err("No ledger length for this proof".to_string()) + }; + KeyValueSimpleDataVerificationType::MerkleTree(len) + } else { + KeyValueSimpleDataVerificationType::Simple + }; + + let multi_sig = if xtype != constants::GET_TXN {json_msg["state_proof"]["multi_signature"].clone()} else {parsed_data["multi_signature"].clone()}; + trace!("parse_reply_for_builtin_sp: <<< proof {:?}, root_hash: {:?}, dest: {:?}, value: {:?}", proof, root_hash, sp_key, value); Ok(ParsedSP { root_hash: root_hash.to_owned(), proof_nodes: proof.to_owned(), - multi_signature: if xtype != constants::GET_TXN {json_msg["state_proof"]["multi_signature"].clone()} else {parsed_data["multi_signature"].clone()}, + multi_signature: multi_sig, kvs_to_verify: KeyValuesInSP::Simple(KeyValueSimpleData { kvs: vec![(base64::encode(sp_key), value)], - verification_type: if xtype == constants::GET_TXN { - let len = if let Some(len) = parsed_data["ledger_size"].as_u64() { - trace!("Ledger length: {}", len); - len - } else { - return Err("No ledger length for this proof".to_string()) - }; - KeyValueSimpleDataVerificationType::MerkleTree(len) - } else { - KeyValueSimpleDataVerificationType::Simple - }, + verification_type: ver_type, }), }) } @@ -567,13 +579,12 @@ fn _verify_merkle_tree(proof_nodes: &[u8], root_hash: &[u8], kvs: &[(String, Opt for (next_hash, turn_right) in hashes_with_turns { let _next_hash = unwrap_or_return!(next_hash.from_base58(), false); - hash = match { - if turn_right { - Hash::hash_nodes(&hash, &_next_hash) - } else { - Hash::hash_nodes(&_next_hash, &hash) - } - } { + let turned_hash = if turn_right { + Hash::hash_nodes(&hash, &_next_hash) + } else { + Hash::hash_nodes(&_next_hash, &hash) + }; + hash = match turned_hash { Ok(hash) => hash, Err(err) => { error!("Error while hashing: {:?}", err); @@ -1514,8 +1525,6 @@ mod tests { } }); - let nodes_str = base64::encode(&json!(["1", "2"]).to_string()); - assert!(super::parse_generic_reply_for_proof_checking(json_msg, "", Some("2".as_bytes())).is_none()); From a3eced7e7611f197aa267f085fc2732d690c93cb Mon Sep 17 00:00:00 2001 From: Nikita Khateev Date: Fri, 16 Aug 2019 12:46:26 +0300 Subject: [PATCH 231/320] IS-1316 -- Codestyle refactoring Signed-off-by: Nikita Khateev --- libindy/src/services/pool/state_proof/mod.rs | 53 +++++++++----------- 1 file changed, 24 insertions(+), 29 deletions(-) diff --git a/libindy/src/services/pool/state_proof/mod.rs b/libindy/src/services/pool/state_proof/mod.rs index d97c7ad4a3..365328fe87 100644 --- a/libindy/src/services/pool/state_proof/mod.rs +++ b/libindy/src/services/pool/state_proof/mod.rs @@ -382,59 +382,54 @@ fn _parse_reply_for_builtin_sp(json_msg: &SJsonValue, type_: &str, key: &[u8]) - fn _parse_reply_for_sp(json_msg: &SJsonValue, data: Option<&str>, parsed_data: &SJsonValue, xtype: &str, sp_key: &[u8]) -> Result { trace!("TransactionHandler::_parse_reply_for_sp: data: {:?}, parsed_data: {:?}", data, parsed_data); - let proof = if xtype != constants::GET_TXN { - if let Some(proof) = json_msg["state_proof"]["proof_nodes"].as_str() { + let (proof, root_hash, ver_type, multi_sig) = if xtype != constants::GET_TXN { + let proof = if let Some(proof) = json_msg["state_proof"]["proof_nodes"].as_str() { trace!("TransactionHandler::parse_reply_for_builtin_sp: proof: {:?}", proof); proof.to_string() } else { return Err("No proof".to_string()); - } + }; + + let root_hash = if let Some(root_hash) = json_msg["state_proof"]["root_hash"].as_str() { + trace!("TransactionHandler::parse_reply_for_builtin_sp: root_hash: {:?}", root_hash); + root_hash + } else { + return Err("No root hash".to_string()); + }; + + (proof, root_hash, KeyValueSimpleDataVerificationType::Simple, json_msg["state_proof"]["multi_signature"].clone()) } else { - if let Some(path) = parsed_data["audit_path"].as_array() { + let proof = if let Some(path) = parsed_data["audit_path"].as_array() { let path_str = json!(path).to_string(); trace!("TransactionHandler::parse_reply_for_builtin_sp: proof: {:?}", path); base64::encode(&path_str) } else { return Err("No proof".to_string()); - } - }; + }; - let root_hash = if xtype != constants::GET_TXN { - if let Some(root_hash) = json_msg["state_proof"]["root_hash"].as_str() { - trace!("TransactionHandler::parse_reply_for_builtin_sp: root_hash: {:?}", root_hash); - root_hash - } else { - return Err("No root hash".to_string()); - } - } else { - if let Some(root_hash) = parsed_data["root_hash"].as_str() { + let root_hash = if let Some(root_hash) = parsed_data["root_hash"].as_str() { trace!("TransactionHandler::parse_reply_for_builtin_sp: root_hash: {:?}", root_hash); root_hash } else { return Err("No root hash".to_string()); - } - }; - - let value: Option = match _parse_reply_for_proof_value(json_msg, data, parsed_data, xtype, sp_key) { - Ok(value) => value, - Err(err_str) => { - return Err(err_str); - } - }; + }; - let ver_type = if xtype == constants::GET_TXN { let len = if let Some(len) = parsed_data["ledger_size"].as_u64() { trace!("Ledger length: {}", len); len } else { return Err("No ledger length for this proof".to_string()) }; - KeyValueSimpleDataVerificationType::MerkleTree(len) - } else { - KeyValueSimpleDataVerificationType::Simple + + (proof, root_hash, KeyValueSimpleDataVerificationType::MerkleTree(len), parsed_data["multi_signature"].clone()) }; - let multi_sig = if xtype != constants::GET_TXN {json_msg["state_proof"]["multi_signature"].clone()} else {parsed_data["multi_signature"].clone()}; + let value: Option = match _parse_reply_for_proof_value(json_msg, data, parsed_data, xtype, sp_key) { + Ok(value) => value, + Err(err_str) => { + return Err(err_str); + } + }; trace!("parse_reply_for_builtin_sp: <<< proof {:?}, root_hash: {:?}, dest: {:?}, value: {:?}", proof, root_hash, sp_key, value); From 8b7ca74c3f4edcc52ed830b160783c7d8044da47 Mon Sep 17 00:00:00 2001 From: Axel Nennker Date: Fri, 16 Aug 2019 12:02:40 +0200 Subject: [PATCH 232/320] clippy ok_or to to ok_or_else Signed-off-by: Axel Nennker --- libindy/Cargo.lock | 400 ++++++++++-------- libindy/src/commands/anoncreds/issuer.rs | 4 +- libindy/src/commands/anoncreds/prover.rs | 10 +- libindy/src/commands/did.rs | 2 +- libindy/src/commands/non_secrets.rs | 2 +- libindy/src/commands/pairwise.rs | 2 +- libindy/src/services/anoncreds/issuer.rs | 8 +- libindy/src/services/anoncreds/prover.rs | 20 +- libindy/src/services/anoncreds/verifier.rs | 24 +- libindy/src/services/blob_storage/mod.rs | 18 +- libindy/src/services/ledger/mod.rs | 16 +- libindy/src/services/payments.rs | 30 +- libindy/src/services/pool/events.rs | 4 +- libindy/src/services/pool/mod.rs | 2 +- libindy/src/services/pool/types.rs | 4 +- libindy/src/services/wallet/export_import.rs | 6 +- libindy/src/services/wallet/mod.rs | 8 +- .../src/utils/crypto/signature_serializer.rs | 2 +- 18 files changed, 307 insertions(+), 255 deletions(-) diff --git a/libindy/Cargo.lock b/libindy/Cargo.lock index f77e68fc01..5ba6ec715e 100644 --- a/libindy/Cargo.lock +++ b/libindy/Cargo.lock @@ -2,7 +2,7 @@ # It is not intended for manual editing. [[package]] name = "aho-corasick" -version = "0.7.4" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -25,16 +25,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "android_log-sys 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "argon2rs" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", - "scoped_threadpool 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -72,7 +63,7 @@ dependencies = [ "backtrace-sys 0.1.30 (registry+https://github.com/rust-lang/crates.io-index)", "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-demangle 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-demangle 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -94,6 +85,14 @@ dependencies = [ "safemem 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "base64" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "bitflags" version = "1.1.0" @@ -107,14 +106,15 @@ dependencies = [ "byte-tools 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "crypto-mac 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "digest 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", - "opaque-debug 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "opaque-debug 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "blake2-rfc" -version = "0.2.18" +name = "blake2b_simd" +version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ + "arrayref 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", "arrayvec 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", "constant_time_eq 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -140,13 +140,13 @@ dependencies = [ [[package]] name = "bstr" -version = "0.2.2" +version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-automata 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.97 (registry+https://github.com/rust-lang/crates.io-index)", + "regex-automata 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.98 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -229,11 +229,11 @@ dependencies = [ "rand_xoshiro 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "rayon 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "rayon-core 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.97 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.97 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.98 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.98 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", "tinytemplate 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "walkdir 2.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "walkdir 2.2.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -251,21 +251,21 @@ name = "crossbeam-deque" version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "crossbeam-epoch 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-epoch 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "crossbeam-epoch" -version = "0.7.1" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "arrayvec 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "memoffset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "memoffset 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "scopeguard 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -273,12 +273,12 @@ name = "crossbeam-queue" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "crossbeam-utils" -version = "0.6.5" +version = "0.6.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", @@ -299,11 +299,11 @@ name = "csv" version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "bstr 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "bstr 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)", "csv-core 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", "ryu 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.97 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.98 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -316,14 +316,14 @@ dependencies = [ [[package]] name = "curve25519-dalek" -version = "1.2.1" +version = "1.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "clear_on_drop 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "digest 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "subtle 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "subtle 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -345,7 +345,7 @@ dependencies = [ "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", "strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.39 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -355,7 +355,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "darling_core 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.39 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -365,7 +365,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.39 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -382,7 +382,7 @@ version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_users 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_users 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -392,7 +392,7 @@ version = "1.0.0-pre.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "clear_on_drop 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "curve25519-dalek 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "curve25519-dalek 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", "sha2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -415,8 +415,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "atty 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)", "humantime 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "termcolor 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -476,7 +476,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.39 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)", "synstructure 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -563,11 +563,11 @@ dependencies = [ "indy-sys 1.11.0", "lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "num-derive 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.97 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.97 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.98 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.98 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -576,8 +576,8 @@ name = "indy-sys" version = "1.11.0" dependencies = [ "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", - "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "vcpkg 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -641,7 +641,7 @@ dependencies = [ "int_traits 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "log-derive 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "log-panics 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "named_type 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -652,8 +652,8 @@ dependencies = [ "rmp-serde 0.13.7 (registry+https://github.com/rust-lang/crates.io-index)", "rusqlite 0.19.0 (registry+https://github.com/rust-lang/crates.io-index)", "rust-base58 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.97 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.97 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.98 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.98 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", "sha2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "sha3 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -662,7 +662,7 @@ dependencies = [ "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", "ursa 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "uuid 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "zeroize 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)", + "zeroize 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)", "zmq 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -672,7 +672,7 @@ version = "0.0.16" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", - "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -681,7 +681,7 @@ version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cc 1.0.26 (registry+https://github.com/rust-lang/crates.io-index)", - "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", "vcpkg 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -692,7 +692,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "log" -version = "0.4.7" +version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", @@ -704,10 +704,10 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "darling 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.39 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -715,7 +715,7 @@ name = "log-panics" version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -736,8 +736,11 @@ dependencies = [ [[package]] name = "memoffset" -version = "0.2.1" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", +] [[package]] name = "metadeps" @@ -745,7 +748,7 @@ version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "error-chain 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", - "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", "toml 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -807,7 +810,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.39 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -866,7 +869,7 @@ dependencies = [ [[package]] name = "opaque-debug" -version = "0.2.2" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -879,18 +882,18 @@ dependencies = [ "foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl-sys 0.9.48 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl-sys 0.9.49 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "openssl-sys" -version = "0.9.48" +version = "0.9.49" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "autocfg 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "cc 1.0.26 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", - "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", "vcpkg 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -904,7 +907,7 @@ dependencies = [ [[package]] name = "pkg-config" -version = "0.3.14" +version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -915,6 +918,14 @@ dependencies = [ "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "proc-macro2" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "quick-error" version = "1.2.2" @@ -933,6 +944,14 @@ dependencies = [ "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "quote" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "rand" version = "0.3.23" @@ -962,7 +981,7 @@ dependencies = [ "autocfg 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", "rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "rand_hc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand_isaac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "rand_jitter 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", @@ -986,12 +1005,12 @@ name = "rand_core" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rand_core" -version = "0.4.0" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -1016,7 +1035,7 @@ version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1028,9 +1047,9 @@ dependencies = [ "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen 0.2.49 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1040,7 +1059,7 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "autocfg 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1077,7 +1096,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "crossbeam-deque 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", "crossbeam-queue 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "num_cpus 1.10.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1097,30 +1116,29 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "redox_users" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "argon2rs 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "rand_os 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)", + "rust-argon2 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "regex" -version = "1.1.9" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "aho-corasick 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)", + "aho-corasick 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)", "memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-syntax 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)", + "regex-syntax 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", "thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", - "utf8-ranges 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "regex-automata" -version = "0.1.7" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1128,11 +1146,8 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.6.8" +version = "0.6.11" source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "ucd-util 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", -] [[package]] name = "rmp" @@ -1150,7 +1165,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "rmp 0.8.7 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.97 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.98 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1167,6 +1182,16 @@ dependencies = [ "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "rust-argon2" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", + "blake2b_simd 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "rust-base58" version = "0.0.4" @@ -1177,9 +1202,17 @@ dependencies = [ [[package]] name = "rustc-demangle" -version = "0.1.15" +version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "rustc_version" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "ryu" version = "1.0.0" @@ -1198,14 +1231,9 @@ dependencies = [ "winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "scoped_threadpool" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "scopeguard" -version = "0.3.3" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -1215,22 +1243,35 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cc 1.0.26 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.97 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.98 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "semver" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "semver-parser" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "serde" -version = "1.0.97" +version = "1.0.98" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "serde_derive" -version = "1.0.97" +version = "1.0.98" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.39 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1240,7 +1281,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", "ryu 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.97 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.98 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1251,7 +1292,7 @@ dependencies = [ "block-buffer 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", "digest 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "fake-simd 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "opaque-debug 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "opaque-debug 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1263,7 +1304,7 @@ dependencies = [ "byte-tools 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "digest 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "keccak 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "opaque-debug 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "opaque-debug 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1273,7 +1314,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", "libsodium-sys 0.0.16 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.97 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.98 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1293,7 +1334,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "subtle" -version = "2.1.0" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -1308,7 +1349,7 @@ dependencies = [ [[package]] name = "syn" -version = "0.15.39" +version = "0.15.44" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1316,6 +1357,16 @@ dependencies = [ "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "syn" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "synom" version = "0.11.3" @@ -1331,7 +1382,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.39 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1382,7 +1433,7 @@ name = "tinytemplate" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "serde 1.0.97 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.98 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1396,11 +1447,6 @@ name = "typenum" version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "ucd-util" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "unicode-width" version = "0.1.5" @@ -1416,6 +1462,11 @@ name = "unicode-xid" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "unicode-xid" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "ursa" version = "0.1.1" @@ -1430,13 +1481,13 @@ dependencies = [ "generic-array 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)", "int_traits 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "openssl 0.10.24 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", "rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "secp256k1 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.97 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.97 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.98 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.98 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", "sha2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "sha3 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1444,11 +1495,6 @@ dependencies = [ "zeroize 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "utf8-ranges" -version = "1.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "uuid" version = "0.5.1" @@ -1464,7 +1510,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "walkdir" -version = "2.2.8" +version = "2.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "same-file 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1474,50 +1520,51 @@ dependencies = [ [[package]] name = "wasm-bindgen" -version = "0.2.48" +version = "0.2.49" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "wasm-bindgen-macro 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-macro 0.2.49 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "wasm-bindgen-backend" -version = "0.2.48" +version = "0.2.49" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bumpalo 2.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.39 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-shared 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-shared 0.2.49 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "wasm-bindgen-macro" -version = "0.2.48" +version = "0.2.49" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-macro-support 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-macro-support 0.2.49 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.48" +version = "0.2.49" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.39 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-backend 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-shared 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-backend 0.2.49 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-shared 0.2.49 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.48" +version = "0.2.49" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -1563,20 +1610,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "zeroize" -version = "0.9.2" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "zeroize_derive 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "zeroize_derive 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "zeroize_derive" -version = "0.9.0" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.39 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)", "synstructure 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1586,7 +1633,7 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "zmq-sys 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1600,24 +1647,24 @@ dependencies = [ ] [metadata] -"checksum aho-corasick 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)" = "36b7aa1ccb7d7ea3f437cf025a2ab1c47cc6c1bc9fc84918ff449def12f5e282" +"checksum aho-corasick 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)" = "58fb5e95d83b38284460a5fda7d6470aa0b8844d283a0b614b8535e880800d2d" "checksum amcl 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee5cca1ddc8b9dceb55b7f1272a9d1e643d73006f350a20ab4926d24e33f0f0d" "checksum android_log-sys 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b8052e2d8aabbb8d556d6abbcce2a22b9590996c5f849b9c7ce4544a2e3b984e" "checksum android_logger 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "86983875e7c3a202e31471cc6d60fcc18f30e194f1729cfff3bfb43d646ffced" -"checksum argon2rs 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "3f67b0b6a86dae6e67ff4ca2b6201396074996379fba2b92ff649126f37cb392" "checksum arrayref 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "0d382e583f07208808f6b1249e60848879ba3543f57c32277bf52d69c2f0f0ee" "checksum arrayvec 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)" = "b8d73f9beda665eaa98ab9e4f7442bd4e7de6652587de55b2525e52e29c1b0ba" "checksum atty 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)" = "1803c647a3ec87095e7ae7acfca019e98de5ec9a7d01343f611cf3152ed71a90" "checksum autocfg 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "22130e92352b948e7e82a49cdb0aa94f2211761117f29e052dd397c1ac33542b" "checksum backtrace 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)" = "18b65ea1161bfb2dd6da6fade5edd4dbd08fba85012123dd333d2fd1b90b2782" "checksum backtrace-sys 0.1.30 (registry+https://github.com/rust-lang/crates.io-index)" = "5b3a000b9c543553af61bc01cbfc403b04b5caa9e421033866f2e98061eb3e61" +"checksum base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0b25d992356d2eb0ed82172f5248873db5560c4721f564b13cb5193bda5e668e" "checksum base64 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "96434f987501f0ed4eb336a411e0631ecd1afa11574fe148587adc4ff96143c9" "checksum bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3d155346769a6855b86399e9bc3814ab343cd3d62c7e985113d46a0ec3c281fd" "checksum blake2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "91721a6330935673395a0607df4d49a9cb90ae12d259f1b3e0a3f6e1d486872e" -"checksum blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)" = "5d6d530bdd2d52966a6d03b7a964add7ae1a288d25214066fd4b600f0f796400" +"checksum blake2b_simd 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "461f4b879a8eb70c1debf7d0788a9a5ff15f1ea9d25925fea264ef4258bed6b2" "checksum block-buffer 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c0940dc441f31689269e10ac70eb1002a3a1d3ad1390e030043662eb7fe4688b" "checksum block-padding 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "6d4dc3af3ee2e12f3e5d224e5e1e3d73668abbeb69e566d361f7d5563a4fdf09" -"checksum bstr 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "fc0662252f9bba48c251a16d16a768b9fcd959593bde07544710bce6efe60b7a" +"checksum bstr 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "94cdf78eb7e94c566c1f5dbe2abf8fc70a548fc902942a48c4b3a98b48ca9ade" "checksum bumpalo 2.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2cd43d82f27d68911e6ee11ee791fb248f138f5d69424dc02e098d4f152b0b05" "checksum byte-tools 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7" "checksum byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a7c3dd8985a7111efc5c80b44e23ecdd8c007de8ade3b96595387e812b957cf5" @@ -1631,13 +1678,13 @@ dependencies = [ "checksum criterion 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "0363053954f3e679645fc443321ca128b7b950a6fe288cf5f9335cc22ee58394" "checksum criterion-plot 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "76f9212ddf2f4a9eb2d401635190600656a1f88a932ef53d06e7fa4c7e02fb8e" "checksum crossbeam-deque 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "05e44b8cf3e1a625844d1750e1f7820da46044ff6d28f4d43e455ba3e5bb2c13" -"checksum crossbeam-epoch 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "04c9e3102cc2d69cd681412141b390abd55a362afc1540965dad0ad4d34280b4" +"checksum crossbeam-epoch 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "fedcd6772e37f3da2a9af9bf12ebe046c0dfe657992377b4df982a2b54cd37a9" "checksum crossbeam-queue 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7c979cd6cfe72335896575c6b5688da489e420d36a27a0b9eb0c73db574b4a4b" -"checksum crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "f8306fcef4a7b563b76b7dd949ca48f52bc1141aa067d2ea09565f3e2652aa5c" +"checksum crossbeam-utils 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)" = "04973fa96e96579258a5091af6003abde64af786b860f18622b82e026cca60e6" "checksum crypto-mac 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4434400df11d95d556bac068ddfedd482915eb18fe8bea89bc80b6e4b1c179e5" "checksum csv 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "37519ccdfd73a75821cac9319d4fce15a81b9fcf75f951df5b9988aa3a0af87d" "checksum csv-core 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "9b5cadb6b25c77aeff80ba701712494213f4a8418fcda2ee11b6560c3ad0bf4c" -"checksum curve25519-dalek 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "5d4b820e8711c211745880150f5fac78ab07d6e3851d8ce9f5a02cedc199174c" +"checksum curve25519-dalek 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8b7dcd30ba50cdf88b55b033456138b7c0ac4afdc436d82e1b79f370f24cc66d" "checksum darling 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fcfbcb0c5961907597a7d1148e3af036268f2b773886b8bb3eeb1e1281d3d3d6" "checksum darling_core 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6afc018370c3bff3eb51f89256a6bdb18b4fdcda72d577982a14954a7a0b402c" "checksum darling_macro 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c6d8dac1c6f1d29a41c4712b4400f878cb4fcc4c7628f298dd75038e024998d1" @@ -1678,12 +1725,12 @@ dependencies = [ "checksum libsodium-sys 0.0.16 (registry+https://github.com/rust-lang/crates.io-index)" = "fcbd1beeed8d44caa8a669ebaa697c313976e242c03cc9fb23d88bf1656f5542" "checksum libsqlite3-sys 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)" = "72b1e07fcc60484f42e246f0cf1f133940c98117c81b2cefcdf71be288069680" "checksum linked-hash-map 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "ae91b68aebc4ddb91978b11a1b02ddd8602a05ec19002801c5666000e05e0f83" -"checksum log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)" = "c275b6ad54070ac2d665eef9197db647b32239c9d244bfb6f041a766d00da5b3" +"checksum log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)" = "14b6052be84e6b71ab17edffc2eeabf5c2c3ae1fdb464aae35ac50c67a44e1f7" "checksum log-derive 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "90b7e153f2d4bf69d46a9e640e2c96573940fca671d275bf6f7687f6bab803fc" "checksum log-panics 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ae0136257df209261daa18d6c16394757c63e032e27aafd8b07788b051082bef" "checksum lru-cache 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "31e24f1ad8321ca0e8a1e0ac13f23cb668e6f5466c2c57319f6a5cf1cc8e3b1c" "checksum memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "88579771288728879b57485cc7d6b07d648c9f0141eb955f8ab7f9d45394468e" -"checksum memoffset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0f9dc261e2b62d7a622bf416ea3c5245cdd5d9a7fcc428c0d06804dfce1775b3" +"checksum memoffset 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ce6075db033bbbb7ee5a0bbd3a3186bbae616f57fb001c485c7ff77955f8177f" "checksum metadeps 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "73b122901b3a675fac8cecf68dcb2f0d3036193bc861d1ac0e1c337f7d5254c2" "checksum named_type 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c39ac6c5ee13bf558879a82198b0afe84989cf3f7fb7592b56d73eb1a50c9e66" "checksum named_type_derive 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "651d7e408d728ded66748986dc046156dbc7bd25add9ea334bcf762c7a83e14a" @@ -1698,21 +1745,23 @@ dependencies = [ "checksum num-traits 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)" = "92e5113e9fd4cc14ded8e499429f396a20f98c772a47cc8622a736e1ec843c31" "checksum num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "6ba9a427cfca2be13aa6f6403b0b7e7368fe982bfa16fccc450ce74c46cd9b32" "checksum num_cpus 1.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "bcef43580c035376c0705c42792c294b66974abbfd2789b511784023f71f3273" -"checksum opaque-debug 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "93f5bb2e8e8dec81642920ccff6b61f1eb94fa3020c5a325c9851ff604152409" +"checksum opaque-debug 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c" "checksum openssl 0.10.24 (registry+https://github.com/rust-lang/crates.io-index)" = "8152bb5a9b5b721538462336e3bef9a539f892715e5037fda0f984577311af15" -"checksum openssl-sys 0.9.48 (registry+https://github.com/rust-lang/crates.io-index)" = "b5ba300217253bcc5dc68bed23d782affa45000193866e025329aa8a7a9f05b8" +"checksum openssl-sys 0.9.49 (registry+https://github.com/rust-lang/crates.io-index)" = "f4fad9e54bd23bd4cbbe48fdc08a1b8091707ac869ef8508edea2fec77dcc884" "checksum owning_ref 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "49a4b8ea2179e6a2e27411d3bca09ca6dd630821cf6894c6c7c8467a8ee7ef13" -"checksum pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)" = "676e8eb2b1b4c9043511a9b7bea0915320d7e502b0a079fb03f9635a5252b18c" +"checksum pkg-config 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "a7c1d2cfa5a714db3b5f24f0915e74fcdf91d09d496ba61329705dda7774d2af" "checksum proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)" = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759" +"checksum proc-macro2 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "19f287c234c9b2d0308d692dee5c449c1a171167a6f8150f7cf2a49d8fd96967" "checksum quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9274b940887ce9addde99c4eee6b5c44cc494b182b97e73dc8ffdcb3397fd3f0" "checksum quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a" "checksum quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)" = "6ce23b6b870e8f94f81fb0a363d65d86675884b34a09043c81e5562f11c1f8e1" +"checksum quote 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7ab938ebe6f1c82426b5fb82eaf10c3e3028c53deaa3fbe38f5904b37cf4d767" "checksum rand 0.3.23 (registry+https://github.com/rust-lang/crates.io-index)" = "64ac302d8f83c0c1974bf758f6b041c6c8ada916fbb44a609158ca8b064cc76c" "checksum rand 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "552840b97013b1a26992c11eac34bdd778e464601a4c2054b5f0bff7c6761293" "checksum rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "6d71dacdc3c88c1fde3885a3be3fbab9f35724e6ce99467f7d9c5026132184ca" "checksum rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "556d3a1ca6600bfcbab7c7c91ccb085ac7fbbcd70e008a98742e7847f4f7bcef" "checksum rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b" -"checksum rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d0e7a549d590831370895ab7ba4ea0c1b6b011d106b5ff2da6eee112615e6dc0" +"checksum rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc" "checksum rand_hc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7b40677c7be09ae76218dc623efbf7b18e34bced3f38883af07bb75630a21bc4" "checksum rand_isaac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ded997c9d5f13925be2a6fd7e66bf1872597f759fd9dd93513dd7e92e5a5ee08" "checksum rand_jitter 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "1166d5c91dc97b88d1decc3285bb0a99ed84b05cfd0bc2341bdf2d43fc41e39b" @@ -1724,23 +1773,26 @@ dependencies = [ "checksum rayon-core 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ebbe0df8435ac0c397d467b6cad6d25543d06e8a019ef3f6af3c384597515bd2" "checksum rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2" "checksum redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)" = "2439c63f3f6139d1b57529d16bc3b8bb855230c8efcc5d3a896c8bea7c3b1e84" -"checksum redox_users 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3fe5204c3a17e97dde73f285d49be585df59ed84b50a872baf416e73b62c3828" -"checksum regex 1.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "d9d8297cc20bbb6184f8b45ff61c8ee6a9ac56c156cec8e38c3e5084773c44ad" -"checksum regex-automata 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "3ed09217220c272b29ef237a974ad58515bde75f194e3ffa7e6d0bf0f3b01f86" -"checksum regex-syntax 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)" = "9b01330cce219c1c6b2e209e5ed64ccd587ae5c67bed91c0b49eecf02ae40e21" +"checksum redox_users 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4ecedbca3bf205f8d8f5c2b44d83cd0690e39ee84b951ed649e9f1841132b66d" +"checksum regex 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "88c3d9193984285d544df4a30c23a4e62ead42edf70a4452ceb76dac1ce05c26" +"checksum regex-automata 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "92b73c2a1770c255c240eaa4ee600df1704a38dc3feaa6e949e7fcd4f8dc09f9" +"checksum regex-syntax 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)" = "b143cceb2ca5e56d5671988ef8b15615733e7ee16cd348e064333b251b89343f" "checksum rmp 0.8.7 (registry+https://github.com/rust-lang/crates.io-index)" = "a3d45d7afc9b132b34a2479648863aa95c5c88e98b32285326a6ebadc80ec5c9" "checksum rmp-serde 0.13.7 (registry+https://github.com/rust-lang/crates.io-index)" = "011e1d58446e9fa3af7cdc1fb91295b10621d3ac4cb3a85cc86385ee9ca50cd3" "checksum rusqlite 0.19.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6ebca2e7e3deb7241b7fa5929c088548c590728b1b740c479594c23f813eb8a7" +"checksum rust-argon2 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4ca4eaef519b494d1f2848fc602d18816fed808a981aedf4f1f00ceb7c9d32cf" "checksum rust-base58 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "b313b91fcdc6719ad41fa2dad2b7e810b03833fae4bf911950e15529a5f04439" -"checksum rustc-demangle 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)" = "a7f4dccf6f4891ebcc0c39f9b6eb1a83b9bf5d747cb439ec6fba4f3b977038af" +"checksum rustc-demangle 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "4c691c0e608126e00913e33f0ccf3727d5fc84573623b8d65b2df340b5201783" +"checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" "checksum ryu 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c92464b447c0ee8c4fb3824ecc8383b81717b9f1e74ba2e72540aef7b9f82997" "checksum safemem 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e27a8b19b835f7aea908818e871f5cc3a5a186550c30773be987e155e8163d8f" "checksum same-file 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "585e8ddcedc187886a30fa705c47985c3fa88d06624095856b36ca0b82ff4421" -"checksum scoped_threadpool 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "1d51f5df5af43ab3f1360b429fa5e0152ac5ce8c0bd6485cae490332e96846a8" -"checksum scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "94258f53601af11e6a49f722422f6e3425c52b06245a5cf9bc09908b174f5e27" +"checksum scopeguard 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b42e15e59b18a828bbf5c58ea01debb36b9b096346de35d941dcb89009f24a0d" "checksum secp256k1 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)" = "bfaccd3a23619349e0878d9a241f34b1982343cdf67367058cd7d078d326b63e" -"checksum serde 1.0.97 (registry+https://github.com/rust-lang/crates.io-index)" = "d46b3dfedb19360a74316866cef04687cd4d6a70df8e6a506c63512790769b72" -"checksum serde_derive 1.0.97 (registry+https://github.com/rust-lang/crates.io-index)" = "c22a0820adfe2f257b098714323563dd06426502abbbce4f51b72ef544c5027f" +"checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" +"checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" +"checksum serde 1.0.98 (registry+https://github.com/rust-lang/crates.io-index)" = "7fe5626ac617da2f2d9c48af5515a21d5a480dbd151e01bb1c355e26a3e68113" +"checksum serde_derive 1.0.98 (registry+https://github.com/rust-lang/crates.io-index)" = "01e69e1b8a631f245467ee275b8c757b818653c6d704cdbcaeb56b56767b529c" "checksum serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)" = "051c49229f282f7c6f3813f8286cc1e3323e8051823fce42c7ea80fe13521704" "checksum sha2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7b4d8bfd0e469f417657573d8451fb33d16cfe0989359b93baf3a1ffc639543d" "checksum sha3 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dd26bc0e7a2e3a7c959bc494caf58b72ee0c71d67704e9520f736ca7e4853ecf" @@ -1748,9 +1800,10 @@ dependencies = [ "checksum stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dba1a27d3efae4351c8051072d619e3ade2820635c3958d826bfea39d59b54c8" "checksum strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bb4f380125926a99e52bc279241539c018323fab05ad6368b56f93d9369ff550" "checksum subtle 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2d67a5a62ba6e01cb2192ff309324cb4875d0c451d55fe2319433abe7a05a8ee" -"checksum subtle 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "01dca13cf6c3b179864ab3292bd794e757618d35a7766b7c46050c614ba00829" +"checksum subtle 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "01f40907d9ffc762709e4ff3eb4a6f6b41b650375a3f09ac92b641942b7fb082" "checksum syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)" = "d3b891b9015c88c576343b9b3e41c2c11a51c219ef067b264bd9c8aa9b441dad" -"checksum syn 0.15.39 (registry+https://github.com/rust-lang/crates.io-index)" = "b4d960b829a55e56db167e861ddb43602c003c7be0bee1d345021703fac2fb7c" +"checksum syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)" = "9ca4b3b69a77cbe1ffc9e198781b7acb0c7365a883670e8f1c1bc66fba79a5c5" +"checksum syn 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "863ecbce06044c8380458360b4146d7372edadfedd77f120ba8c193da427b708" "checksum synom 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a393066ed9010ebaed60b9eafa373d4b1baac186dd7e008555b0f702b51945b6" "checksum synstructure 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)" = "02353edf96d6e4dc81aea2d8490a7e9db177bf8acb0e951c24940bf866cb313f" "checksum termcolor 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "96d6098003bde162e4277c70665bd87c326f5a0c3f3fbfb285787fa482d54e6e" @@ -1761,27 +1814,26 @@ dependencies = [ "checksum tinytemplate 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4574b75faccaacddb9b284faecdf0b544b80b6b294f3d062d325c5726a209c20" "checksum toml 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "736b60249cb25337bc196faa43ee12c705e426f3d55c214d73a4e7be06f92cb4" "checksum typenum 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "612d636f949607bdf9b123b4a6f6d966dedf3ff669f7f045890d3a4a73948169" -"checksum ucd-util 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "535c204ee4d8434478593480b8f86ab45ec9aae0e83c568ca81abf0fd0e88f86" "checksum unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "882386231c45df4700b275c7ff55b6f3698780a650026380e72dabe76fa46526" "checksum unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f860d7d29cf02cb2f3f359fd35991af3d30bac52c57d265a3c461074cb4dc" "checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" +"checksum unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c" "checksum ursa 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9081683a6861bee60c4005c280dafd50c6ee9c2ffd14935865f72658e5f2d9f8" -"checksum utf8-ranges 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "9d50aa7650df78abf942826607c62468ce18d9019673d4a2ebe1865dbb96ffde" "checksum uuid 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "bcc7e3b898aa6f6c08e5295b6c89258d1331e9ac578cc992fb818759951bdc22" "checksum vcpkg 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "33dd455d0f96e90a75803cfeb7f948768c08d70a6de9a8d2362461935698bf95" -"checksum walkdir 2.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "c7904a7e2bb3cdf0cf5e783f44204a85a37a93151738fa349f06680f59a98b45" -"checksum wasm-bindgen 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)" = "4de97fa1806bb1a99904216f6ac5e0c050dc4f8c676dc98775047c38e5c01b55" -"checksum wasm-bindgen-backend 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)" = "5d82c170ef9f5b2c63ad4460dfcee93f3ec04a9a36a4cc20bc973c39e59ab8e3" -"checksum wasm-bindgen-macro 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)" = "f07d50f74bf7a738304f6b8157f4a581e1512cd9e9cdb5baad8c31bbe8ffd81d" -"checksum wasm-bindgen-macro-support 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)" = "95cf8fe77e45ba5f91bc8f3da0c3aa5d464b3d8ed85d84f4d4c7cc106436b1d7" -"checksum wasm-bindgen-shared 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)" = "d9c2d4d4756b2e46d3a5422e06277d02e4d3e1d62d138b76a4c681e925743623" +"checksum walkdir 2.2.9 (registry+https://github.com/rust-lang/crates.io-index)" = "9658c94fa8b940eab2250bd5a457f9c48b748420d71293b165c8cdbe2f55f71e" +"checksum wasm-bindgen 0.2.49 (registry+https://github.com/rust-lang/crates.io-index)" = "220f01bcb6b306c063e3283f97dd974bcab4e5affed2b654bae1a22d0d99c3aa" +"checksum wasm-bindgen-backend 0.2.49 (registry+https://github.com/rust-lang/crates.io-index)" = "8894c95e23cc5082786192ebbd2ac0e31e9f77a022132ba03e8b8de32a2323c6" +"checksum wasm-bindgen-macro 0.2.49 (registry+https://github.com/rust-lang/crates.io-index)" = "ec031a3190c51dda28c9f3623e2674e58c79f6d88c020c2157417fcf62298a3f" +"checksum wasm-bindgen-macro-support 0.2.49 (registry+https://github.com/rust-lang/crates.io-index)" = "3b7cad0ab0bb5fefbb770279f522dcebb6433585174d93ea648390f61db57401" +"checksum wasm-bindgen-shared 0.2.49 (registry+https://github.com/rust-lang/crates.io-index)" = "9142625bbb0d70710b3f2a6b20924c80fa182b05888b6bd21600ab9075673563" "checksum winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)" = "f10e386af2b13e47c89e7236a7a14a086791a2b88ebad6df9bf42040195cf770" "checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" "checksum winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7168bab6e1daee33b4557efd0e95d5ca70a03706d39fa5f3fe7a236f584b03c9" "checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" "checksum wincolor 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "561ed901ae465d6185fa7864d63fbd5720d0ef718366c9a4dc83cf6170d7e9ba" "checksum zeroize 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "8ddfeb6eee2fb3b262ef6e0898a52b7563bb8e0d5955a313b3cf2f808246ea14" -"checksum zeroize 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4177936c03b5a349c1b8e4509c46add268e66bc66fe92663729fa0570fe4f213" -"checksum zeroize_derive 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "afd1469e4bbca3b96606d26ba6e9bd6d3aed3b1299c82b92ec94377d22d78dbc" +"checksum zeroize 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)" = "45af6a010d13e4cf5b54c94ba5a2b2eba5596b9e46bf5875612d332a1f2b3f86" +"checksum zeroize_derive 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)" = "080616bd0e31f36095288bb0acdf1f78ef02c2fa15527d7e993f2a6c7591643e" "checksum zmq 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8ff1c5e9ff4ac9c2847b2e72ada1c1eb3e188adb49fe3f1dd3bbcdc47f414d17" "checksum zmq-sys 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)" = "4b770cf495ad41e920ab25c465f35b7eec09d0ce8d7c892a7c8334a5e0de037c" diff --git a/libindy/src/commands/anoncreds/issuer.rs b/libindy/src/commands/anoncreds/issuer.rs index d629f0f8b0..4eed0b9763 100644 --- a/libindy/src/commands/anoncreds/issuer.rs +++ b/libindy/src/commands/anoncreds/issuer.rs @@ -702,7 +702,7 @@ impl IssuerCommandExecutor { // TODO: FIXME: Review error kind! let blob_storage_reader_handle = blob_storage_reader_handle - .ok_or(err_msg(IndyErrorKind::InvalidStructure, "TailsReaderHandle not found"))?; + .ok_or_else(|| err_msg(IndyErrorKind::InvalidStructure, "TailsReaderHandle not found"))?; let sdk_tails_accessor = SDKTailsAccessor::new(self.blob_storage_service.clone(), blob_storage_reader_handle, @@ -920,7 +920,7 @@ impl IssuerCommandExecutor { fn _wallet_get_schema_id(&self, wallet_handle: WalletHandle, key: &str) -> IndyResult { let schema_id_record = self.wallet_service.get_record(wallet_handle, &self.wallet_service.add_prefix("SchemaId"), &key, &RecordOptions::id_value())?; Ok(schema_id_record.get_value() - .ok_or(err_msg(IndyErrorKind::InvalidStructure, format!("SchemaId not found for id: {}", key)))?.to_string()) + .ok_or_else(||err_msg(IndyErrorKind::InvalidStructure, format!("SchemaId not found for id: {}", key)))?.to_string()) } fn _wallet_get_rev_reg_def(&self, wallet_handle: WalletHandle, key: &str) -> IndyResult { diff --git a/libindy/src/commands/anoncreds/prover.rs b/libindy/src/commands/anoncreds/prover.rs index c75518b300..e87fda64ce 100644 --- a/libindy/src/commands/anoncreds/prover.rs +++ b/libindy/src/commands/anoncreds/prover.rs @@ -483,7 +483,7 @@ impl ProverCommandExecutor { let mut searches = self.searches.borrow_mut(); let search = searches.get_mut(&search_handle) - .ok_or(err_msg(IndyErrorKind::InvalidWalletHandle, format!("Unknown CredentialsSearch handle: {}", search_handle)))?; + .ok_or_else(|| err_msg(IndyErrorKind::InvalidWalletHandle, format!("Unknown CredentialsSearch handle: {}", search_handle)))?; let mut credentials_info: Vec = Vec::new(); @@ -611,9 +611,9 @@ impl ProverCommandExecutor { let mut searches = self.searches_for_proof_requests.borrow_mut(); let search: &mut SearchForProofRequest = searches.get_mut(&search_handle) - .ok_or(err_msg(IndyErrorKind::InvalidWalletHandle, format!("Unknown CredentialsSearch handle: {}", search_handle)))? + .ok_or_else(||err_msg(IndyErrorKind::InvalidWalletHandle, format!("Unknown CredentialsSearch handle: {}", search_handle)))? .get_mut(item_referent) - .ok_or(err_msg(IndyErrorKind::InvalidWalletHandle, format!("Unknown item referent {} for CredentialsSearch handle: {}", item_referent, search_handle)))?; + .ok_or_else(||err_msg(IndyErrorKind::InvalidWalletHandle, format!("Unknown item referent {} for CredentialsSearch handle: {}", item_referent, search_handle)))?; let requested_credentials: Vec = self._get_requested_credentials(&mut search.search, search.predicate_info.as_ref(), &search.interval, Some(count))?; @@ -794,7 +794,7 @@ impl ProverCommandExecutor { let referent = record.get_id(); let value = record.get_value() - .ok_or(err_msg(IndyErrorKind::InvalidState, format!("Credential not found for id: {}", referent)))?; + .ok_or_else(||err_msg(IndyErrorKind::InvalidState, format!("Credential not found for id: {}", referent)))?; let credential: Credential = serde_json::from_str(value) .to_indy(IndyErrorKind::InvalidState, "Cannot deserialize Credential")?; @@ -836,7 +836,7 @@ impl ProverCommandExecutor { if let Some(predicate) = predicate_info { let values = self.anoncreds_service.prover.get_credential_values_for_attribute(&credential.values, &predicate.name) - .ok_or(err_msg(IndyErrorKind::InvalidState, "Credential values not found"))?; + .ok_or_else(||err_msg(IndyErrorKind::InvalidState, "Credential values not found"))?; let satisfy = self.anoncreds_service.prover.attribute_satisfy_predicate(predicate, &values.encoded)?; if !satisfy { continue; } diff --git a/libindy/src/commands/did.rs b/libindy/src/commands/did.rs index 03aed87508..b01e18910e 100644 --- a/libindy/src/commands/did.rs +++ b/libindy/src/commands/did.rs @@ -303,7 +303,7 @@ impl DidCommandExecutor { let did_id = did_record.get_id(); let did: Did = did_record.get_value() - .ok_or(err_msg(IndyErrorKind::InvalidState, "No value for DID record")) + .ok_or_else(||err_msg(IndyErrorKind::InvalidState, "No value for DID record")) .and_then(|tags_json| serde_json::from_str(&tags_json) .to_indy(IndyErrorKind::InvalidState, format!("Cannot deserialize Did: {:?}", did_id)))?; diff --git a/libindy/src/commands/non_secrets.rs b/libindy/src/commands/non_secrets.rs index b84a7e1f40..1d2370e151 100644 --- a/libindy/src/commands/non_secrets.rs +++ b/libindy/src/commands/non_secrets.rs @@ -268,7 +268,7 @@ impl NonSecretsCommandExecutor { let mut searches = self.searches.borrow_mut(); let search = searches.get_mut(&wallet_search_handle) - .ok_or(err_msg(IndyErrorKind::InvalidWalletHandle, format!("Unknown WalletSearch handle: {}", wallet_search_handle)))?; + .ok_or_else(||err_msg(IndyErrorKind::InvalidWalletHandle, format!("Unknown WalletSearch handle: {}", wallet_search_handle)))?; let mut records: Vec = Vec::new(); for _ in 0..count { diff --git a/libindy/src/commands/pairwise.rs b/libindy/src/commands/pairwise.rs index 45addb7599..8c0b11b279 100644 --- a/libindy/src/commands/pairwise.rs +++ b/libindy/src/commands/pairwise.rs @@ -117,7 +117,7 @@ impl PairwiseCommandExecutor { let pairwise_id = pairwise_record.get_id(); let pairwise_value = pairwise_record.get_value() - .ok_or(err_msg(IndyErrorKind::InvalidStructure, format!("Pairwise not found for id: {}", pairwise_id)))?.to_string(); + .ok_or_else(||err_msg(IndyErrorKind::InvalidStructure, format!("Pairwise not found for id: {}", pairwise_id)))?.to_string(); list_pairwise.push(pairwise_value); } diff --git a/libindy/src/services/anoncreds/issuer.rs b/libindy/src/services/anoncreds/issuer.rs index b0ac5e0446..80a9ecd325 100644 --- a/libindy/src/services/anoncreds/issuer.rs +++ b/libindy/src/services/anoncreds/issuer.rs @@ -106,16 +106,16 @@ impl Issuer { let rev_idx = rev_idx.unwrap(); let rev_reg = rev_reg - .ok_or(err_msg(IndyErrorKind::InvalidState, "RevocationRegistry not found"))?; + .ok_or_else(||err_msg(IndyErrorKind::InvalidState, "RevocationRegistry not found"))?; let rev_key_priv = rev_key_priv - .ok_or(err_msg(IndyErrorKind::InvalidState, "RevocationKeyPrivate not found"))?; + .ok_or_else(||err_msg(IndyErrorKind::InvalidState, "RevocationKeyPrivate not found"))?; let rev_reg_def = rev_reg_def - .ok_or(err_msg(IndyErrorKind::InvalidState, "RevocationRegistryDefinitionValue not found"))?; + .ok_or_else(||err_msg(IndyErrorKind::InvalidState, "RevocationRegistryDefinitionValue not found"))?; let rev_tails_accessor = rev_tails_accessor - .ok_or(err_msg(IndyErrorKind::InvalidState, "RevocationTailsAccessor not found"))?; + .ok_or_else(||err_msg(IndyErrorKind::InvalidState, "RevocationTailsAccessor not found"))?; CryptoIssuer::sign_credential_with_revoc(&cred_request.prover_did, &cred_request.blinded_ms, diff --git a/libindy/src/services/anoncreds/prover.rs b/libindy/src/services/anoncreds/prover.rs index 8ec970c76a..7f32408368 100644 --- a/libindy/src/services/anoncreds/prover.rs +++ b/libindy/src/services/anoncreds/prover.rs @@ -137,24 +137,24 @@ impl Prover { let mut identifiers: Vec = Vec::with_capacity(credentials_for_proving.len()); for (cred_key, (req_attrs_for_cred, req_predicates_for_cred)) in credentials_for_proving { let credential: &Credential = credentials.get(cred_key.cred_id.as_str()) - .ok_or(err_msg(IndyErrorKind::InvalidStructure, format!("Credential not found by id: {:?}", cred_key.cred_id)))?; + .ok_or_else(|| err_msg(IndyErrorKind::InvalidStructure, format!("Credential not found by id: {:?}", cred_key.cred_id)))?; let schema: &SchemaV1 = schemas.get(&credential.schema_id) - .ok_or(err_msg(IndyErrorKind::InvalidStructure, format!("Schema not found by id: {:?}", credential.schema_id)))?; + .ok_or_else(|| err_msg(IndyErrorKind::InvalidStructure, format!("Schema not found by id: {:?}", credential.schema_id)))?; let cred_def: &CredentialDefinition = cred_defs.get(&credential.cred_def_id) - .ok_or(err_msg(IndyErrorKind::InvalidStructure, format!("CredentialDefinition not found by id: {:?}", credential.cred_def_id)))?; + .ok_or_else(|| err_msg(IndyErrorKind::InvalidStructure, format!("CredentialDefinition not found by id: {:?}", credential.cred_def_id)))?; let rev_state = if let Some(timestamp) = cred_key.timestamp { let rev_reg_id = credential.rev_reg_id .clone() - .ok_or(err_msg(IndyErrorKind::InvalidStructure, "Revocation Registry Id not found"))?; + .ok_or_else(|| err_msg(IndyErrorKind::InvalidStructure, "Revocation Registry Id not found"))?; let rev_states_for_timestamp = rev_states.get(&rev_reg_id) - .ok_or(err_msg(IndyErrorKind::InvalidStructure, format!("RevocationState not found by id: {:?}", rev_reg_id)))?; + .ok_or_else(|| err_msg(IndyErrorKind::InvalidStructure, format!("RevocationState not found by id: {:?}", rev_reg_id)))?; Some(rev_states_for_timestamp.get(×tamp) - .ok_or(err_msg(IndyErrorKind::InvalidStructure, format!("RevocationInfo not found by timestamp: {:?}", timestamp)))?) + .ok_or_else(|| err_msg(IndyErrorKind::InvalidStructure, format!("RevocationInfo not found by timestamp: {:?}", timestamp)))?) } else { None }; let credential_pub_key = CredentialPublicKey::build_from_parts(&cred_def.value.primary, cred_def.value.revocation.as_ref())?; @@ -210,7 +210,7 @@ impl Prover { for (attr_referent, requested_attr) in requested_credentials.requested_attributes.iter() { let attr_info = proof_req.requested_attributes .get(attr_referent.as_str()) - .ok_or(err_msg(IndyErrorKind::InvalidStructure, format!("AttributeInfo not found in ProofRequest for referent \"{}\"", attr_referent.as_str())))?; + .ok_or_else(|| err_msg(IndyErrorKind::InvalidStructure, format!("AttributeInfo not found in ProofRequest for referent \"{}\"", attr_referent.as_str())))?; let req_attr_info = RequestedAttributeInfo { attr_referent: attr_referent.clone(), @@ -232,7 +232,7 @@ impl Prover { for (predicate_referent, proving_cred_key) in requested_credentials.requested_predicates.iter() { let predicate_info = proof_req.requested_predicates .get(predicate_referent.as_str()) - .ok_or(err_msg(IndyErrorKind::InvalidStructure, format!("PredicateInfo not found in ProofRequest for referent \"{}\"", predicate_referent.as_str())))?; + .ok_or_else(|| err_msg(IndyErrorKind::InvalidStructure, format!("PredicateInfo not found in ProofRequest for referent \"{}\"", predicate_referent.as_str())))?; let req_predicate_info = RequestedPredicateInfo { predicate_referent: predicate_referent.clone(), @@ -315,7 +315,7 @@ impl Prover { let mut res: Vec = Vec::new(); for sub_query in array { let sub_query = sub_query.as_object() - .ok_or(err_msg(IndyErrorKind::InvalidStructure, "Restriction is invalid"))? + .ok_or_else(|| err_msg(IndyErrorKind::InvalidStructure, "Restriction is invalid"))? .clone() .into_iter() .filter(|&(_, ref v)| !v.is_null()) @@ -400,7 +400,7 @@ impl Prover { let attribute = &proof_req.requested_attributes[&attr_info.attr_referent]; let attribute_values = self.get_credential_values_for_attribute(&credential.values, &attribute.name) - .ok_or(err_msg(IndyErrorKind::InvalidStructure, format!("Credential value not found for attribute {:?}", attribute.name)))?; + .ok_or_else(|| err_msg(IndyErrorKind::InvalidStructure, format!("Credential value not found for attribute {:?}", attribute.name)))?; requested_proof.revealed_attrs.insert(attr_info.attr_referent, RevealedAttributeInfo { diff --git a/libindy/src/services/anoncreds/verifier.rs b/libindy/src/services/anoncreds/verifier.rs index 5f4714130d..b7728d68ce 100644 --- a/libindy/src/services/anoncreds/verifier.rs +++ b/libindy/src/services/anoncreds/verifier.rs @@ -72,28 +72,28 @@ impl Verifier { let identifier = full_proof.identifiers[sub_proof_index].clone(); let schema: &SchemaV1 = schemas.get(&identifier.schema_id) - .ok_or(err_msg(IndyErrorKind::InvalidStructure, format!("Schema not found for id: {:?}", identifier.schema_id)))?; + .ok_or_else(|| err_msg(IndyErrorKind::InvalidStructure, format!("Schema not found for id: {:?}", identifier.schema_id)))?; let cred_def: &CredentialDefinitionV1 = cred_defs.get(&identifier.cred_def_id) - .ok_or(err_msg(IndyErrorKind::InvalidStructure, format!("CredentialDefinition not found for id: {:?}", identifier.cred_def_id)))?; + .ok_or_else(|| err_msg(IndyErrorKind::InvalidStructure, format!("CredentialDefinition not found for id: {:?}", identifier.cred_def_id)))?; let (rev_reg_def, rev_reg) = if let Some(timestamp) = identifier.timestamp { let rev_reg_id = identifier.rev_reg_id .clone() - .ok_or(err_msg(IndyErrorKind::InvalidStructure, "Revocation Registry Id not found"))?; + .ok_or_else(|| err_msg(IndyErrorKind::InvalidStructure, "Revocation Registry Id not found"))?; let rev_reg_def = Some(rev_reg_defs .get(&rev_reg_id) - .ok_or(err_msg(IndyErrorKind::InvalidStructure, format!("RevocationRegistryDefinition not found for id: {:?}", identifier.rev_reg_id)))?); + .ok_or_else(|| err_msg(IndyErrorKind::InvalidStructure, format!("RevocationRegistryDefinition not found for id: {:?}", identifier.rev_reg_id)))?); let rev_regs_for_cred = rev_regs .get(&rev_reg_id) - .ok_or(err_msg(IndyErrorKind::InvalidStructure, format!("RevocationRegistry not found for id: {:?}", rev_reg_id)))?; + .ok_or_else(|| err_msg(IndyErrorKind::InvalidStructure, format!("RevocationRegistry not found for id: {:?}", rev_reg_id)))?; let rev_reg = Some(rev_regs_for_cred .get(×tamp) - .ok_or(err_msg(IndyErrorKind::InvalidStructure, format!("RevocationRegistry not found for timestamp: {:?}", timestamp)))?); + .ok_or_else(|| err_msg(IndyErrorKind::InvalidStructure, format!("RevocationRegistry not found for timestamp: {:?}", timestamp)))?); (rev_reg_def, rev_reg) } else { (None, None) }; @@ -292,7 +292,7 @@ impl Verifier { proof.identifiers .get(index as usize) .cloned() - .ok_or(err_msg( + .ok_or_else(|| err_msg( IndyErrorKind::InvalidStructure, format!("Identifier not found for index: {}", index) )) @@ -357,33 +357,33 @@ impl Verifier { cred_defs: &HashMap) -> IndyResult { let identifier = identifiers .get(referent) - .ok_or(err_msg( + .ok_or_else(|| err_msg( IndyErrorKind::InvalidState, format!("Identifier not found for referent: {}", referent)) )?; let schema: &SchemaV1 = schemas .get(&identifier.schema_id) - .ok_or(err_msg( + .ok_or_else(|| err_msg( IndyErrorKind::InvalidStructure, format!("Schema not found for id: {:?}", identifier.schema_id)) )?; let cred_def: &CredentialDefinitionV1 = cred_defs .get(&identifier.cred_def_id) - .ok_or(err_msg( + .ok_or_else(|| err_msg( IndyErrorKind::InvalidStructure, format!("CredentialDefinitionV1 not found for id: {:?}", identifier.cred_def_id)) )?; let schema_issuer_did = Schema::issuer_did(&schema.id) - .ok_or(err_msg( + .ok_or_else(|| err_msg( IndyErrorKind::InvalidStructure, format!("schema_id has invalid format: {:?}", schema.id)) )?; let issuer_did = CredentialDefinition::issuer_did(&cred_def.id) - .ok_or(err_msg( + .ok_or_else(|| err_msg( IndyErrorKind::InvalidStructure, format!("cred_def_id has invalid format: {:?}", cred_def.id)) )?; diff --git a/libindy/src/services/blob_storage/mod.rs b/libindy/src/services/blob_storage/mod.rs index 9e49fa22af..706c93e2a4 100644 --- a/libindy/src/services/blob_storage/mod.rs +++ b/libindy/src/services/blob_storage/mod.rs @@ -70,7 +70,7 @@ impl BlobStorageService { impl BlobStorageService { pub fn open_writer(&self, type_: &str, config: &str) -> IndyResult { let writer_config = self.writer_types.try_borrow()? - .get(type_).ok_or(err_msg(IndyErrorKind::InvalidStructure, "Unknown BlobStorage Writer type"))? + .get(type_).ok_or_else(|| err_msg(IndyErrorKind::InvalidStructure, "Unknown BlobStorage Writer type"))? .open(config)?; let config_handle = sequence::get_next_id(); @@ -82,7 +82,7 @@ impl BlobStorageService { pub fn create_blob(&self, config_handle: i32) -> IndyResult { let blob_handle = sequence::get_next_id(); let writer = self.writer_configs.try_borrow()? - .get(&config_handle).ok_or(err_msg(IndyErrorKind::InvalidStructure, "Invalid BlobStorage config handle"))? // FIXME: Review error kind + .get(&config_handle).ok_or_else(|| err_msg(IndyErrorKind::InvalidStructure, "Invalid BlobStorage config handle"))? // FIXME: Review error kind .create(blob_handle)?; self.writer_blobs.try_borrow_mut()?.insert(blob_handle, (writer, Sha256::default())); @@ -93,7 +93,7 @@ impl BlobStorageService { pub fn append(&self, handle: i32, bytes: &[u8]) -> IndyResult { let mut writers = self.writer_blobs.try_borrow_mut()?; let &mut (ref mut writer, ref mut hasher) = writers - .get_mut(&handle).ok_or(err_msg(IndyErrorKind::InvalidStructure, "Invalid BlobStorage handle"))?; // FIXME: Review error kind + .get_mut(&handle).ok_or_else(|| err_msg(IndyErrorKind::InvalidStructure, "Invalid BlobStorage handle"))?; // FIXME: Review error kind hasher.input(bytes); writer.append(bytes) @@ -102,7 +102,7 @@ impl BlobStorageService { pub fn finalize(&self, handle: i32) -> IndyResult<(String, Vec)> { let mut writers = self.writer_blobs.try_borrow_mut()?; let (mut writer, hasher) = writers - .remove(&handle).ok_or(err_msg(IndyErrorKind::InvalidStructure, "Invalid BlobStorage handle"))?; // FIXME: Review error kind + .remove(&handle).ok_or_else(|| err_msg(IndyErrorKind::InvalidStructure, "Invalid BlobStorage handle"))?; // FIXME: Review error kind let hash = hasher.fixed_result().to_vec(); @@ -115,7 +115,7 @@ impl BlobStorageService { impl BlobStorageService { pub fn open_reader(&self, type_: &str, config: &str) -> IndyResult { let reader_config = self.reader_types.try_borrow()? - .get(type_).ok_or(err_msg(IndyErrorKind::InvalidStructure, "Invalid BlobStorage Reader type"))? // FIXME: Review error kind + .get(type_).ok_or_else(|| err_msg(IndyErrorKind::InvalidStructure, "Invalid BlobStorage Reader type"))? // FIXME: Review error kind .open(config)?; let config_handle = sequence::get_next_id(); @@ -126,7 +126,7 @@ impl BlobStorageService { pub fn open_blob(&self, config_handle: i32, location: &str, hash: &[u8]) -> IndyResult { let reader = self.reader_configs.try_borrow()? - .get(&config_handle).ok_or(err_msg(IndyErrorKind::InvalidStructure, "Invalid BlobStorage config handle"))? // FIXME: Review error kind + .get(&config_handle).ok_or_else(|| err_msg(IndyErrorKind::InvalidStructure, "Invalid BlobStorage config handle"))? // FIXME: Review error kind .open(hash, location)?; let reader_handle = sequence::get_next_id(); @@ -137,19 +137,19 @@ impl BlobStorageService { pub fn read(&self, handle: i32, size: usize, offset: usize) -> IndyResult> { self.reader_blobs.try_borrow_mut()? - .get_mut(&handle).ok_or(err_msg(IndyErrorKind::InvalidStructure, "Invalid BlobStorage handle"))? // FIXME: Review error kind + .get_mut(&handle).ok_or_else(|| err_msg(IndyErrorKind::InvalidStructure, "Invalid BlobStorage handle"))? // FIXME: Review error kind .read(size, offset) } pub fn _verify(&self, handle: i32) -> IndyResult { self.reader_blobs.try_borrow_mut()? - .get_mut(&handle).ok_or(err_msg(IndyErrorKind::InvalidStructure, "Invalid BlobStorage handle"))? // FIXME: Review error kind + .get_mut(&handle).ok_or_else(|| err_msg(IndyErrorKind::InvalidStructure, "Invalid BlobStorage handle"))? // FIXME: Review error kind .verify() } pub fn close(&self, handle: i32) -> IndyResult<()> { self.reader_blobs.try_borrow_mut()? - .remove(&handle).ok_or(err_msg(IndyErrorKind::InvalidStructure, "Invalid BlobStorage handle"))? // FIXME: Review error kind + .remove(&handle).ok_or_else(|| err_msg(IndyErrorKind::InvalidStructure, "Invalid BlobStorage handle"))? // FIXME: Review error kind .close() } } diff --git a/libindy/src/services/ledger/mod.rs b/libindy/src/services/ledger/mod.rs index 6afe2d4590..6fa681f7c0 100644 --- a/libindy/src/services/ledger/mod.rs +++ b/libindy/src/services/ledger/mod.rs @@ -141,13 +141,13 @@ impl LedgerService { let parts: Vec<&str> = id.split_terminator(DELIMITER).collect::>(); let dest = parts.get(0) - .ok_or(err_msg(IndyErrorKind::InvalidStructure, format!("Schema issuer DID not found in: {}", id)))?.to_string(); + .ok_or_else(|| err_msg(IndyErrorKind::InvalidStructure, format!("Schema issuer DID not found in: {}", id)))?.to_string(); let name = parts.get(2) - .ok_or(err_msg(IndyErrorKind::InvalidStructure, format!("Schema name not found in: {}", id)))?.to_string(); + .ok_or_else(|| err_msg(IndyErrorKind::InvalidStructure, format!("Schema name not found in: {}", id)))?.to_string(); let version = parts.get(3) - .ok_or(err_msg(IndyErrorKind::InvalidStructure, format!("Schema version not found in: {}", id)))?.to_string(); + .ok_or_else(|| err_msg(IndyErrorKind::InvalidStructure, format!("Schema version not found in: {}", id)))?.to_string(); let data = GetSchemaOperationData::new(name, version); @@ -164,15 +164,15 @@ impl LedgerService { let parts: Vec<&str> = id.split_terminator(DELIMITER).collect::>(); let origin = parts.get(0) - .ok_or(err_msg(IndyErrorKind::InvalidStructure, format!("Origin not found in: {}", id)))?.to_string(); + .ok_or_else(|| err_msg(IndyErrorKind::InvalidStructure, format!("Origin not found in: {}", id)))?.to_string(); let ref_ = parts.get(3) - .ok_or(err_msg(IndyErrorKind::InvalidStructure, format!("Schema ID not found in: {}", id)))? + .ok_or_else(|| err_msg(IndyErrorKind::InvalidStructure, format!("Schema ID not found in: {}", id)))? .parse::() .to_indy(IndyErrorKind::InvalidStructure, format!("Schema ID is invalid number in: {}", id))?; let signature_type = parts.get(2) - .ok_or(err_msg(IndyErrorKind::InvalidStructure, format!("Signature type not found in: {}", id)))?.to_string(); + .ok_or_else(|| err_msg(IndyErrorKind::InvalidStructure, format!("Signature type not found in: {}", id)))?.to_string(); let tag = parts.get(4).map(|tag| tag.to_string()); @@ -399,7 +399,7 @@ impl LedgerService { pub fn build_auth_rule_request(&self, submitter_did: &str, txn_type: &str, action: &str, field: &str, old_value: Option<&str>, new_value: Option<&str>, constraint: &str) -> IndyResult { let txn_type = txn_name_to_code(&txn_type) - .ok_or(err_msg(IndyErrorKind::InvalidStructure, format!("Unsupported `txn_type`: {}", txn_type)))?; + .ok_or_else(|| err_msg(IndyErrorKind::InvalidStructure, format!("Unsupported `txn_type`: {}", txn_type)))?; let action = serde_json::from_str::(&format!("\"{}\"", action)) .map_err(|err| IndyError::from_msg(IndyErrorKind::InvalidStructure, format!("Cannot parse auth action: {}", err)))?; @@ -423,7 +423,7 @@ impl LedgerService { (None, None, None) => GetAuthRuleOperation::get_all(), (Some(auth_type), Some(auth_action), Some(field)) => { let type_ = txn_name_to_code(&auth_type) - .ok_or(err_msg(IndyErrorKind::InvalidStructure, format!("Unsupported `auth_type`: {}", auth_type)))?; + .ok_or_else(|| err_msg(IndyErrorKind::InvalidStructure, format!("Unsupported `auth_type`: {}", auth_type)))?; let action = serde_json::from_str::(&format!("\"{}\"", auth_action)) .map_err(|err| IndyError::from_msg(IndyErrorKind::InvalidStructure, format!("Cannot parse auth action: {}", err)))?; diff --git a/libindy/src/services/payments.rs b/libindy/src/services/payments.rs index 3331c38c15..6ec1f2005e 100644 --- a/libindy/src/services/payments.rs +++ b/libindy/src/services/payments.rs @@ -95,7 +95,7 @@ impl PaymentsService { pub fn create_address(&self, cmd_handle: CommandHandle, wallet_handle: WalletHandle, method_type: &str, config: &str) -> IndyResult<()> { trace!("create_address >>> wallet_handle: {:?}, method_type: {:?}, config: {:?}", wallet_handle, method_type, config); let create_address: CreatePaymentAddressCB = self.methods.borrow().get(method_type) - .ok_or(err_msg(IndyErrorKind::UnknownPaymentMethodType, format!("Unknown payment method {}", method_type)))?.create_address; + .ok_or_else(|| err_msg(IndyErrorKind::UnknownPaymentMethodType, format!("Unknown payment method {}", method_type)))?.create_address; let config = CString::new(config)?; @@ -110,7 +110,7 @@ impl PaymentsService { trace!("add_request_fees >>> method_type: {:?}, wallet_handle: {:?}, submitter_did: {:?}, req: {:?}, inputs: {:?}, outputs: {:?}, extra: {:?}", method_type, wallet_handle, submitter_did, req, inputs, outputs, extra); let add_request_fees: AddRequestFeesCB = self.methods.borrow().get(method_type) - .ok_or(err_msg(IndyErrorKind::UnknownPaymentMethodType, format!("Unknown payment method {}", method_type)))?.add_request_fees; + .ok_or_else(|| err_msg(IndyErrorKind::UnknownPaymentMethodType, format!("Unknown payment method {}", method_type)))?.add_request_fees; let submitter_did = submitter_did.map(ctypes::str_to_cstring); let req = CString::new(req)?; @@ -135,7 +135,7 @@ impl PaymentsService { pub fn parse_response_with_fees(&self, cmd_handle: CommandHandle, type_: &str, response: &str) -> IndyResult<()> { trace!("parse_response_with_fees >>> type_: {:?}, response: {:?}", type_, response); let parse_response_with_fees: ParseResponseWithFeesCB = self.methods.borrow().get(type_) - .ok_or(err_msg(IndyErrorKind::UnknownPaymentMethodType, format!("Unknown payment method {}", type_)))?.parse_response_with_fees; + .ok_or_else(|| err_msg(IndyErrorKind::UnknownPaymentMethodType, format!("Unknown payment method {}", type_)))?.parse_response_with_fees; let response = CString::new(response)?; let err = parse_response_with_fees(cmd_handle, response.as_ptr(), cbs::parse_response_with_fees_cb(cmd_handle)); @@ -148,7 +148,7 @@ impl PaymentsService { pub fn build_get_payment_sources_request(&self, cmd_handle: CommandHandle, type_: &str, wallet_handle: WalletHandle, submitter_did: Option<&str>, address: &str, next: Option) -> IndyResult<()> { trace!("build_get_payment_sources_request >>> type_: {:?}, wallet_handle: {:?}, submitter_did: {:?}, address: {:?}", type_, wallet_handle, submitter_did, address); let build_get_payment_sources_request: BuildGetPaymentSourcesRequestCB = self.methods.borrow().get(type_) - .ok_or(err_msg(IndyErrorKind::UnknownPaymentMethodType, format!("Unknown payment method {}", type_)))?.build_get_payment_sources_request; + .ok_or_else(|| err_msg(IndyErrorKind::UnknownPaymentMethodType, format!("Unknown payment method {}", type_)))?.build_get_payment_sources_request; let submitter_did = submitter_did.map(ctypes::str_to_cstring); let address = CString::new(address)?; @@ -170,7 +170,7 @@ impl PaymentsService { trace!("parse_get_payment_sources_response >>> type_: {:?}, response: {:?}", type_, response); let parse_get_payment_sources_response: ParseGetPaymentSourcesResponseCB = self.methods.borrow().get(type_) - .ok_or(err_msg(IndyErrorKind::UnknownPaymentMethodType, format!("Unknown payment method {}", type_)))?.parse_get_payment_sources_response; + .ok_or_else(|| err_msg(IndyErrorKind::UnknownPaymentMethodType, format!("Unknown payment method {}", type_)))?.parse_get_payment_sources_response; let response = CString::new(response)?; let err = parse_get_payment_sources_response(cmd_handle, response.as_ptr(), cbs::parse_get_payment_sources_response_cb(cmd_handle)); @@ -183,7 +183,7 @@ impl PaymentsService { pub fn build_payment_req(&self, cmd_handle: CommandHandle, type_: &str, wallet_handle: WalletHandle, submitter_did: Option<&str>, inputs: &str, outputs: &str, extra: Option<&str>) -> IndyResult<()> { trace!("build_payment_req >>> type_: {:?}, wallet_handle: {:?}, submitter_did: {:?}, inputs: {:?}, outputs: {:?}, extra: {:?}", type_, wallet_handle, submitter_did, inputs, outputs, extra); let build_payment_req: BuildPaymentReqCB = self.methods.borrow().get(type_) - .ok_or(err_msg(IndyErrorKind::UnknownPaymentMethodType, format!("Unknown payment method {}", type_)))?.build_payment_req; + .ok_or_else(|| err_msg(IndyErrorKind::UnknownPaymentMethodType, format!("Unknown payment method {}", type_)))?.build_payment_req; let submitter_did = submitter_did.map(ctypes::str_to_cstring); let inputs = CString::new(inputs)?; @@ -206,7 +206,7 @@ impl PaymentsService { pub fn parse_payment_response(&self, cmd_handle: CommandHandle, type_: &str, response: &str) -> IndyResult<()> { trace!("parse_payment_response >>> type_: {:?}, response: {:?}", type_, response); let parse_payment_response: ParsePaymentResponseCB = self.methods.borrow().get(type_) - .ok_or(err_msg(IndyErrorKind::UnknownPaymentMethodType, format!("Unknown payment method {}", type_)))?.parse_payment_response; + .ok_or_else(|| err_msg(IndyErrorKind::UnknownPaymentMethodType, format!("Unknown payment method {}", type_)))?.parse_payment_response; let response = CString::new(response)?; @@ -220,7 +220,7 @@ impl PaymentsService { pub fn build_mint_req(&self, cmd_handle: CommandHandle, type_: &str, wallet_handle: WalletHandle, submitter_did: Option<&str>, outputs: &str, extra: Option<&str>) -> IndyResult<()> { trace!("build_mint_req >>> type_: {:?}, wallet_handle: {:?}, submitter_did: {:?}, outputs: {:?}, extra: {:?}", type_, wallet_handle, submitter_did, outputs, extra); let build_mint_req: BuildMintReqCB = self.methods.borrow().get(type_) - .ok_or(err_msg(IndyErrorKind::UnknownPaymentMethodType, format!("Unknown payment method {}", type_)))?.build_mint_req; + .ok_or_else(|| err_msg(IndyErrorKind::UnknownPaymentMethodType, format!("Unknown payment method {}", type_)))?.build_mint_req; let submitter_did = submitter_did.map(ctypes::str_to_cstring); let outputs = CString::new(outputs)?; @@ -241,7 +241,7 @@ impl PaymentsService { pub fn build_set_txn_fees_req(&self, cmd_handle: CommandHandle, type_: &str, wallet_handle: WalletHandle, submitter_did: Option<&str>, fees: &str) -> IndyResult<()> { trace!("build_set_txn_fees_req >>> type_: {:?}, wallet_handle: {:?}, submitter_did: {:?}, fees: {:?}", type_, wallet_handle, submitter_did, fees); let build_set_txn_fees_req: BuildSetTxnFeesReqCB = self.methods.borrow().get(type_) - .ok_or(err_msg(IndyErrorKind::UnknownPaymentMethodType, format!("Unknown payment method {}", type_)))?.build_set_txn_fees_req; + .ok_or_else(|| err_msg(IndyErrorKind::UnknownPaymentMethodType, format!("Unknown payment method {}", type_)))?.build_set_txn_fees_req; let submitter_did = submitter_did.map(ctypes::str_to_cstring); let fees = CString::new(fees)?; @@ -260,7 +260,7 @@ impl PaymentsService { pub fn build_get_txn_fees_req(&self, cmd_handle: CommandHandle, type_: &str, wallet_handle: WalletHandle, submitter_did: Option<&str>) -> IndyResult<()> { trace!("build_get_txn_fees_req >>> type_: {:?}, wallet_handle: {:?}, submitter_did: {:?}", type_, wallet_handle, submitter_did); let build_get_txn_fees_req: BuildGetTxnFeesReqCB = self.methods.borrow().get(type_) - .ok_or(err_msg(IndyErrorKind::UnknownPaymentMethodType, format!("Unknown payment method {}", type_)))?.build_get_txn_fees_req; + .ok_or_else(|| err_msg(IndyErrorKind::UnknownPaymentMethodType, format!("Unknown payment method {}", type_)))?.build_get_txn_fees_req; let submitter_did = submitter_did.map(ctypes::str_to_cstring); @@ -277,7 +277,7 @@ impl PaymentsService { pub fn parse_get_txn_fees_response(&self, cmd_handle: CommandHandle, type_: &str, response: &str) -> IndyResult<()> { trace!("parse_get_txn_fees_response >>> type_: {:?}, response: {:?}", type_, response); let parse_get_txn_fees_response: ParseGetTxnFeesResponseCB = self.methods.borrow().get(type_) - .ok_or(err_msg(IndyErrorKind::UnknownPaymentMethodType, format!("Unknown payment method {}", type_)))?.parse_get_txn_fees_response; + .ok_or_else(|| err_msg(IndyErrorKind::UnknownPaymentMethodType, format!("Unknown payment method {}", type_)))?.parse_get_txn_fees_response; let response = CString::new(response)?; @@ -291,7 +291,7 @@ impl PaymentsService { pub fn build_verify_payment_req(&self, cmd_handle: CommandHandle, type_: &str, wallet_handle: WalletHandle, submitter_did: Option<&str>, receipt: &str) -> IndyResult<()> { trace!("build_verify_payment_req >>> type_: {:?}, wallet_handle: {:?}, submitter_did: {:?}, receipt: {:?}", type_, wallet_handle, submitter_did, receipt); let build_verify_payment_req: BuildVerifyPaymentReqCB = self.methods.borrow().get(type_) - .ok_or(err_msg(IndyErrorKind::UnknownPaymentMethodType, format!("Unknown payment method {}", type_)))?.build_verify_payment_req; + .ok_or_else(|| err_msg(IndyErrorKind::UnknownPaymentMethodType, format!("Unknown payment method {}", type_)))?.build_verify_payment_req; let submitter_did = submitter_did.map(ctypes::str_to_cstring); let receipt = CString::new(receipt)?; @@ -310,7 +310,7 @@ impl PaymentsService { pub fn parse_verify_payment_response(&self, cmd_handle: CommandHandle, type_: &str, resp_json: &str) -> IndyResult<()> { trace!("parse_verify_payment_response >>> type_: {:?}, resp_json: {:?}", type_, resp_json); let parse_verify_payment_response: ParseVerifyPaymentResponseCB = self.methods.borrow().get(type_) - .ok_or(err_msg(IndyErrorKind::UnknownPaymentMethodType, format!("Unknown payment method {}", type_)))?.parse_verify_payment_response; + .ok_or_else(|| err_msg(IndyErrorKind::UnknownPaymentMethodType, format!("Unknown payment method {}", type_)))?.parse_verify_payment_response; let resp_json = CString::new(resp_json)?; @@ -576,7 +576,7 @@ impl PaymentsService { pub fn sign_with_address(&self, cmd_handle: CommandHandle, method: &str, wallet_handle: WalletHandle, address: &str, message: &[u8]) -> IndyResult<()> { trace!("sign_with_address >>> wallet_handle: {:?}, address: {:?}, message: {:?}", wallet_handle, address, hex::encode(message)); let sign_with_address: SignWithAddressCB = self.methods.borrow().get(method) - .ok_or(err_msg(IndyErrorKind::UnknownPaymentMethodType, format!("Unknown payment method {}", method)))?.sign_with_address; + .ok_or_else(|| err_msg(IndyErrorKind::UnknownPaymentMethodType, format!("Unknown payment method {}", method)))?.sign_with_address; let address = CString::new(address)?; @@ -590,7 +590,7 @@ impl PaymentsService { pub fn verify_with_address(&self, cmd_handle: CommandHandle, method: &str, address: &str, message: &[u8], signature: &[u8]) -> IndyResult<()> { trace!("verify_with_address >>> address: {:?}, message: {:?}, signature: {:?}", address, hex::encode(message), hex::encode(signature)); let verify_with_address: VerifyWithAddressCB = self.methods.borrow().get(method) - .ok_or(err_msg(IndyErrorKind::UnknownPaymentMethodType, format!("Unknown payment method {}", method)))?.verify_with_address; + .ok_or_else(|| err_msg(IndyErrorKind::UnknownPaymentMethodType, format!("Unknown payment method {}", method)))?.verify_with_address; let address = CString::new(address)?; diff --git a/libindy/src/services/pool/events.rs b/libindy/src/services/pool/events.rs index 8013c6b75a..4617347d7e 100644 --- a/libindy/src/services/pool/events.rs +++ b/libindy/src/services/pool/events.rs @@ -284,12 +284,12 @@ fn _parse_req_id_and_op(msg: &str) -> IndyResult<(SJsonValue, String, String)> { let req_id = req_json["reqId"] .as_u64() - .ok_or(err_msg(IndyErrorKind::InvalidStructure, "No reqId in request"))? + .ok_or_else(|| err_msg(IndyErrorKind::InvalidStructure, "No reqId in request"))? .to_string(); let op = req_json["operation"]["type"] .as_str() - .ok_or(err_msg(IndyErrorKind::InvalidStructure, "No operation type in request"))? + .ok_or_else(|| err_msg(IndyErrorKind::InvalidStructure, "No operation type in request"))? .to_string(); Ok((req_json, req_id, op)) diff --git a/libindy/src/services/pool/mod.rs b/libindy/src/services/pool/mod.rs index d729a24fd1..f1af65be0f 100644 --- a/libindy/src/services/pool/mod.rs +++ b/libindy/src/services/pool/mod.rs @@ -176,7 +176,7 @@ impl PoolService { pub fn add_open_pool(&self, pool_id: PoolHandle) -> IndyResult { let pool = self.pending_pools.try_borrow_mut()? .remove(&pool_id) - .ok_or(err_msg(IndyErrorKind::InvalidPoolHandle, format!("No pool with requested handle {:?}", pool_id)))?; + .ok_or_else(|| err_msg(IndyErrorKind::InvalidPoolHandle, format!("No pool with requested handle {:?}", pool_id)))?; self.open_pools.try_borrow_mut()?.insert(pool_id, pool); diff --git a/libindy/src/services/pool/types.rs b/libindy/src/services/pool/types.rs index 718d1dc633..c70b3671f5 100644 --- a/libindy/src/services/pool/types.rs +++ b/libindy/src/services/pool/types.rs @@ -253,7 +253,7 @@ impl CatchupRep { } } - min.ok_or(err_msg(IndyErrorKind::InvalidStructure, "Empty map")) + min.ok_or_else(|| err_msg(IndyErrorKind::InvalidStructure, "Empty map")) } } @@ -499,7 +499,7 @@ impl MinValue for Vec<(CatchupRep, usize)> { } } - Ok(res.ok_or(err_msg(IndyErrorKind::InvalidStructure, "Element not Found"))?.1) + Ok(res.ok_or_else(|| err_msg(IndyErrorKind::InvalidStructure, "Element not Found"))?.1) } } diff --git a/libindy/src/services/wallet/export_import.rs b/libindy/src/services/wallet/export_import.rs index 20224aa305..a06a37dc87 100644 --- a/libindy/src/services/wallet/export_import.rs +++ b/libindy/src/services/wallet/export_import.rs @@ -63,10 +63,10 @@ pub(super) fn export_continue(wallet: &Wallet, writer: &mut dyn Write, version: while let Some(WalletRecord { type_, id, value, tags }) = records.next()? { let record = Record { - type_: type_.ok_or(err_msg(IndyErrorKind::InvalidState, "No type fetched for exported record"))?, + type_: type_.ok_or_else(|| err_msg(IndyErrorKind::InvalidState, "No type fetched for exported record"))?, id, - value: value.ok_or(err_msg(IndyErrorKind::InvalidState, "No value fetched for exported record"))?, - tags: tags.ok_or(err_msg(IndyErrorKind::InvalidState, "No tags fetched for exported record"))?, + value: value.ok_or_else(|| err_msg(IndyErrorKind::InvalidState, "No value fetched for exported record"))?, + tags: tags.ok_or_else(|| err_msg(IndyErrorKind::InvalidState, "No tags fetched for exported record"))?, }; let record = rmp_serde::to_vec(&record) diff --git a/libindy/src/services/wallet/mod.rs b/libindy/src/services/wallet/mod.rs index 9beb14f683..4cefdd7ffc 100644 --- a/libindy/src/services/wallet/mod.rs +++ b/libindy/src/services/wallet/mod.rs @@ -198,7 +198,7 @@ impl WalletService { pub fn open_wallet_continue(&self, wallet_handle: WalletHandle, master_key: (&MasterKey, Option<&MasterKey>)) -> IndyResult { let (id, storage, metadata, rekey_data) = self.pending_for_open.borrow_mut().remove(&wallet_handle) - .ok_or(err_msg(IndyErrorKind::InvalidState, "Open data not found"))?; + .ok_or_else(|| err_msg(IndyErrorKind::InvalidState, "Open data not found"))?; let (master_key, rekey) = master_key; let keys = self._restore_keys(&metadata, &master_key)?; @@ -348,7 +348,7 @@ impl WalletService { }?; let record_value = record.get_value() - .ok_or(err_msg(IndyErrorKind::InvalidStructure, format!("{} not found for id: {:?}", type_, name)))?.to_string(); + .ok_or_else(|| err_msg(IndyErrorKind::InvalidStructure, format!("{} not found for id: {:?}", type_, name)))?.to_string(); Ok(record_value) } @@ -430,7 +430,7 @@ impl WalletService { let wallets = self.wallets.borrow(); let wallet = wallets .get(&wallet_handle) - .ok_or(err_msg(IndyErrorKind::InvalidWalletHandle, "Unknown wallet handle"))?; + .ok_or_else(|| err_msg(IndyErrorKind::InvalidWalletHandle, "Unknown wallet handle"))?; let path = PathBuf::from(&export_config.path); @@ -515,7 +515,7 @@ impl WalletService { storage_types .get(storage_type) - .ok_or(err_msg(IndyErrorKind::UnknownWalletStorageType, "Unknown wallet storage type"))? + .ok_or_else(|| err_msg(IndyErrorKind::UnknownWalletStorageType, "Unknown wallet storage type"))? }; let storage_config = config.storage_config.as_ref().map(|value| value.to_string()); diff --git a/libindy/src/utils/crypto/signature_serializer.rs b/libindy/src/utils/crypto/signature_serializer.rs index a535c95b78..7f05f55c7d 100644 --- a/libindy/src/utils/crypto/signature_serializer.rs +++ b/libindy/src/utils/crypto/signature_serializer.rs @@ -38,7 +38,7 @@ fn _serialize_signature(v: Value, is_top_level: bool, _type: Option<&str>) -> Re ctx.update(&value .as_str() - .ok_or(IndyError::from_msg(IndyErrorKind::InvalidState, "Cannot update hash context"))? + .ok_or_else(|| IndyError::from_msg(IndyErrorKind::InvalidState, "Cannot update hash context"))? .as_bytes())?; value = Value::String(hex::encode(ctx.finish()?.as_ref())); From df743c2d7199feebbe3d8e3ba673bacf638f9d36 Mon Sep 17 00:00:00 2001 From: Axel Nennker Date: Fri, 16 Aug 2019 12:14:18 +0200 Subject: [PATCH 233/320] warning: unneeded return statement Signed-off-by: Axel Nennker --- libindy/src/services/pool/state_proof/mod.rs | 2 +- libindy/src/services/pool/state_proof/node.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libindy/src/services/pool/state_proof/mod.rs b/libindy/src/services/pool/state_proof/mod.rs index c1f69e4c9f..2e449ea8f4 100644 --- a/libindy/src/services/pool/state_proof/mod.rs +++ b/libindy/src/services/pool/state_proof/mod.rs @@ -40,7 +40,7 @@ pub fn parse_generic_reply_for_proof_checking(json_msg: &SJsonValue, raw_msg: &s _parse_reply_for_builtin_sp(json_msg, type_, sp_key) } else { warn!("parse_generic_reply_for_proof_checking: can't get key in sp for built-in type"); - return None; + None } } else if let Some((parser, free)) = PoolService::get_sp_parser(type_) { trace!("TransactionHandler::parse_generic_reply_for_proof_checking: plugged: parser {:?}, free {:?}", diff --git a/libindy/src/services/pool/state_proof/node.rs b/libindy/src/services/pool/state_proof/node.rs index a966154891..e119234e89 100644 --- a/libindy/src/services/pool/state_proof/node.rs +++ b/libindy/src/services/pool/state_proof/node.rs @@ -203,9 +203,9 @@ impl Node { Node::Hash(ref hash) => { let hash = NodeHash::from_slice(hash.as_slice()); if let Some(ref next) = db.get(hash) { - return next._get_node(db, path, seen_path); + next._get_node(db, path, seen_path) } else { - return Err(err_msg(IndyErrorKind::InvalidStructure, "Incomplete key-value DB for Patricia Merkle Trie to get value by the key")); + Err(err_msg(IndyErrorKind::InvalidStructure, "Incomplete key-value DB for Patricia Merkle Trie to get value by the key")) } } Node::Leaf(ref pair) => { From 57883447cc1d4888255cfc9410d32ed59afae8c5 Mon Sep 17 00:00:00 2001 From: Axel Nennker Date: Fri, 16 Aug 2019 12:28:53 +0200 Subject: [PATCH 234/320] this type has already been used as a bound predicate Signed-off-by: Axel Nennker --- libindy/src/services/wallet/mod.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/libindy/src/services/wallet/mod.rs b/libindy/src/services/wallet/mod.rs index 4cefdd7ffc..67294e0fd2 100644 --- a/libindy/src/services/wallet/mod.rs +++ b/libindy/src/services/wallet/mod.rs @@ -258,7 +258,7 @@ impl WalletService { } pub fn add_indy_object(&self, wallet_handle: WalletHandle, name: &str, object: &T, tags: &Tags) - -> IndyResult where T: ::serde::Serialize + Sized, T: NamedType { + -> IndyResult where T: ::serde::Serialize + Sized + NamedType { let type_ = T::short_type_name(); let object_json = serde_json::to_string(object) @@ -277,7 +277,7 @@ impl WalletService { } } - pub fn update_indy_object(&self, wallet_handle: WalletHandle, name: &str, object: &T) -> IndyResult where T: ::serde::Serialize + Sized, T: NamedType { + pub fn update_indy_object(&self, wallet_handle: WalletHandle, name: &str, object: &T) -> IndyResult where T: ::serde::Serialize + Sized + NamedType { let type_ = T::short_type_name(); match self.wallets.borrow().get(&wallet_handle) { Some(wallet) => { @@ -354,7 +354,7 @@ impl WalletService { } // Dirty hack. json must live longer then result T - pub fn get_indy_object(&self, wallet_handle: WalletHandle, name: &str, options_json: &str) -> IndyResult where T: ::serde::de::DeserializeOwned, T: NamedType { + pub fn get_indy_object(&self, wallet_handle: WalletHandle, name: &str, options_json: &str) -> IndyResult where T: ::serde::de::DeserializeOwned + NamedType { let record_value = self.get_indy_record_value::(wallet_handle, name, options_json)?; serde_json::from_str(&record_value) @@ -362,7 +362,7 @@ impl WalletService { } // Dirty hack. json must live longer then result T - pub fn get_indy_opt_object(&self, wallet_handle: WalletHandle, name: &str, options_json: &str) -> IndyResult> where T: ::serde::de::DeserializeOwned, T: NamedType { + pub fn get_indy_opt_object(&self, wallet_handle: WalletHandle, name: &str, options_json: &str) -> IndyResult> where T: ::serde::de::DeserializeOwned + NamedType { match self.get_indy_object::(wallet_handle, name, options_json) { Ok(res) => Ok(Some(res)), Err(ref err) if err.kind() == IndyErrorKind::WalletItemNotFound => Ok(None), @@ -391,7 +391,7 @@ impl WalletService { } pub fn upsert_indy_object(&self, wallet_handle: WalletHandle, name: &str, object: &T) -> IndyResult - where T: ::serde::Serialize + Sized, T: NamedType { + where T: ::serde::Serialize + Sized + NamedType { if self.record_exists::(wallet_handle, name)? { self.update_indy_object::(wallet_handle, name, object) } else { From 8bc1714ec25ea07d58790307684884de6d2fc1ed Mon Sep 17 00:00:00 2001 From: Axel Nennker Date: Fri, 16 Aug 2019 12:31:31 +0200 Subject: [PATCH 235/320] use of followed by a function call Signed-off-by: Axel Nennker --- libindy/src/services/anoncreds/verifier.rs | 2 +- libindy/src/services/payments.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libindy/src/services/anoncreds/verifier.rs b/libindy/src/services/anoncreds/verifier.rs index b7728d68ce..1a55334479 100644 --- a/libindy/src/services/anoncreds/verifier.rs +++ b/libindy/src/services/anoncreds/verifier.rs @@ -219,7 +219,7 @@ impl Verifier { .map(|(referent, info)| Verifier::_validate_timestamp(&received_revealed_attrs, referent, &proof_req.non_revoked, &info.non_revoked) .or_else(|_|Verifier::_validate_timestamp(&received_unrevealed_attrs, referent, &proof_req.non_revoked, &info.non_revoked)) - .or_else(|_|received_self_attested_attrs.get(referent).map(|_| ()).ok_or(IndyError::from(IndyErrorKind::InvalidStructure))) + .or_else(|_|received_self_attested_attrs.get(referent).map(|_| ()).ok_or_else(|| IndyError::from(IndyErrorKind::InvalidStructure))) ) .collect::>>()?; diff --git a/libindy/src/services/payments.rs b/libindy/src/services/payments.rs index 6ec1f2005e..c08921300b 100644 --- a/libindy/src/services/payments.rs +++ b/libindy/src/services/payments.rs @@ -430,7 +430,7 @@ impl PaymentsService { let res = prices.into_iter() .min_by_key(|x| x.price) - .ok_or(IndyError::from_msg(IndyErrorKind::InvalidStructure, "RequestInfo not found"))?; + .ok_or_else(|| IndyError::from_msg(IndyErrorKind::InvalidStructure, "RequestInfo not found"))?; trace!("get_request_info_with_min_price <<< result: {:?}", res); Ok(res) @@ -476,7 +476,7 @@ impl PaymentsService { .collect(); let price = req_info.get(0) - .ok_or(IndyError::from_msg(IndyErrorKind::InvalidStructure, "AND Constraint doesn't contain sub constraints."))? + .ok_or_else(|| IndyError::from_msg(IndyErrorKind::InvalidStructure, "AND Constraint doesn't contain sub constraints."))? .price; if req_info.iter().any(|x| x.price != price) { From 3a4e7198171cef690e9cd41b98fee209045e922e Mon Sep 17 00:00:00 2001 From: Axel Nennker Date: Fri, 16 Aug 2019 12:35:49 +0200 Subject: [PATCH 236/320] useless use of vec! Signed-off-by: Axel Nennker --- libindy/src/services/pool/pool.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libindy/src/services/pool/pool.rs b/libindy/src/services/pool/pool.rs index 0e2dd7f22f..132f5d8ca8 100644 --- a/libindy/src/services/pool/pool.rs +++ b/libindy/src/services/pool/pool.rs @@ -311,7 +311,7 @@ impl> PoolSM { PoolEvent::CatchupRestart(merkle_tree) => { if let Ok((nodes, remotes)) = _get_nodes_and_remotes(&merkle_tree) { state.networker.borrow_mut().process_event(Some(NetworkerEvent::NodesStateUpdated(remotes))); - state.request_handler = R::new(state.networker.clone(), _get_f(nodes.len()), &vec![], &nodes, &pool_name, timeout, extended_timeout, number_read_nodes); + state.request_handler = R::new(state.networker.clone(), _get_f(nodes.len()), &[], &nodes, &pool_name, timeout, extended_timeout, number_read_nodes); let ls = _ledger_status(&merkle_tree); state.request_handler.process_event(Some(RequestEvent::LedgerStatus(ls, None, Some(merkle_tree)))); PoolState::GettingCatchupTarget(state) @@ -322,7 +322,7 @@ impl> PoolSM { PoolEvent::CatchupTargetFound(target_mt_root, target_mt_size, merkle_tree) => { if let Ok((nodes, remotes)) = _get_nodes_and_remotes(&merkle_tree) { state.networker.borrow_mut().process_event(Some(NetworkerEvent::NodesStateUpdated(remotes))); - let mut request_handler = R::new(state.networker.clone(), _get_f(nodes.len()), &vec![], &nodes, &pool_name, timeout, extended_timeout, number_read_nodes); + let mut request_handler = R::new(state.networker.clone(), _get_f(nodes.len()), &[], &nodes, &pool_name, timeout, extended_timeout, number_read_nodes); request_handler.process_event(Some(RequestEvent::CatchupReq(merkle_tree, target_mt_size, target_mt_root))); PoolState::SyncCatchup((request_handler, state).into()) } else { @@ -385,7 +385,7 @@ impl> PoolSM { let re: Option = pe.into(); match re.as_ref().map(|r| r.get_req_id()) { Some(req_id) => { - let mut request_handler = R::new(state.networker.clone(), _get_f(state.nodes.len()), &vec![cmd_id], &state.nodes, &pool_name, timeout, extended_timeout, number_read_nodes); + let mut request_handler = R::new(state.networker.clone(), _get_f(state.nodes.len()), &[cmd_id], &state.nodes, &pool_name, timeout, extended_timeout, number_read_nodes); request_handler.process_event(re); state.request_handlers.insert(req_id.to_string(), request_handler); //FIXME check already exists } @@ -628,7 +628,7 @@ fn _get_request_handler_with_ledger_status_sent Date: Fri, 16 Aug 2019 12:38:30 +0200 Subject: [PATCH 237/320] using clone on a copy type Signed-off-by: Axel Nennker --- libindy/src/services/pool/pool.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libindy/src/services/pool/pool.rs b/libindy/src/services/pool/pool.rs index 132f5d8ca8..2ee620c7a8 100644 --- a/libindy/src/services/pool/pool.rs +++ b/libindy/src/services/pool/pool.rs @@ -503,7 +503,7 @@ impl> Pool { let active_timeout = self.active_timeout; let conn_limit = self.conn_limit; let preordered_nodes = self.preordered_nodes.clone(); - let number_read_nodes = self.number_read_nodes.clone(); + let number_read_nodes = self.number_read_nodes; self.worker = Some(thread::spawn(move || { let mut pool_thread: PoolThread = PoolThread::new(cmd_socket, name, id, timeout, extended_timeout, From 8efda3d1e780a52d7ab9be15df3bf5dde094fab8 Mon Sep 17 00:00:00 2001 From: Axel Nennker Date: Fri, 16 Aug 2019 12:41:27 +0200 Subject: [PATCH 238/320] identical conversion Signed-off-by: Axel Nennker --- libindy/src/commands/payments.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libindy/src/commands/payments.rs b/libindy/src/commands/payments.rs index 7f208c6e0b..be2e4099dc 100644 --- a/libindy/src/commands/payments.rs +++ b/libindy/src/commands/payments.rs @@ -461,7 +461,7 @@ impl PaymentsCommandExecutor { let method = match self.payments_service.parse_method_from_payment_address(payment_address) { Ok(method) => method, Err(err) => { - cb(Err(IndyError::from(err))); + cb(Err(err)); return; } }; @@ -620,7 +620,7 @@ impl PaymentsCommandExecutor { trace!("build_get_txn_fees_req >>> wallet_handle: {:?}, submitter_did: {:?}, type_: {:?}", wallet_handle, submitter_did, type_); if let Some(did) = submitter_did { match self.crypto_service.validate_did(did).map_err(map_err_err!()) { - Err(err) => return cb(Err(IndyError::from(err))), + Err(err) => return cb(Err(err)), _ => () } } From 57ef930ff866299b17a3d0d2659223109d86680d Mon Sep 17 00:00:00 2001 From: Axel Nennker Date: Fri, 16 Aug 2019 12:57:40 +0200 Subject: [PATCH 239/320] complex type BoxedCallbackStringStringSend Signed-off-by: Axel Nennker --- libindy/src/commands/anoncreds/issuer.rs | 10 +++++----- libindy/src/commands/anoncreds/prover.rs | 3 ++- libindy/src/commands/did.rs | 4 ++-- libindy/src/commands/ledger.rs | 16 ++++++++-------- libindy/src/commands/mod.rs | 2 ++ libindy/src/commands/payments.rs | 21 +++++++++++---------- 6 files changed, 30 insertions(+), 26 deletions(-) diff --git a/libindy/src/commands/anoncreds/issuer.rs b/libindy/src/commands/anoncreds/issuer.rs index 4eed0b9763..414a745b49 100644 --- a/libindy/src/commands/anoncreds/issuer.rs +++ b/libindy/src/commands/anoncreds/issuer.rs @@ -9,7 +9,7 @@ use ursa::cl::{ }; use ursa::cl::{CredentialKeyCorrectnessProof, CredentialPrivateKey}; -use commands::{Command, CommandExecutor}; +use commands::{Command, CommandExecutor, BoxedCallbackStringStringSend}; use commands::anoncreds::AnoncredsCommand; use domain::anoncreds::credential::{AttributeValues, Credential}; use domain::anoncreds::credential_definition::{ @@ -61,7 +61,7 @@ pub enum IssuerCommand { String, // name String, // version AttributeNames, // attribute names - Box) + Send>), + BoxedCallbackStringStringSend), CreateAndStoreCredentialDefinition( WalletHandle, String, // issuer did @@ -69,7 +69,7 @@ pub enum IssuerCommand { String, // tag Option, // type Option, // config - Box) + Send>), + BoxedCallbackStringStringSend), CreateAndStoreCredentialDefinitionContinue( WalletHandle, SchemaV1, // credentials @@ -145,7 +145,7 @@ pub struct IssuerCommandExecutor { pub pool_service: Rc, pub wallet_service: Rc, pub crypto_service: Rc, - pending_str_str_callbacks: RefCell) + Send>>>, + pending_str_str_callbacks: RefCell>, pending_str_callbacks: RefCell) + Send>>>, } @@ -267,7 +267,7 @@ impl IssuerCommandExecutor { tag: &str, type_: Option<&str>, config: Option<&CredentialDefinitionConfig>, - cb: Box) + Send>) { + cb: BoxedCallbackStringStringSend) { debug!("create_and_store_credential_definition >>> wallet_handle: {:?}, issuer_did: {:?}, schema: {:?}, tag: {:?}, \ type_: {:?}, config: {:?}", wallet_handle, issuer_did, schema, tag, type_, config); diff --git a/libindy/src/commands/anoncreds/prover.rs b/libindy/src/commands/anoncreds/prover.rs index e87fda64ce..525c331a53 100644 --- a/libindy/src/commands/anoncreds/prover.rs +++ b/libindy/src/commands/anoncreds/prover.rs @@ -29,6 +29,7 @@ use utils::sequence; use super::tails::SDKTailsAccessor; use api::WalletHandle; +use commands::BoxedCallbackStringStringSend; pub enum ProverCommand { CreateMasterSecret( @@ -41,7 +42,7 @@ pub enum ProverCommand { CredentialOffer, // credential offer CredentialDefinition, // credential def String, // master secret name - Box) + Send>), + BoxedCallbackStringStringSend), SetCredentialAttrTagPolicy( WalletHandle, String, // credential definition id diff --git a/libindy/src/commands/did.rs b/libindy/src/commands/did.rs index b01e18910e..2ec13aeb53 100644 --- a/libindy/src/commands/did.rs +++ b/libindy/src/commands/did.rs @@ -5,7 +5,7 @@ use std::str; use serde_json; -use commands::{Command, CommandExecutor}; +use commands::{Command, CommandExecutor, BoxedCallbackStringStringSend}; use commands::ledger::LedgerCommand; use domain::crypto::did::{Did, DidMetadata, DidWithMeta, MyDidInfo, TemporaryDid, TheirDid, TheirDidInfo}; use domain::crypto::key::KeyInfo; @@ -23,7 +23,7 @@ pub enum DidCommand { CreateAndStoreMyDid( WalletHandle, MyDidInfo, // my did info - Box) + Send>), + BoxedCallbackStringStringSend), ReplaceKeysStart( WalletHandle, KeyInfo, // key info diff --git a/libindy/src/commands/ledger.rs b/libindy/src/commands/ledger.rs index 7157cc0d5e..1be419bb89 100644 --- a/libindy/src/commands/ledger.rs +++ b/libindy/src/commands/ledger.rs @@ -25,7 +25,7 @@ use services::pool::{ use services::wallet::{RecordOptions, WalletService}; use utils::crypto::signature_serializer::serialize_signature; use api::{WalletHandle, PoolHandle, CommandHandle, next_command_handle}; -use commands::{Command, CommandExecutor}; +use commands::{Command, CommandExecutor, BoxedCallbackStringStringSend}; use rust_base58::ToBase58; pub enum LedgerCommand { @@ -98,7 +98,7 @@ pub enum LedgerCommand { Box) + Send>), ParseGetSchemaResponse( String, // get schema response json - Box) + Send>), + BoxedCallbackStringStringSend), BuildCredDefRequest( String, // submitter did CredentialDefinition, // data @@ -109,7 +109,7 @@ pub enum LedgerCommand { Box) + Send>), ParseGetCredDefResponse( String, // get cred definition response - Box) + Send>), + BoxedCallbackStringStringSend), BuildNodeRequest( String, // submitter did String, // target_did @@ -156,7 +156,7 @@ pub enum LedgerCommand { Box) + Send>), ParseGetRevocRegDefResponse( String, // get revocation registry definition response - Box) + Send>), + BoxedCallbackStringStringSend), BuildRevocRegEntryRequest( String, // submitter did String, // revocation registry definition id @@ -213,7 +213,7 @@ pub enum LedgerCommand { PoolHandle, Option, String, - Box) + Send>, + BoxedCallbackStringStringSend, ), GetSchemaContinue( IndyResult, @@ -223,7 +223,7 @@ pub enum LedgerCommand { PoolHandle, Option, String, - Box) + Send>, + BoxedCallbackStringStringSend, ), GetCredDefContinue( IndyResult, @@ -1201,7 +1201,7 @@ impl LedgerCommandExecutor { } } - fn get_schema(&self, pool_handle: i32, submitter_did: Option<&str>, id: &str, cb: Box) + Send>) { + fn get_schema(&self, pool_handle: i32, submitter_did: Option<&str>, id: &str, cb: BoxedCallbackStringStringSend) { let request_json = try_cb!(self.build_get_schema_request(submitter_did, id), cb); let cb_id = next_command_handle(); @@ -1225,7 +1225,7 @@ impl LedgerCommandExecutor { cb(self.parse_get_schema_response(&pool_response)); } - fn get_cred_def(&self, pool_handle: i32, submitter_did: Option<&str>, id: &str, cb: Box) + Send>) { + fn get_cred_def(&self, pool_handle: i32, submitter_did: Option<&str>, id: &str, cb: BoxedCallbackStringStringSend) { let request_json = try_cb!(self.build_get_cred_def_request(submitter_did, id), cb); let cb_id = next_command_handle(); diff --git a/libindy/src/commands/mod.rs b/libindy/src/commands/mod.rs index 465824510e..6bd274956f 100644 --- a/libindy/src/commands/mod.rs +++ b/libindy/src/commands/mod.rs @@ -42,6 +42,8 @@ pub mod non_secrets; pub mod payments; pub mod cache; +type BoxedCallbackStringStringSend = Box) + Send>; + pub enum Command { Exit, Anoncreds(AnoncredsCommand), diff --git a/libindy/src/commands/payments.rs b/libindy/src/commands/payments.rs index be2e4099dc..f3095f22a7 100644 --- a/libindy/src/commands/payments.rs +++ b/libindy/src/commands/payments.rs @@ -17,6 +17,7 @@ use api::{WalletHandle, CommandHandle}; use domain::ledger::auth_rule::AuthRule; use api::next_command_handle; +use commands::BoxedCallbackStringStringSend; pub enum PaymentsCommand { RegisterMethod( @@ -42,7 +43,7 @@ pub enum PaymentsCommand { String, //inputs String, //outputs Option, //extra - Box) + Send>), + BoxedCallbackStringStringSend), AddRequestFeesAck( CommandHandle, //handle IndyResult), @@ -58,7 +59,7 @@ pub enum PaymentsCommand { Option, //submitter did String, //payment address Option, //from - Box) + Send>), + BoxedCallbackStringStringSend), BuildGetPaymentSourcesRequestAck( CommandHandle, IndyResult), @@ -75,7 +76,7 @@ pub enum PaymentsCommand { String, //inputs String, //outputs Option, //extra - Box) + Send>), + BoxedCallbackStringStringSend), BuildPaymentReqAck( CommandHandle, IndyResult), @@ -99,7 +100,7 @@ pub enum PaymentsCommand { Option, //submitter did String, //outputs Option, //extra - Box) + Send>), + BoxedCallbackStringStringSend), BuildMintReqAck( CommandHandle, IndyResult), @@ -131,7 +132,7 @@ pub enum PaymentsCommand { WalletHandle, Option, //submitter_did String, //receipt - Box) + Send>), + BoxedCallbackStringStringSend), BuildVerifyPaymentReqAck( CommandHandle, IndyResult), @@ -397,7 +398,7 @@ impl PaymentsCommandExecutor { trace!("list_addresses <<<"); } - fn add_request_fees(&self, wallet_handle: WalletHandle, submitter_did: Option<&str>, req: &str, inputs: &str, outputs: &str, extra: Option<&str>, cb: Box) + Send>) { + fn add_request_fees(&self, wallet_handle: WalletHandle, submitter_did: Option<&str>, req: &str, inputs: &str, outputs: &str, extra: Option<&str>, cb: BoxedCallbackStringStringSend) { trace!("add_request_fees >>> wallet_handle: {:?}, submitter_did: {:?}, req: {:?}, inputs: {:?}, outputs: {:?}, extra: {:?}", wallet_handle, submitter_did, req, inputs, outputs, extra); if let Some(did) = submitter_did { @@ -449,7 +450,7 @@ impl PaymentsCommandExecutor { trace!("parse_response_with_fees_ack <<<"); } - fn build_get_payment_sources_request(&self, wallet_handle: WalletHandle, submitter_did: Option<&str>, payment_address: &str, next: Option, cb: Box) + Send>) { + fn build_get_payment_sources_request(&self, wallet_handle: WalletHandle, submitter_did: Option<&str>, payment_address: &str, next: Option, cb: BoxedCallbackStringStringSend) { trace!("build_get_payment_sources_request >>> wallet_handle: {:?}, submitter_did: {:?}, payment_address: {:?}", wallet_handle, submitter_did, payment_address); if let Some(did) = submitter_did { match self.crypto_service.validate_did(did).map_err(map_err_err!()) { @@ -492,7 +493,7 @@ impl PaymentsCommandExecutor { trace!("parse_get_payment_sources_response_ack <<<"); } - fn build_payment_req(&self, wallet_handle: WalletHandle, submitter_did: Option<&str>, inputs: &str, outputs: &str, extra: Option<&str>, cb: Box) + Send>) { + fn build_payment_req(&self, wallet_handle: WalletHandle, submitter_did: Option<&str>, inputs: &str, outputs: &str, extra: Option<&str>, cb: BoxedCallbackStringStringSend) { trace!("build_payment_req >>> wallet_handle: {:?}, submitter_did: {:?}, inputs: {:?}, outputs: {:?}, extra: {:?}", wallet_handle, submitter_did, inputs, outputs, extra); if let Some(did) = submitter_did { match self.crypto_service.validate_did(did).map_err(map_err_err!()) { @@ -563,7 +564,7 @@ impl PaymentsCommandExecutor { trace!("parse_payment_response_ack <<<"); } - fn build_mint_req(&self, wallet_handle: WalletHandle, submitter_did: Option<&str>, outputs: &str, extra: Option<&str>, cb: Box) + Send>) { + fn build_mint_req(&self, wallet_handle: WalletHandle, submitter_did: Option<&str>, outputs: &str, extra: Option<&str>, cb: BoxedCallbackStringStringSend) { trace!("build_mint_req >>> wallet_handle: {:?}, submitter_did: {:?}, outputs: {:?}, extra: {:?}", wallet_handle, submitter_did, outputs, extra); if let Some(did) = submitter_did { match self.crypto_service.validate_did(did).map_err(map_err_err!()) { @@ -647,7 +648,7 @@ impl PaymentsCommandExecutor { trace!("parse_get_txn_fees_response_ack <<<"); } - fn build_verify_payment_request(&self, wallet_handle: WalletHandle, submitter_did: Option<&str>, receipt: &str, cb: Box) + Send>) { + fn build_verify_payment_request(&self, wallet_handle: WalletHandle, submitter_did: Option<&str>, receipt: &str, cb: BoxedCallbackStringStringSend) { trace!("build_verify_payment_request >>> wallet_handle: {:?}, submitter_did: {:?}, receipt: {:?}", wallet_handle, submitter_did, receipt); if let Some(did) = submitter_did { match self.crypto_service.validate_did(did).map_err(map_err_err!()) { From 65854c30543c5b2ff5bb432e40b4e1634bcf8ba2 Mon Sep 17 00:00:00 2001 From: "artem.ivanov" Date: Fri, 16 Aug 2019 14:01:27 +0300 Subject: [PATCH 240/320] Refactored Libindy tests to use setup/drop Signed-off-by: artem.ivanov --- libindy/tests/anoncreds.rs | 23 +- libindy/tests/anoncreds_demos.rs | 92 +-- libindy/tests/cache.rs | 179 ++--- libindy/tests/crypto.rs | 8 +- libindy/tests/demo.rs | 15 +- libindy/tests/did.rs | 548 ++++++---------- libindy/tests/interaction.rs | 25 +- libindy/tests/ledger.rs | 1039 ++++++++++++------------------ libindy/tests/non_secrets.rs | 445 +++++-------- libindy/tests/pairwise.rs | 177 ++--- libindy/tests/payments.rs | 10 +- libindy/tests/pool.rs | 250 +++---- libindy/tests/utils/mod.rs | 123 +--- libindy/tests/utils/wallet.rs | 21 - libindy/tests/wallet.rs | 211 ++---- 15 files changed, 1101 insertions(+), 2065 deletions(-) diff --git a/libindy/tests/anoncreds.rs b/libindy/tests/anoncreds.rs index e5511cae14..91c7ad4b8d 100644 --- a/libindy/tests/anoncreds.rs +++ b/libindy/tests/anoncreds.rs @@ -33,6 +33,7 @@ use utils::anoncreds::{COMMON_MASTER_SECRET, CREDENTIAL1_ID, ANONCREDS_WALLET_CO use indy::ErrorCode; use utils::constants::*; +use utils::Setup; use utils::domain::anoncreds::schema::{Schema, AttributeNames, MAX_ATTRIBUTES_COUNT}; use utils::domain::anoncreds::credential_definition::CredentialDefinition; @@ -3496,9 +3497,9 @@ mod high_cases { #[test] fn issuer_rotate_credential_def_works() { - let (wallet_handle, config) = utils::setup_with_wallet("issuer_rotate_credential_def_works"); + let setup = Setup::wallet(); - let (cred_def_id, cred_def_json) = anoncreds::issuer_create_credential_definition(wallet_handle, + let (cred_def_id, cred_def_json) = anoncreds::issuer_create_credential_definition(setup.wallet_handle, ISSUER_DID, &anoncreds::gvt_schema_json(), TAG_1, @@ -3506,34 +3507,28 @@ mod high_cases { Some(&anoncreds::default_cred_def_config())) .unwrap(); - let temp_cred_def_json = anoncreds::issuer_rotate_credential_def_start(wallet_handle, &cred_def_id, None).unwrap(); + let temp_cred_def_json = anoncreds::issuer_rotate_credential_def_start(setup.wallet_handle, &cred_def_id, None).unwrap(); assert_ne!(serde_json::from_str::(&cred_def_json).unwrap(), serde_json::from_str::(&temp_cred_def_json).unwrap()); - anoncreds::issuer_rotate_credential_def_apply(wallet_handle, &cred_def_id).unwrap(); - - utils::tear_down_with_wallet(wallet_handle, "issuer_rotate_credential_def_works", &config); + anoncreds::issuer_rotate_credential_def_apply(setup.wallet_handle, &cred_def_id).unwrap(); } #[test] fn issuer_rotate_credential_def_works_no_cred_def() { - let (wallet_handle, config) = utils::setup_with_wallet("issuer_rotate_credential_def_works_no_cred_def"); + let setup = Setup::wallet(); - let res = anoncreds::issuer_rotate_credential_def_start(wallet_handle, &anoncreds::issuer_1_gvt_cred_def_id(), None); + let res = anoncreds::issuer_rotate_credential_def_start(setup.wallet_handle, &anoncreds::issuer_1_gvt_cred_def_id(), None); assert_code!(ErrorCode::WalletItemNotFound, res); - - utils::tear_down_with_wallet(wallet_handle, "issuer_rotate_credential_def_works_no_cred_def", &config); } #[test] fn issuer_rotate_credential_def_apply_works_for_no_temporary_cred_def() { - let (wallet_handle, config) = utils::setup_with_wallet("issuer_rotate_credential_def_apply_works_for_no_temporary_cred_def"); + let setup = Setup::wallet(); - let res = anoncreds::issuer_rotate_credential_def_apply(wallet_handle, &anoncreds::issuer_1_gvt_cred_def_id()); + let res = anoncreds::issuer_rotate_credential_def_apply(setup.wallet_handle, &anoncreds::issuer_1_gvt_cred_def_id()); assert_code!(ErrorCode::WalletItemNotFound, res); - - utils::tear_down_with_wallet(wallet_handle, "issuer_rotate_credential_def_apply_works_for_no_temporary_cred_def", &config); } } } diff --git a/libindy/tests/anoncreds_demos.rs b/libindy/tests/anoncreds_demos.rs index 621c3794a1..91cc950137 100644 --- a/libindy/tests/anoncreds_demos.rs +++ b/libindy/tests/anoncreds_demos.rs @@ -33,6 +33,7 @@ use utils::anoncreds::{COMMON_MASTER_SECRET, CREDENTIAL1_ID, CREDENTIAL2_ID, CRE use indy::ErrorCode; use utils::inmem_wallet::InmemWallet; use utils::constants::*; +use utils::Setup; use utils::domain::anoncreds::schema::Schema; use utils::domain::anoncreds::credential_definition::CredentialDefinition; @@ -48,7 +49,7 @@ mod demos { #[test] fn anoncreds_works_for_single_issuer_single_prover() { - utils::setup("anoncreds_works_for_single_issuer_single_prover"); + Setup::empty(); //1. Create Issuer wallet, gets wallet handle let (issuer_wallet_handle, issuer_wallet_config) = wallet::create_and_open_default_wallet("anoncreds_works_for_single_issuer_single_prover").unwrap(); @@ -143,13 +144,11 @@ mod demos { wallet::close_and_delete_wallet(issuer_wallet_handle, &issuer_wallet_config).unwrap(); wallet::close_and_delete_wallet(prover_wallet_handle, &prover_wallet_config).unwrap(); - - utils::tear_down("anoncreds_works_for_single_issuer_single_prover"); } #[test] fn anoncreds_works_for_plugged_wallet() { - utils::setup("anoncreds_works_for_plugged_wallet"); + Setup::empty(); InmemWallet::cleanup(); //1. Registers new wallet type @@ -249,12 +248,11 @@ mod demos { wallet::close_and_delete_wallet(prover_wallet_handle, &prover_wallet_config).unwrap(); wallet::close_and_delete_wallet(issuer_wallet_handle, &issuer_wallet_config).unwrap(); InmemWallet::cleanup(); - utils::tear_down("anoncreds_works_for_plugged_wallet"); } #[test] fn anoncreds_works_for_multiple_issuer_single_prover() { - utils::setup("anoncreds_works_for_multiple_issuer_single_prover"); + Setup::empty(); //1. Issuer1 creates wallet, gets wallet handles let (issuer_gvt_wallet_handle, issuer_gvt_wallet_config) = wallet::create_and_open_default_wallet("anoncreds_works_for_multiple_issuer_single_prover").unwrap(); @@ -380,13 +378,11 @@ mod demos { wallet::close_and_delete_wallet(prover_wallet_handle, &prover_wallet_config).unwrap(); wallet::close_and_delete_wallet(issuer_gvt_wallet_handle, &issuer_gvt_wallet_config).unwrap(); wallet::close_and_delete_wallet(issuer_xyz_wallet_handle, &issuer_xyz_wallet_config).unwrap(); - - utils::tear_down("anoncreds_works_for_multiple_issuer_single_prover"); } #[test] fn anoncreds_works_for_single_issuer_multiple_credentials_single_prover() { - utils::setup("anoncreds_works_for_single_issuer_multiple_credentials_single_prover"); + Setup::empty(); //1. Issuer creates wallet, gets wallet handles let (issuer_wallet_handle, issuer_wallet_config) = wallet::create_and_open_default_wallet("anoncreds_works_for_single_issuer_multiple_credentials_single_prover").unwrap(); @@ -508,14 +504,12 @@ mod demos { wallet::close_and_delete_wallet(prover_wallet_handle, &prover_wallet_config).unwrap(); wallet::close_and_delete_wallet(issuer_wallet_handle, &issuer_wallet_config).unwrap(); - - utils::tear_down("anoncreds_works_for_single_issuer_multiple_credentials_single_prover"); } #[cfg(feature = "revocation_tests")] #[test] fn anoncreds_works_for_revocation_proof_issuance_by_demand() { - utils::setup("anoncreds_works_for_revocation_proof_issuance_by_demand"); + Setup::empty(); //1. Issuer creates wallet, gets wallet handle let (issuer_wallet_handle, issuer_wallet_config) = wallet::create_and_open_default_wallet("anoncreds_works_for_revocation_proof_issuance_by_demand").unwrap(); @@ -637,14 +631,12 @@ mod demos { wallet::close_and_delete_wallet(issuer_wallet_handle, &issuer_wallet_config).unwrap(); wallet::close_and_delete_wallet(prover_wallet_handle, &prover_wallet_config).unwrap(); - - utils::tear_down("anoncreds_works_for_revocation_proof_issuance_by_demand"); } #[cfg(feature = "revocation_tests")] #[test] fn anoncreds_works_for_revocation_proof_issuance_by_default() { - utils::setup("anoncreds_works_for_revocation_proof_issuance_by_default"); + Setup::empty(); //1. Issuer creates wallet, gets wallet handle let (issuer_wallet_handle, issuer_wallet_config) = wallet::create_and_open_default_wallet("anoncreds_works_for_revocation_proof_issuance_by_default").unwrap(); @@ -764,13 +756,11 @@ mod demos { wallet::close_and_delete_wallet(issuer_wallet_handle, &issuer_wallet_config).unwrap(); wallet::close_and_delete_wallet(prover_wallet_handle, &prover_wallet_config).unwrap(); - - utils::tear_down("anoncreds_works_for_revocation_proof_issuance_by_default"); } #[test] fn verifier_verify_proof_works_for_proof_does_not_correspond_proof_request_attr_and_predicate() { - utils::setup("verifier_verify_proof_works_for_proof_does_not_correspond_proof_request_attr_and_predicate"); + Setup::empty(); // 1. Creates wallet, gets wallet handle let (wallet_handle, wallet_config) = wallet::create_and_open_default_wallet("verifier_verify_proof_works_for_proof_does_not_correspond_proof_request_attr_and_predicate").unwrap(); @@ -837,13 +827,11 @@ mod demos { assert_code!(ErrorCode::CommonInvalidStructure, res); wallet::close_and_delete_wallet(wallet_handle, &wallet_config).unwrap(); - - utils::tear_down("verifier_verify_proof_works_for_proof_does_not_correspond_proof_request_attr_and_predicate"); } #[test] fn anoncreds_works_for_requested_attribute_in_upper_case() { - utils::setup("anoncreds_works_for_requested_attribute_in_upper_case"); + Setup::empty(); //1. Create Issuer wallet, gets wallet handle let (issuer_wallet_handle, issuer_wallet_config) = wallet::create_and_open_default_wallet("anoncreds_works_for_requested_attribute_in_upper_case").unwrap(); @@ -934,14 +922,12 @@ mod demos { wallet::close_and_delete_wallet(issuer_wallet_handle, &issuer_wallet_config).unwrap(); wallet::close_and_delete_wallet(prover_wallet_handle, &prover_wallet_config).unwrap(); - - utils::tear_down("anoncreds_works_for_requested_attribute_in_upper_case"); } #[cfg(feature = "revocation_tests")] #[test] fn anoncreds_works_for_revocation_proof_for_issuance_and_proving_three_credential() { - utils::setup("anoncreds_works_for_revocation_proof_for_issuance_and_proving_three_credential"); + Setup::empty(); // Issuer creates wallet, gets wallet handle let (issuer_wallet_handle, issuer_wallet_config) = wallet::create_and_open_default_wallet("anoncreds_works_for_revocation_proof_for_issuance_and_proving_three_credential").unwrap(); @@ -1257,13 +1243,11 @@ mod demos { wallet::close_and_delete_wallet(prover1_wallet_handle, &prover1_wallet_config).unwrap(); wallet::close_and_delete_wallet(prover2_wallet_handle, &prover2_wallet_config).unwrap(); wallet::close_and_delete_wallet(prover3_wallet_handle, &prover3_wallet_config).unwrap(); - - utils::tear_down("anoncreds_works_for_revocation_proof_for_issuance_and_proving_three_credential"); } #[test] fn anoncreds_works_for_twice_entry_of_attribute_from_different_credential() { - utils::setup("anoncreds_works_for_twice_entry_of_attribute_from_different_credential"); + Setup::empty(); //1. Issuer1 creates wallet, gets wallet handles let (issuer_gvt_wallet_handle, issuer_gvt_wallet_config) = wallet::create_and_open_default_wallet("anoncreds_works_for_twice_entry_of_attribute_from_different_credential").unwrap(); @@ -1385,13 +1369,11 @@ mod demos { wallet::close_and_delete_wallet(prover_wallet_handle, &prover_wallet_config).unwrap(); wallet::close_and_delete_wallet(issuer_gvt_wallet_handle, &issuer_gvt_wallet_config).unwrap(); wallet::close_and_delete_wallet(issuer_abc_wallet_handle, &issuer_abc_wallet_config).unwrap(); - - utils::tear_down("anoncreds_works_for_twice_entry_of_attribute_from_different_credential"); } #[test] fn anoncreds_works_for_twice_entry_of_credential_for_different_witness() { - utils::setup("anoncreds_works_for_twice_entry_of_credential_for_different_witness"); + Setup::empty(); // Issuer creates wallet, gets wallet handle let (issuer_wallet_handle, issuer_wallet_config) = wallet::create_and_open_default_wallet("anoncreds_works_for_twice_entry_of_credential_for_different_witness").unwrap(); @@ -1568,8 +1550,6 @@ mod demos { wallet::close_and_delete_wallet(issuer_wallet_handle, &issuer_wallet_config).unwrap(); wallet::close_and_delete_wallet(prover1_wallet_handle, &prover1_wallet_config).unwrap(); wallet::close_and_delete_wallet(prover2_wallet_handle, &prover2_wallet_config).unwrap(); - - utils::tear_down("anoncreds_works_for_twice_entry_of_credential_for_different_witness"); } #[test] @@ -1585,7 +1565,7 @@ mod demos { #[cfg(feature = "revocation_tests")] #[test] fn anoncreds_works_for_issuance_on_demand_revocation_strategy_revoke_credential() { - utils::setup("anoncreds_works_for_issuance_on_demand_revocation_strategy_revoke_credential"); + Setup::empty(); //1. Issuer creates wallet, gets wallet handle let (issuer_wallet_handle, issuer_wallet_config) = wallet::create_and_open_default_wallet("anoncreds_works_for_issuance_on_demand_revocation_strategy_revoke_credential").unwrap(); @@ -1727,14 +1707,12 @@ mod demos { wallet::close_and_delete_wallet(issuer_wallet_handle, &issuer_wallet_config).unwrap(); wallet::close_and_delete_wallet(prover_wallet_handle, &prover_wallet_config).unwrap(); - - utils::tear_down("anoncreds_works_for_issuance_on_demand_revocation_strategy_revoke_credential"); } #[cfg(feature = "revocation_tests")] #[test] fn anoncreds_works_for_issuance_by_default_revocation_strategy_revoke_credential() { - utils::setup("anoncreds_works_for_issuance_by_default_revocation_strategy_revoke_credential"); + Setup::empty(); //1. Issuer creates wallet, gets wallet handle let (issuer_wallet_handle, issuer_wallet_config) = wallet::create_and_open_default_wallet("anoncreds_works_for_issuance_by_default_revocation_strategy_revoke_credential").unwrap(); @@ -1874,14 +1852,12 @@ mod demos { wallet::close_and_delete_wallet(issuer_wallet_handle, &issuer_wallet_config).unwrap(); wallet::close_and_delete_wallet(prover_wallet_handle, &prover_wallet_config).unwrap(); - - utils::tear_down("anoncreds_works_for_issuance_by_default_revocation_strategy_revoke_credential"); } #[cfg(feature = "revocation_tests")] #[test] fn anoncreds_works_for_issuance_by_demand_revocation_strategy_for_full_revocation_registry() { - utils::setup("anoncreds_works_for_issuance_by_demand_revocation_strategy_for_full_revocation_registry"); + Setup::empty(); //1. Issuer creates wallet, gets wallet handle let (issuer_wallet_handle, issuer_wallet_config) = wallet::create_and_open_default_wallet("anoncreds_works_for_issuance_by_demand_revocation_strategy_for_full_revocation_registry").unwrap(); @@ -1961,15 +1937,13 @@ mod demos { wallet::close_and_delete_wallet(prover_1_wallet_handle, &prover_1_wallet_config).unwrap(); wallet::close_and_delete_wallet(prover_2_wallet_handle, &prover_2_wallet_config).unwrap(); wallet::close_and_delete_wallet(prover_3_wallet_handle, &prover_3_wallet_config).unwrap(); - - utils::tear_down("anoncreds_works_for_issuance_by_demand_revocation_strategy_for_full_revocation_registry"); } #[cfg(feature = "revocation_tests")] #[test] fn anoncreds_works_for_issuance_by_default_revocation_strategy_for_full_revocation_registry() { - utils::setup("anoncreds_works_for_issuance_by_default_revocation_strategy_for_full_revocation_registry"); + Setup::empty(); //1. Issuer creates wallet, gets wallet handle let (issuer_wallet_handle, issuer_wallet_config) = wallet::create_and_open_default_wallet("anoncreds_works_for_issuance_by_default_revocation_strategy_for_full_revocation_registry").unwrap(); @@ -2048,14 +2022,12 @@ mod demos { wallet::close_and_delete_wallet(prover_1_wallet_handle, &prover_1_wallet_config).unwrap(); wallet::close_and_delete_wallet(prover_2_wallet_handle, &prover_2_wallet_config).unwrap(); wallet::close_and_delete_wallet(prover_3_wallet_handle, &prover_3_wallet_config).unwrap(); - - utils::tear_down("anoncreds_works_for_issuance_by_default_revocation_strategy_for_full_revocation_registry"); } #[cfg(feature = "revocation_tests")] #[test] fn anoncreds_works_for_issuance_by_demand_revocation_strategy_for_revoke_not_issued_credential_id() { - utils::setup("anoncreds_works_for_issuance_by_demand_revocation_strategy_for_revoke_not_issued_credential_id"); + Setup::empty(); //1. Issuer creates wallet, gets wallet handle let (issuer_wallet_handle, issuer_wallet_config) = wallet::create_and_open_default_wallet("anoncreds_works_for_issuance_by_demand_revocation_strategy_for_revoke_not_issued_credential_id").unwrap(); @@ -2095,14 +2067,12 @@ mod demos { assert_code!(ErrorCode::AnoncredsInvalidUserRevocId, res); wallet::close_and_delete_wallet(issuer_wallet_handle, &issuer_wallet_config).unwrap(); - - utils::tear_down("anoncreds_works_for_issuance_by_demand_revocation_strategy_for_revoke_not_issued_credential_id"); } #[cfg(feature = "revocation_tests")] #[test] fn anoncreds_works_for_issuance_by_default_revocation_strategy_for_revoke_not_issued_credential_id() { - utils::setup("anoncreds_works_for_issuance_by_default_revocation_strategy_for_revoke_not_issued_credential_id"); + Setup::empty(); //1. Issuer creates wallet, gets wallet handle let (issuer_wallet_handle, issuer_wallet_config) = wallet::create_and_open_default_wallet("anoncreds_works_for_issuance_by_default_revocation_strategy_for_revoke_not_issued_credential_id").unwrap(); @@ -2123,14 +2093,12 @@ mod demos { assert_code!(ErrorCode::AnoncredsInvalidUserRevocId, res); wallet::close_and_delete_wallet(issuer_wallet_handle, &issuer_wallet_config).unwrap(); - - utils::tear_down("anoncreds_works_for_issuance_by_default_revocation_strategy_for_revoke_not_issued_credential_id"); } #[test] fn anoncreds_works_for_multiple_requested_predicates_from_one_credential() { - utils::setup("anoncreds_works_for_multiple_requested_predicates_from_one_credential"); + Setup::empty(); //1. Create Issuer wallet, gets wallet handle let (issuer_wallet_handle, issuer_wallet_config) = wallet::create_and_open_default_wallet("anoncreds_works_for_multiple_requested_predicates_from_one_credential").unwrap(); @@ -2255,13 +2223,11 @@ mod demos { wallet::close_and_delete_wallet(issuer_wallet_handle, &issuer_wallet_config).unwrap(); wallet::close_and_delete_wallet(prover_wallet_handle, &prover_wallet_config).unwrap(); - - utils::tear_down("anoncreds_works_for_multiple_requested_predicates_from_one_credential"); } #[test] fn anoncreds_works_for_credential_attr_tag_policy() { - utils::setup("anoncreds_works_for_credential_attr_tag_policy"); + Setup::empty(); //1. Create Issuer wallet, gets wallet handle let (issuer_wallet_handle, issuer_wallet_config) = wallet::create_and_open_default_wallet("anoncreds_works_for_credential_attr_tag_policy").unwrap(); @@ -2333,13 +2299,11 @@ mod demos { wallet::close_and_delete_wallet(issuer_wallet_handle, &issuer_wallet_config).unwrap(); wallet::close_and_delete_wallet(prover_wallet_handle, &prover_wallet_config).unwrap(); - - utils::tear_down("anoncreds_works_for_credential_attr_tag_policy"); } #[test] fn anoncreds_works_for_credential_deletion() { - utils::setup("anoncreds_works_for_credential_deletion"); + Setup::empty(); //1. Create Issuer wallet, gets wallet handle let (issuer_wallet_handle, issuer_wallet_config) = wallet::create_and_open_default_wallet("anoncreds_works_for_credential_deletion").unwrap(); @@ -2378,14 +2342,12 @@ mod demos { wallet::close_and_delete_wallet(issuer_wallet_handle, &issuer_wallet_config).unwrap(); wallet::close_and_delete_wallet(prover_wallet_handle, &prover_wallet_config).unwrap(); - - utils::tear_down("anoncreds_works_for_credential_deletion"); } #[cfg(feature = "revocation_tests")] #[test] fn anoncreds_works_for_cred_def_with_revocation_but_primary_proof_only() { - utils::setup("anoncreds_works_for_cred_def_with_revocation_but_primary_proof_only"); + Setup::empty(); //1. Issuer creates wallet, gets wallet handle let (issuer_wallet_handle, issuer_wallet_config) = wallet::create_and_open_default_wallet("anoncreds_works_for_revocation_proof_issuance_by_default").unwrap(); @@ -2479,14 +2441,12 @@ mod demos { wallet::close_and_delete_wallet(issuer_wallet_handle, &issuer_wallet_config).unwrap(); wallet::close_and_delete_wallet(prover_wallet_handle, &prover_wallet_config).unwrap(); - - utils::tear_down("anoncreds_works_for_cred_def_with_revocation_but_primary_proof_only"); } #[cfg(feature = "revocation_tests")] #[test] fn anoncreds_works_for_requested_proof_with_revocation_but_provided_primary_only() { - utils::setup("anoncreds_works_for_requested_proof_with_revocation_but_provided_primary_only"); + Setup::empty(); //1. Issuer creates wallet, gets wallet handle let (issuer_wallet_handle, issuer_wallet_config) = wallet::create_and_open_default_wallet("anoncreds_works_for_revocation_proof_issuance_by_default").unwrap(); @@ -2581,14 +2541,12 @@ mod demos { wallet::close_and_delete_wallet(issuer_wallet_handle, &issuer_wallet_config).unwrap(); wallet::close_and_delete_wallet(prover_wallet_handle, &prover_wallet_config).unwrap(); - - utils::tear_down("anoncreds_works_for_requested_proof_with_revocation_but_provided_primary_only"); } #[test] fn anoncreds_works_for_cred_def_rotation() { - utils::setup("anoncreds_works_for_cred_def_rotation"); + Setup::empty(); //1. Create Issuer wallet, gets wallet handle let (issuer_wallet_handle, issuer_wallet_config) = wallet::create_and_open_default_wallet("anoncreds_works_for_cred_def_rotation_issuer").unwrap(); @@ -2696,7 +2654,5 @@ mod demos { wallet::close_and_delete_wallet(issuer_wallet_handle, &issuer_wallet_config).unwrap(); wallet::close_and_delete_wallet(prover_wallet_handle, &prover_wallet_config).unwrap(); - - utils::tear_down("anoncreds_works_for_cred_def_rotation"); } } diff --git a/libindy/tests/cache.rs b/libindy/tests/cache.rs index 80e6c4bf94..10edd3d5c6 100644 --- a/libindy/tests/cache.rs +++ b/libindy/tests/cache.rs @@ -28,6 +28,7 @@ extern crate serde; mod utils; use utils::cache::*; +use utils::Setup; use self::indy::ErrorCode; @@ -44,72 +45,66 @@ mod high_cases { #[test] fn indy_get_schema_empty_options() { - let (wallet_handle, pool_handle, wallet_config) = utils::setup_with_wallet_and_pool("indy_get_schema_empty_options"); + let setup = Setup::wallet_and_pool(); let (schema_id, _, _) = utils::ledger::post_entities(); let options_json = json!({}).to_string(); let schema_json = get_schema_cache( - pool_handle, - wallet_handle, + setup.pool_handle, + setup.wallet_handle, DID_MY1, schema_id, &options_json).unwrap(); let _schema: SchemaV1 = serde_json::from_str(&schema_json).unwrap(); - - utils::tear_down_with_wallet_and_pool(wallet_handle, pool_handle, "indy_get_schema_empty_options", &wallet_config); } #[test] fn indy_get_schema_empty_options_for_unknown_id() { - let (wallet_handle, pool_handle, wallet_config) = utils::setup_with_wallet_and_pool("indy_get_schema_empty_options_for_unknown_id"); + let setup = Setup::wallet_and_pool(); let options_json = json!({}).to_string(); let res = get_schema_cache( - pool_handle, - wallet_handle, + setup.pool_handle, + setup.wallet_handle, DID_MY1, &Schema::schema_id(DID, "other_schema", "1.0"), &options_json); assert_code!(ErrorCode::LedgerNotFound, res); - - utils::tear_down_with_wallet_and_pool(wallet_handle, pool_handle, "indy_get_schema_empty_options_for_unknown_id", &wallet_config); } #[test] fn indy_get_schema_only_cache_no_cached_data() { - let (wallet_handle, pool_handle, wallet_config) = utils::setup_with_wallet_and_pool("indy_get_schema_only_cache_no_cached_data"); + let setup = Setup::wallet_and_pool(); let (schema_id, _, _) = utils::ledger::post_entities(); let options_json = json!({"noUpdate": true}).to_string(); let res = get_schema_cache( - pool_handle, - wallet_handle, + setup.pool_handle, + setup.wallet_handle, DID_MY1, schema_id, &options_json); assert_code!(ErrorCode::LedgerNotFound, res); - - utils::tear_down_with_wallet_and_pool(wallet_handle, pool_handle, "indy_get_schema_only_cache_no_cached_data", &wallet_config); } #[test] fn indy_get_schema_cache_works() { - let (wallet_handle, pool_handle, wallet_config) = utils::setup_with_wallet_and_pool("indy_get_schema_cache_works"); + let setup = Setup::wallet_and_pool(); let (schema_id, _, _) = utils::ledger::post_entities(); let options_json = json!({}).to_string(); let schema_json1 = get_schema_cache( - pool_handle, - wallet_handle, + setup.pool_handle, + setup.wallet_handle, DID_MY1, schema_id, &options_json @@ -119,8 +114,8 @@ mod high_cases { // now retrieve it from cache let options_json = json!({"noUpdate": true}).to_string(); let schema_json2 = get_schema_cache( - pool_handle, - wallet_handle, + setup.pool_handle, + setup.wallet_handle, DID_MY1, schema_id, &options_json @@ -128,20 +123,18 @@ mod high_cases { let _schema: SchemaV1 = serde_json::from_str(&schema_json2).unwrap(); assert_eq!(schema_json1, schema_json2); - - utils::tear_down_with_wallet_and_pool(wallet_handle, pool_handle, "indy_get_schema_cache_works", &wallet_config); } #[test] fn indy_get_schema_no_store_works() { - let (wallet_handle, pool_handle, wallet_config) = utils::setup_with_wallet_and_pool("indy_get_schema_no_store_works"); + let setup = Setup::wallet_and_pool(); let (schema_id, _, _) = utils::ledger::post_entities(); let options_json = json!({"noStore": true}).to_string(); let schema_json1 = get_schema_cache( - pool_handle, - wallet_handle, + setup.pool_handle, + setup.wallet_handle, DID_MY1, schema_id, &options_json @@ -151,27 +144,25 @@ mod high_cases { // it should not be present inside of cache, because of noStore option in previous request. let options_json = json!({"noUpdate": true}).to_string(); let res = get_schema_cache( - pool_handle, - wallet_handle, + setup.pool_handle, + setup.wallet_handle, DID_MY1, schema_id, &options_json ); assert_code!(ErrorCode::LedgerNotFound, res); - - utils::tear_down_with_wallet_and_pool(wallet_handle, pool_handle, "indy_get_schema_no_store_works", &wallet_config); } #[test] fn indy_get_schema_no_cache_works() { - let (wallet_handle, pool_handle, wallet_config) = utils::setup_with_wallet_and_pool("indy_get_schema_no_cache_works"); + let setup = Setup::wallet_and_pool(); let (schema_id, _, _) = utils::ledger::post_entities(); let options_json = json!({}).to_string(); let schema_json1 = get_schema_cache( - pool_handle, - wallet_handle, + setup.pool_handle, + setup.wallet_handle, DID_MY1, schema_id, &options_json @@ -181,27 +172,25 @@ mod high_cases { // it should not be present inside of cache, because of noStore option in previous request. let options_json = json!({"noUpdate": true, "noCache": true}).to_string(); let res = get_schema_cache( - pool_handle, - wallet_handle, + setup.pool_handle, + setup.wallet_handle, DID_MY1, schema_id, &options_json ); assert_code!(ErrorCode::LedgerNotFound, res); - - utils::tear_down_with_wallet_and_pool(wallet_handle, pool_handle, "indy_get_schema_no_cache_works", &wallet_config); } #[test] fn indy_get_schema_min_fresh_works() { - let (wallet_handle, pool_handle, wallet_config) = utils::setup_with_wallet_and_pool("indy_get_schema_min_fresh_works"); + let setup = Setup::wallet_and_pool(); let (schema_id, _, _) = utils::ledger::post_entities(); let options_json = json!({}).to_string(); let schema_json1 = get_schema_cache( - pool_handle, - wallet_handle, + setup.pool_handle, + setup.wallet_handle, DID_MY1, schema_id, &options_json @@ -213,42 +202,31 @@ mod high_cases { // it should not be present inside of cache, because of noStore option in previous request. let options_json = json!({"noUpdate": true, "minFresh": 1}).to_string(); let res = get_schema_cache( - pool_handle, - wallet_handle, + setup.pool_handle, + setup.wallet_handle, DID_MY1, schema_id, &options_json ); assert_code!(ErrorCode::LedgerNotFound, res); - - utils::tear_down_with_wallet_and_pool(wallet_handle, pool_handle, "indy_get_schema_min_fresh_works", &wallet_config); } #[test] fn indy_purge_schema_cache_no_options() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("indy_purge_schema_cache_no_options"); - - purge_schema_cache(wallet_handle, "{}").unwrap(); - - utils::tear_down_with_wallet(wallet_handle, "indy_purge_schema_cache_no_options", &wallet_config); + let setup = Setup::wallet(); + purge_schema_cache(setup.wallet_handle, "{}").unwrap(); } #[test] fn indy_purge_schema_cache_all_data() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("indy_purge_schema_cache_all_data"); - - purge_schema_cache(wallet_handle, &json!({"minFresh": -1}).to_string()).unwrap(); - - utils::tear_down_with_wallet(wallet_handle, "indy_purge_schema_cache_all_data", &wallet_config); + let setup = Setup::wallet(); + purge_schema_cache(setup.wallet_handle, &json!({"minFresh": -1}).to_string()).unwrap(); } #[test] fn indy_purge_schema_cache_older_than_1000_seconds() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("indy_purge_schema_cache_older_than_1000_seconds"); - - purge_schema_cache(wallet_handle, &json!({"minFresh": 1000}).to_string()).unwrap(); - - utils::tear_down_with_wallet(wallet_handle, "indy_purge_schema_cache_older_than_1000_seconds", &wallet_config); + let setup = Setup::wallet(); + purge_schema_cache(setup.wallet_handle, &json!({"minFresh": 1000}).to_string()).unwrap(); } } @@ -261,54 +239,50 @@ mod high_cases { #[test] fn indy_get_cred_def_empty_options() { - let (wallet_handle, pool_handle, wallet_config) = utils::setup_with_wallet_and_pool("indy_get_cred_def_empty_options"); + let setup = Setup::wallet_and_pool(); let (_, cred_def_id, _) = utils::ledger::post_entities(); let options_json = json!({}).to_string(); let cred_def_json = get_cred_def_cache( - pool_handle, - wallet_handle, + setup.pool_handle, + setup.wallet_handle, DID_MY1, cred_def_id, &options_json).unwrap(); let _cred_def: CredentialDefinition = serde_json::from_str(&cred_def_json).unwrap(); - - utils::tear_down_with_wallet_and_pool(wallet_handle, pool_handle, "indy_get_cred_def_empty_options", &wallet_config); } #[test] fn indy_get_cred_def_only_cache_no_cached_data() { - let (wallet_handle, pool_handle, wallet_config) = utils::setup_with_wallet_and_pool("indy_get_cred_def_only_cache_no_cached_data"); + let setup = Setup::wallet_and_pool(); let (_, cred_def_id, _) = utils::ledger::post_entities(); let options_json = json!({"noUpdate": true}).to_string(); let res = get_cred_def_cache( - pool_handle, - wallet_handle, + setup.pool_handle, + setup.wallet_handle, DID_MY1, cred_def_id, &options_json); assert_code!(ErrorCode::LedgerNotFound, res); - - utils::tear_down_with_wallet_and_pool(wallet_handle, pool_handle, "indy_get_cred_def_only_cache_no_cached_data", &wallet_config); } #[test] fn indy_get_cred_def_cache_works() { - let (wallet_handle, pool_handle, wallet_config) = utils::setup_with_wallet_and_pool("indy_get_cred_def_cache_works"); + let setup = Setup::wallet_and_pool(); let (_, cred_def_id, _) = utils::ledger::post_entities(); let options_json = json!({}).to_string(); let cred_def_json1 = get_cred_def_cache( - pool_handle, - wallet_handle, + setup.pool_handle, + setup.wallet_handle, DID_MY1, cred_def_id, &options_json @@ -318,8 +292,8 @@ mod high_cases { // now retrieve it from cache let options_json = json!({"noUpdate": true}).to_string(); let cred_def_json2 = get_cred_def_cache( - pool_handle, - wallet_handle, + setup.pool_handle, + setup.wallet_handle, DID_MY1, cred_def_id, &options_json @@ -327,20 +301,18 @@ mod high_cases { let _cred_def: CredentialDefinition = serde_json::from_str(&cred_def_json2).unwrap(); assert_eq!(cred_def_json1, cred_def_json2); - - utils::tear_down_with_wallet_and_pool(wallet_handle, pool_handle, "indy_get_cred_def_cache_works", &wallet_config); } #[test] fn indy_get_cred_def_no_store_works() { - let (wallet_handle, pool_handle, wallet_config) = utils::setup_with_wallet_and_pool("indy_get_cred_def_no_store_works"); + let setup = Setup::wallet_and_pool(); let (_, cred_def_id, _) = utils::ledger::post_entities(); let options_json = json!({"noStore": true}).to_string(); let cred_def_json1 = get_cred_def_cache( - pool_handle, - wallet_handle, + setup.pool_handle, + setup.wallet_handle, DID_MY1, cred_def_id, &options_json @@ -350,27 +322,25 @@ mod high_cases { // it should not be present inside of cache, because of noStore option in previous request. let options_json = json!({"noUpdate": true}).to_string(); let res = get_cred_def_cache( - pool_handle, - wallet_handle, + setup.pool_handle, + setup.wallet_handle, DID_MY1, cred_def_id, &options_json ); assert_code!(ErrorCode::LedgerNotFound, res); - - utils::tear_down_with_wallet_and_pool(wallet_handle, pool_handle, "indy_get_cred_def_no_store_works", &wallet_config); } #[test] fn indy_get_cred_def_no_cache_works() { - let (wallet_handle, pool_handle, wallet_config) = utils::setup_with_wallet_and_pool("indy_get_cred_def_no_cache_works"); + let setup = Setup::wallet_and_pool(); let (_, cred_def_id, _) = utils::ledger::post_entities(); let options_json = json!({}).to_string(); let cred_def_json1 = get_cred_def_cache( - pool_handle, - wallet_handle, + setup.pool_handle, + setup.wallet_handle, DID_MY1, cred_def_id, &options_json @@ -380,27 +350,25 @@ mod high_cases { // it should not be present inside of cache, because of noStore option in previous request. let options_json = json!({"noUpdate": true, "noCache": true}).to_string(); let res = get_cred_def_cache( - pool_handle, - wallet_handle, + setup.pool_handle, + setup.wallet_handle, DID_MY1, cred_def_id, &options_json ); assert_code!(ErrorCode::LedgerNotFound, res); - - utils::tear_down_with_wallet_and_pool(wallet_handle, pool_handle, "indy_get_cred_def_no_cache_works", &wallet_config); } #[test] fn indy_get_cred_def_min_fresh_works() { - let (wallet_handle, pool_handle, wallet_config) = utils::setup_with_wallet_and_pool("indy_get_cred_def_min_fresh_works"); + let setup = Setup::wallet_and_pool(); let (_, cred_def_id, _) = utils::ledger::post_entities(); let options_json = json!({}).to_string(); let cred_def_json1 = get_cred_def_cache( - pool_handle, - wallet_handle, + setup.pool_handle, + setup.wallet_handle, DID_MY1, cred_def_id, &options_json @@ -412,42 +380,31 @@ mod high_cases { // it should not be present inside of cache, because of noStore option in previous request. let options_json = json!({"noUpdate": true, "minFresh": 1}).to_string(); let res = get_cred_def_cache( - pool_handle, - wallet_handle, + setup.pool_handle, + setup.wallet_handle, DID_MY1, cred_def_id, &options_json ); assert_code!(ErrorCode::LedgerNotFound, res); - - utils::tear_down_with_wallet_and_pool(wallet_handle, pool_handle, "indy_get_cred_def_min_fresh_works", &wallet_config); } #[test] fn indy_purge_cred_def_cache_no_options() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("indy_purge_cred_def_cache_no_options"); - - purge_cred_def_cache(wallet_handle, "{}").unwrap(); - - utils::tear_down_with_wallet(wallet_handle, "indy_purge_cred_def_cache_no_options", &wallet_config); + let setup = Setup::wallet(); + purge_cred_def_cache(setup.wallet_handle, "{}").unwrap(); } #[test] fn indy_purge_cred_def_cache_all_data() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("indy_purge_cred_def_cache_all_data"); - - purge_cred_def_cache(wallet_handle, &json!({"minFresh": -1}).to_string()).unwrap(); - - utils::tear_down_with_wallet(wallet_handle, "indy_purge_cred_def_cache_all_data", &wallet_config); + let setup = Setup::wallet(); + purge_cred_def_cache(setup.wallet_handle, &json!({"minFresh": -1}).to_string()).unwrap(); } #[test] fn indy_purge_cred_def_cache_older_than_1000_seconds() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("indy_purge_cred_def_cache_older_than_1000_seconds"); - - purge_cred_def_cache(wallet_handle, &json!({"minFresh": 1000}).to_string()).unwrap(); - - utils::tear_down_with_wallet(wallet_handle, "indy_purge_cred_def_cache_older_than_1000_seconds", &wallet_config); + let setup = Setup::wallet(); + purge_cred_def_cache(setup.wallet_handle, &json!({"minFresh": 1000}).to_string()).unwrap(); } } } \ No newline at end of file diff --git a/libindy/tests/crypto.rs b/libindy/tests/crypto.rs index 04fac33da5..ce2af0bf88 100644 --- a/libindy/tests/crypto.rs +++ b/libindy/tests/crypto.rs @@ -64,7 +64,7 @@ mod high_cases { #[test] fn indy_create_key_works_for_invalid_wallet_handle() { - let _ = Setup::empty(); + Setup::empty(); let res = crypto::create_key(INVALID_WALLET_HANDLE, None); assert_code!(ErrorCode::WalletInvalidHandle, res); } @@ -324,13 +324,13 @@ mod high_cases { #[test] fn indy_anon_crypt_works() { - let _ = Setup::empty(); + Setup::empty(); crypto::anon_crypt(VERKEY_MY2, &MESSAGE.as_bytes()).unwrap(); } #[test] fn indy_anon_crypt_works_for_invalid_their_vk() { - let _ = Setup::empty(); + Setup::empty(); let res = crypto::anon_crypt(INVALID_VERKEY_LENGTH, &MESSAGE.as_bytes()); assert_code!(ErrorCode::CommonInvalidStructure, res); @@ -591,7 +591,7 @@ mod load { */ #[test] fn parallel_auth_encrypt() { - let _ = Setup::empty(); + Setup::empty(); let agent_cnt = std::env::var("AGENTS_CNT").ok().and_then(|s| s.parse::().ok()).unwrap_or(AGENT_CNT); let data_sz = std::env::var("DATA_SZ").ok().and_then(|s| s.parse::().ok()).unwrap_or(DATA_SZ); diff --git a/libindy/tests/demo.rs b/libindy/tests/demo.rs index 0b2f93605a..bf6abb99e1 100644 --- a/libindy/tests/demo.rs +++ b/libindy/tests/demo.rs @@ -41,6 +41,7 @@ use utils::domain::anoncreds::revocation_state::RevocationState; use utils::domain::anoncreds::schema::Schema; use utils::environment; +use utils::Setup; use self::indy::ErrorCode; use self::indy_sys::*; @@ -53,7 +54,7 @@ use std::thread; #[test] fn anoncreds_demo_works() { - utils::setup("anoncreds_demo_works"); + Setup::empty(); let (issuer_create_wallet_receiver, issuer_create_wallet_command_handle, issuer_create_wallet_callback) = callback::_closure_to_cb_ec(); let (prover_create_wallet_receiver, prover_create_wallet_command_handle, prover_create_wallet_callback) = callback::_closure_to_cb_ec(); @@ -472,16 +473,12 @@ fn anoncreds_demo_works() { assert_eq!(ErrorCode::from(res), ErrorCode::Success); let res = prover_close_wallet_receiver.recv_timeout(timeout::medium_timeout()).unwrap(); assert_eq!(ErrorCode::from(res), ErrorCode::Success); - - utils::tear_down_delete_wallet_with_credentials(&issuer_wallet_config, &issuer_wallet_credentials); - utils::tear_down_delete_wallet_with_credentials(&prover_wallet_config, &prover_wallet_credentials); - utils::tear_down("anoncreds_demo_works"); } #[test] #[cfg(feature = "local_nodes_pool")] fn ledger_demo_works() { - utils::setup("ledger_demo_works"); + Setup::empty(); let my_wallet_config = json!({"id": "my_wallet"}).to_string(); let their_wallet_config = json!({"id": "their_wallet"}).to_string(); @@ -720,8 +717,6 @@ fn ledger_demo_works() { let res = close_their_wallet_receiver.recv_timeout(timeout::medium_timeout()).unwrap(); assert_eq!(ErrorCode::from(res), ErrorCode::Success); - utils::tear_down("ledger_demo_works"); - #[derive(Deserialize, Eq, PartialEq, Debug)] struct Reply { op: String, @@ -747,7 +742,7 @@ fn ledger_demo_works() { #[test] fn crypto_demo_works() { - utils::setup("crypto_demo_works"); + Setup::empty(); let (create_wallet_receiver, create_wallet_command_handle, create_wallet_callback) = callback::_closure_to_cb_ec(); let (open_wallet_receiver, open_wallet_command_handle, open_wallet_callback) = callback::_closure_to_cb_ec_i32(); @@ -847,6 +842,4 @@ fn crypto_demo_works() { assert_eq!(ErrorCode::from(res), ErrorCode::Success); let res = close_wallet_receiver.recv_timeout(timeout::medium_timeout()).unwrap(); assert_eq!(ErrorCode::from(res), ErrorCode::Success); - - utils::tear_down("crypto_demo_works"); } diff --git a/libindy/tests/did.rs b/libindy/tests/did.rs index bb73ae3d88..afc064a236 100644 --- a/libindy/tests/did.rs +++ b/libindy/tests/did.rs @@ -27,9 +27,10 @@ extern crate serde; #[macro_use] mod utils; -use utils::{wallet, did, pool, ledger}; +use utils::{did, pool, ledger}; use utils::constants::*; use utils::types::ResponseType; +use utils::Setup; use self::indy::ErrorCode; @@ -49,77 +50,54 @@ mod high_cases { #[test] fn indy_key_for_did_works_for_my_did() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("indy_key_for_did_works_for_my_did"); + let setup = Setup::wallet(); - let (did, verkey) = did::create_and_store_my_did(wallet_handle, Some(MY1_SEED)).unwrap(); + let (did, verkey) = did::create_and_store_my_did(setup.wallet_handle, Some(MY1_SEED)).unwrap(); - let received_verkey = did::key_for_did(-1, wallet_handle, &did).unwrap(); + let received_verkey = did::key_for_did(-1, setup.wallet_handle, &did).unwrap(); assert_eq!(verkey, received_verkey); - - utils::tear_down_with_wallet(wallet_handle, "indy_key_for_did_works_for_my_did", &wallet_config); } #[test] fn indy_key_for_did_works_for_their_did() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("indy_key_for_did_works_for_their_did"); + let setup = Setup::wallet(); - did::store_their_did_from_parts(wallet_handle, DID, VERKEY).unwrap(); + did::store_their_did_from_parts(setup.wallet_handle, DID, VERKEY).unwrap(); - let received_verkey = did::key_for_did(-1, wallet_handle, DID).unwrap(); + let received_verkey = did::key_for_did(-1, setup.wallet_handle, DID).unwrap(); assert_eq!(VERKEY, received_verkey); - - utils::tear_down_with_wallet(wallet_handle, "indy_key_for_did_works_for_their_did", &wallet_config); } #[test] fn indy_key_for_did_works_for_get_key_from_ledger() { - let (trustee_wallet_handle, pool_handle, trustee_did, wallet_config) = utils::setup_trustee("indy_key_for_did_works_for_get_key_from_ledger"); - let (did, verkey) = did::create_and_store_my_did(trustee_wallet_handle, None).unwrap(); - - let nym_request = ledger::build_nym_request(&trustee_did, &did, Some(&verkey), None, None).unwrap(); - let nym_resp = ledger::sign_and_submit_request(pool_handle, trustee_wallet_handle, &trustee_did, &nym_request).unwrap(); - - let get_nym_request = ledger::build_get_nym_request(Some(&did), &did).unwrap(); - ledger::submit_request_with_retries(pool_handle, &get_nym_request, &nym_resp).unwrap(); - - wallet::close_wallet(trustee_wallet_handle).unwrap(); - wallet::delete_wallet(&wallet_config, WALLET_CREDENTIALS).unwrap(); - - let (wallet_handle, wallet_config) = wallet::create_and_open_default_wallet("indy_key_for_did_works_for_get_key_from_ledger_2").unwrap(); - let received_verkey = did::key_for_did(pool_handle, wallet_handle, &did).unwrap(); - assert_eq!(verkey, received_verkey); + let setup = Setup::wallet_and_pool(); - utils::tear_down_with_wallet_and_pool(wallet_handle, pool_handle, "indy_key_for_did_works_for_get_key_from_ledger", &wallet_config); + let received_verkey = did::key_for_did(setup.pool_handle, setup.wallet_handle, DID_TRUSTEE).unwrap(); + assert_eq!(VERKEY_TRUSTEE.to_string(), received_verkey); } #[test] fn indy_key_for_did_works_for_unknown_did() { - let (wallet_handle, pool_handle, wallet_config) = utils::setup_with_wallet_and_pool("indy_key_for_did_works_for_unknown_did"); + let setup = Setup::wallet_and_pool(); - let res = did::key_for_did(pool_handle, wallet_handle, DID); + let res = did::key_for_did(setup.pool_handle, setup.wallet_handle, DID); assert_code!(ErrorCode::WalletItemNotFound, res); - - utils::tear_down_with_wallet_and_pool(wallet_handle, pool_handle, "indy_key_for_did_works_for_unknown_did", &wallet_config); } #[test] fn indy_key_for_did_works_for_invalid_pool_handle() { - let (wallet_handle, pool_handle, wallet_config) = utils::setup_with_wallet_and_pool("indy_key_for_did_works_for_invalid_pool_handle"); + let setup = Setup::wallet(); - let res = did::key_for_did(INVALID_POOL_HANDLE, wallet_handle, DID_TRUSTEE); + let res = did::key_for_did(INVALID_POOL_HANDLE, setup.wallet_handle, DID_TRUSTEE); assert_code!(ErrorCode::PoolLedgerInvalidPoolHandle, res); - - utils::tear_down_with_wallet_and_pool(wallet_handle, pool_handle, "indy_key_for_did_works_for_invalid_pool_handle", &wallet_config); } #[test] fn indy_key_for_did_works_for_invalid_wallet_handle() { - let (wallet_handle, did, wallet_config) = utils::setup_did("indy_key_for_did_works_for_invalid_wallet_handle"); + Setup::empty(); - let res = did::key_for_did(-1, INVALID_WALLET_HANDLE, &did); + let res = did::key_for_did(-1, INVALID_WALLET_HANDLE, DID); assert_code!(ErrorCode::WalletInvalidHandle, res); - - utils::tear_down_with_wallet(wallet_handle, "indy_key_for_did_works_for_invalid_wallet_handle", &wallet_config); } } @@ -128,46 +106,36 @@ mod high_cases { #[test] fn indy_key_for_local_did_works_for_my_did() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("indy_key_for_local_did_works_for_my_did"); - - let (did, verkey) = did::create_and_store_my_did(wallet_handle, Some(MY1_SEED)).unwrap(); - - let received_verkey = did::key_for_local_did(wallet_handle, &did).unwrap(); - assert_eq!(verkey, received_verkey); + let setup = Setup::did(); - utils::tear_down_with_wallet(wallet_handle, "indy_key_for_local_did_works_for_my_did", &wallet_config); + let received_verkey = did::key_for_local_did(setup.wallet_handle, &setup.did).unwrap(); + assert_eq!(setup.verkey, received_verkey); } #[test] fn indy_key_for_local_did_works_for_their_did() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("indy_key_for_local_did_works_for_their_did"); + let setup = Setup::wallet(); - did::store_their_did_from_parts(wallet_handle, DID, VERKEY).unwrap(); + did::store_their_did_from_parts(setup.wallet_handle, DID, VERKEY).unwrap(); - let received_verkey = did::key_for_local_did(wallet_handle, DID).unwrap(); + let received_verkey = did::key_for_local_did(setup.wallet_handle, DID).unwrap(); assert_eq!(VERKEY, received_verkey); - - utils::tear_down_with_wallet(wallet_handle, "indy_key_for_local_did_works_for_their_did", &wallet_config); } #[test] fn indy_key_for_local_did_works_for_unknown_did() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("indy_key_for_local_did_works_for_unknown_did"); + let setup = Setup::wallet(); - let res = did::key_for_local_did(wallet_handle, DID); + let res = did::key_for_local_did(setup.wallet_handle, DID); assert_code!(ErrorCode::WalletItemNotFound, res); - - utils::tear_down_with_wallet(wallet_handle, "indy_key_for_local_did_works_for_unknown_did", &wallet_config); } #[test] fn indy_key_for_local_did_works_for_invalid_wallet_handle() { - let (wallet_handle, did, wallet_config) = utils::setup_did("indy_key_for_local_did_works_for_invalid_wallet_handle"); + Setup::empty(); - let res = did::key_for_local_did(INVALID_WALLET_HANDLE, &did); + let res = did::key_for_local_did(INVALID_WALLET_HANDLE, DID_TRUSTEE); assert_code!(ErrorCode::WalletInvalidHandle, res); - - utils::tear_down_with_wallet(wallet_handle, "indy_key_for_local_did_works_for_invalid_wallet_handle", &wallet_config); } } @@ -176,62 +144,51 @@ mod high_cases { #[test] fn indy_set_endpoint_for_did_works() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("indy_set_endpoint_for_did_works"); - - did::set_endpoint_for_did(wallet_handle, DID, ENDPOINT, VERKEY).unwrap(); - - utils::tear_down_with_wallet(wallet_handle, "indy_set_endpoint_for_did_works", &wallet_config); + let setup = Setup::wallet(); + did::set_endpoint_for_did(setup.wallet_handle, DID, ENDPOINT, VERKEY).unwrap(); } #[test] fn indy_set_endpoint_for_did_works_for_replace() { - let (wallet_handle, pool_handle, wallet_config) = utils::setup_with_wallet_and_pool("indy_set_endpoint_for_did_works_for_replace"); + let setup = Setup::wallet_and_pool(); - did::set_endpoint_for_did(wallet_handle, DID, ENDPOINT, VERKEY).unwrap(); - let (endpoint, key) = did::get_endpoint_for_did(wallet_handle, pool_handle, DID).unwrap(); + did::set_endpoint_for_did(setup.wallet_handle, DID, ENDPOINT, VERKEY).unwrap(); + let (endpoint, key) = did::get_endpoint_for_did(setup.wallet_handle, setup.pool_handle, DID).unwrap(); assert_eq!(ENDPOINT, endpoint); assert_eq!(VERKEY, key.unwrap()); let new_endpoint = "10.10.10.1:9710"; - did::set_endpoint_for_did(wallet_handle, DID, new_endpoint, VERKEY_MY2).unwrap(); - let (updated_endpoint, updated_key) = did::get_endpoint_for_did(wallet_handle, pool_handle, DID).unwrap(); + did::set_endpoint_for_did(setup.wallet_handle, DID, new_endpoint, VERKEY_MY2).unwrap(); + let (updated_endpoint, updated_key) = did::get_endpoint_for_did(setup.wallet_handle, setup.pool_handle, DID).unwrap(); assert_eq!(new_endpoint, updated_endpoint); assert_eq!(VERKEY_MY2, updated_key.unwrap()); - - utils::tear_down_with_wallet_and_pool(wallet_handle, pool_handle, "indy_set_endpoint_for_did_works_for_replace", &wallet_config); } #[test] fn indy_set_endpoint_for_did_works_for_invalid_did() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("indy_set_endpoint_for_did_works_for_invalid_did"); + let setup = Setup::wallet(); - let res = did::set_endpoint_for_did(wallet_handle, INVALID_BASE58_DID, ENDPOINT, VERKEY); + let res = did::set_endpoint_for_did(setup.wallet_handle, INVALID_BASE58_DID, ENDPOINT, VERKEY); assert_code!(ErrorCode::CommonInvalidStructure, res); - - utils::tear_down_with_wallet(wallet_handle, "indy_set_endpoint_for_did_works_for_invalid_did", &wallet_config); } #[test] fn indy_set_endpoint_for_did_works_for_invalid_transport_key() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("indy_set_endpoint_for_did_works_for_invalid_transport_key"); + let setup = Setup::wallet(); - let res = did::set_endpoint_for_did(wallet_handle, DID, ENDPOINT, INVALID_BASE58_VERKEY); + let res = did::set_endpoint_for_did(setup.wallet_handle, DID, ENDPOINT, INVALID_BASE58_VERKEY); assert_code!(ErrorCode::CommonInvalidStructure, res); - let res = did::set_endpoint_for_did(wallet_handle, DID, ENDPOINT, INVALID_VERKEY_LENGTH); + let res = did::set_endpoint_for_did(setup.wallet_handle, DID, ENDPOINT, INVALID_VERKEY_LENGTH); assert_code!(ErrorCode::CommonInvalidStructure, res); - - utils::tear_down_with_wallet(wallet_handle, "indy_set_endpoint_for_did_works_for_invalid_transport_key", &wallet_config); } #[test] fn indy_set_endpoint_for_did_works_for_invalid_handle() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("indy_set_endpoint_for_did_works_for_invalid_handle"); + Setup::empty(); let res = did::set_endpoint_for_did(INVALID_WALLET_HANDLE, DID, ENDPOINT, VERKEY); assert_code!(ErrorCode::WalletInvalidHandle, res); - - utils::tear_down_with_wallet(wallet_handle, "indy_set_endpoint_for_did_works_for_invalid_handle", &wallet_config); } } @@ -240,81 +197,66 @@ mod high_cases { #[test] fn indy_get_endpoint_for_did_works() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("indy_get_endpoint_for_did_works"); - - did::set_endpoint_for_did(wallet_handle, DID, ENDPOINT, VERKEY).unwrap(); + let setup = Setup::wallet(); - let (endpoint, key) = did::get_endpoint_for_did(wallet_handle, -1, DID).unwrap(); + did::set_endpoint_for_did(setup.wallet_handle, DID, ENDPOINT, VERKEY).unwrap(); + let (endpoint, key) = did::get_endpoint_for_did(setup.wallet_handle, -1, DID).unwrap(); assert_eq!(ENDPOINT, endpoint); assert_eq!(VERKEY, key.unwrap()); - - utils::tear_down_with_wallet(wallet_handle, "indy_get_endpoint_for_did_works", &wallet_config); } #[test] fn indy_get_endpoint_for_did_works_from_ledger() { - let (wallet_handle, pool_handle, trustee_did, wallet_config) = utils::setup_trustee("indy_get_endpoint_for_did_works_from_ledger"); + let setup = Setup::new_identity(); let attrib_data = json!({"endpoint": {"ha": ENDPOINT, "verkey": VERKEY_TRUSTEE}}).to_string(); - let attrib_request = ledger::build_attrib_request(&trustee_did, &trustee_did, None, Some(&attrib_data), None).unwrap(); - ledger::sign_and_submit_request(pool_handle, wallet_handle, &trustee_did, &attrib_request).unwrap(); + let attrib_request = ledger::build_attrib_request(&setup.did, &setup.did, None, Some(&attrib_data), None).unwrap(); + ledger::sign_and_submit_request(setup.pool_handle, setup.wallet_handle, &setup.did, &attrib_request).unwrap(); - thread::sleep(std::time::Duration::from_millis(1000)); + thread::sleep(std::time::Duration::from_secs(1)); - let (endpoint, key) = did::get_endpoint_for_did(wallet_handle, pool_handle, &trustee_did).unwrap(); + let (endpoint, key) = did::get_endpoint_for_did(setup.wallet_handle, setup.pool_handle, &setup.did).unwrap(); assert_eq!(ENDPOINT, endpoint); assert_eq!(VERKEY_TRUSTEE, key.unwrap()); - - utils::tear_down_with_wallet_and_pool(wallet_handle, pool_handle, "indy_get_endpoint_for_did_works_from_ledger", &wallet_config); } #[test] fn indy_get_endpoint_for_did_works_from_ledger_for_address_only() { - let (wallet_handle, pool_handle, trustee_did, wallet_config) = utils::setup_trustee("indy_get_endpoint_for_did_works_from_ledger_for_address_only"); + let setup = Setup::new_identity(); let attrib_data = json!({"endpoint": {"ha": ENDPOINT}}).to_string(); - let attrib_request = ledger::build_attrib_request(&trustee_did, &trustee_did, None, Some(&attrib_data), None).unwrap(); - ledger::sign_and_submit_request(pool_handle, wallet_handle, &trustee_did, &attrib_request).unwrap(); + let attrib_request = ledger::build_attrib_request(&setup.did, &setup.did, None, Some(&attrib_data), None).unwrap(); + ledger::sign_and_submit_request(setup.pool_handle, setup.wallet_handle, &setup.did, &attrib_request).unwrap(); - thread::sleep(std::time::Duration::from_millis(1000)); + thread::sleep(std::time::Duration::from_secs(1)); - let (endpoint, key) = did::get_endpoint_for_did(wallet_handle, pool_handle, &trustee_did).unwrap(); + let (endpoint, key) = did::get_endpoint_for_did(setup.wallet_handle, setup.pool_handle, &setup.did).unwrap(); assert_eq!(ENDPOINT, endpoint); assert_eq!(None, key); - - utils::tear_down_with_wallet_and_pool(wallet_handle, pool_handle, "indy_get_endpoint_for_did_works_from_ledger_for_address_only", &wallet_config); } #[test] fn indy_get_endpoint_for_did_works_for_unknown_did() { - let (wallet_handle, pool_handle, wallet_config) = utils::setup_with_wallet_and_pool("indy_get_endpoint_for_did_works_for_unknown_did"); + let setup = Setup::wallet_and_pool(); - let res = did::get_endpoint_for_did(wallet_handle, pool_handle, DID); + let res = did::get_endpoint_for_did(setup.wallet_handle, setup.pool_handle, DID); assert_code!(ErrorCode::CommonInvalidState, res); - - utils::tear_down_with_wallet_and_pool(wallet_handle, pool_handle, "indy_get_endpoint_for_did_works_for_unknown_did", &wallet_config); } #[test] fn indy_get_endpoint_for_did_works_invalid_poll_handle() { - let (wallet_handle, pool_handle, wallet_config) = utils::setup_with_wallet_and_pool("indy_get_endpoint_for_did_works_invalid_poll_handle"); + let setup = Setup::wallet(); - let res = did::get_endpoint_for_did(wallet_handle, INVALID_POOL_HANDLE, DID); + let res = did::get_endpoint_for_did(setup.wallet_handle, INVALID_POOL_HANDLE, DID); assert_code!(ErrorCode::PoolLedgerInvalidPoolHandle, res); - - utils::tear_down_with_wallet_and_pool(wallet_handle, pool_handle, "indy_get_endpoint_for_did_works_invalid_poll_handle", &wallet_config); } #[test] fn indy_get_endpoint_for_did_works_invalid_wallet_handle() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("indy_get_endpoint_for_did_works_invalid_wallet_handle"); - - did::set_endpoint_for_did(wallet_handle, DID, ENDPOINT, VERKEY).unwrap(); + Setup::empty(); let res = did::get_endpoint_for_did(INVALID_WALLET_HANDLE, -1, DID); assert_code!(ErrorCode::WalletInvalidHandle, res); - - utils::tear_down_with_wallet(wallet_handle, "indy_get_endpoint_for_did_works_invalid_wallet_handle", &wallet_config); } } @@ -323,76 +265,57 @@ mod high_cases { #[test] fn indy_set_did_metadata_works() { - let (wallet_handle, did, wallet_config) = utils::setup_did("indy_set_did_metadata_works"); - - did::set_did_metadata(wallet_handle, &did, METADATA).unwrap(); - - utils::tear_down_with_wallet(wallet_handle, "indy_set_did_metadata_works", &wallet_config); + let setup = Setup::did(); + did::set_did_metadata(setup.wallet_handle, &setup.did, METADATA).unwrap(); } #[test] fn indy_set_did_metadata_works_for_their_did() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("indy_set_did_metadata_works_for_their_did"); - - did::store_their_did_from_parts(wallet_handle, DID, VERKEY).unwrap(); - - did::set_did_metadata(wallet_handle, DID, METADATA).unwrap(); - - utils::tear_down_with_wallet(wallet_handle, "indy_set_did_metadata_works_for_their_did", &wallet_config); + let setup = Setup::wallet(); + did::store_their_did_from_parts(setup.wallet_handle, DID, VERKEY).unwrap(); + did::set_did_metadata(setup.wallet_handle, DID, METADATA).unwrap(); } #[test] fn indy_set_did_metadata_works_for_replace() { - let (wallet_handle, did, wallet_config) = utils::setup_did("indy_set_did_metadata_works_for_replace"); + let setup = Setup::did(); - did::set_did_metadata(wallet_handle, &did, METADATA).unwrap(); - let metadata = did::get_did_metadata(wallet_handle, &did).unwrap(); + did::set_did_metadata(setup.wallet_handle, &setup.did, METADATA).unwrap(); + let metadata = did::get_did_metadata(setup.wallet_handle, &setup.did).unwrap(); assert_eq!(METADATA.to_string(), metadata); let new_metadata = "updated metadata"; - did::set_did_metadata(wallet_handle, &did, new_metadata).unwrap(); - let updated_metadata = did::get_did_metadata(wallet_handle, &did).unwrap(); + did::set_did_metadata(setup.wallet_handle, &setup.did, new_metadata).unwrap(); + let updated_metadata = did::get_did_metadata(setup.wallet_handle, &setup.did).unwrap(); assert_eq!(new_metadata, updated_metadata); - - utils::tear_down_with_wallet(wallet_handle, "indy_set_did_metadata_works_for_replace", &wallet_config); } #[test] fn indy_set_did_metadata_works_for_empty_string() { - let (wallet_handle, did, wallet_config) = utils::setup_did("indy_set_did_metadata_works_for_empty_string"); - - did::set_did_metadata(wallet_handle, &did, "").unwrap(); - - utils::tear_down_with_wallet(wallet_handle, "indy_set_did_metadata_works_for_empty_string", &wallet_config); + let setup = Setup::did(); + did::set_did_metadata(setup.wallet_handle, &setup.did, "").unwrap(); } #[test] fn indy_set_did_metadata_works_for_invalid_did() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("indy_set_did_metadata_works_for_invalid_did"); + let setup = Setup::wallet(); - let res = did::set_did_metadata(wallet_handle, INVALID_BASE58_DID, METADATA); + let res = did::set_did_metadata(setup.wallet_handle, INVALID_BASE58_DID, METADATA); assert_code!(ErrorCode::CommonInvalidStructure, res); - - utils::tear_down_with_wallet(wallet_handle, "indy_set_did_metadata_works_for_invalid_did", &wallet_config); } #[test] fn indy_set_did_metadata_works_for_unknown_did() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("indy_set_did_metadata_works_for_unknown_did"); - - did::set_did_metadata(wallet_handle, &DID, METADATA).unwrap(); - - utils::tear_down_with_wallet(wallet_handle, "indy_set_did_metadata_works_for_unknown_did", &wallet_config); + let setup = Setup::wallet(); + did::set_did_metadata(setup.wallet_handle, &DID, METADATA).unwrap(); } #[test] fn indy_set_did_metadata_works_for_invalid_handle() { - let (wallet_handle, did, wallet_config) = utils::setup_did("indy_set_did_metadata_works_for_invalid_handle"); + Setup::empty(); - let res = did::set_did_metadata(INVALID_WALLET_HANDLE, &did, METADATA); + let res = did::set_did_metadata(INVALID_WALLET_HANDLE, DID_TRUSTEE, METADATA); assert_code!(ErrorCode::WalletInvalidHandle, res); - - utils::tear_down_with_wallet(wallet_handle, "indy_set_did_metadata_works_for_invalid_handle", &wallet_config); } } @@ -401,72 +324,57 @@ mod high_cases { #[test] fn indy_get_did_metadata_works() { - let (wallet_handle, did, wallet_config) = utils::setup_did("indy_get_did_metadata_works"); + let setup = Setup::did(); - did::set_did_metadata(wallet_handle, &did, METADATA).unwrap(); + did::set_did_metadata(setup.wallet_handle, &setup.did, METADATA).unwrap(); - let metadata = did::get_did_metadata(wallet_handle, &did).unwrap(); + let metadata = did::get_did_metadata(setup.wallet_handle, &setup.did).unwrap(); assert_eq!(METADATA.to_string(), metadata); - - utils::tear_down_with_wallet(wallet_handle, "indy_get_did_metadata_works", &wallet_config); } #[test] fn indy_get_did_metadata_works_for_their_did() { - let (wallet_handle, did, wallet_config) = utils::setup_did("indy_get_did_metadata_works_for_their_did"); + let setup = Setup::wallet(); - did::store_their_did_from_parts(wallet_handle, &did, VERKEY).unwrap(); + did::store_their_did_from_parts(setup.wallet_handle, DID, VERKEY).unwrap(); - did::set_did_metadata(wallet_handle, &did, METADATA).unwrap(); + did::set_did_metadata(setup.wallet_handle, DID, METADATA).unwrap(); - let metadata = did::get_did_metadata(wallet_handle, &did).unwrap(); + let metadata = did::get_did_metadata(setup.wallet_handle, DID).unwrap(); assert_eq!(METADATA.to_string(), metadata); - - utils::tear_down_with_wallet(wallet_handle, "indy_get_did_metadata_works_for_their_did", &wallet_config); } #[test] fn indy_get_did_metadata_works_for_empty_string() { - let (wallet_handle, did, wallet_config) = utils::setup_did("indy_get_did_metadata_works_for_empty_string"); - - did::set_did_metadata(wallet_handle, &did, "").unwrap(); + let setup = Setup::did(); - let metadata = did::get_did_metadata(wallet_handle, &did).unwrap(); + did::set_did_metadata(setup.wallet_handle, &setup.did, "").unwrap(); + let metadata = did::get_did_metadata(setup.wallet_handle, &setup.did).unwrap(); assert_eq!("", metadata); - - utils::tear_down_with_wallet(wallet_handle, "indy_get_did_metadata_works_for_empty_string", &wallet_config); } #[test] fn indy_get_did_metadata_works_for_no_metadata() { - let (wallet_handle, did, wallet_config) = utils::setup_did("indy_get_did_metadata_works_for_no_metadata"); + let setup = Setup::did(); - let res = did::get_did_metadata(wallet_handle, &did); + let res = did::get_did_metadata(setup.wallet_handle, &setup.did); assert_code!(ErrorCode::WalletItemNotFound, res); - - utils::tear_down_with_wallet(wallet_handle, "indy_get_did_metadata_works_for_no_metadata", &wallet_config); } #[test] fn indy_get_did_metadata_works_for_unknown_did() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("indy_get_did_metadata_works_for_unknown_did"); + let setup = Setup::wallet(); - let res = did::get_did_metadata(wallet_handle, DID); + let res = did::get_did_metadata(setup.wallet_handle, DID); assert_code!(ErrorCode::WalletItemNotFound, res); - - utils::tear_down_with_wallet(wallet_handle, "indy_get_did_metadata_works_for_unknown_did", &wallet_config); } #[test] fn indy_get_did_metadata_works_for_invalid_handle() { - let (wallet_handle, did, wallet_config) = utils::setup_did("indy_get_did_metadata_works_for_invalid_handle"); + Setup::empty(); - did::set_did_metadata(wallet_handle, &did, METADATA).unwrap(); - - let res = did::get_did_metadata(INVALID_WALLET_HANDLE, &did); + let res = did::get_did_metadata(INVALID_WALLET_HANDLE, DID); assert_code!(ErrorCode::WalletInvalidHandle, res); - - utils::tear_down_with_wallet(wallet_handle, "indy_get_did_metadata_works_for_invalid_handle", &wallet_config); } } @@ -475,45 +383,34 @@ mod high_cases { #[test] fn indy_get_my_did_metadata_works() { - let (wallet_handle, did, wallet_config) = utils::setup_did("indy_get_my_did_metadata_works"); - - did::set_did_metadata(wallet_handle, &did, METADATA).unwrap(); + let setup = Setup::did(); - did::get_my_did_with_metadata(wallet_handle, &did).unwrap(); - - utils::tear_down_with_wallet(wallet_handle, "indy_get_my_did_metadata_works", &wallet_config); + did::set_did_metadata(setup.wallet_handle, &setup.did, METADATA).unwrap(); + did::get_my_did_with_metadata(setup.wallet_handle, &setup.did).unwrap(); } #[test] fn indy_get_my_did_metadata_works_for_no_metadata() { - let (wallet_handle, did, wallet_config) = utils::setup_did("indy_get_my_did_metadata_works_for_no_metadata"); - - did::get_my_did_with_metadata(wallet_handle, &did).unwrap(); - - utils::tear_down_with_wallet(wallet_handle, "indy_get_my_did_metadata_works_for_no_metadata", &wallet_config); + let setup = Setup::did(); + did::get_my_did_with_metadata(setup.wallet_handle, &setup.did).unwrap(); } #[test] fn indy_get_my_did_metadata_works_with_temp_verkey() { - let (wallet_handle, did, wallet_config) = utils::setup_did("indy_get_my_did_metadata_works_with_temp_verkey"); - - did::set_did_metadata(wallet_handle, &did, METADATA).unwrap(); - did::replace_keys_start(wallet_handle, &did, "{}").unwrap(); + let setup = Setup::did(); - did::get_my_did_with_metadata(wallet_handle, &did).unwrap(); - - utils::tear_down_with_wallet(wallet_handle, "indy_get_my_did_metadata_works_with_temp_verkey", &wallet_config); + did::set_did_metadata(setup.wallet_handle, &setup.did, METADATA).unwrap(); + did::replace_keys_start(setup.wallet_handle, &setup.did, "{}").unwrap(); + did::get_my_did_with_metadata(setup.wallet_handle, &setup.did).unwrap(); } #[test] fn indy_get_my_did_metadata_works_for_unknown_did() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("indy_get_my_did_metadata_works_for_unknown_did"); + let setup = Setup::wallet(); - let res = did::get_my_did_with_metadata(wallet_handle, DID); + let res = did::get_my_did_with_metadata(setup.wallet_handle, DID); assert_code!(ErrorCode::WalletItemNotFound, res); - - utils::tear_down_with_wallet(wallet_handle, "indy_get_my_did_metadata_works_for_unknown_did", &wallet_config); } } @@ -523,97 +420,77 @@ mod high_cases { #[test] fn indy_create_my_did_works_for_empty_json() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("indy_create_my_did_works_for_empty_json"); - - let (my_did, my_verkey) = did::create_my_did(wallet_handle, "{}").unwrap(); + let setup = Setup::wallet(); + let (my_did, my_verkey) = did::create_my_did(setup.wallet_handle, "{}").unwrap(); assert_eq!(my_did.from_base58().unwrap().len(), 16); assert_eq!(my_verkey.from_base58().unwrap().len(), 32); - - utils::tear_down_with_wallet(wallet_handle, "indy_create_my_did_works_for_empty_json", &wallet_config); } #[test] fn indy_create_my_did_works_with_seed() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("indy_create_my_did_works_with_seed"); - - let (my_did, my_verkey) = did::create_and_store_my_did(wallet_handle, Some(MY1_SEED)).unwrap(); + let setup = Setup::wallet(); + let (my_did, my_verkey) = did::create_and_store_my_did(setup.wallet_handle, Some(MY1_SEED)).unwrap(); assert_eq!(my_did, DID_MY1); assert_eq!(my_verkey, VERKEY_MY1); - - utils::tear_down_with_wallet(wallet_handle, "indy_create_my_did_works_with_seed", &wallet_config); } #[test] fn indy_create_my_did_works_with_hex_seed() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("indy_create_my_did_works_with_hex_seed"); - - let (my_did, my_verkey) = did::create_and_store_my_did(wallet_handle, Some("94a823a6387cdd30d8f7687d95710ebab84c6e277b724790a5b221440beb7df6")).unwrap(); + let setup = Setup::wallet(); + let (my_did, my_verkey) = did::create_and_store_my_did(setup.wallet_handle, Some("94a823a6387cdd30d8f7687d95710ebab84c6e277b724790a5b221440beb7df6")).unwrap(); assert_eq!(my_did, "HWvjYf77k1dqQAk6sE4gaS"); assert_eq!(my_verkey, "A16wi1xHBu5KT4SqNhZXrKZfoQbXJCbDozgSTJhUgu9x"); - - utils::tear_down_with_wallet(wallet_handle, "indy_create_my_did_works_with_hex_seed", &wallet_config); } #[test] fn indy_create_my_did_works_as_cid() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("indy_create_my_did_works_as_cid"); - - let (my_did, my_verkey) = did::create_my_did(wallet_handle, r#"{"seed":"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa","cid":true}"#).unwrap(); + let setup = Setup::wallet(); + let (my_did, my_verkey) = did::create_my_did(setup.wallet_handle, r#"{"seed":"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa","cid":true}"#).unwrap(); assert_eq!(my_did, VERKEY); assert_eq!(my_verkey, VERKEY); - - utils::tear_down_with_wallet(wallet_handle, "indy_create_my_did_works_as_cid", &wallet_config); } #[test] fn indy_create_my_did_works_with_passed_did() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("indy_create_my_did_works_with_passed_did"); + let setup = Setup::wallet(); - let (my_did, my_verkey) = did::create_my_did(wallet_handle, &format!(r#"{{"did":"{}","seed":"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"}}"#, DID)).unwrap(); + let (my_did, my_verkey) = did::create_my_did(setup.wallet_handle, &format!(r#"{{"did":"{}","seed":"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"}}"#, DID)).unwrap(); assert_eq!(my_did, DID); assert_eq!(my_verkey, VERKEY); - - utils::tear_down_with_wallet(wallet_handle, "indy_create_my_did_works_with_passed_did", &wallet_config); } #[test] fn indy_create_my_did_works_for_exists_crypto_type() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("indy_create_my_did_works_for_exists_crypto_type"); + let setup = Setup::wallet(); - did::create_my_did(wallet_handle, r#"{"crypto_type":"ed25519"}"#).unwrap(); - - utils::tear_down_with_wallet(wallet_handle, "indy_create_my_did_works_for_exists_crypto_type", &wallet_config); + did::create_my_did(setup.wallet_handle, r#"{"crypto_type":"ed25519"}"#).unwrap(); } #[test] fn indy_create_my_did_works_for_invalid_wallet_handle() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("indy_create_my_did_works_for_invalid_wallet_handle"); + Setup::empty(); let res = did::create_my_did(INVALID_WALLET_HANDLE, "{}"); assert_code!(ErrorCode::WalletInvalidHandle, res); - - utils::tear_down_with_wallet(wallet_handle, "indy_create_my_did_works_for_invalid_wallet_handle", &wallet_config); } #[test] fn indy_create_my_did_works_for_duplicate() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("indy_create_my_did_works_for_duplicate"); + let setup = Setup::wallet(); - let (did, verkey) = did::create_and_store_my_did(wallet_handle, Some(MY1_SEED)).unwrap(); + let (did, verkey) = did::create_and_store_my_did(setup.wallet_handle, Some(MY1_SEED)).unwrap(); - let (dup_did, dup_verkey) = did::create_and_store_my_did(wallet_handle, Some(MY1_SEED)).unwrap(); + let (dup_did, dup_verkey) = did::create_and_store_my_did(setup.wallet_handle, Some(MY1_SEED)).unwrap(); assert_eq!(did, dup_did); assert_eq!(verkey, dup_verkey); - let res = did::create_my_did(wallet_handle, &json!({"did": did}).to_string()); + let res = did::create_my_did(setup.wallet_handle, &json!({"did": did}).to_string()); assert_code!(ErrorCode::DidAlreadyExistsError, res); - - utils::tear_down_with_wallet(wallet_handle, "indy_create_my_did_works_for_duplicate", &wallet_config); } } @@ -622,40 +499,27 @@ mod high_cases { #[test] fn indy_replace_keys_start_works() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("indy_replace_keys_start_works"); - - let (my_did, my_verkey) = did::create_and_store_my_did(wallet_handle, None).unwrap(); - - let new_verkey = did::replace_keys_start(wallet_handle, &my_did, "{}").unwrap(); + let setup = Setup::did(); - assert_ne!(new_verkey, my_verkey); - - utils::tear_down_with_wallet(wallet_handle, "indy_replace_keys_start_works", &wallet_config); + let new_verkey = did::replace_keys_start(setup.wallet_handle, &setup.did, "{}").unwrap(); + assert_ne!(new_verkey, setup.verkey); } #[test] fn indy_replace_keys_start_works_for_invalid_wallet_handle() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("indy_replace_keys_start_works_for_invalid_wallet_handle"); - - let (my_did, _) = did::create_and_store_my_did(wallet_handle, None).unwrap(); + Setup::empty(); - let res = did::replace_keys_start(INVALID_WALLET_HANDLE, &my_did, "{}"); + let res = did::replace_keys_start(INVALID_WALLET_HANDLE, DID, "{}"); assert_code!(ErrorCode::WalletInvalidHandle, res); - - utils::tear_down_with_wallet(wallet_handle, "indy_replace_keys_start_works_for_invalid_wallet_handle", &wallet_config); } #[test] fn indy_replace_keys_start_works_for_seed() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("indy_replace_keys_start_works_for_seed"); + let setup = Setup::did(); - let (my_did, my_verkey) = did::create_and_store_my_did(wallet_handle, None).unwrap(); - - let new_verkey = did::replace_keys_start(wallet_handle, &my_did, r#"{"seed":"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"}"#).unwrap(); + let new_verkey = did::replace_keys_start(setup.wallet_handle, &setup.did, r#"{"seed":"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"}"#).unwrap(); assert_eq!(new_verkey, VERKEY); - assert_ne!(my_verkey, new_verkey); - - utils::tear_down_with_wallet(wallet_handle, "indy_replace_keys_start_works_for_seed", &wallet_config); + assert_ne!(setup.verkey, new_verkey); } } @@ -664,47 +528,37 @@ mod high_cases { #[test] fn indy_replace_keys_apply_works() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("indy_replace_keys_apply_works"); - - let (my_did, my_verkey) = did::create_and_store_my_did(wallet_handle, None).unwrap(); + let setup = Setup::did(); - let new_verkey = did::replace_keys_start(wallet_handle, &my_did, "{}").unwrap(); + let new_verkey = did::replace_keys_start(setup.wallet_handle, &setup.did, "{}").unwrap(); - assert_ne!(new_verkey, my_verkey); + assert_ne!(new_verkey, setup.verkey); - did::replace_keys_apply(wallet_handle, &my_did).unwrap(); - - utils::tear_down_with_wallet(wallet_handle, "indy_replace_keys_apply_works", &wallet_config); + did::replace_keys_apply(setup.wallet_handle, &setup.did).unwrap(); } #[test] fn indy_replace_keys_apply_works_without_calling_replace_start() { - let (wallet_handle, my_did, wallet_config) = utils::setup_did("indy_replace_keys_apply_works_without_calling_replace_start"); + let setup = Setup::did(); - let res = did::replace_keys_apply(wallet_handle, &my_did); + let res = did::replace_keys_apply(setup.wallet_handle, &setup.did); assert_code!(ErrorCode::WalletItemNotFound, res); - - utils::tear_down_with_wallet(wallet_handle, "indy_replace_keys_apply_works_without_calling_replace_start", &wallet_config); } #[test] fn indy_replace_keys_apply_works_for_unknown_did() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("indy_replace_keys_apply_works_for_unknown_did"); + let setup = Setup::wallet(); - let res = did::replace_keys_apply(wallet_handle, DID); + let res = did::replace_keys_apply(setup.wallet_handle, DID); assert_code!(ErrorCode::WalletItemNotFound, res); - - utils::tear_down_with_wallet(wallet_handle, "indy_replace_keys_apply_works_for_unknown_did", &wallet_config); } #[test] fn indy_replace_keys_apply_works_for_invalid_wallet_handle() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("indy_replace_keys_apply_works_for_invalid_wallet_handle"); + Setup::empty(); let res = did::replace_keys_apply(INVALID_WALLET_HANDLE, DID); assert_code!(ErrorCode::WalletInvalidHandle, res); - - utils::tear_down_with_wallet(wallet_handle, "indy_replace_keys_apply_works_for_invalid_wallet_handle", &wallet_config); } } @@ -713,143 +567,119 @@ mod high_cases { #[test] fn indy_store_their_did_works_for_did_only() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("indy_store_their_did_works_for_did_only"); + let setup = Setup::wallet(); let identity_json = json!({"did": DID}).to_string(); - did::store_their_did(wallet_handle, &identity_json).unwrap(); - - utils::tear_down_with_wallet(wallet_handle, "indy_store_their_did_works_for_did_only", &wallet_config); + did::store_their_did(setup.wallet_handle, &identity_json).unwrap(); } #[test] fn indy_store_their_did_works_for_verkey() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("indy_store_their_did_works_for_verkey"); + let setup = Setup::wallet(); let identity_json = json!({"did": DID, "verkey": VERKEY}).to_string(); - did::store_their_did(wallet_handle, &identity_json).unwrap(); - - utils::tear_down_with_wallet(wallet_handle, "indy_store_their_did_works_for_verkey", &wallet_config); + did::store_their_did(setup.wallet_handle, &identity_json).unwrap(); } #[test] fn indy_store_their_did_works_for_verkey_with_crypto_type() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("indy_store_their_did_works_for_verkey_with_crypto_type"); + let setup = Setup::wallet(); let identity_json = json!({"did": DID, "verkey": VERKEY.to_owned() + ":ed25519"}).to_string(); - did::store_their_did(wallet_handle, &identity_json).unwrap(); - - utils::tear_down_with_wallet(wallet_handle, "indy_store_their_did_works_for_verkey_with_crypto_type", &wallet_config); + did::store_their_did(setup.wallet_handle, &identity_json).unwrap(); } #[test] fn indy_create_my_did_works_for_invalid_seed() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("indy_create_my_did_works_for_invalid_seed"); + let setup = Setup::wallet(); - let res = did::create_my_did(wallet_handle, r#"{"seed":"seed"}"#); + let res = did::create_my_did(setup.wallet_handle, r#"{"seed":"seed"}"#); assert_code!(ErrorCode::CommonInvalidStructure, res); - - utils::tear_down_with_wallet(wallet_handle, "indy_create_my_did_works_for_invalid_seed", &wallet_config); } #[test] fn indy_store_their_did_works_for_invalid_wallet_handle() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("indy_store_their_did_works_for_invalid_wallet_handle"); + Setup::empty(); let identity_json = json!({"did": DID}).to_string(); let res = did::store_their_did(INVALID_WALLET_HANDLE, &identity_json); assert_code!(ErrorCode::WalletInvalidHandle, res); - - utils::tear_down_with_wallet(wallet_handle, "indy_store_their_did_works_for_invalid_wallet_handle", &wallet_config); } #[test] fn indy_store_their_did_works_for_abbreviated_verkey() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("indy_store_their_did_works_for_abbreviated_verkey"); + let setup = Setup::wallet(); let identity_json = r#"{"did":"8wZcEriaNLNKtteJvx7f8i", "verkey":"~NcYxiDXkpYi6ov5FcYDi1e"}"#; - did::store_their_did(wallet_handle, identity_json).unwrap(); - - utils::tear_down_with_wallet(wallet_handle, "indy_store_their_did_works_for_abbreviated_verkey", &wallet_config); + did::store_their_did(setup.wallet_handle, identity_json).unwrap(); } #[test] fn indy_create_my_did_works_for_invalid_json() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("indy_create_my_did_works_for_invalid_json"); + let setup = Setup::wallet(); - let res = did::create_my_did(wallet_handle, r#"{"seed":123}"#); + let res = did::create_my_did(setup.wallet_handle, r#"{"seed":123}"#); assert_code!(ErrorCode::CommonInvalidStructure, res); - - utils::tear_down_with_wallet(wallet_handle, "indy_create_my_did_works_for_invalid_json", &wallet_config); } #[test] fn indy_store_their_did_works_for_invalid_did() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("indy_store_their_did_works_for_invalid_did"); + let setup = Setup::wallet(); let identity_json = json!({"did": INVALID_BASE58_DID}).to_string(); - let res = did::store_their_did(wallet_handle, &identity_json); + let res = did::store_their_did(setup.wallet_handle, &identity_json); assert_code!(ErrorCode::CommonInvalidStructure, res); - - utils::tear_down_with_wallet(wallet_handle, "indy_store_their_did_works_for_invalid_did", &wallet_config); } #[test] fn indy_store_their_did_works_for_invalid_verkey() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("indy_store_their_did_works_for_invalid_verkey"); + let setup = Setup::wallet(); let identity_json = json!({"did": "did", "verkey":"invalid_base58string"}).to_string(); - let res = did::store_their_did(wallet_handle, &identity_json); + let res = did::store_their_did(setup.wallet_handle, &identity_json); assert_code!(ErrorCode::CommonInvalidStructure, res); - - utils::tear_down_with_wallet(wallet_handle, "indy_store_their_did_works_for_invalid_verkey", &wallet_config); } #[test] fn indy_store_their_did_works_for_verkey_with_invalid_crypto_type() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("indy_store_their_did_works_for_verkey_with_invalid_crypto_type"); + let setup = Setup::wallet(); let identity_json = json!({"did": DID, "verkey": VERKEY.to_owned() + ":crypto_type"}).to_string(); - let res = did::store_their_did(wallet_handle, &identity_json); + let res = did::store_their_did(setup.wallet_handle, &identity_json); assert_code!(ErrorCode::UnknownCryptoTypeError, res); - - utils::tear_down_with_wallet(wallet_handle, "indy_store_their_did_works_for_verkey_with_invalid_crypto_type", &wallet_config); } #[test] fn indy_store_their_did_works_twice() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("indy_store_their_did_works_twice"); + let setup = Setup::wallet(); let identity_json = json!({"did": DID}).to_string(); - did::store_their_did(wallet_handle, &identity_json).unwrap(); + did::store_their_did(setup.wallet_handle, &identity_json).unwrap(); - let res = did::store_their_did(wallet_handle, &identity_json); + let res = did::store_their_did(setup.wallet_handle, &identity_json); assert_code!(ErrorCode::WalletItemAlreadyExists, res); - - utils::tear_down_with_wallet(wallet_handle, "indy_store_their_did_works_twice", &wallet_config); } #[test] fn indy_store_their_did_works_for_is_802() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("indy_store_their_did_works_for_is_802"); + let setup = Setup::wallet(); let identity_json = json!({"did": DID, "verkey": VERKEY}).to_string(); // 1. Try 'storeTheirDid' operation with say did1 and verkey1 - did::store_their_did(wallet_handle, &identity_json).unwrap(); + did::store_their_did(setup.wallet_handle, &identity_json).unwrap(); // 2. Repeat above operation (with same did and ver key used in #1) // but this time catch and swallow the exception (it will throw the exception WalletItemAlreadyExistsException) - let res = did::store_their_did(wallet_handle, &identity_json); + let res = did::store_their_did(setup.wallet_handle, &identity_json); assert_code!(ErrorCode::WalletItemAlreadyExists, res); // 3. Then, now if you try 'storeTheirDid' operation // (either with same did and verkey or you can choose different did and verkey), // in IS-802 it fails with error 'Storage error occurred during wallet operation.' - let res = did::store_their_did(wallet_handle, &identity_json); + let res = did::store_their_did(setup.wallet_handle, &identity_json); assert_code!(ErrorCode::WalletItemAlreadyExists, res); - - utils::tear_down_with_wallet(wallet_handle, "indy_store_their_did_works_for_is_802", &wallet_config); } } @@ -861,50 +691,41 @@ mod high_cases { // 1. Create and open pool // 2. Create and open wallet // 3. Generate did from Trustee seed - let (wallet_handle, pool_handle, trustee_did, wallet_config) = utils::setup_trustee("indy_replace_keys_demo"); - // 4. Generate my did - let (my_did, my_verkey) = did::create_my_did(wallet_handle, "{}").unwrap(); - // 5. Send Nym request to Ledger - let nym_request = ledger::build_nym_request(&trustee_did, &my_did, Some(&my_verkey), None, None).unwrap(); - ledger::sign_and_submit_request(pool_handle, wallet_handle, &trustee_did, &nym_request).unwrap(); + let setup = Setup::new_identity(); // 6. Start replacing of keys - let new_verkey = did::replace_keys_start(wallet_handle, &my_did, "{}").unwrap(); + let new_verkey = did::replace_keys_start(setup.wallet_handle, &setup.did, "{}").unwrap(); // 7. Send Nym request to Ledger with new verkey - let nym_request = ledger::build_nym_request(&my_did, &my_did, Some(&new_verkey), None, None).unwrap(); - ledger::sign_and_submit_request(pool_handle, wallet_handle, &my_did, &nym_request).unwrap(); + let nym_request = ledger::build_nym_request(&setup.did, &setup.did, Some(&new_verkey), None, None).unwrap(); + ledger::sign_and_submit_request(setup.pool_handle, setup.wallet_handle, &setup.did, &nym_request).unwrap(); // 8. Send Schema request before apply replacing of keys - let schema_request = ledger::build_schema_request(&my_did, SCHEMA_DATA).unwrap(); - let response = ledger::sign_and_submit_request(pool_handle, wallet_handle, &my_did, &schema_request).unwrap(); + let schema_request = ledger::build_schema_request(&setup.did, SCHEMA_DATA).unwrap(); + let response = ledger::sign_and_submit_request(setup.pool_handle, setup.wallet_handle, &setup.did, &schema_request).unwrap(); pool::check_response_type(&response, ResponseType::REQNACK); // 9. Apply replacing of keys - did::replace_keys_apply(wallet_handle, &my_did).unwrap(); + did::replace_keys_apply(setup.wallet_handle, &setup.did).unwrap(); // 10. Send Schema request - ledger::sign_and_submit_request(pool_handle, wallet_handle, &my_did, &schema_request).unwrap(); - - utils::tear_down_with_wallet_and_pool(wallet_handle, pool_handle, "indy_replace_keys_demo", &wallet_config); + ledger::sign_and_submit_request(setup.pool_handle, setup.wallet_handle, &setup.did, &schema_request).unwrap(); } #[test] fn indy_replace_keys_without_nym_transaction() { - let (wallet_handle, pool_handle, wallet_config) = utils::setup_with_wallet_and_pool("indy_replace_keys_without_nym_transaction"); + let setup = Setup::wallet_and_pool(); - let (my_did, _) = did::create_store_and_publish_my_did_from_trustee(wallet_handle, pool_handle).unwrap(); + let (my_did, _) = did::create_store_and_publish_my_did_from_trustee(setup.wallet_handle, setup.pool_handle).unwrap(); - did::replace_keys_start(wallet_handle, &my_did, "{}").unwrap(); - did::replace_keys_apply(wallet_handle, &my_did).unwrap(); + did::replace_keys_start(setup.wallet_handle, &my_did, "{}").unwrap(); + did::replace_keys_apply(setup.wallet_handle, &my_did).unwrap(); let schema_request = ledger::build_schema_request(&my_did, SCHEMA_DATA).unwrap(); - let response = ledger::sign_and_submit_request(pool_handle, wallet_handle, &my_did, &schema_request).unwrap(); + let response = ledger::sign_and_submit_request(setup.pool_handle, setup.wallet_handle, &my_did, &schema_request).unwrap(); pool::check_response_type(&response, ResponseType::REQNACK); - - utils::tear_down_with_wallet_and_pool(wallet_handle, pool_handle, "indy_replace_keys_without_nym_transaction", &wallet_config); } } @@ -913,28 +734,21 @@ mod high_cases { #[test] fn indy_abbreviate_verkey_works_for_abbr_key() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("indy_abbreviate_verkey_works_for_abbr_key"); - - let (did, verkey) = did::create_my_did(wallet_handle, "{}").unwrap(); + let setup = Setup::did(); - let abbr_verkey = did::abbreviate_verkey(&did, &verkey).unwrap(); - - assert_ne!(verkey, abbr_verkey); - - utils::tear_down_with_wallet(wallet_handle, "indy_abbreviate_verkey_works_for_abbr_key", &wallet_config); + let abbr_verkey = did::abbreviate_verkey(&setup.did, &setup.verkey).unwrap(); + assert_ne!(setup.verkey, abbr_verkey); } #[test] fn indy_abbreviate_verkey_works_for_not_abbr_key() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("indy_abbreviate_verkey_works_for_not_abbr_key"); + let setup = Setup::wallet(); - let (did, verkey) = did::create_my_did(wallet_handle, &format!(r#"{{"did":{:?}}}"#, DID_TRUSTEE)).unwrap(); + let (did, verkey) = did::create_my_did(setup.wallet_handle, &format!(r#"{{"did":{:?}}}"#, DID_TRUSTEE)).unwrap(); let full_verkey = did::abbreviate_verkey(&did, &verkey).unwrap(); assert_eq!(verkey, full_verkey); - - utils::tear_down_with_wallet(wallet_handle, "indy_abbreviate_verkey_works_for_not_abbr_key", &wallet_config); } #[test] diff --git a/libindy/tests/interaction.rs b/libindy/tests/interaction.rs index e5f582e38b..fcd4033e3f 100644 --- a/libindy/tests/interaction.rs +++ b/libindy/tests/interaction.rs @@ -34,6 +34,7 @@ use utils::anoncreds::{COMMON_MASTER_SECRET, CREDENTIAL1_ID}; use utils::anoncreds::{CREDENTIAL2_ID, CREDENTIAL3_ID}; use utils::constants::*; +use utils::Setup; use utils::domain::anoncreds::schema::Schema; use utils::domain::anoncreds::credential_definition::CredentialDefinition; @@ -45,6 +46,7 @@ use utils::domain::anoncreds::proof::Proof; use utils::domain::anoncreds::revocation_state::RevocationState; use utils::domain::anoncreds::revocation_registry::RevocationRegistry; + use std::thread; use serde_json::Value; @@ -197,7 +199,7 @@ impl Issuer { // After that we can create CredentialDefinition for received Schema(not for result of indy_issuer_create_schema) let _schema_response = pool.submit_schema(&self.issuer_did, self.issuer_wallet_handle,&schema_json); - ::std::thread::sleep(::std::time::Duration::from_secs(2)); + ::std::thread::sleep(::std::time::Duration::from_secs(1)); // Issuer gets Schema from Ledger let (_ , schema_json) = pool.get_schema(Some(&self.issuer_did),&schema_id); @@ -541,7 +543,7 @@ fn anoncreds_revocation_interaction_test_issuance_by_default() // the common function for two previous tests fn anoncreds_revocation_interaction_test_one_prover(pool_name: &str, revocation_registry_config: &str) { - utils::setup(pool_name); + Setup::empty(); let pool = Pool::new(pool_name); @@ -580,7 +582,7 @@ fn anoncreds_revocation_interaction_test_one_prover(pool_name: &str, revocation_ ///////////////////////////////////////////////////////////////////////////////////////////////// // Verifying Prover's Credential - thread::sleep(std::time::Duration::from_secs(3)); + thread::sleep(std::time::Duration::from_secs(1)); let to = time::get_time().sec as u64; @@ -615,7 +617,7 @@ fn anoncreds_revocation_interaction_test_one_prover(pool_name: &str, revocation_ let _rev_reg_delta_json = issuer.revoke_credential(&pool, &cred_rev_id ); // Verifying Prover Credential after Revocation - thread::sleep(std::time::Duration::from_secs(3)); + thread::sleep(std::time::Duration::from_secs(1)); let from = to; let to = time::get_time().sec as u64; @@ -630,8 +632,6 @@ fn anoncreds_revocation_interaction_test_one_prover(pool_name: &str, revocation_ prover.close(); pool.close(); - - utils::tear_down(pool_name); } @@ -657,7 +657,7 @@ fn multi_steps_create_revocation_credential(pool : &Pool, issuer: &Issuer, prove #[cfg(any(feature = "force_full_interaction_tests", not(target_os = "android")))] #[test] fn anoncreds_revocation_interaction_test_issuance_by_demand_three_credentials_post_entry_three_times_proving_first() { - utils::setup("anoncreds_4711"); + Setup::empty(); let pool = Pool::new("anoncreds_4711"); @@ -692,7 +692,7 @@ fn anoncreds_revocation_interaction_test_issuance_by_demand_three_credentials_po // Verifying Prover1 Credential - thread::sleep(std::time::Duration::from_secs(3)); + thread::sleep(std::time::Duration::from_secs(1)); let to = time::get_time().sec as u64; @@ -727,15 +727,13 @@ fn anoncreds_revocation_interaction_test_issuance_by_demand_three_credentials_po prover3.close(); pool.close(); - - utils::tear_down("anoncreds_4711"); } #[cfg(feature = "revocation_tests")] #[cfg(any(feature = "force_full_interaction_tests", not(target_os = "android")))] #[test] fn anoncreds_revocation_interaction_test_issuance_by_demand_three_credentials_post_common_entry_proving_all() { - utils::setup("aritibdtcpcepa"); + Setup::empty(); let pool = Pool::new("aritibdtcpcepa"); @@ -779,7 +777,7 @@ fn anoncreds_revocation_interaction_test_issuance_by_demand_three_credentials_po // ledger::sign_and_submit_request(pool_handle, issuer_wallet_handle, &issuer_did, &rev_reg_entry_request).unwrap(); // Verifying Prover1 Credential - thread::sleep(std::time::Duration::from_secs(3)); + thread::sleep(std::time::Duration::from_secs(1)); let to = time::get_time().sec as u64; @@ -827,7 +825,4 @@ fn anoncreds_revocation_interaction_test_issuance_by_demand_three_credentials_po prover3.close(); pool.close(); - - - utils::tear_down("aritibdtcpcepa"); } diff --git a/libindy/tests/ledger.rs b/libindy/tests/ledger.rs index 6be9efa792..97ab4e3fb4 100644 --- a/libindy/tests/ledger.rs +++ b/libindy/tests/ledger.rs @@ -36,6 +36,7 @@ use self::indy::ErrorCode; use utils::{pool, ledger, did, anoncreds}; use utils::types::*; use utils::constants::*; +use utils::Setup; use openssl::hash::{MessageDigest, Hasher}; use sodiumoxide::crypto::secretbox; @@ -53,6 +54,7 @@ use std::collections::HashMap; use std::thread; use api::INVALID_WALLET_HANDLE; +use api::INVALID_POOL_HANDLE; mod high_cases { use super::*; @@ -63,40 +65,34 @@ mod high_cases { #[test] #[cfg(feature = "local_nodes_pool")] fn indy_send_request_works_for_invalid_pool_handle() { - let (wallet_handle, pool_handle, wallet_config) = utils::setup_with_wallet_and_pool("indy_send_request_works_for_invalid_pool_handle"); + Setup::empty(); - let res = ledger::submit_request(pool_handle + 1, REQUEST); + let res = ledger::submit_request(INVALID_POOL_HANDLE, REQUEST); assert_code!(ErrorCode::PoolLedgerInvalidPoolHandle, res); - - utils::tear_down_with_wallet_and_pool(wallet_handle, pool_handle, "indy_send_request_works_for_invalid_pool_handle", &wallet_config); } #[test] #[cfg(feature = "local_nodes_pool")] fn indy_sign_and_submit_request_works_for_invalid_pool_handle() { - let (wallet_handle, pool_handle, trustee_did, wallet_config) = utils::setup_trustee("indy_sign_and_submit_request_works_for_invalid_pool_handle"); + let setup = Setup::trustee(); - let res = ledger::sign_and_submit_request(pool_handle + 1, wallet_handle, &trustee_did, REQUEST); + let res = ledger::sign_and_submit_request(INVALID_POOL_HANDLE, setup.wallet_handle, &setup.did, REQUEST); assert_code!(ErrorCode::PoolLedgerInvalidPoolHandle, res); - - utils::tear_down_with_wallet_and_pool(wallet_handle, pool_handle, "indy_sign_and_submit_request_works_for_invalid_pool_handle", &wallet_config); } #[test] #[cfg(feature = "local_nodes_pool")] fn indy_sign_and_submit_request_works_for_invalid_wallet_handle() { - let (wallet_handle, pool_handle, trustee_did, wallet_config) = utils::setup_trustee("indy_sign_and_submit_request_works_for_invalid_wallet_handle"); + let setup = Setup::trustee(); - let res = ledger::sign_and_submit_request(pool_handle, INVALID_WALLET_HANDLE, &trustee_did, REQUEST); + let res = ledger::sign_and_submit_request(setup.pool_handle, INVALID_WALLET_HANDLE, &setup.did, REQUEST); assert_code!(ErrorCode::WalletInvalidHandle, res); - - utils::tear_down_with_wallet_and_pool(wallet_handle, pool_handle, "indy_sign_and_submit_request_works_for_invalid_wallet_handle", &wallet_config); } #[test] #[cfg(feature = "local_nodes_pool")] fn indy_submit_request_works() { - let pool_handle = utils::setup_with_pool("indy_submit_request_works"); + let setup = Setup::pool(); let request = r#"{ "reqId":1491566332010860, @@ -108,7 +104,7 @@ mod high_cases { "protocolVersion":2, "signature":"4o86XfkiJ4e2r3J6Ufoi17UU3W5Zi9sshV6FjBjkVw4sgEQFQov9dxqDEtLbAJAWffCWd5KfAk164QVo7mYwKkiV"}"#; - let resp = ledger::submit_request(pool_handle, request); + let resp = ledger::submit_request(setup.pool_handle, request); let reply: serde_json::Value = serde_json::from_str(resp.unwrap().as_str()).unwrap(); assert_eq!(reply["op"].as_str().unwrap(), "REPLY"); @@ -123,21 +119,18 @@ mod high_cases { assert_eq!(reply["result"]["identifier"].as_str().unwrap(), "Th7MpTaRZVRYnPiabds81Y"); assert_eq!(reply["result"]["dest"].as_str().unwrap(), "Th7MpTaRZVRYnPiabds81Y"); - - utils::tear_down_with_pool(pool_handle, "indy_submit_request_works"); } #[test] #[cfg(feature = "local_nodes_pool")] fn indy_sign_and_submit_request_works() { - let (wallet_handle, pool_handle, trustee_did, wallet_config) = utils::setup_trustee("indy_sign_and_submit_request_works"); - let (did, _) = did::create_and_store_my_did(wallet_handle, None).unwrap(); + let setup = Setup::trustee(); - let nym_request = ledger::build_nym_request(&trustee_did, &did, None, None, None).unwrap(); - let nym_response = ledger::sign_and_submit_request(pool_handle, wallet_handle, &trustee_did, &nym_request).unwrap(); - pool::check_response_type(&nym_response, ResponseType::REPLY); + let (did, _) = did::create_and_store_my_did(setup.wallet_handle, None).unwrap(); - utils::tear_down_with_wallet_and_pool(wallet_handle, pool_handle, "indy_sign_and_submit_request_works", &wallet_config); + let nym_request = ledger::build_nym_request(&setup.did, &did, None, None, None).unwrap(); + let nym_response = ledger::sign_and_submit_request(setup.pool_handle, setup.wallet_handle, &setup.did, &nym_request).unwrap(); + pool::check_response_type(&nym_response, ResponseType::REPLY); } } @@ -147,82 +140,70 @@ mod high_cases { #[test] #[cfg(feature = "local_nodes_pool")] fn indy_submit_action_works_for_pool_restart() { - let (wallet_handle, pool_handle, trustee_did, wallet_config) = utils::setup_trustee("indy_submit_action_works_for_pool_restart"); + let setup = Setup::trustee(); - let pool_request_request = ledger::build_pool_restart_request(DID_TRUSTEE, "start", None).unwrap(); - let pool_request_request = ledger::sign_request(wallet_handle, &trustee_did, &pool_request_request).unwrap(); - ledger::submit_action(pool_handle, &pool_request_request, None, None).unwrap(); - - utils::tear_down_with_wallet_and_pool(wallet_handle, pool_handle, "indy_submit_action_works_for_pool_restart", &wallet_config); + let pool_request_request = ledger::build_pool_restart_request(&setup.did, "start", None).unwrap(); + let pool_request_request = ledger::sign_request(setup.wallet_handle, &setup.did, &pool_request_request).unwrap(); + ledger::submit_action(setup.pool_handle, &pool_request_request, None, None).unwrap(); } #[test] #[cfg(feature = "local_nodes_pool")] fn indy_submit_action_works_for_validator_info() { - let (wallet_handle, pool_handle, trustee_did, wallet_config) = utils::setup_trustee("indy_submit_action_works_for_validator_info"); - - let get_validator_info_request = ledger::build_get_validator_info_request(&trustee_did).unwrap(); - let get_validator_info_request = ledger::sign_request(wallet_handle, &trustee_did, &get_validator_info_request).unwrap(); - ledger::submit_action(pool_handle, &get_validator_info_request, None, None).unwrap(); + let setup = Setup::trustee(); - utils::tear_down_with_wallet_and_pool(wallet_handle, pool_handle, "indy_submit_action_works_for_validator_info", &wallet_config); + let get_validator_info_request = ledger::build_get_validator_info_request(&setup.did).unwrap(); + let get_validator_info_request = ledger::sign_request(setup.wallet_handle, &setup.did, &get_validator_info_request).unwrap(); + ledger::submit_action(setup.pool_handle, &get_validator_info_request, None, None).unwrap(); } #[test] #[cfg(feature = "local_nodes_pool")] fn indy_submit_action_works_for_not_supported_request_type() { - let (wallet_handle, pool_handle, trustee_did, wallet_config) = utils::setup_trustee("indy_submit_action_works_for_not_supported_request_type"); + let setup = Setup::trustee(); - let get_nym_request = ledger::build_get_nym_request(Some(&trustee_did), &trustee_did).unwrap(); - let res = ledger::submit_action(pool_handle, &get_nym_request, None, None); + let get_nym_request = ledger::build_get_nym_request(Some(&setup.did), &setup.did).unwrap(); + let res = ledger::submit_action(setup.pool_handle, &get_nym_request, None, None); assert_code!(ErrorCode::CommonInvalidStructure, res); - - utils::tear_down_with_wallet_and_pool(wallet_handle, pool_handle, "indy_submit_action_works_for_not_supported_request_type", &wallet_config); } #[test] #[cfg(feature = "local_nodes_pool")] fn indy_submit_action_works_for_pool_restart_for_invalid_pool_handle() { - let (wallet_handle, pool_handle, trustee_did, wallet_config) = utils::setup_trustee("indy_submit_action_works_for_pool_restart_for_invalid_pool_handle"); + let setup = Setup::did(); - let get_validator_info_request = ledger::build_get_validator_info_request(&trustee_did).unwrap(); - let get_validator_info_request = ledger::sign_request(wallet_handle, &trustee_did, &get_validator_info_request).unwrap(); + let get_validator_info_request = ledger::build_get_validator_info_request(&setup.did).unwrap(); + let get_validator_info_request = ledger::sign_request(setup.wallet_handle, &setup.did, &get_validator_info_request).unwrap(); - let res = ledger::submit_action(pool_handle + 1, &get_validator_info_request, None, None); + let res = ledger::submit_action(INVALID_POOL_HANDLE, &get_validator_info_request, None, None); assert_code!(ErrorCode::PoolLedgerInvalidPoolHandle, res); - - utils::tear_down_with_wallet_and_pool(wallet_handle, pool_handle, "indy_submit_action_works_for_pool_restart_for_invalid_pool_handle", &wallet_config); } #[test] #[cfg(feature = "local_nodes_pool")] fn indy_submit_action_works_for_list_nodes() { - let (wallet_handle, pool_handle, trustee_did, wallet_config) = utils::setup_trustee("indy_submit_action_works_for_list_nodes"); + let setup = Setup::trustee(); - let get_validator_info_request = ledger::build_get_validator_info_request(&trustee_did).unwrap(); - let get_validator_info_request = ledger::sign_request(wallet_handle, &trustee_did, &get_validator_info_request).unwrap(); + let get_validator_info_request = ledger::build_get_validator_info_request(&setup.did).unwrap(); + let get_validator_info_request = ledger::sign_request(setup.wallet_handle, &setup.did, &get_validator_info_request).unwrap(); let nodes = r#"["Node1", "Node2"]"#; - let response = ledger::submit_action(pool_handle, &get_validator_info_request, Some(nodes), None).unwrap(); + let response = ledger::submit_action(setup.pool_handle, &get_validator_info_request, Some(nodes), None).unwrap(); let responses: HashMap = serde_json::from_str(&response).unwrap(); assert_eq!(2, responses.len()); assert!(responses.contains_key("Node1")); assert!(responses.contains_key("Node2")); - - utils::tear_down_with_wallet_and_pool(wallet_handle, pool_handle, "indy_submit_action_works_for_list_nodes", &wallet_config); } #[test] #[cfg(feature = "local_nodes_pool")] fn indy_submit_action_works_for_timeout() { - let (wallet_handle, pool_handle, trustee_did, wallet_config) = utils::setup_trustee("indy_submit_action_works_for_timeout"); - - let get_validator_info_request = ledger::build_get_validator_info_request(&trustee_did).unwrap(); - let get_validator_info_request = ledger::sign_request(wallet_handle, &trustee_did, &get_validator_info_request).unwrap(); - ledger::submit_action(pool_handle, &get_validator_info_request, None, Some(100)).unwrap(); + let setup = Setup::trustee(); - utils::tear_down_with_wallet_and_pool(wallet_handle, pool_handle, "indy_submit_action_works_for_timeout", &wallet_config); + let get_validator_info_request = ledger::build_get_validator_info_request(&setup.did).unwrap(); + let get_validator_info_request = ledger::sign_request(setup.wallet_handle, &setup.did, &get_validator_info_request).unwrap(); + ledger::submit_action(setup.pool_handle, &get_validator_info_request, None, Some(100)).unwrap(); } } @@ -231,43 +212,37 @@ mod high_cases { #[test] fn indy_sign_request_works() { - let (wallet_handle, pool_handle, trustee_did, wallet_config) = utils::setup_trustee("indy_sign_request_works"); + let setup = Setup::wallet(); - let request = ledger::sign_request(wallet_handle, &trustee_did, REQUEST).unwrap(); + let (did, _) = did::create_and_store_my_did(setup.wallet_handle, Some(TRUSTEE_SEED)).unwrap(); + + let request = ledger::sign_request(setup.wallet_handle, &did, REQUEST).unwrap(); let request: serde_json::Value = serde_json::from_str(&request).unwrap(); assert_eq!(request["signature"].as_str().unwrap(), "65hzs4nsdQsTUqLCLy2qisbKLfwYKZSWoyh1C6CU59p5pfG3EHQXGAsjW4Qw4QdwkrvjSgQuyv8qyABcXRBznFKW"); - - utils::tear_down_with_wallet_and_pool(wallet_handle, pool_handle, "indy_sign_request_works", &wallet_config); } #[test] fn indy_sign_works_for_unknown_signer() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("indy_sign_works_for_unknown_signer"); + let setup = Setup::wallet(); - let res = ledger::sign_request(wallet_handle, DID, REQUEST); + let res = ledger::sign_request(setup.wallet_handle, DID, REQUEST); assert_code!(ErrorCode::WalletItemNotFound, res); - - utils::tear_down_with_wallet(wallet_handle, "indy_sign_works_for_unknown_signer", &wallet_config); } #[test] fn indy_sign_request_works_for_invalid_message_format() { - let (wallet_handle, my_did, wallet_config) = utils::setup_did("indy_sign_request_works_for_invalid_message_format"); + let setup = Setup::did(); - let res = ledger::sign_request(wallet_handle, &my_did, "1495034346617224651"); + let res = ledger::sign_request(setup.wallet_handle, &setup.did, "1495034346617224651"); assert_code!(ErrorCode::CommonInvalidStructure, res); - - utils::tear_down_with_wallet(wallet_handle, "indy_sign_request_works_for_invalid_message_format", &wallet_config); } #[test] fn indy_sign_request_works_for_invalid_handle() { - let (wallet_handle, my_did, wallet_config) = utils::setup_did("indy_sign_request_works_for_invalid_handle"); + Setup::empty(); - let res = ledger::sign_request(INVALID_WALLET_HANDLE, &my_did, MESSAGE); + let res = ledger::sign_request(INVALID_WALLET_HANDLE, DID, MESSAGE); assert_code!(ErrorCode::WalletInvalidHandle, res); - - utils::tear_down_with_wallet(wallet_handle, "indy_sign_request_works_for_invalid_handle", &wallet_config); } } @@ -276,32 +251,30 @@ mod high_cases { #[test] fn indy_multi_sign_request_works() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("indy_multi_sign_request_works"); + let setup = Setup::wallet(); - let (did, _) = did::create_and_store_my_did(wallet_handle, Some(TRUSTEE_SEED)).unwrap(); - let (did2, _) = did::create_and_store_my_did(wallet_handle, Some(MY1_SEED)).unwrap(); + let (did1, _) = did::create_and_store_my_did(setup.wallet_handle, Some(TRUSTEE_SEED)).unwrap(); + let (did2, _) = did::create_and_store_my_did(setup.wallet_handle, Some(MY1_SEED)).unwrap(); - let message = ledger::multi_sign_request(wallet_handle, &did, REQUEST).unwrap(); - let message = ledger::multi_sign_request(wallet_handle, &did2, &message).unwrap(); + let message = ledger::multi_sign_request(setup.wallet_handle, &did1, REQUEST).unwrap(); + let message = ledger::multi_sign_request(setup.wallet_handle, &did2, &message).unwrap(); let msg: serde_json::Value = serde_json::from_str(&message).unwrap(); let signatures = msg["signatures"].as_object().unwrap(); assert_eq!(signatures[DID_TRUSTEE], r#"65hzs4nsdQsTUqLCLy2qisbKLfwYKZSWoyh1C6CU59p5pfG3EHQXGAsjW4Qw4QdwkrvjSgQuyv8qyABcXRBznFKW"#); assert_eq!(signatures[DID_MY1], r#"49aXkbrtTE3e522AefE76J51WzUiakw3ZbxxWzf44cv7RS21n8mMr4vJzi4TymuqDupzCz7wEtuGz6rA94Y73kKR"#); - - utils::tear_down_with_wallet(wallet_handle, "indy_multi_sign_request_works", &wallet_config); } #[test] fn indy_multi_sign_request_works_for_start_from_single_signature() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("indy_multi_sign_request_works_for_start_from_single_signature"); + let setup = Setup::wallet(); - let (did, _) = did::create_and_store_my_did(wallet_handle, Some(TRUSTEE_SEED)).unwrap(); - let (did2, _) = did::create_and_store_my_did(wallet_handle, Some(MY1_SEED)).unwrap(); + let (did, _) = did::create_and_store_my_did(setup.wallet_handle, Some(TRUSTEE_SEED)).unwrap(); + let (did2, _) = did::create_and_store_my_did(setup.wallet_handle, Some(MY1_SEED)).unwrap(); - let message = ledger::sign_request(wallet_handle, &did, REQUEST_FROM_TRUSTEE).unwrap(); - let message = ledger::multi_sign_request(wallet_handle, &did2, &message).unwrap(); + let message = ledger::sign_request(setup.wallet_handle, &did, REQUEST_FROM_TRUSTEE).unwrap(); + let message = ledger::multi_sign_request(setup.wallet_handle, &did2, &message).unwrap(); let msg: serde_json::Value = serde_json::from_str(&message).unwrap(); let signatures = msg["signatures"].as_object().unwrap(); @@ -309,45 +282,37 @@ mod high_cases { assert!(!msg.as_object().unwrap().contains_key("signature")); assert_eq!(signatures[DID_TRUSTEE], r#"3YnLxoUd4utFLzeXUkeGefAqAdHUD7rBprpSx2CJeH7gRYnyjkgJi7tCnFgUiMo62k6M2AyUDtJrkUSgHfcq3vua"#); assert_eq!(signatures[DID_MY1], r#"4EyvSFPoeQCJLziGVqjuMxrbuoWjAWUGPd6LdxeZuG9w3Bcbt7cSvhjrv8SX5e8mGf8jrf3K6xd9kEhXsQLqUg45"#); - - utils::tear_down_with_wallet(wallet_handle, "indy_multi_sign_request_works_for_start_from_single_signature", &wallet_config); } #[test] fn indy_multi_sign_request_works_for_unknown_signer() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("indy_multi_sign_request_works_for_unknown_signer"); + let setup = Setup::wallet(); - let res = ledger::multi_sign_request(wallet_handle, DID, REQUEST); + let res = ledger::multi_sign_request(setup.wallet_handle, DID, REQUEST); assert_code!(ErrorCode::WalletItemNotFound, res); - - utils::tear_down_with_wallet(wallet_handle, "indy_multi_sign_request_works_for_unknown_signer", &wallet_config); } #[test] fn indy_multi_sign_request_works_for_invalid_message_format() { - let (wallet_handle, my_did, wallet_config) = utils::setup_did("indy_multi_sign_request_works_for_invalid_message_format"); + let setup = Setup::did(); - let res = ledger::multi_sign_request(wallet_handle, &my_did, "1495034346617224651"); + let res = ledger::multi_sign_request(setup.wallet_handle, &setup.did, "1495034346617224651"); assert_code!(ErrorCode::CommonInvalidStructure, res); - - utils::tear_down_with_wallet(wallet_handle, "indy_multi_sign_request_works_for_invalid_message_format", &wallet_config); } #[test] fn indy_multi_sign_request_works_for_twice_use_same_did() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("indy_multi_sign_request_works_for_twice_use_same_did"); + let setup = Setup::wallet(); - let (did, _) = did::create_and_store_my_did(wallet_handle, Some(MY1_SEED)).unwrap(); + let (did, _) = did::create_and_store_my_did(setup.wallet_handle, Some(MY1_SEED)).unwrap(); - let message = ledger::multi_sign_request(wallet_handle, &did, REQUEST).unwrap(); - let message = ledger::multi_sign_request(wallet_handle, &did, &message).unwrap(); + let message = ledger::multi_sign_request(setup.wallet_handle, &did, REQUEST).unwrap(); + let message = ledger::multi_sign_request(setup.wallet_handle, &did, &message).unwrap(); let msg: serde_json::Value = serde_json::from_str(&message).unwrap(); let signatures = msg["signatures"].as_object().unwrap(); assert_eq!(1, signatures.len()); assert_eq!(signatures[DID_MY1], r#"49aXkbrtTE3e522AefE76J51WzUiakw3ZbxxWzf44cv7RS21n8mMr4vJzi4TymuqDupzCz7wEtuGz6rA94Y73kKR"#); - - utils::tear_down_with_wallet(wallet_handle, "indy_multi_sign_request_works_for_twice_use_same_did", &wallet_config); } } @@ -420,60 +385,52 @@ mod high_cases { #[test] #[cfg(feature = "local_nodes_pool")] fn indy_nym_request_works_without_signature() { - let (wallet_handle, pool_handle, trustee_did, wallet_config) = utils::setup_trustee("indy_nym_request_works_without_signature"); + let setup = Setup::trustee(); - let (did, _) = did::create_and_store_my_did(wallet_handle, None).unwrap(); - let nym_request = ledger::build_nym_request(&trustee_did, &did, None, None, None).unwrap(); - let response = ledger::submit_request(pool_handle, &nym_request).unwrap(); + let (did, _) = did::create_and_store_my_did(setup.wallet_handle, None).unwrap(); + let nym_request = ledger::build_nym_request(&setup.did, &did, None, None, None).unwrap(); + let response = ledger::submit_request(setup.pool_handle, &nym_request).unwrap(); pool::check_response_type(&response, ResponseType::REQNACK); - - utils::tear_down_with_wallet_and_pool(wallet_handle, pool_handle, "indy_nym_request_works_without_signature", &wallet_config); } #[test] #[cfg(feature = "local_nodes_pool")] fn indy_send_get_nym_request_works() { - let (wallet_handle, pool_handle, trustee_did, wallet_config) = utils::setup_trustee("indy_send_get_nym_request_works"); + let setup = Setup::trustee(); - let get_nym_request = ledger::build_get_nym_request(Some(&trustee_did), &trustee_did).unwrap(); - let get_nym_response = ledger::submit_request(pool_handle, &get_nym_request).unwrap(); + let get_nym_request = ledger::build_get_nym_request(Some(&setup.did), &setup.did).unwrap(); + let get_nym_response = ledger::submit_request(setup.pool_handle, &get_nym_request).unwrap(); let get_nym_response: Reply = serde_json::from_str(&get_nym_response).unwrap(); assert!(get_nym_response.result.data.is_some()); - - utils::tear_down_with_wallet_and_pool(wallet_handle, pool_handle, "indy_send_get_nym_request_works", &wallet_config); } #[test] #[cfg(feature = "local_nodes_pool")] fn indy_send_get_nym_request_works_default_submitter_did() { - let (wallet_handle, pool_handle, wallet_config) = utils::setup_with_wallet_and_pool("indy_send_get_nym_request_works_default_submitter_did"); + let setup = Setup::trustee(); let get_nym_request = ledger::build_get_nym_request(None, DID_TRUSTEE).unwrap(); - let get_nym_response = ledger::submit_request(pool_handle, &get_nym_request).unwrap(); + let get_nym_response = ledger::submit_request(setup.pool_handle, &get_nym_request).unwrap(); let get_nym_response: Reply = serde_json::from_str(&get_nym_response).unwrap(); assert!(get_nym_response.result.data.is_some()); - - utils::tear_down_with_wallet_and_pool(wallet_handle, pool_handle, "indy_send_get_nym_request_works_default_submitter_did", &wallet_config); } #[test] #[cfg(feature = "local_nodes_pool")] fn indy_nym_requests_works() { - let (wallet_handle, pool_handle, trustee_did, wallet_config) = utils::setup_trustee("indy_nym_requests_works"); + let setup = Setup::trustee(); - let (my_did, my_verkey) = did::create_and_store_my_did(wallet_handle, None).unwrap(); + let (my_did, my_verkey) = did::create_and_store_my_did(setup.wallet_handle, None).unwrap(); - let nym_request = ledger::build_nym_request(&trustee_did, &my_did, Some(&my_verkey), None, None).unwrap(); - let nym_resp = ledger::sign_and_submit_request(pool_handle, wallet_handle, &trustee_did, &nym_request).unwrap(); + let nym_request = ledger::build_nym_request(&setup.did, &my_did, Some(&my_verkey), None, None).unwrap(); + let nym_resp = ledger::sign_and_submit_request(setup.pool_handle, setup.wallet_handle, &setup.did, &nym_request).unwrap(); pool::check_response_type(&nym_resp, ResponseType::REPLY); let get_nym_request = ledger::build_get_nym_request(Some(&my_did), &my_did).unwrap(); - let get_nym_response = ledger::submit_request_with_retries(pool_handle, &get_nym_request, &nym_resp).unwrap(); + let get_nym_response = ledger::submit_request_with_retries(setup.pool_handle, &get_nym_request, &nym_resp).unwrap(); let get_nym_response: Reply = serde_json::from_str(&get_nym_response).unwrap(); assert!(get_nym_response.result.data.is_some()); - - utils::tear_down_with_wallet_and_pool(wallet_handle, pool_handle, "indy_nym_requests_works", &wallet_config); } } @@ -577,109 +534,99 @@ mod high_cases { #[test] #[cfg(feature = "local_nodes_pool")] fn indy_attrib_request_works_without_signature() { - let (wallet_handle, pool_handle, trustee_did, wallet_config) = utils::setup_trustee("indy_attrib_request_works_without_signature"); + let setup = Setup::trustee(); - let attrib_request = ledger::build_attrib_request(&trustee_did, &trustee_did, None, Some(ATTRIB_RAW_DATA), None).unwrap(); - let response = ledger::submit_request(pool_handle, &attrib_request).unwrap(); + let attrib_request = ledger::build_attrib_request(&setup.did, &setup.did, None, Some(ATTRIB_RAW_DATA), None).unwrap(); + let response = ledger::submit_request(setup.pool_handle, &attrib_request).unwrap(); pool::check_response_type(&response, ResponseType::REQNACK); - - utils::tear_down_with_wallet_and_pool(wallet_handle, pool_handle, "indy_attrib_request_works_without_signature", &wallet_config); } #[test] #[cfg(feature = "local_nodes_pool")] fn indy_attrib_requests_works_for_raw_value() { - let (wallet_handle, pool_handle, did, _my_vk, wallet_config) = utils::setup_new_identity("indy_attrib_requests_works_for_raw_value"); + let setup = Setup::new_identity(); - let attrib_request = ledger::build_attrib_request(&did, - &did, + let attrib_request = ledger::build_attrib_request(&setup.did, + &setup.did, None, Some(ATTRIB_RAW_DATA), None).unwrap(); - let attrib_req_resp = ledger::sign_and_submit_request(pool_handle, wallet_handle, &did, &attrib_request).unwrap(); + let attrib_req_resp = ledger::sign_and_submit_request(setup.pool_handle, setup.wallet_handle, &setup.did, &attrib_request).unwrap(); pool::check_response_type(&attrib_req_resp, ResponseType::REPLY); - let get_attrib_request = ledger::build_get_attrib_request(Some(&did), &did, Some("endpoint"), None, None).unwrap(); - let get_attrib_response = ledger::submit_request_with_retries(pool_handle, &get_attrib_request, &attrib_req_resp).unwrap(); + let get_attrib_request = ledger::build_get_attrib_request(Some(&setup.did), &setup.did, Some("endpoint"), None, None).unwrap(); + let get_attrib_response = ledger::submit_request_with_retries(setup.pool_handle, &get_attrib_request, &attrib_req_resp).unwrap(); let get_attrib_response: Reply = serde_json::from_str(&get_attrib_response).unwrap(); assert_eq!(get_attrib_response.result.data.unwrap().as_str(), ATTRIB_RAW_DATA); - - utils::tear_down_with_wallet_and_pool(wallet_handle, pool_handle, "indy_attrib_requests_works_for_raw_value", &wallet_config); } #[test] #[cfg(feature = "local_nodes_pool")] fn indy_attrib_requests_works_for_hash_value() { - let (wallet_handle, pool_handle, did, _my_vk, wallet_config) = utils::setup_new_identity("indy_attrib_requests_works_for_hash_value"); + let setup = Setup::new_identity(); let mut ctx = Hasher::new(MessageDigest::sha256()).unwrap(); ctx.update(&ATTRIB_RAW_DATA.as_bytes()).unwrap(); let hashed_attr = hex::encode(ctx.finish().unwrap().as_ref()); - let attrib_request = ledger::build_attrib_request(&did, - &did, + let attrib_request = ledger::build_attrib_request(&setup.did, + &setup.did, Some(&hashed_attr), None, None).unwrap(); - let attrib_req_resp = ledger::sign_and_submit_request(pool_handle, wallet_handle, &did, &attrib_request).unwrap(); + let attrib_req_resp = ledger::sign_and_submit_request(setup.pool_handle, setup.wallet_handle, &setup.did, &attrib_request).unwrap(); pool::check_response_type(&attrib_req_resp, ResponseType::REPLY); - let get_attrib_request = ledger::build_get_attrib_request(Some(&did), &did, None, Some(&hashed_attr), None).unwrap(); - let get_attrib_response = ledger::submit_request_with_retries(pool_handle, &get_attrib_request, &attrib_req_resp).unwrap(); + let get_attrib_request = ledger::build_get_attrib_request(Some(&setup.did), &setup.did, None, Some(&hashed_attr), None).unwrap(); + let get_attrib_response = ledger::submit_request_with_retries(setup.pool_handle, &get_attrib_request, &attrib_req_resp).unwrap(); let get_attrib_response: Reply = serde_json::from_str(&get_attrib_response).unwrap(); assert_eq!(get_attrib_response.result.data.unwrap().as_str(), hashed_attr.as_str()); - - utils::tear_down_with_wallet_and_pool(wallet_handle, pool_handle, "indy_attrib_requests_works_for_hash_value", &wallet_config); } #[test] #[cfg(feature = "local_nodes_pool")] fn indy_attrib_requests_works_for_encrypted_value() { - let (wallet_handle, pool_handle, did, _my_vk, wallet_config) = utils::setup_new_identity("indy_attrib_requests_works_for_encrypted_value"); + let setup = Setup::new_identity(); let key = secretbox::gen_key(); let nonce = secretbox::gen_nonce(); let encryted_attr = hex::encode(secretbox::seal(&ATTRIB_RAW_DATA.as_bytes(), &nonce, &key)); - let attrib_request = ledger::build_attrib_request(&did, - &did, + let attrib_request = ledger::build_attrib_request(&setup.did, + &setup.did, None, None, Some(&encryted_attr)).unwrap(); - let attrib_req_resp = ledger::sign_and_submit_request(pool_handle, wallet_handle, &did, &attrib_request).unwrap(); + let attrib_req_resp = ledger::sign_and_submit_request(setup.pool_handle, setup.wallet_handle, &setup.did, &attrib_request).unwrap(); pool::check_response_type(&attrib_req_resp, ResponseType::REPLY); - let get_attrib_request = ledger::build_get_attrib_request(Some(&did), &did, None, None, Some(&encryted_attr)).unwrap(); - let get_attrib_response = ledger::submit_request_with_retries(pool_handle, &get_attrib_request, &attrib_req_resp).unwrap(); + let get_attrib_request = ledger::build_get_attrib_request(Some(&setup.did), &setup.did, None, None, Some(&encryted_attr)).unwrap(); + let get_attrib_response = ledger::submit_request_with_retries(setup.pool_handle, &get_attrib_request, &attrib_req_resp).unwrap(); let get_attrib_response: Reply = serde_json::from_str(&get_attrib_response).unwrap(); assert_eq!(get_attrib_response.result.data.unwrap().as_str(), encryted_attr.as_str()); - - utils::tear_down_with_wallet_and_pool(wallet_handle, pool_handle, "indy_attrib_requests_works_for_encrypted_value", &wallet_config); } #[test] #[cfg(feature = "local_nodes_pool")] fn indy_get_attrib_requests_works_for_default_submitter_did() { - let (wallet_handle, pool_handle, did, _my_vk, wallet_config) = utils::setup_new_identity("indy_get_attrib_requests_works_for_default_submitter_did"); + let setup = Setup::new_identity(); - let attrib_request = ledger::build_attrib_request(&did, - &did, + let attrib_request = ledger::build_attrib_request(&setup.did, + &setup.did, None, Some(ATTRIB_RAW_DATA), None).unwrap(); - let attrib_req_resp = ledger::sign_and_submit_request(pool_handle, wallet_handle, &did, &attrib_request).unwrap(); + let attrib_req_resp = ledger::sign_and_submit_request(setup.pool_handle, setup.wallet_handle, &setup.did, &attrib_request).unwrap(); pool::check_response_type(&attrib_req_resp, ResponseType::REPLY); - let get_attrib_request = ledger::build_get_attrib_request(None, &did, Some("endpoint"), None, None).unwrap(); - let get_attrib_response = ledger::submit_request_with_retries(pool_handle, &get_attrib_request, &attrib_req_resp).unwrap(); + let get_attrib_request = ledger::build_get_attrib_request(None, &setup.did, Some("endpoint"), None, None).unwrap(); + let get_attrib_response = ledger::submit_request_with_retries(setup.pool_handle, &get_attrib_request, &attrib_req_resp).unwrap(); let get_attrib_response: Reply = serde_json::from_str(&get_attrib_response).unwrap(); assert_eq!(get_attrib_response.result.data.unwrap().as_str(), ATTRIB_RAW_DATA); - - utils::tear_down_with_wallet_and_pool(wallet_handle, pool_handle, "indy_get_attrib_requests_works_for_default_submitter_did", &wallet_config); } } @@ -728,45 +675,39 @@ mod high_cases { #[test] #[cfg(feature = "local_nodes_pool")] fn indy_schema_request_works_without_signature() { - let (wallet_handle, pool_handle, wallet_config) = utils::setup_with_wallet_and_pool("indy_schema_request_works_without_signature"); + let setup = Setup::trustee(); - let schema_request = ledger::build_schema_request(&DID_TRUSTEE, SCHEMA_DATA).unwrap(); - let response = ledger::submit_request(pool_handle, &schema_request).unwrap(); + let schema_request = ledger::build_schema_request(&setup.did, SCHEMA_DATA).unwrap(); + let response = ledger::submit_request(setup.pool_handle, &schema_request).unwrap(); pool::check_response_type(&response, ResponseType::REQNACK); - - utils::tear_down_with_wallet_and_pool(wallet_handle, pool_handle, "indy_schema_request_works_without_signature", &wallet_config); } #[test] #[cfg(feature = "local_nodes_pool")] fn indy_schema_requests_works() { - let (wallet_handle, pool_handle, wallet_config) = utils::setup_with_wallet_and_pool("indy_schema_requests_works"); + let setup = Setup::pool(); let (schema_id, _, _) = ledger::post_entities(); let get_schema_request = ledger::build_get_schema_request(Some(DID_MY1), &schema_id).unwrap(); - let get_schema_response = ledger::submit_request(pool_handle, &get_schema_request).unwrap(); + let get_schema_response = ledger::submit_request(setup.pool_handle, &get_schema_request).unwrap(); let (_, schema_json) = ledger::parse_get_schema_response(&get_schema_response).unwrap(); let _schema: SchemaV1 = serde_json::from_str(&schema_json).unwrap(); - - utils::tear_down_with_wallet_and_pool(wallet_handle, pool_handle, "indy_schema_requests_works", &wallet_config); } #[test] #[cfg(feature = "local_nodes_pool")] fn indy_get_schema_requests_works_for_default_submitter_did() { - let (wallet_handle, pool_handle, wallet_config) = utils::setup_with_wallet_and_pool("indy_get_schema_requests_works_for_default_submitter_did"); + let setup = Setup::pool(); let (schema_id, _, _) = ledger::post_entities(); let get_schema_request = ledger::build_get_schema_request(None, &schema_id).unwrap(); - let get_schema_response = ledger::submit_request(pool_handle, &get_schema_request).unwrap(); + let get_schema_response = ledger::submit_request(setup.pool_handle, &get_schema_request).unwrap(); let (_, schema_json) = ledger::parse_get_schema_response(&get_schema_response).unwrap(); let _schema: SchemaV1 = serde_json::from_str(&schema_json).unwrap(); - - utils::tear_down_with_wallet_and_pool(wallet_handle, pool_handle, "indy_get_schema_requests_works_for_default_submitter_did", &wallet_config); } } @@ -797,30 +738,26 @@ mod high_cases { #[test] #[cfg(feature = "local_nodes_pool")] fn indy_send_node_request_works_without_signature() { - let (wallet_handle, pool_handle, did, wallet_config) = utils::setup_steward("indy_send_node_request_works_without_signature"); + let setup = Setup::steward(); - let node_request = ledger::build_node_request(&did, &did, NODE_DATA).unwrap(); - let response = ledger::submit_request(pool_handle, &node_request).unwrap(); + let node_request = ledger::build_node_request(&setup.did, &setup.did, NODE_DATA).unwrap(); + let response = ledger::submit_request(setup.pool_handle, &node_request).unwrap(); pool::check_response_type(&response, ResponseType::REQNACK); - - utils::tear_down_with_wallet_and_pool(wallet_handle, pool_handle, "indy_send_node_request_works_without_signature", &wallet_config); } #[test] #[cfg(feature = "local_nodes_pool")] #[ignore] //FIXME currently unstable pool behaviour after new non-existing node was added fn indy_submit_node_request_works_for_new_steward() { - let (wallet_handle, pool_handle, wallet_config) = utils::setup_with_wallet_and_pool("indy_submit_node_request_works_for_new_steward"); + let setup = Setup::wallet_and_pool(); - let (my_did, _) = did::create_store_and_publish_my_did_from_steward(wallet_handle, pool_handle).unwrap(); + let (my_did, _) = did::create_store_and_publish_my_did_from_steward(setup.wallet_handle, setup.pool_handle).unwrap(); let dest = "A5iWQVT3k8Zo9nXj4otmeqaUziPQPCiDqcydXkAJBk1Y"; // random(32) and base58 let node_request = ledger::build_node_request(&my_did, dest, NODE_DATA).unwrap(); - let response = ledger::sign_and_submit_request(pool_handle, wallet_handle, &my_did, &node_request).unwrap(); + let response = ledger::sign_and_submit_request(setup.pool_handle, setup.wallet_handle, &my_did, &node_request).unwrap(); pool::check_response_type(&response, ResponseType::REPLY); - - utils::tear_down_with_wallet_and_pool(wallet_handle, pool_handle, "indy_submit_node_request_works_for_new_steward", &wallet_config); } } @@ -897,47 +834,39 @@ mod high_cases { #[test] #[cfg(feature = "local_nodes_pool")] fn indy_cred_def_request_works_without_signature() { - let (wallet_handle, pool_handle, wallet_config) = utils::setup_with_wallet_and_pool("indy_cred_def_request_works_without_signature"); - - let (did, _) = did::create_store_and_publish_my_did_from_trustee(wallet_handle, pool_handle).unwrap(); + let setup = Setup::trustee(); - let cred_def_request = ledger::build_cred_def_txn(&did, &anoncreds::credential_def_json()).unwrap(); - let response = ledger::submit_request(pool_handle, &cred_def_request).unwrap(); + let cred_def_request = ledger::build_cred_def_txn(&setup.did, &anoncreds::credential_def_json()).unwrap(); + let response = ledger::submit_request(setup.pool_handle, &cred_def_request).unwrap(); pool::check_response_type(&response, ResponseType::REQNACK); - - utils::tear_down_with_wallet_and_pool(wallet_handle, pool_handle, "indy_cred_def_request_works_without_signature", &wallet_config); } #[test] #[cfg(feature = "local_nodes_pool")] fn indy_cred_def_requests_works() { - let (wallet_handle, pool_handle, wallet_config) = utils::setup_with_wallet_and_pool("indy_cred_def_requests_works"); + let setup = Setup::pool(); let (_, cred_def_id, _) = ledger::post_entities(); let get_cred_def_request = ledger::build_get_cred_def_request(Some(DID_MY1), &cred_def_id).unwrap(); - let get_cred_def_response = ledger::submit_request(pool_handle, &get_cred_def_request).unwrap(); + let get_cred_def_response = ledger::submit_request(setup.pool_handle, &get_cred_def_request).unwrap(); let (_, cred_def_json) = ledger::parse_get_cred_def_response(&get_cred_def_response).unwrap(); let _cred_def: CredentialDefinitionV1 = serde_json::from_str(&cred_def_json).unwrap(); - - utils::tear_down_with_wallet_and_pool(wallet_handle, pool_handle, "indy_cred_def_requests_works", &wallet_config); } #[test] #[cfg(feature = "local_nodes_pool")] fn indy_get_cred_def_requests_works_for_default_submitter_did() { - let (wallet_handle, pool_handle, wallet_config) = utils::setup_with_wallet_and_pool("indy_get_cred_def_requests_works_for_default_submitter_did"); + let setup = Setup::pool(); let (_, cred_def_id, _) = ledger::post_entities(); let get_cred_def_request = ledger::build_get_cred_def_request(None, &cred_def_id).unwrap(); - let get_cred_def_response = ledger::submit_request(pool_handle, &get_cred_def_request).unwrap(); + let get_cred_def_response = ledger::submit_request(setup.pool_handle, &get_cred_def_request).unwrap(); let (_, cred_def_json) = ledger::parse_get_cred_def_response(&get_cred_def_response).unwrap(); let _cred_def: CredentialDefinitionV1 = serde_json::from_str(&cred_def_json).unwrap(); - - utils::tear_down_with_wallet_and_pool(wallet_handle, pool_handle, "indy_get_cred_def_requests_works_for_default_submitter_did", &wallet_config); } } @@ -957,17 +886,15 @@ mod high_cases { #[test] #[cfg(feature = "local_nodes_pool")] fn indy_get_validator_info_request_works() { - let (wallet_handle, pool_handle, did, wallet_config) = utils::setup_trustee("indy_get_validator_info_request_works"); + let setup = Setup::trustee(); - let get_validator_info_request = ledger::build_get_validator_info_request(&did).unwrap(); - let get_validator_info_response = ledger::sign_and_submit_request(pool_handle, wallet_handle, &did, &get_validator_info_request).unwrap(); + let get_validator_info_request = ledger::build_get_validator_info_request(&setup.did).unwrap(); + let get_validator_info_response = ledger::sign_and_submit_request(setup.pool_handle, setup.wallet_handle, &setup.did, &get_validator_info_request).unwrap(); let get_validator_info_response: HashMap = serde_json::from_str(&get_validator_info_response).unwrap(); for value in get_validator_info_response.values() { serde_json::from_str::>(value).unwrap(); } - - utils::tear_down_with_wallet_and_pool(wallet_handle, pool_handle, "indy_get_validator_info_request_works", &wallet_config); } } @@ -1019,18 +946,18 @@ mod high_cases { #[test] #[cfg(feature = "local_nodes_pool")] fn indy_get_txn_request_works() { - let (wallet_handle, pool_handle, did, _my_vk, wallet_config) = utils::setup_new_identity("indy_get_txn_request_works"); + let setup = Setup::new_identity(); - let schema_request = ledger::build_schema_request(&did, &anoncreds::gvt_schema_json()).unwrap(); - let schema_response = ledger::sign_and_submit_request(pool_handle, wallet_handle, &did, &schema_request).unwrap(); + let schema_request = ledger::build_schema_request(&setup.did, &anoncreds::gvt_schema_json()).unwrap(); + let schema_response = ledger::sign_and_submit_request(setup.pool_handle, setup.wallet_handle, &setup.did, &schema_request).unwrap(); pool::check_response_type(&schema_response, ResponseType::REPLY); let seq_no = ledger::extract_seq_no_from_reply(&schema_response).unwrap() as i32; - thread::sleep(std::time::Duration::from_secs(3)); + thread::sleep(std::time::Duration::from_secs(1)); - let get_txn_request = ledger::build_get_txn_request(Some(&did), seq_no, None).unwrap(); - let get_txn_response = ledger::submit_request(pool_handle, &get_txn_request).unwrap(); + let get_txn_request = ledger::build_get_txn_request(Some(&setup.did), seq_no, None).unwrap(); + let get_txn_response = ledger::submit_request(setup.pool_handle, &get_txn_request).unwrap(); let get_txn_response: Reply = serde_json::from_str(&get_txn_response).unwrap(); let get_txn_schema_data: SchemaData = serde_json::from_value( @@ -1039,31 +966,26 @@ mod high_cases { let expected_schema_data: SchemaData = serde_json::from_str(r#"{"name":"gvt","version":"1.0","attr_names":["name", "age", "sex", "height"]}"#).unwrap(); assert_eq!(expected_schema_data, get_txn_schema_data); - - utils::tear_down_with_wallet_and_pool(wallet_handle, pool_handle, "indy_get_txn_request_works", &wallet_config); } #[test] #[cfg(feature = "local_nodes_pool")] fn indy_get_txn_request_works_for_invalid_seq_no() { - let (wallet_handle, pool_handle, did, _my_vk, wallet_config) = utils::setup_new_identity("indy_get_txn_request_works_for_invalid_seq_no"); + let setup = Setup::new_identity(); - let schema_request = ledger::build_schema_request(&did, &anoncreds::gvt_schema_json()).unwrap(); - let schema_response = ledger::sign_and_submit_request(pool_handle, wallet_handle, &did, &schema_request).unwrap(); + let schema_request = ledger::build_schema_request(&setup.did, &anoncreds::gvt_schema_json()).unwrap(); + let schema_response = ledger::sign_and_submit_request(setup.pool_handle, setup.wallet_handle, &setup.did, &schema_request).unwrap(); pool::check_response_type(&schema_response, ResponseType::REPLY); let seq_no = ledger::extract_seq_no_from_reply(&schema_response).unwrap() as i32; - let seq_no = seq_no + 1; - thread::sleep(std::time::Duration::from_secs(3)); + thread::sleep(std::time::Duration::from_secs(1)); - let get_txn_request = ledger::build_get_txn_request(Some(&did), seq_no, None).unwrap(); + let get_txn_request = ledger::build_get_txn_request(Some(DID), seq_no + 1, None).unwrap(); - let get_txn_response = ledger::submit_request(pool_handle, &get_txn_request).unwrap(); + let get_txn_response = ledger::submit_request(setup.pool_handle, &get_txn_request).unwrap(); let get_txn_response: Reply = serde_json::from_str(&get_txn_response).unwrap(); assert!(get_txn_response.result.data.is_none()); - - utils::tear_down_with_wallet_and_pool(wallet_handle, pool_handle, "indy_get_txn_request_works_for_invalid_seq_no", &wallet_config); } } @@ -1086,33 +1008,29 @@ mod high_cases { #[test] #[cfg(feature = "local_nodes_pool")] fn indy_pool_config_request_works() { - let (wallet_handle, pool_handle, trustee_did, wallet_config) = utils::setup_trustee("indy_pool_config_request_works"); + let setup = Setup::trustee(); - let request = ledger::build_pool_config_request(&trustee_did, true, false).unwrap(); - ledger::sign_and_submit_request(pool_handle, wallet_handle, &trustee_did, &request).unwrap(); - - utils::tear_down_with_wallet_and_pool(wallet_handle, pool_handle, "indy_pool_config_request_works", &wallet_config); + let request = ledger::build_pool_config_request(&setup.did, true, false).unwrap(); + ledger::sign_and_submit_request(setup.pool_handle, setup.wallet_handle, &setup.did, &request).unwrap(); } #[test] #[cfg(feature = "local_nodes_pool")] fn indy_pool_config_request_works_for_disabling_writing() { - let (wallet_handle, pool_handle, trustee_did, wallet_config) = utils::setup_trustee("indy_pool_config_request_works_for_disabling_writing"); + let setup = Setup::trustee(); // set Ledger as readonly - let request = ledger::build_pool_config_request(&trustee_did, false, false).unwrap(); - ledger::sign_and_submit_request(pool_handle, wallet_handle, &trustee_did, &request).unwrap(); + let request = ledger::build_pool_config_request(&setup.did, false, false).unwrap(); + ledger::sign_and_submit_request(setup.pool_handle, setup.wallet_handle, &setup.did, &request).unwrap(); // try send schema request - let schema_request = ledger::build_schema_request(&trustee_did, &anoncreds::gvt_schema_json()).unwrap(); - let response = ledger::sign_and_submit_request(pool_handle, wallet_handle, &trustee_did, &schema_request).unwrap(); + let schema_request = ledger::build_schema_request(&setup.did, &anoncreds::gvt_schema_json()).unwrap(); + let response = ledger::sign_and_submit_request(setup.pool_handle, setup.wallet_handle, &setup.did, &schema_request).unwrap(); pool::check_response_type(&response, ResponseType::REQNACK); // return Ledger to the previous state - let request = ledger::build_pool_config_request(&trustee_did, true, false).unwrap(); - ledger::sign_and_submit_request(pool_handle, wallet_handle, &trustee_did, &request).unwrap(); - - utils::tear_down_with_wallet_and_pool(wallet_handle, pool_handle, "indy_pool_config_request_works_for_disabling_writing", &wallet_config); + let request = ledger::build_pool_config_request(&setup.did, true, false).unwrap(); + ledger::sign_and_submit_request(setup.pool_handle, setup.wallet_handle, &setup.did, &request).unwrap(); } } @@ -1154,17 +1072,15 @@ mod high_cases { #[test] #[cfg(feature = "local_nodes_pool")] fn indy_pool_restart_request_works_for_start_cancel_works() { - let (wallet_handle, pool_handle, trustee_did, wallet_config) = utils::setup_trustee("indy_pool_restart_request_works_for_start_cancel_works"); + let setup = Setup::trustee(); //start - let request = ledger::build_pool_restart_request(&trustee_did, "start", Some(&DATETIME)).unwrap(); - ledger::sign_and_submit_request(pool_handle, wallet_handle, &trustee_did, &request).unwrap(); + let request = ledger::build_pool_restart_request(&setup.did, "start", Some(&DATETIME)).unwrap(); + ledger::sign_and_submit_request(setup.pool_handle, setup.wallet_handle, &setup.did, &request).unwrap(); //cancel - let request = ledger::build_pool_restart_request(&trustee_did, "cancel", None).unwrap(); - ledger::sign_and_submit_request(pool_handle, wallet_handle, &trustee_did, &request).unwrap(); - - utils::tear_down_with_wallet_and_pool(wallet_handle, pool_handle, "indy_pool_restart_request_works_for_start_cancel_works", &wallet_config); + let request = ledger::build_pool_restart_request(&setup.did, "cancel", None).unwrap(); + ledger::sign_and_submit_request(setup.pool_handle, setup.wallet_handle, &setup.did, &request).unwrap(); } } @@ -1269,10 +1185,10 @@ mod high_cases { #[test] #[cfg(feature = "local_nodes_pool")] fn indy_pool_upgrade_request_works_for_start_cancel_works() { - let (wallet_handle, pool_handle, trustee_did, wallet_config) = utils::setup_trustee("indy_pool_upgrade_request_works_for_start_cancel_works"); + let setup = Setup::trustee(); //start - let request = ledger::build_pool_upgrade_request(&trustee_did, + let request = ledger::build_pool_upgrade_request(&setup.did, "upgrade-libindy", "2.0.0", "start", @@ -1283,10 +1199,10 @@ mod high_cases { false, false, None).unwrap(); - ledger::sign_and_submit_request(pool_handle, wallet_handle, &trustee_did, &request).unwrap(); + ledger::sign_and_submit_request(setup.pool_handle, setup.wallet_handle, &setup.did, &request).unwrap(); //cancel - let request = ledger::build_pool_upgrade_request(&trustee_did, + let request = ledger::build_pool_upgrade_request(&setup.did, "upgrade-libindy", "2.0.0", "cancel", @@ -1297,9 +1213,7 @@ mod high_cases { false, false, None).unwrap(); - ledger::sign_and_submit_request(pool_handle, wallet_handle, &trustee_did, &request).unwrap(); - - utils::tear_down_with_wallet_and_pool(wallet_handle, pool_handle, "indy_pool_upgrade_request_works_for_start_cancel_works", &wallet_config); + ledger::sign_and_submit_request(setup.pool_handle, setup.wallet_handle, &setup.did, &request).unwrap(); } } @@ -1332,8 +1246,6 @@ mod high_cases { let request = ledger::build_revoc_reg_def_request(DID, &data).unwrap(); assert!(request.contains(expected_result)); - - utils::tear_down("indy_build_revoc_reg_def_request"); } #[test] @@ -1358,33 +1270,29 @@ mod high_cases { #[test] #[cfg(feature = "local_nodes_pool")] fn indy_revoc_reg_def_requests_works() { - let (wallet_handle, pool_handle, wallet_config) = utils::setup_with_wallet_and_pool("indy_revoc_reg_def_requests_works"); + let setup = Setup::pool(); let (_, _, rev_reg_id) = ledger::post_entities(); let get_rev_reg_def_request = ledger::build_get_revoc_reg_def_request(Some(DID_MY1), &rev_reg_id).unwrap(); - let get_rev_reg_def_response = ledger::submit_request(pool_handle, &get_rev_reg_def_request).unwrap(); + let get_rev_reg_def_response = ledger::submit_request(setup.pool_handle, &get_rev_reg_def_request).unwrap(); let (_, revoc_reg_def_json) = ledger::parse_get_revoc_reg_def_response(&get_rev_reg_def_response).unwrap(); let _revoc_reg_def: RevocationRegistryDefinitionV1 = serde_json::from_str(&revoc_reg_def_json).unwrap(); - - utils::tear_down_with_wallet_and_pool(wallet_handle, pool_handle, "indy_revoc_reg_def_requests_works", &wallet_config); } #[test] #[cfg(feature = "local_nodes_pool")] fn indy_revoc_get_reg_def_requests_works_for_default_submitter_did() { - let (wallet_handle, pool_handle, wallet_config) = utils::setup_with_wallet_and_pool("indy_revoc_get_reg_def_requests_works_for_default_submitter_did"); + let setup = Setup::pool(); let (_, _, rev_reg_id) = ledger::post_entities(); let get_rev_reg_def_request = ledger::build_get_revoc_reg_def_request(None, &rev_reg_id).unwrap(); - let get_rev_reg_def_response = ledger::submit_request(pool_handle, &get_rev_reg_def_request).unwrap(); + let get_rev_reg_def_response = ledger::submit_request(setup.pool_handle, &get_rev_reg_def_request).unwrap(); let (_, revoc_reg_def_json) = ledger::parse_get_revoc_reg_def_response(&get_rev_reg_def_response).unwrap(); let _revoc_reg_def: RevocationRegistryDefinitionV1 = serde_json::from_str(&revoc_reg_def_json).unwrap(); - - utils::tear_down_with_wallet_and_pool(wallet_handle, pool_handle, "indy_revoc_get_reg_def_requests_works_for_default_submitter_did", &wallet_config); } } @@ -1411,11 +1319,7 @@ mod high_cases { #[test] #[cfg(feature = "local_nodes_pool")] fn indy_revoc_reg_entry_requests_works() { - let (wallet_handle, pool_handle, wallet_config) = utils::setup_with_wallet_and_pool("indy_revoc_reg_entry_requests_works"); - ledger::post_entities(); - - utils::tear_down_with_wallet_and_pool(wallet_handle, pool_handle, "indy_revoc_reg_entry_requests_works", &wallet_config); } } @@ -1445,37 +1349,33 @@ mod high_cases { #[test] #[cfg(feature = "local_nodes_pool")] fn indy_get_revoc_reg_request_works() { - let (wallet_handle, pool_handle, wallet_config) = utils::setup_with_wallet_and_pool("indy_get_revoc_reg_request_works"); + let setup = Setup::pool(); let (_, _, rev_reg_id) = ledger::post_entities(); let timestamp = time::get_time().sec as u64 + 1000; let get_rev_reg_req = ledger::build_get_revoc_reg_request(Some(DID_MY1), &rev_reg_id, timestamp).unwrap(); - let get_rev_reg_resp = ledger::submit_request(pool_handle, &get_rev_reg_req).unwrap(); + let get_rev_reg_resp = ledger::submit_request(setup.pool_handle, &get_rev_reg_req).unwrap(); let (_, revoc_reg_json, _) = ledger::parse_get_revoc_reg_response(&get_rev_reg_resp).unwrap(); let _revoc_reg: RevocationRegistryV1 = serde_json::from_str(&revoc_reg_json).unwrap(); - - utils::tear_down_with_wallet_and_pool(wallet_handle, pool_handle, "indy_get_revoc_reg_request_works", &wallet_config); } #[test] #[cfg(feature = "local_nodes_pool")] fn indy_get_revoc_reg_request_works_for_default_submitter_did() { - let (wallet_handle, pool_handle, wallet_config) = utils::setup_with_wallet_and_pool("indy_get_revoc_reg_request_works_for_default_submitter_did"); + let setup = Setup::pool(); let (_, _, rev_reg_id) = ledger::post_entities(); let timestamp = time::get_time().sec as u64 + 1000; let get_rev_reg_req = ledger::build_get_revoc_reg_request(None, &rev_reg_id, timestamp).unwrap(); - let get_rev_reg_resp = ledger::submit_request(pool_handle, &get_rev_reg_req).unwrap(); + let get_rev_reg_resp = ledger::submit_request(setup.pool_handle, &get_rev_reg_req).unwrap(); let (_, revoc_reg_json, _) = ledger::parse_get_revoc_reg_response(&get_rev_reg_resp).unwrap(); let _revoc_reg: RevocationRegistryV1 = serde_json::from_str(&revoc_reg_json).unwrap(); - - utils::tear_down_with_wallet_and_pool(wallet_handle, pool_handle, "indy_get_revoc_reg_request_works_for_default_submitter_did", &wallet_config); } } @@ -1505,56 +1405,50 @@ mod high_cases { #[test] #[cfg(feature = "local_nodes_pool")] fn indy_get_revoc_reg_delta_request_works() { - let (wallet_handle, pool_handle, wallet_config) = utils::setup_with_wallet_and_pool("indy_get_revoc_reg_delta_request_works"); + let setup = Setup::pool(); let (_, _, rev_reg_id) = ledger::post_entities(); let to = time::get_time().sec as u64 + 300; let get_rev_reg_delta_req = ledger::build_get_revoc_reg_delta_request(Some(DID_MY1), &rev_reg_id, None, to).unwrap(); - let get_rev_reg_delta_resp = ledger::submit_request(pool_handle, &get_rev_reg_delta_req).unwrap(); + let get_rev_reg_delta_resp = ledger::submit_request(setup.pool_handle, &get_rev_reg_delta_req).unwrap(); let (_, revoc_reg_delta_json, _) = ledger::parse_get_revoc_reg_delta_response(&get_rev_reg_delta_resp).unwrap(); let _revoc_reg_delta: RevocationRegistryDeltaV1 = serde_json::from_str(&revoc_reg_delta_json).unwrap(); - - utils::tear_down_with_wallet_and_pool(wallet_handle, pool_handle, "indy_get_revoc_reg_delta_request_works", &wallet_config); } #[test] #[cfg(feature = "local_nodes_pool")] fn indy_get_revoc_reg_delta_request_works_for_two_timestamps() { - let (wallet_handle, pool_handle, wallet_config) = utils::setup_with_wallet_and_pool("indy_get_revoc_reg_delta_request_works_for_two_timestamps"); + let setup = Setup::pool(); let (_, _, rev_reg_id) = ledger::post_entities(); let from = time::get_time().sec as u64; let to = time::get_time().sec as u64 + 300; let get_rev_reg_delta_req = ledger::build_get_revoc_reg_delta_request(Some(DID_MY1), &rev_reg_id, Some(from), to).unwrap(); - let get_rev_reg_delta_resp = ledger::submit_request(pool_handle, &get_rev_reg_delta_req).unwrap(); + let get_rev_reg_delta_resp = ledger::submit_request(setup.pool_handle, &get_rev_reg_delta_req).unwrap(); let (_, revoc_reg_delta_json, _) = ledger::parse_get_revoc_reg_delta_response(&get_rev_reg_delta_resp).unwrap(); let _revoc_reg_delta: RevocationRegistryDeltaV1 = serde_json::from_str(&revoc_reg_delta_json).unwrap(); - - utils::tear_down_with_wallet_and_pool(wallet_handle, pool_handle, "indy_get_revoc_reg_delta_request_works_for_two_timestamps", &wallet_config); } #[test] #[cfg(feature = "local_nodes_pool")] fn indy_get_revoc_reg_delta_request_works_for_default_submitter_did() { - let (wallet_handle, pool_handle, wallet_config) = utils::setup_with_wallet_and_pool("indy_get_revoc_reg_delta_request_works_for_default_submitter_did"); + let setup = Setup::pool(); let (_, _, rev_reg_id) = ledger::post_entities(); let to = time::get_time().sec as u64 + 1000; let get_rev_reg_delta_req = ledger::build_get_revoc_reg_delta_request(None, &rev_reg_id, None, to).unwrap(); - let get_rev_reg_delta_resp = ledger::submit_request(pool_handle, &get_rev_reg_delta_req).unwrap(); + let get_rev_reg_delta_resp = ledger::submit_request(setup.pool_handle, &get_rev_reg_delta_req).unwrap(); let (_, revoc_reg_delta_json, _) = ledger::parse_get_revoc_reg_delta_response(&get_rev_reg_delta_resp).unwrap(); let _revoc_reg_delta: RevocationRegistryDeltaV1 = serde_json::from_str(&revoc_reg_delta_json).unwrap(); - - utils::tear_down_with_wallet_and_pool(wallet_handle, pool_handle, "indy_get_revoc_reg_delta_request_works_for_default_submitter_did", &wallet_config); } } @@ -1567,7 +1461,7 @@ mod high_cases { #[test] fn indy_register_transaction_parser_for_sp_works() { - utils::setup("indy_register_transaction_parser_for_sp_works"); + Setup::empty(); extern fn parse(msg: *const c_char, parsed: *mut *const c_char) -> i32 { unsafe { *parsed = msg; } @@ -1576,8 +1470,6 @@ mod high_cases { extern fn free(_buf: *const c_char) -> i32 { ErrorCode::Success as i32 } ledger::register_transaction_parser_for_sp("my_txn_type", parse, free).unwrap(); - - utils::tear_down("indy_register_transaction_parser_for_sp_works"); } } @@ -1587,46 +1479,31 @@ mod high_cases { #[test] #[cfg(feature = "local_nodes_pool")] fn get_response_metadata_works_for_nym_requests() { - let (wallet_handle, pool_handle, trustee_did, wallet_config) = utils::setup_trustee("get_response_metadata_works_for_nym_requests"); + let setup = Setup::trustee(); - let (did, _) = did::create_and_store_my_did(wallet_handle, None).unwrap(); + let (did, _) = did::create_and_store_my_did(setup.wallet_handle, None).unwrap(); - let nym_request = ledger::build_nym_request(&trustee_did, &did, None, None, None).unwrap(); - let nym_resp = ledger::sign_and_submit_request(pool_handle, wallet_handle, &trustee_did, &nym_request).unwrap(); + let nym_request = ledger::build_nym_request(&setup.did, &did, None, None, None).unwrap(); + let nym_resp = ledger::sign_and_submit_request(setup.pool_handle, setup.wallet_handle, &setup.did, &nym_request).unwrap(); pool::check_response_type(&nym_resp, ResponseType::REPLY); let response_metadata = ledger::get_response_metadata(&nym_resp).unwrap(); _check_write_response_metadata(&response_metadata); let get_nym_request = ledger::build_get_nym_request(None, &did).unwrap(); - let get_nym_response = ledger::submit_request_with_retries(pool_handle, &get_nym_request, &nym_resp).unwrap(); + let get_nym_response = ledger::submit_request_with_retries(setup.pool_handle, &get_nym_request, &nym_resp).unwrap(); let response_metadata = ledger::get_response_metadata(&get_nym_response).unwrap(); _check_read_response_metadata(&response_metadata); - - utils::tear_down_with_wallet_and_pool(wallet_handle, pool_handle, "get_response_metadata_works_for_nym_requests", &wallet_config); } #[test] #[cfg(feature = "local_nodes_pool")] fn get_response_metadata_works_for_get_txn_request() { - let (wallet_handle, pool_handle, trustee_did, wallet_config) = utils::setup_trustee("get_response_metadata_works_for_get_txn_request"); + let setup = Setup::pool(); - let (did, _) = did::create_and_store_my_did(wallet_handle, None).unwrap(); - - let nym_request = ledger::build_nym_request(&trustee_did, &did, None, None, None).unwrap(); - let nym_resp = ledger::sign_and_submit_request(pool_handle, wallet_handle, &trustee_did, &nym_request).unwrap(); - pool::check_response_type(&nym_resp, ResponseType::REPLY); - - let response_metadata = ledger::get_response_metadata(&nym_resp).unwrap(); - let response_metadata: serde_json::Value = serde_json::from_str(&response_metadata).unwrap(); - - let seq_no = response_metadata["seqNo"].as_u64().unwrap() as i32; - - thread::sleep(std::time::Duration::from_secs(2)); - - let get_txn_request = ledger::build_get_txn_request(None, seq_no, None).unwrap(); - let get_txn_response = ledger::submit_request(pool_handle, &get_txn_request).unwrap(); + let get_txn_request = ledger::build_get_txn_request(None, 1, None).unwrap(); + let get_txn_response = ledger::submit_request(setup.pool_handle, &get_txn_request).unwrap(); let response_metadata = ledger::get_response_metadata(&get_txn_response).unwrap(); let response_metadata: serde_json::Value = serde_json::from_str(&response_metadata).unwrap(); @@ -1634,69 +1511,61 @@ mod high_cases { assert!(response_metadata["txnTime"].as_u64().is_none()); assert!(response_metadata["lastTxnTime"].as_u64().is_none()); assert!(response_metadata["lastSeqNo"].as_u64().is_none()); - - utils::tear_down_with_wallet_and_pool(wallet_handle, pool_handle, "get_response_metadata_works_for_get_txn_request", &wallet_config); } #[test] #[cfg(feature = "local_nodes_pool")] fn get_response_metadata_works_for_pool_config_request() { - let (wallet_handle, pool_handle, trustee_did, wallet_config) = utils::setup_trustee("get_response_metadata_works_for_pool_config_request"); + let setup = Setup::trustee(); - let request = ledger::build_pool_config_request(&trustee_did, true, false).unwrap(); - let response = ledger::sign_and_submit_request(pool_handle, wallet_handle, &trustee_did, &request).unwrap(); + let request = ledger::build_pool_config_request(&setup.did, true, false).unwrap(); + let response = ledger::sign_and_submit_request(setup.pool_handle, setup.wallet_handle, &setup.did, &request).unwrap(); pool::check_response_type(&response, ResponseType::REPLY); let response_metadata = ledger::get_response_metadata(&response).unwrap(); _check_write_response_metadata(&response_metadata); - - utils::tear_down_with_wallet_and_pool(wallet_handle, pool_handle, "get_response_metadata_works_for_pool_config_request", &wallet_config); } #[test] #[cfg(feature = "local_nodes_pool")] fn get_response_metadata_works_for_revocation_related_get_requests() { - let (wallet_handle, pool_handle, wallet_config) = utils::setup_with_wallet_and_pool("get_response_metadata_works_for_revocation_related_get_requests"); + let setup = Setup::pool(); let (_, _, rev_reg_id) = ledger::post_entities(); let timestamp = time::get_time().sec as u64 + 1000; let get_rev_reg_req = ledger::build_get_revoc_reg_request(Some(DID_MY1), &rev_reg_id, timestamp).unwrap(); - let get_rev_reg_resp = ledger::submit_request(pool_handle, &get_rev_reg_req).unwrap(); + let get_rev_reg_resp = ledger::submit_request(setup.pool_handle, &get_rev_reg_req).unwrap(); let response_metadata = ledger::get_response_metadata(&get_rev_reg_resp).unwrap(); _check_read_response_metadata(&response_metadata); let get_rev_reg_delta_req = ledger::build_get_revoc_reg_delta_request(Some(DID_MY1), &rev_reg_id, None, timestamp).unwrap(); - let get_rev_reg_delta_resp = ledger::submit_request(pool_handle, &get_rev_reg_delta_req).unwrap(); + let get_rev_reg_delta_resp = ledger::submit_request(setup.pool_handle, &get_rev_reg_delta_req).unwrap(); let response_metadata = ledger::get_response_metadata(&get_rev_reg_delta_resp).unwrap(); _check_read_response_metadata(&response_metadata); - - utils::tear_down_with_wallet_and_pool(wallet_handle, pool_handle, "get_response_metadata_works_for_revocation_related_get_requests", &wallet_config); } #[test] #[cfg(feature = "local_nodes_pool")] fn get_response_metadata_works_for_invalid_response() { - utils::setup("get_response_metadata_works_for_invalid_response"); + Setup::empty(); let res = ledger::get_response_metadata("{}"); assert_code!(ErrorCode::LedgerInvalidTransaction, res); - - utils::tear_down("get_response_metadata_works_for_invalid_response"); } #[test] #[cfg(feature = "local_nodes_pool")] fn get_response_metadata_works_for_not_found_response() { - let (wallet_handle, pool_handle, wallet_config) = utils::setup_with_wallet_and_pool("get_response_metadata_works_for_not_found_response"); + let setup = Setup::wallet_and_pool(); - let (did, _) = did::create_and_store_my_did(wallet_handle, None).unwrap(); + let (did, _) = did::create_and_store_my_did(setup.wallet_handle, None).unwrap(); let get_nym_request = ledger::build_get_nym_request(Some(&did), &did).unwrap(); - let get_nym_response = ledger::submit_request(pool_handle, &get_nym_request).unwrap(); + let get_nym_response = ledger::submit_request(setup.pool_handle, &get_nym_request).unwrap(); let response_metadata = ledger::get_response_metadata(&get_nym_response).unwrap(); let response_metadata: serde_json::Value = serde_json::from_str(&response_metadata).unwrap(); @@ -1705,8 +1574,6 @@ mod high_cases { assert!(response_metadata["seqNo"].as_u64().is_none()); assert!(response_metadata["txnTime"].as_u64().is_none()); assert!(response_metadata["lastSeqNo"].as_u64().is_none()); - - utils::tear_down_with_wallet_and_pool(wallet_handle, pool_handle, "get_response_metadata_works_for_not_found_response", &wallet_config); } fn _check_write_response_metadata(response_metadata: &str) { @@ -2189,19 +2056,19 @@ mod high_cases { #[test] #[cfg(feature = "local_nodes_pool")] fn indy_auth_rule_requests_works_for_adding_new_trustee() { - let (wallet_handle, pool_handle, trustee_did, wallet_config) = utils::setup_trustee("indy_auth_rule_requests_work"); + let setup = Setup::trustee(); - let (_, default_constraint_json) = _get_constraint(pool_handle, ADD_AUTH_ACTION, + let (_, default_constraint_json) = _get_constraint(setup.pool_handle, ADD_AUTH_ACTION, constants::NYM, FIELD, None, Some(VALUE)); - _change_constraint(pool_handle, wallet_handle, &trustee_did, ADD_AUTH_ACTION, + _change_constraint(setup.pool_handle, setup.wallet_handle, &setup.did, ADD_AUTH_ACTION, constants::NYM, FIELD, None, Some(VALUE), ROLE_CONSTRAINT); ::std::thread::sleep(::std::time::Duration::from_secs(1)); - let (actual_constraint, _) = _get_constraint(pool_handle, ADD_AUTH_ACTION, + let (actual_constraint, _) = _get_constraint(setup.pool_handle, ADD_AUTH_ACTION, constants::NYM, FIELD, None, Some(VALUE)); @@ -2209,132 +2076,122 @@ mod high_cases { assert_eq!(expected_constraint, actual_constraint); - _change_constraint(pool_handle, wallet_handle, &trustee_did, ADD_AUTH_ACTION, + _change_constraint(setup.pool_handle, setup.wallet_handle, &setup.did, ADD_AUTH_ACTION, constants::NYM, FIELD, None, Some(VALUE), &default_constraint_json); - - utils::tear_down_with_wallet_and_pool(wallet_handle, pool_handle, "indy_auth_rule_requests_work", &wallet_config); } #[test] #[cfg(feature = "local_nodes_pool")] fn indy_auth_rule_requests_works_for_adding_new_identity_owner() { - let (wallet_handle, pool_handle, trustee_did, wallet_config) = utils::setup_trustee("indy_auth_rule_requests_works_for_adding_new_identity_owner"); + let setup = Setup::trustee(); - let (_, default_constraint_json) = _get_constraint(pool_handle, + let (_, default_constraint_json) = _get_constraint(setup.pool_handle, &ADD_AUTH_ACTION, constants::NYM, FIELD, None, None); - _change_constraint(pool_handle, wallet_handle, &trustee_did, ADD_AUTH_ACTION, + _change_constraint(setup.pool_handle, setup.wallet_handle, &setup.did, ADD_AUTH_ACTION, constants::NYM, FIELD, None, None, ROLE_CONSTRAINT); ::std::thread::sleep(::std::time::Duration::from_secs(1)); - let (actual_constraint, _) = _get_constraint(pool_handle, ADD_AUTH_ACTION, + let (actual_constraint, _) = _get_constraint(setup.pool_handle, ADD_AUTH_ACTION, constants::NYM, FIELD, None, None); let expected_constraint: serde_json::Value = serde_json::from_str(ROLE_CONSTRAINT).unwrap(); assert_eq!(expected_constraint, actual_constraint); - _change_constraint(pool_handle, wallet_handle, &trustee_did, ADD_AUTH_ACTION, constants::NYM, + _change_constraint(setup.pool_handle, setup.wallet_handle, &setup.did, ADD_AUTH_ACTION, constants::NYM, FIELD, None, None, &default_constraint_json); - - utils::tear_down_with_wallet_and_pool(wallet_handle, pool_handle, "indy_auth_rule_requests_works_for_adding_new_identity_owner", &wallet_config); } #[test] #[cfg(feature = "local_nodes_pool")] fn indy_auth_rule_requests_works_for_demote_trustee() { - let (wallet_handle, pool_handle, trustee_did, wallet_config) = utils::setup_trustee("indy_auth_rule_requests_works_for_demote_trustee"); + let setup = Setup::trustee(); - let (_, default_constraint_json) = _get_constraint(pool_handle, + let (_, default_constraint_json) = _get_constraint(setup.pool_handle, &EDIT_AUTH_ACTION, constants::NYM, FIELD, Some(VALUE), None); - _change_constraint(pool_handle, wallet_handle, &trustee_did, EDIT_AUTH_ACTION, + _change_constraint(setup.pool_handle, setup.wallet_handle, &setup.did, EDIT_AUTH_ACTION, constants::NYM, FIELD, Some(VALUE), None, ROLE_CONSTRAINT); ::std::thread::sleep(::std::time::Duration::from_secs(1)); - let (actual_constraint, _) = _get_constraint(pool_handle, EDIT_AUTH_ACTION, constants::NYM, + let (actual_constraint, _) = _get_constraint(setup.pool_handle, EDIT_AUTH_ACTION, constants::NYM, FIELD, Some(VALUE), None); let expected_constraint: serde_json::Value = serde_json::from_str(ROLE_CONSTRAINT).unwrap(); assert_eq!(expected_constraint, actual_constraint); - _change_constraint(pool_handle, wallet_handle, &trustee_did, EDIT_AUTH_ACTION, constants::NYM, + _change_constraint(setup.pool_handle, setup.wallet_handle, &setup.did, EDIT_AUTH_ACTION, constants::NYM, FIELD, Some(VALUE), None, &default_constraint_json); - - utils::tear_down_with_wallet_and_pool(wallet_handle, pool_handle, "indy_auth_rule_requests_works_for_demote_trustee", &wallet_config); } #[test] #[cfg(feature = "local_nodes_pool")] fn indy_auth_rule_requests_works_for_promote_role_to_trustee() { - let (wallet_handle, pool_handle, trustee_did, wallet_config) = utils::setup_trustee("indy_auth_rule_requests_works_for_promote_role_to_trustee"); + let setup = Setup::trustee(); - let (_, default_constraint_json) = _get_constraint(pool_handle, + let (_, default_constraint_json) = _get_constraint(setup.pool_handle, &EDIT_AUTH_ACTION, constants::NYM, FIELD, None, Some(VALUE)); - _change_constraint(pool_handle, wallet_handle, &trustee_did, EDIT_AUTH_ACTION, + _change_constraint(setup.pool_handle, setup.wallet_handle, &setup.did, EDIT_AUTH_ACTION, constants::NYM, FIELD, None, Some(VALUE), ROLE_CONSTRAINT); ::std::thread::sleep(::std::time::Duration::from_secs(1)); - let (actual_constraint, _) = _get_constraint(pool_handle, EDIT_AUTH_ACTION, constants::NYM, + let (actual_constraint, _) = _get_constraint(setup.pool_handle, EDIT_AUTH_ACTION, constants::NYM, FIELD, None, Some(VALUE)); let expected_constraint: serde_json::Value = serde_json::from_str(ROLE_CONSTRAINT).unwrap(); assert_eq!(expected_constraint, actual_constraint); - _change_constraint(pool_handle, wallet_handle, &trustee_did, EDIT_AUTH_ACTION, constants::NYM, + _change_constraint(setup.pool_handle, setup.wallet_handle, &setup.did, EDIT_AUTH_ACTION, constants::NYM, FIELD, None, Some(VALUE), &default_constraint_json); - - utils::tear_down_with_wallet_and_pool(wallet_handle, pool_handle, "indy_auth_rule_requests_works_for_promote_role_to_trustee", &wallet_config); } #[test] #[cfg(feature = "local_nodes_pool")] fn indy_auth_rule_requests_works_for_change_trustee_to_steward() { - let (wallet_handle, pool_handle, trustee_did, wallet_config) = utils::setup_trustee("indy_auth_rule_requests_works_for_change_trustee_to_steward"); + let setup = Setup::trustee(); - let (_, default_constraint_json) = _get_constraint(pool_handle, + let (_, default_constraint_json) = _get_constraint(setup.pool_handle, &EDIT_AUTH_ACTION, constants::NYM, FIELD, Some("0"), Some("2")); - _change_constraint(pool_handle, wallet_handle, &trustee_did, EDIT_AUTH_ACTION, + _change_constraint(setup.pool_handle, setup.wallet_handle, &setup.did, EDIT_AUTH_ACTION, constants::NYM, FIELD, Some("0"), Some("2"), ROLE_CONSTRAINT); ::std::thread::sleep(::std::time::Duration::from_secs(1)); - let (actual_constraint, _) = _get_constraint(pool_handle, EDIT_AUTH_ACTION, + let (actual_constraint, _) = _get_constraint(setup.pool_handle, EDIT_AUTH_ACTION, constants::NYM, FIELD, Some("0"), Some("2")); let expected_constraint: serde_json::Value = serde_json::from_str(ROLE_CONSTRAINT).unwrap(); assert_eq!(expected_constraint, actual_constraint); - _change_constraint(pool_handle, wallet_handle, &trustee_did, EDIT_AUTH_ACTION, + _change_constraint(setup.pool_handle, setup.wallet_handle, &setup.did, EDIT_AUTH_ACTION, constants::NYM, FIELD, Some("0"), Some("2"), &default_constraint_json); - - utils::tear_down_with_wallet_and_pool(wallet_handle, pool_handle, "indy_auth_rule_requests_works_for_change_trustee_to_steward", &wallet_config); } fn _change_constraint(pool_handle: i32, wallet_handle: i32, trustee_did: &str, action: &str, txn_type: &str, field: &str, @@ -2372,7 +2229,7 @@ mod high_cases { #[test] #[cfg(feature = "local_nodes_pool")] fn indy_get_auth_rule_request_works_for_getting_all() { - let (wallet_handle, pool_handle, wallet_config) = utils::setup_with_wallet_and_pool("indy_get_auth_rule_request_works_for_getting_all"); + let setup = Setup::pool(); let get_auth_rule_request = ledger::build_get_auth_rule_request(None, None, @@ -2381,20 +2238,18 @@ mod high_cases { None, None).unwrap(); - let response = ledger::submit_request(pool_handle, &get_auth_rule_request).unwrap(); + let response = ledger::submit_request(setup.pool_handle, &get_auth_rule_request).unwrap(); let response: Reply = serde_json::from_str(&response).unwrap(); let constraints = response.result["data"].as_array().unwrap(); assert!(constraints.len() > 0); - - utils::tear_down_with_wallet_and_pool(wallet_handle, pool_handle, "indy_get_auth_rule_request_works_for_getting_all", &wallet_config); } #[test] #[cfg(feature = "local_nodes_pool")] fn indy_get_auth_rule_request_works_for_no_constraint() { - let (wallet_handle, pool_handle, wallet_config) = utils::setup_with_wallet_and_pool("indy_get_auth_rule_request_works_for_no_constraint"); + let setup = Setup::pool(); let get_auth_rule_request = ledger::build_get_auth_rule_request(None, Some(constants::NYM), @@ -2403,24 +2258,22 @@ mod high_cases { None, Some("wrong_new_value")).unwrap(); - let response = ledger::submit_request(pool_handle, &get_auth_rule_request).unwrap(); + let response = ledger::submit_request(setup.pool_handle, &get_auth_rule_request).unwrap(); pool::check_response_type(&response, ResponseType::REQNACK); - - utils::tear_down_with_wallet_and_pool(wallet_handle, pool_handle, "indy_get_auth_rule_request_works_for_no_constraint", &wallet_config); } #[test] #[cfg(feature = "local_nodes_pool")] fn indy_auth_rules_request_works() { - let (wallet_handle, pool_handle, trustee_did, wallet_config) = utils::setup_trustee("indy_auth_rules_request_works"); + let setup = Setup::trustee(); let action1: (&str, &str, &str, Option<&str>, Option<&str>) = (ADD_AUTH_ACTION, constants::NYM, FIELD, None, Some(VALUE)); let action2: (&str, &str, &str, Option<&str>, Option<&str>) = (EDIT_AUTH_ACTION, constants::NYM, FIELD, Some(VALUE), Some(NEW_VALUE)); - let (_, default_constraint_action_1) = _get_constraint(pool_handle, action1.0, + let (_, default_constraint_action_1) = _get_constraint(setup.pool_handle, action1.0, action1.1, action1.2, action1.3, action1.4); - let (_, default_constraint_action_2) = _get_constraint(pool_handle, action2.0, + let (_, default_constraint_action_2) = _get_constraint(setup.pool_handle, action2.0, action2.1, action2.2, action2.3, action2.4); let data = json!([ @@ -2453,30 +2306,28 @@ mod high_cases { } ]); - let auth_rule_request = ledger::build_auth_rules_request(&trustee_did, &data.to_string()).unwrap(); - let response = ledger::sign_and_submit_request(pool_handle, wallet_handle, &trustee_did, &auth_rule_request).unwrap(); + let auth_rule_request = ledger::build_auth_rules_request(&setup.did, &data.to_string()).unwrap(); + let response = ledger::sign_and_submit_request(setup.pool_handle, setup.wallet_handle, &setup.did, &auth_rule_request).unwrap(); pool::check_response_type(&response, ResponseType::REPLY); ::std::thread::sleep(::std::time::Duration::from_secs(1)); - let (actual_constraint, _) = _get_constraint(pool_handle, action1.0, action1.1, action1.2, action1.3, action1.4); + let (actual_constraint, _) = _get_constraint(setup.pool_handle, action1.0, action1.1, action1.2, action1.3, action1.4); let expected_constraint: serde_json::Value = serde_json::from_str(ROLE_CONSTRAINT).unwrap(); assert_eq!(expected_constraint, actual_constraint); - let (actual_constraint, _) = _get_constraint(pool_handle, action2.0, + let (actual_constraint, _) = _get_constraint(setup.pool_handle, action2.0, action2.1, action2.2, action2.3, action2.4); let expected_constraint: serde_json::Value = serde_json::from_str(ROLE_CONSTRAINT).unwrap(); assert_eq!(expected_constraint, actual_constraint); - _change_constraint(pool_handle, wallet_handle, &trustee_did, action1.0, + _change_constraint(setup.pool_handle, setup.wallet_handle, &setup.did, action1.0, action1.1, action1.2, action1.3, action1.4, &default_constraint_action_1); - _change_constraint(pool_handle, wallet_handle, &trustee_did, action2.0, + _change_constraint(setup.pool_handle, setup.wallet_handle, &setup.did, action2.0, action2.1, action2.2, action2.3, action2.4, &default_constraint_action_2); - - utils::tear_down_with_wallet_and_pool(wallet_handle, pool_handle, "indy_auth_rules_request_works", &wallet_config); } } @@ -2687,7 +2538,7 @@ mod high_cases { #[test] fn indy_append_txn_author_agreement_acceptance_to_request_works_for_text_version() { - utils::setup("indy_append_txn_author_agreement_acceptance_to_request_works_for_text_version"); + Setup::empty(); let request = ledger::append_txn_author_agreement_acceptance_to_request(REQUEST, Some(TEXT), @@ -2696,13 +2547,11 @@ mod high_cases { ACCEPTANCE_MECH_TYPE, TIME_OF_ACCEPTANCE).unwrap(); _check_request_meta(&request); - - utils::tear_down("indy_append_txn_author_agreement_acceptance_to_request_works_for_text_version"); } #[test] fn indy_append_txn_author_agreement_acceptance_to_request_works_for_hash() { - utils::setup("indy_append_txn_author_agreement_acceptance_to_request_works_for_hash"); + Setup::empty(); let request = ledger::append_txn_author_agreement_acceptance_to_request(REQUEST, None, @@ -2711,13 +2560,11 @@ mod high_cases { ACCEPTANCE_MECH_TYPE, TIME_OF_ACCEPTANCE).unwrap(); _check_request_meta(&request); - - utils::tear_down("indy_append_txn_author_agreement_acceptance_to_request_works_for_hash"); } #[test] fn indy_append_txn_author_agreement_acceptance_to_request_works_for_text_version_and_hash() { - utils::setup("indy_append_txn_author_agreement_acceptance_to_request_works_for_text_version_and_hash"); + Setup::empty(); let request = ledger::append_txn_author_agreement_acceptance_to_request(REQUEST, Some(TEXT), @@ -2726,13 +2573,11 @@ mod high_cases { ACCEPTANCE_MECH_TYPE, TIME_OF_ACCEPTANCE).unwrap(); _check_request_meta(&request); - - utils::tear_down("indy_append_txn_author_agreement_acceptance_to_request_works_for_text_version_and_hash"); } #[test] fn indy_append_txn_author_agreement_acceptance_to_request_works_for_text_version_not_correspond_to_hash() { - utils::setup("indy_append_txn_author_agreement_acceptance_to_request_works_for_text_version_not_correspond_to_hash"); + Setup::empty(); let res = ledger::append_txn_author_agreement_acceptance_to_request(REQUEST, Some("other text"), @@ -2741,13 +2586,11 @@ mod high_cases { ACCEPTANCE_MECH_TYPE, TIME_OF_ACCEPTANCE); assert_code!(ErrorCode::CommonInvalidStructure, res); - - utils::tear_down("indy_append_txn_author_agreement_acceptance_to_request_works_for_text_version_not_correspond_to_hash"); } #[test] fn indy_append_txn_author_agreement_acceptance_to_request_works_for_invalid_request() { - utils::setup("indy_append_txn_author_agreement_acceptance_to_request_works_for_invalid_request"); + Setup::empty(); let res = ledger::append_txn_author_agreement_acceptance_to_request("Invalid request string", None, @@ -2756,13 +2599,11 @@ mod high_cases { ACCEPTANCE_MECH_TYPE, TIME_OF_ACCEPTANCE); assert_code!(ErrorCode::CommonInvalidStructure, res); - - utils::tear_down("indy_append_txn_author_agreement_acceptance_to_request_works_for_invalid_request"); } #[test] fn indy_append_txn_author_agreement_acceptance_to_request_works_for_missed_text_version_hash() { - utils::setup("indy_append_txn_author_agreement_acceptance_to_request_works_for_missed_text_version_hash"); + Setup::empty(); let res = ledger::append_txn_author_agreement_acceptance_to_request(REQUEST, None, @@ -2771,13 +2612,11 @@ mod high_cases { ACCEPTANCE_MECH_TYPE, TIME_OF_ACCEPTANCE); assert_code!(ErrorCode::CommonInvalidStructure, res); - - utils::tear_down("indy_append_txn_author_agreement_acceptance_to_request_works_for_missed_text_version_hash"); } #[test] fn indy_append_txn_author_agreement_acceptance_to_request_works_for_partial_combination_of_text_version() { - utils::setup("indy_append_txn_author_agreement_acceptance_to_request_works_for_partial_combination_of_text_version"); + Setup::empty(); let res = ledger::append_txn_author_agreement_acceptance_to_request(REQUEST, Some(TEXT), @@ -2794,8 +2633,6 @@ mod high_cases { ACCEPTANCE_MECH_TYPE, TIME_OF_ACCEPTANCE); assert_code!(ErrorCode::CommonInvalidStructure, res); - - utils::tear_down("indy_append_txn_author_agreement_acceptance_to_request_works_for_partial_combination_of_text_version"); } fn _rand_string() -> String { @@ -2853,37 +2690,35 @@ mod high_cases { #[test] fn indy_txn_author_agreement_requests_works() { - let (wallet_handle, pool_handle, trustee_did, wallet_config) = utils::setup_trustee("indy_txn_author_agreement_requests_works"); + let setup = Setup::trustee(); - _set_aml(pool_handle, wallet_handle, &trustee_did); + _set_aml(setup.pool_handle, setup.wallet_handle, &setup.did); let (taa_text, taa_version) = _gen_taa_data(); - let txn_author_agreement_request = ledger::build_txn_author_agreement_request(&trustee_did, &taa_text, &taa_version).unwrap(); - let txn_author_agreement_response = ledger::sign_and_submit_request(pool_handle, wallet_handle, &trustee_did, &txn_author_agreement_request).unwrap(); + let txn_author_agreement_request = ledger::build_txn_author_agreement_request(&setup.did, &taa_text, &taa_version).unwrap(); + let txn_author_agreement_response = ledger::sign_and_submit_request(setup.pool_handle, setup.wallet_handle, &setup.did, &txn_author_agreement_request).unwrap(); pool::check_response_type(&txn_author_agreement_response, ResponseType::REPLY); - let get_txn_author_agreement_request = ledger::build_get_txn_author_agreement_request(Some(&trustee_did), None).unwrap(); - let get_txn_author_agreement_response = ledger::submit_request_with_retries(pool_handle, &get_txn_author_agreement_request, &txn_author_agreement_response).unwrap(); + let get_txn_author_agreement_request = ledger::build_get_txn_author_agreement_request(Some(&setup.did), None).unwrap(); + let get_txn_author_agreement_response = ledger::submit_request_with_retries(setup.pool_handle, &get_txn_author_agreement_request, &txn_author_agreement_response).unwrap(); pool::check_response_type(&get_txn_author_agreement_response, ResponseType::REPLY); let response: serde_json::Value = serde_json::from_str(&get_txn_author_agreement_response).unwrap(); let expected_data = json!({"text": taa_text, "version": taa_version}); assert_eq!(response["result"]["data"], expected_data); - _reset_taa(pool_handle, wallet_handle, &trustee_did); - - utils::tear_down_with_wallet_and_pool(wallet_handle, pool_handle, "indy_txn_author_agreement_requests_works", &wallet_config); + _reset_taa(setup.pool_handle, setup.wallet_handle, &setup.did); } #[test] fn indy_acceptance_mechanism_requests_works() { - let (wallet_handle, pool_handle, trustee_did, wallet_config) = utils::setup_trustee("indy_acceptance_mechanism_requests_works"); + let setup = Setup::trustee(); let (aml, _, aml_version, aml_context) = _gen_aml_data(); - let acceptance_mechanisms_request = ledger::build_acceptance_mechanisms_request(&trustee_did, &aml, &aml_version, Some(&aml_context)).unwrap(); - let acceptance_mechanisms_response = ledger::sign_and_submit_request(pool_handle, wallet_handle, &trustee_did, &acceptance_mechanisms_request).unwrap(); + let acceptance_mechanisms_request = ledger::build_acceptance_mechanisms_request(&setup.did, &aml, &aml_version, Some(&aml_context)).unwrap(); + let acceptance_mechanisms_response = ledger::sign_and_submit_request(setup.pool_handle, setup.wallet_handle, &setup.did, &acceptance_mechanisms_request).unwrap(); pool::check_response_type(&acceptance_mechanisms_response, ResponseType::REPLY); // { @@ -2895,75 +2730,69 @@ mod high_cases { // let expected_data = json!({"aml": aml, "version": aml_version, "amlContext": aml_context}); // assert_eq!(response["result"]["data"], expected_data); // } - - utils::tear_down_with_wallet_and_pool(wallet_handle, pool_handle, "indy_acceptance_mechanism_requests_works", &wallet_config); } #[test] fn indy_author_agreement_works() { - let (wallet_handle, pool_handle, trustee_did, wallet_config) = utils::setup_trustee("indy_author_agreement_works"); + let setup = Setup::trustee(); - let (_, aml_label, _, _) = _set_aml(pool_handle, wallet_handle, &trustee_did); - let (taa_text, taa_version) = _set_taa(pool_handle, wallet_handle, &trustee_did); + let (_, aml_label, _, _) = _set_aml(setup.pool_handle, setup.wallet_handle, &setup.did); + let (taa_text, taa_version) = _set_taa(setup.pool_handle, setup.wallet_handle, &setup.did); - let (did_, verkey_) = did::create_and_store_my_did(wallet_handle, None).unwrap(); + let (did_, verkey_) = did::create_and_store_my_did(setup.wallet_handle, None).unwrap(); - let nym_req = ledger::build_nym_request(&trustee_did, &did_, Some(&verkey_), None, None).unwrap(); - let nym_resp = ledger::sign_and_submit_request(pool_handle, wallet_handle, &trustee_did, &nym_req).unwrap(); + let nym_req = ledger::build_nym_request(&setup.did, &did_, Some(&verkey_), None, None).unwrap(); + let nym_resp = ledger::sign_and_submit_request(setup.pool_handle, setup.wallet_handle, &setup.did, &nym_req).unwrap(); pool::check_response_type(&nym_resp, ResponseType::REJECT); - let nym_req = ledger::build_nym_request(&trustee_did, &did_, Some(&verkey_), None, None).unwrap(); + let nym_req = ledger::build_nym_request(&setup.did, &did_, Some(&verkey_), None, None).unwrap(); let nym_req = ledger::append_txn_author_agreement_acceptance_to_request(&nym_req, Some(&taa_text), Some(&taa_version), None, &aml_label, time::get_time().sec as u64).unwrap(); - let nym_resp = ledger::sign_and_submit_request(pool_handle, wallet_handle, &trustee_did, &nym_req).unwrap(); + let nym_resp = ledger::sign_and_submit_request(setup.pool_handle, setup.wallet_handle, &setup.did, &nym_req).unwrap(); pool::check_response_type(&nym_resp, ResponseType::REPLY); - let get_nym_req = ledger::build_get_nym_request(Some(&trustee_did), &did_).unwrap(); - let get_nym_resp = ledger::submit_request_with_retries(pool_handle, &get_nym_req, &nym_resp).unwrap(); + let get_nym_req = ledger::build_get_nym_request(Some(&setup.did), &did_).unwrap(); + let get_nym_resp = ledger::submit_request_with_retries(setup.pool_handle, &get_nym_req, &nym_resp).unwrap(); pool::check_response_type(&get_nym_resp, ResponseType::REPLY); - _reset_taa(pool_handle, wallet_handle, &trustee_did); - - utils::tear_down_with_wallet_and_pool(wallet_handle, pool_handle, "indy_author_agreement_works", &wallet_config); + _reset_taa(setup.pool_handle, setup.wallet_handle, &setup.did); } #[test] fn indy_reset_author_agreement_works() { - let (wallet_handle, pool_handle, trustee_did, wallet_config) = utils::setup_trustee("indy_reset_author_agreement_works"); + let setup = Setup::trustee(); - _set_aml(pool_handle, wallet_handle, &trustee_did); - _set_taa(pool_handle, wallet_handle, &trustee_did); + _set_aml(setup.pool_handle, setup.wallet_handle, &setup.did); + _set_taa(setup.pool_handle, setup.wallet_handle, &setup.did); - let (did_, verkey_) = did::create_and_store_my_did(wallet_handle, None).unwrap(); + let (did_, verkey_) = did::create_and_store_my_did(setup.wallet_handle, None).unwrap(); - let nym_req = ledger::build_nym_request(&trustee_did, &did_, Some(&verkey_), None, None).unwrap(); + let nym_req = ledger::build_nym_request(&setup.did, &did_, Some(&verkey_), None, None).unwrap(); - let nym_resp = ledger::sign_and_submit_request(pool_handle, wallet_handle, &trustee_did, &nym_req).unwrap(); + let nym_resp = ledger::sign_and_submit_request(setup.pool_handle, setup.wallet_handle, &setup.did, &nym_req).unwrap(); pool::check_response_type(&nym_resp, ResponseType::REJECT); - _reset_taa(pool_handle, wallet_handle, &trustee_did); + _reset_taa(setup.pool_handle, setup.wallet_handle, &setup.did); - let nym_req = ledger::build_nym_request(&trustee_did, &did_, Some(&verkey_), None, None).unwrap(); - let nym_resp = ledger::sign_and_submit_request(pool_handle, wallet_handle, &trustee_did, &nym_req).unwrap(); + let nym_req = ledger::build_nym_request(&setup.did, &did_, Some(&verkey_), None, None).unwrap(); + let nym_resp = ledger::sign_and_submit_request(setup.pool_handle, setup.wallet_handle, &setup.did, &nym_req).unwrap(); pool::check_response_type(&nym_resp, ResponseType::REPLY); - - utils::tear_down_with_wallet_and_pool(wallet_handle, pool_handle, "indy_reset_author_agreement_works", &wallet_config); } #[test] fn indy_author_agreement_works_for_using_invalid_taa() { - let (wallet_handle, pool_handle, trustee_did, wallet_config) = utils::setup_trustee("indy_author_agreement_works_for_using_invalid_taa"); + let setup = Setup::trustee(); - let (_, aml_label, _, _) = _set_aml(pool_handle, wallet_handle, &trustee_did); - _set_taa(pool_handle, wallet_handle, &trustee_did); + let (_, aml_label, _, _) = _set_aml(setup.pool_handle, setup.wallet_handle, &setup.did); + _set_taa(setup.pool_handle, setup.wallet_handle, &setup.did); - let (did_, verkey_) = did::create_and_store_my_did(wallet_handle, None).unwrap(); + let (did_, verkey_) = did::create_and_store_my_did(setup.wallet_handle, None).unwrap(); { - let nym_req = ledger::build_nym_request(&trustee_did, &did_, Some(&verkey_), None, None).unwrap(); + let nym_req = ledger::build_nym_request(&setup.did, &did_, Some(&verkey_), None, None).unwrap(); let nym_req = ledger::append_txn_author_agreement_acceptance_to_request(&nym_req, Some("INVALID TAA TEXT"), @@ -2971,26 +2800,24 @@ mod high_cases { None, &aml_label, time::get_time().sec as u64).unwrap(); - let nym_resp = ledger::sign_and_submit_request(pool_handle, wallet_handle, &trustee_did, &nym_req).unwrap(); + let nym_resp = ledger::sign_and_submit_request(setup.pool_handle, setup.wallet_handle, &setup.did, &nym_req).unwrap(); pool::check_response_type(&nym_resp, ResponseType::REJECT); } - _reset_taa(pool_handle, wallet_handle, &trustee_did); - - utils::tear_down_with_wallet_and_pool(wallet_handle, pool_handle, "indy_author_agreement_works_for_using_invalid_taa", &wallet_config); + _reset_taa(setup.pool_handle, setup.wallet_handle, &setup.did); } #[test] fn indy_author_agreement_works_for_using_invalid_aml() { - let (wallet_handle, pool_handle, trustee_did, wallet_config) = utils::setup_trustee("indy_author_agreement_works_for_using_invalid_aml"); + let setup = Setup::trustee(); - _set_aml(pool_handle, wallet_handle, &trustee_did); - let (taa_text, taa_version) = _set_taa(pool_handle, wallet_handle, &trustee_did); + _set_aml(setup.pool_handle, setup.wallet_handle, &setup.did); + let (taa_text, taa_version) = _set_taa(setup.pool_handle, setup.wallet_handle, &setup.did); - let (did_, verkey_) = did::create_and_store_my_did(wallet_handle, None).unwrap(); + let (did_, verkey_) = did::create_and_store_my_did(setup.wallet_handle, None).unwrap(); { - let nym_req = ledger::build_nym_request(&trustee_did, &did_, Some(&verkey_), None, None).unwrap(); + let nym_req = ledger::build_nym_request(&setup.did, &did_, Some(&verkey_), None, None).unwrap(); let nym_req = ledger::append_txn_author_agreement_acceptance_to_request(&nym_req, Some(&taa_text), Some(&taa_version), @@ -2998,26 +2825,24 @@ mod high_cases { "INVALID AML LABEL", time::get_time().sec as u64).unwrap(); - let nym_resp = ledger::sign_and_submit_request(pool_handle, wallet_handle, &trustee_did, &nym_req).unwrap(); + let nym_resp = ledger::sign_and_submit_request(setup.pool_handle, setup.wallet_handle, &setup.did, &nym_req).unwrap(); pool::check_response_type(&nym_resp, ResponseType::REJECT); } - _reset_taa(pool_handle, wallet_handle, &trustee_did); - - utils::tear_down_with_wallet_and_pool(wallet_handle, pool_handle, "indy_author_agreement_works_for_using_invalid_aml", &wallet_config); + _reset_taa(setup.pool_handle, setup.wallet_handle, &setup.did); } #[test] fn indy_author_agreement_works_for_using_not_last_taa() { - let (wallet_handle, pool_handle, trustee_did, wallet_config) = utils::setup_trustee("indy_author_agreement_works_for_using_not_last_taa"); + let setup = Setup::trustee(); - let (_, aml_label, _, _) = _set_aml(pool_handle, wallet_handle, &trustee_did); - let (taa_text, taa_version) = _set_taa(pool_handle, wallet_handle, &trustee_did); - let (taa_text_2, taa_version_2) = _set_taa(pool_handle, wallet_handle, &trustee_did); + let (_, aml_label, _, _) = _set_aml(setup.pool_handle, setup.wallet_handle, &setup.did); + let (taa_text, taa_version) = _set_taa(setup.pool_handle, setup.wallet_handle, &setup.did); + let (taa_text_2, taa_version_2) = _set_taa(setup.pool_handle, setup.wallet_handle, &setup.did); - let (did_, verkey_) = did::create_and_store_my_did(wallet_handle, None).unwrap(); + let (did_, verkey_) = did::create_and_store_my_did(setup.wallet_handle, None).unwrap(); - let nym_req = ledger::build_nym_request(&trustee_did, &did_, Some(&verkey_), None, None).unwrap(); + let nym_req = ledger::build_nym_request(&setup.did, &did_, Some(&verkey_), None, None).unwrap(); { let nym_req = ledger::append_txn_author_agreement_acceptance_to_request(&nym_req, @@ -3025,11 +2850,11 @@ mod high_cases { None, &aml_label, time::get_time().sec as u64).unwrap(); - let nym_resp = ledger::sign_and_submit_request(pool_handle, wallet_handle, &trustee_did, &nym_req).unwrap(); + let nym_resp = ledger::sign_and_submit_request(setup.pool_handle, setup.wallet_handle, &setup.did, &nym_req).unwrap(); pool::check_response_type(&nym_resp, ResponseType::REJECT); } - let nym_req = ledger::build_nym_request(&trustee_did, &did_, Some(&verkey_), None, None).unwrap(); + let nym_req = ledger::build_nym_request(&setup.did, &did_, Some(&verkey_), None, None).unwrap(); { let nym_req = ledger::append_txn_author_agreement_acceptance_to_request(&nym_req, @@ -3037,20 +2862,18 @@ mod high_cases { None, &aml_label, time::get_time().sec as u64).unwrap(); - let nym_resp = ledger::sign_and_submit_request(pool_handle, wallet_handle, &trustee_did, &nym_req).unwrap(); + let nym_resp = ledger::sign_and_submit_request(setup.pool_handle, setup.wallet_handle, &setup.did, &nym_req).unwrap(); pool::check_response_type(&nym_resp, ResponseType::REPLY); } - _reset_taa(pool_handle, wallet_handle, &trustee_did); - - utils::tear_down_with_wallet_and_pool(wallet_handle, pool_handle, "indy_author_agreement_works_for_using_not_last_taa", &wallet_config); + _reset_taa(setup.pool_handle, setup.wallet_handle, &setup.did); } } mod append_request_endorser { use super::*; - fn _setup_new_identity(wallet_handle: i32, pool_handle: i32) -> String{ + fn _setup_new_identity(wallet_handle: i32, pool_handle: i32) -> String { let (my_did, my_vk) = did::create_and_store_my_did(wallet_handle, None).unwrap(); let nym = ledger::build_nym_request(DID_TRUSTEE, &my_did, Some(&my_vk), None, None).unwrap(); let response = ledger::sign_and_submit_request(pool_handle, wallet_handle, DID_TRUSTEE, &nym).unwrap(); @@ -3060,68 +2883,62 @@ mod high_cases { #[test] fn indy_append_request_endorser_works() { - utils::setup("indy_append_request_endorser_works"); + Setup::empty(); let endorser_did = DID_TRUSTEE; let request = ledger::append_request_endorser(REQUEST, endorser_did).unwrap(); let request: serde_json::Value = serde_json::from_str(&request).unwrap(); assert_eq!(endorser_did, request["endorser"].as_str().unwrap()); - - utils::tear_down("indy_append_request_endorser_works"); } #[test] fn indy_send_request_by_endorser_works() { - let (wallet_handle, pool_handle, endorser_did, _, config) = utils::setup_new_endorser("indy_send_request_by_endorser_works"); + let setup = Setup::endorser(); // Multi sign + Multi Sign - let my_did = _setup_new_identity(wallet_handle, pool_handle); + let my_did = _setup_new_identity(setup.wallet_handle, setup.pool_handle); let request = ledger::build_schema_request(&my_did, SCHEMA_DATA).unwrap(); - let request = ledger::append_request_endorser(&request, &endorser_did).unwrap(); - let request = ledger::multi_sign_request(wallet_handle, &my_did, &request).unwrap(); - let request = ledger::multi_sign_request(wallet_handle, &endorser_did, &request).unwrap(); - let response = ledger::submit_request(pool_handle, &request).unwrap(); + let request = ledger::append_request_endorser(&request, &setup.did).unwrap(); + let request = ledger::multi_sign_request(setup.wallet_handle, &my_did, &request).unwrap(); + let request = ledger::multi_sign_request(setup.wallet_handle, &setup.did, &request).unwrap(); + let response = ledger::submit_request(setup.pool_handle, &request).unwrap(); pool::check_response_type(&response, ResponseType::REPLY); // Sign + Multi Sign - let my_did = _setup_new_identity(wallet_handle, pool_handle); + let my_did = _setup_new_identity(setup.wallet_handle, setup.pool_handle); let request = ledger::build_schema_request(&my_did, SCHEMA_DATA).unwrap(); - let request = ledger::append_request_endorser(&request, &endorser_did).unwrap(); - let request = ledger::sign_request(wallet_handle, &my_did, &request).unwrap(); - let request = ledger::multi_sign_request(wallet_handle, &endorser_did, &request).unwrap(); - let response = ledger::submit_request(pool_handle, &request).unwrap(); + let request = ledger::append_request_endorser(&request, &setup.did).unwrap(); + let request = ledger::sign_request(setup.wallet_handle, &my_did, &request).unwrap(); + let request = ledger::multi_sign_request(setup.wallet_handle, &setup.did, &request).unwrap(); + let response = ledger::submit_request(setup.pool_handle, &request).unwrap(); pool::check_response_type(&response, ResponseType::REPLY); - - utils::tear_down_with_wallet_and_pool(wallet_handle, pool_handle, "indy_send_request_by_endorser_works", &config); } #[test] fn indy_send_request_by_endorser_for_both_author_and_endorser_must_sign() { - let (wallet_handle, pool_handle, endorser_did, _, config) = utils::setup_new_endorser("indy_send_request_by_endorser_for_both_author_and_endorser_must_sign"); - let my_did = _setup_new_identity(wallet_handle, pool_handle); + let setup = Setup::endorser(); + let my_did = _setup_new_identity(setup.wallet_handle, setup.pool_handle); let request = ledger::build_schema_request(&my_did, SCHEMA_DATA).unwrap(); // Sign and Send by an unknown DID - let request_1 = ledger::multi_sign_request(wallet_handle, &my_did, &request).unwrap(); - let response = ledger::submit_request(pool_handle, &request_1).unwrap(); + let request_1 = ledger::multi_sign_request(setup.wallet_handle, &my_did, &request).unwrap(); + let response = ledger::submit_request(setup.pool_handle, &request_1).unwrap(); pool::check_response_type(&response, ResponseType::REJECT); // Sign and Send by an Endorser only - let my_did = _setup_new_identity(wallet_handle, pool_handle); + let my_did = _setup_new_identity(setup.wallet_handle, setup.pool_handle); let request = ledger::build_schema_request(&my_did, SCHEMA_DATA).unwrap(); - let request_2 = ledger::append_request_endorser(&request, &endorser_did).unwrap(); - let request_2 = ledger::multi_sign_request(wallet_handle, &endorser_did, &request_2).unwrap(); - let response = ledger::submit_request(pool_handle, &request_2).unwrap(); + let request_2 = ledger::append_request_endorser(&request, &setup.did).unwrap(); + let request_2 = ledger::multi_sign_request(setup.wallet_handle, &setup.did, &request_2).unwrap(); + let response = ledger::submit_request(setup.pool_handle, &request_2).unwrap(); pool::check_response_type(&response, ResponseType::REQNACK); - - utils::tear_down_with_wallet_and_pool(wallet_handle, pool_handle, "indy_send_request_by_endorser_for_both_author_and_endorser_must_sign", &config); } } } @@ -3135,34 +2952,28 @@ mod medium_cases { #[test] #[cfg(feature = "local_nodes_pool")] fn indy_sign_and_submit_request_works_for_not_found_signer() { - let (wallet_handle, pool_handle, wallet_config) = utils::setup_with_wallet_and_pool("indy_sign_and_submit_request_works_for_not_found_signer"); + let setup = Setup::wallet_and_pool(); - let res = ledger::sign_and_submit_request(pool_handle, wallet_handle, &DID, REQUEST); + let res = ledger::sign_and_submit_request(setup.pool_handle, setup.wallet_handle, &DID, REQUEST); assert_code!(ErrorCode::WalletItemNotFound, res); - - utils::tear_down_with_wallet_and_pool(wallet_handle, pool_handle, "indy_sign_and_submit_request_works_for_not_found_signer", &wallet_config); } #[test] #[cfg(feature = "local_nodes_pool")] fn indy_submit_request_works_for_invalid_message() { - let pool_handle = utils::setup_with_pool("indy_submit_request_works_for_invalid_message"); + let setup = Setup::pool(); - let res = ledger::submit_request(pool_handle, "request"); + let res = ledger::submit_request(setup.pool_handle, "request"); assert_code!(ErrorCode::CommonInvalidStructure, res); - - utils::tear_down_with_pool(pool_handle, "indy_submit_request_works_for_invalid_message"); } #[test] #[cfg(feature = "local_nodes_pool")] fn indy_sign_and_submit_request_works_for_invalid_json() { - let (wallet_handle, pool_handle, did, wallet_config) = utils::setup_trustee("indy_sign_and_submit_request_works_for_invalid_json"); + let setup = Setup::new_identity(); - let res = ledger::sign_and_submit_request(pool_handle, wallet_handle, &did, "request"); + let res = ledger::sign_and_submit_request(setup.pool_handle, setup.wallet_handle, &setup.did, "request"); assert_code!(ErrorCode::CommonInvalidStructure, res); - - utils::tear_down_with_wallet_and_pool(wallet_handle, pool_handle, "indy_sign_and_submit_request_works_for_invalid_json", &wallet_config); } } @@ -3172,31 +2983,27 @@ mod medium_cases { #[test] #[cfg(feature = "local_nodes_pool")] fn indy_submit_action_works_for_pool_restart_for_unknown_node_name() { - let (wallet_handle, pool_handle, did, wallet_config) = utils::setup_trustee("indy_submit_action_works_for_pool_restart_for_unknown_node_name"); + let setup = Setup::trustee(); - let get_validator_info_request = ledger::build_get_validator_info_request(&did).unwrap(); - let get_validator_info_request = ledger::sign_request(wallet_handle, &did, &get_validator_info_request).unwrap(); + let get_validator_info_request = ledger::build_get_validator_info_request(&setup.did).unwrap(); + let get_validator_info_request = ledger::sign_request(setup.wallet_handle, &setup.did, &get_validator_info_request).unwrap(); let nodes = r#"["Other Node"]"#; - let res = ledger::submit_action(pool_handle, &get_validator_info_request, Some(nodes), None); + let res = ledger::submit_action(setup.pool_handle, &get_validator_info_request, Some(nodes), None); assert_code!(ErrorCode::CommonInvalidStructure, res); - - utils::tear_down_with_wallet_and_pool(wallet_handle, pool_handle, "indy_submit_action_works_for_pool_restart_for_unknown_node_name", &wallet_config); } #[test] #[cfg(feature = "local_nodes_pool")] fn indy_submit_action_works_for_pool_restart_for_invalid_nodes_format() { - let (wallet_handle, pool_handle, did, wallet_config) = utils::setup_trustee("indy_submit_action_works_for_pool_restart_for_invalid_nodes_format"); + let setup = Setup::trustee(); - let get_validator_info_request = ledger::build_get_validator_info_request(&did).unwrap(); - let get_validator_info_request = ledger::sign_request(wallet_handle, &did, &get_validator_info_request).unwrap(); + let get_validator_info_request = ledger::build_get_validator_info_request(&setup.did).unwrap(); + let get_validator_info_request = ledger::sign_request(setup.wallet_handle, &setup.did, &get_validator_info_request).unwrap(); let nodes = r#""Node1""#; - let res = ledger::submit_action(pool_handle, &get_validator_info_request, Some(nodes), None); + let res = ledger::submit_action(setup.pool_handle, &get_validator_info_request, Some(nodes), None); assert_code!(ErrorCode::CommonInvalidStructure, res); - - utils::tear_down_with_wallet_and_pool(wallet_handle, pool_handle, "indy_submit_action_works_for_pool_restart_for_invalid_nodes_format", &wallet_config); } } @@ -3206,42 +3013,36 @@ mod medium_cases { #[test] #[cfg(feature = "local_nodes_pool")] fn indy_send_nym_request_works_for_only_required_fields() { - let (wallet_handle, pool_handle, trustee_did, wallet_config) = utils::setup_trustee("indy_send_nym_request_works_for_only_required_fields"); - let (my_did, _) = did::create_and_store_my_did(wallet_handle, None).unwrap(); + let setup = Setup::trustee(); + let (my_did, _) = did::create_and_store_my_did(setup.wallet_handle, None).unwrap(); - let nym_request = ledger::build_nym_request(&trustee_did, &my_did, None, None, None).unwrap(); - let response = ledger::sign_and_submit_request(pool_handle, wallet_handle, &trustee_did, &nym_request).unwrap(); + let nym_request = ledger::build_nym_request(&setup.did, &my_did, None, None, None).unwrap(); + let response = ledger::sign_and_submit_request(setup.pool_handle, setup.wallet_handle, &setup.did, &nym_request).unwrap(); pool::check_response_type(&response, ResponseType::REPLY); - - utils::tear_down_with_wallet_and_pool(wallet_handle, pool_handle, "indy_send_nym_request_works_for_only_required_fields", &wallet_config); } #[test] #[cfg(feature = "local_nodes_pool")] fn indy_send_nym_request_works_with_option_fields() { - let (wallet_handle, pool_handle, trustee_did, wallet_config) = utils::setup_trustee("indy_send_nym_request_works_with_option_fields"); - let (my_did, my_verkey) = did::create_and_store_my_did(wallet_handle, None).unwrap(); + let setup = Setup::trustee(); + let (my_did, my_verkey) = did::create_and_store_my_did(setup.wallet_handle, None).unwrap(); - let nym_request = ledger::build_nym_request(&trustee_did, &my_did, Some(&my_verkey), Some("some_alias"), Some("STEWARD")).unwrap(); - let response = ledger::sign_and_submit_request(pool_handle, wallet_handle, &trustee_did, &nym_request).unwrap(); + let nym_request = ledger::build_nym_request(&setup.did, &my_did, Some(&my_verkey), Some("some_alias"), Some("STEWARD")).unwrap(); + let response = ledger::sign_and_submit_request(setup.pool_handle, setup.wallet_handle, &setup.did, &nym_request).unwrap(); pool::check_response_type(&response, ResponseType::REPLY); - - utils::tear_down_with_wallet_and_pool(wallet_handle, pool_handle, "indy_send_nym_request_works_with_option_fields", &wallet_config); } #[test] #[cfg(feature = "local_nodes_pool")] fn indy_send_nym_request_works_for_different_roles() { - let (wallet_handle, pool_handle, trustee_did, wallet_config) = utils::setup_trustee("indy_send_nym_request_works_for_different_roles"); + let setup = Setup::trustee(); for role in ["STEWARD", "TRUSTEE", "TRUST_ANCHOR", "ENDORSER", "NETWORK_MONITOR"].iter() { - let (my_did, _) = did::create_and_store_my_did(wallet_handle, None).unwrap(); - let nym_request = ledger::build_nym_request(&trustee_did, &my_did, None, None, Some(role)).unwrap(); - let response = ledger::sign_and_submit_request(pool_handle, wallet_handle, &trustee_did, &nym_request).unwrap(); + let (my_did, _) = did::create_and_store_my_did(setup.wallet_handle, None).unwrap(); + let nym_request = ledger::build_nym_request(&setup.did, &my_did, None, None, Some(role)).unwrap(); + let response = ledger::sign_and_submit_request(setup.pool_handle, setup.wallet_handle, &setup.did, &nym_request).unwrap(); pool::check_response_type(&response, ResponseType::REPLY); } - - utils::tear_down_with_wallet_and_pool(wallet_handle, pool_handle, "indy_send_nym_request_works_for_different_roles", &wallet_config); } #[test] @@ -3254,48 +3055,42 @@ mod medium_cases { #[test] #[cfg(feature = "local_nodes_pool")] fn indy_nym_request_works_for_wrong_signer_role() { - let (wallet_handle, pool_handle, trustee_did, wallet_config) = utils::setup_trustee("indy_nym_request_works_for_wrong_signer_role"); - let (my_did, _) = did::create_and_store_my_did(wallet_handle, None).unwrap(); + let setup = Setup::trustee(); + let (my_did, _) = did::create_and_store_my_did(setup.wallet_handle, None).unwrap(); - let nym_request = ledger::build_nym_request(&trustee_did, &my_did, None, None, None).unwrap(); - let response = ledger::sign_and_submit_request(pool_handle, wallet_handle, &trustee_did, &nym_request).unwrap(); + let nym_request = ledger::build_nym_request(&setup.did, &my_did, None, None, None).unwrap(); + let response = ledger::sign_and_submit_request(setup.pool_handle, setup.wallet_handle, &setup.did, &nym_request).unwrap(); pool::check_response_type(&response, ResponseType::REPLY); - let (my_did2, _) = did::create_and_store_my_did(wallet_handle, None).unwrap(); + let (my_did2, _) = did::create_and_store_my_did(setup.wallet_handle, None).unwrap(); let nym_request = ledger::build_nym_request(&my_did, &my_did2, None, None, None).unwrap(); - let response = ledger::sign_and_submit_request(pool_handle, wallet_handle, &my_did, &nym_request).unwrap(); + let response = ledger::sign_and_submit_request(setup.pool_handle, setup.wallet_handle, &my_did, &nym_request).unwrap(); pool::check_response_type(&response, ResponseType::REQNACK); - - utils::tear_down_with_wallet_and_pool(wallet_handle, pool_handle, "indy_nym_request_works_for_wrong_signer_role", &wallet_config); } #[test] #[cfg(feature = "local_nodes_pool")] fn indy_nym_request_works_for_unknown_signer_did() { - let (wallet_handle, pool_handle, wallet_config) = utils::setup_with_wallet_and_pool("indy_nym_request_works_for_unknown_signer_did"); + let setup = Setup::wallet_and_pool(); - let (did, _) = did::create_and_store_my_did(wallet_handle, None).unwrap(); + let (did, _) = did::create_and_store_my_did(setup.wallet_handle, None).unwrap(); let nym_request = ledger::build_nym_request(&did, DID, None, None, None).unwrap(); - let response = ledger::sign_and_submit_request(pool_handle, wallet_handle, &did, &nym_request).unwrap(); + let response = ledger::sign_and_submit_request(setup.pool_handle, setup.wallet_handle, &did, &nym_request).unwrap(); pool::check_response_type(&response, ResponseType::REQNACK); - - utils::tear_down_with_wallet_and_pool(wallet_handle, pool_handle, "indy_nym_request_works_for_unknown_signer_did", &wallet_config); } #[test] #[cfg(feature = "local_nodes_pool")] fn indy_get_nym_request_works_for_unknown_did() { - let (wallet_handle, pool_handle, wallet_config) = utils::setup_with_wallet_and_pool("indy_get_nym_request_works_for_unknown_did"); + let setup = Setup::wallet_and_pool(); - let (did, _) = did::create_and_store_my_did(wallet_handle, None).unwrap(); + let (did, _) = did::create_and_store_my_did(setup.wallet_handle, None).unwrap(); let get_nym_request = ledger::build_get_nym_request(Some(&did), &did).unwrap(); - let get_nym_response = ledger::submit_request(pool_handle, &get_nym_request).unwrap(); + let get_nym_response = ledger::submit_request(setup.pool_handle, &get_nym_request).unwrap(); let get_nym_response: Reply = serde_json::from_str(&get_nym_response).unwrap(); assert!(get_nym_response.result.data.is_none()); - - utils::tear_down_with_wallet_and_pool(wallet_handle, pool_handle, "indy_get_nym_request_works_for_unknown_did", &wallet_config); } #[test] @@ -3329,35 +3124,33 @@ mod medium_cases { #[test] #[cfg(feature = "local_nodes_pool")] fn indy_nym_requests_works_for_reset_role() { - let (wallet_handle, pool_handle, trustee_did, wallet_config) = utils::setup_trustee("indy_nym_requests_works_for_reset_role"); - let (my_did, my_verkey) = did::create_and_store_my_did(wallet_handle, None).unwrap(); + let setup = Setup::trustee(); + let (my_did, my_verkey) = did::create_and_store_my_did(setup.wallet_handle, None).unwrap(); - let mut nym_request = ledger::build_nym_request(&trustee_did, &my_did, + let mut nym_request = ledger::build_nym_request(&setup.did, &my_did, Some(&my_verkey), None, Some("TRUSTEE")).unwrap(); - let nym_req_resp = ledger::sign_and_submit_request(pool_handle, wallet_handle, &trustee_did, &nym_request).unwrap(); + let nym_req_resp = ledger::sign_and_submit_request(setup.pool_handle, setup.wallet_handle, &setup.did, &nym_request).unwrap(); pool::check_response_type(&nym_req_resp, ResponseType::REPLY); let mut get_nym_request = ledger::build_get_nym_request(Some(&my_did), &my_did).unwrap(); - let get_nym_response_with_role = ledger::submit_request_with_retries(pool_handle, &get_nym_request, &nym_req_resp).unwrap(); + let get_nym_response_with_role = ledger::submit_request_with_retries(setup.pool_handle, &get_nym_request, &nym_req_resp).unwrap(); let get_nym_response_with_role: Reply = serde_json::from_str(&get_nym_response_with_role).unwrap(); let get_nym_response_data_with_role: GetNymResultData = serde_json::from_str(&get_nym_response_with_role.result.data.unwrap()).unwrap(); nym_request = ledger::build_nym_request(&my_did, &my_did, Some(&my_verkey), None, Some("")).unwrap(); - let nym_req_resp = ledger::sign_and_submit_request(pool_handle, wallet_handle, &my_did, &nym_request).unwrap(); + let nym_req_resp = ledger::sign_and_submit_request(setup.pool_handle, setup.wallet_handle, &my_did, &nym_request).unwrap(); pool::check_response_type(&nym_req_resp, ResponseType::REPLY); get_nym_request = ledger::build_get_nym_request(Some(&my_did), &my_did).unwrap(); - let get_nym_response_without_role = ledger::submit_request_with_retries(pool_handle, &get_nym_request, &nym_req_resp).unwrap(); + let get_nym_response_without_role = ledger::submit_request_with_retries(setup.pool_handle, &get_nym_request, &nym_req_resp).unwrap(); let get_nym_response_without_role: Reply = serde_json::from_str(&get_nym_response_without_role).unwrap(); let get_nym_response_data_without_role: GetNymResultData = serde_json::from_str(&get_nym_response_without_role.result.data.unwrap()).unwrap(); assert!(get_nym_response_data_without_role.role.is_none()); assert_ne!(get_nym_response_data_without_role.role, get_nym_response_data_with_role.role); - - utils::tear_down_with_wallet_and_pool(wallet_handle, pool_handle, "indy_nym_requests_works_for_reset_role", &wallet_config); } } @@ -3367,43 +3160,37 @@ mod medium_cases { #[test] #[cfg(feature = "local_nodes_pool")] fn indy_attrib_request_works_for_unknown_did() { - let (wallet_handle, pool_handle, wallet_config) = utils::setup_with_wallet_and_pool("indy_attrib_request_works_for_unknown_did"); + let setup = Setup::wallet_and_pool(); - let (did, _) = did::create_and_store_my_did(wallet_handle, None).unwrap(); + let (did, _) = did::create_and_store_my_did(setup.wallet_handle, None).unwrap(); let attrib_request = ledger::build_attrib_request(&did, &did, None, Some(ATTRIB_RAW_DATA), None).unwrap(); - let response = ledger::submit_request(pool_handle, &attrib_request).unwrap(); + let response = ledger::submit_request(setup.pool_handle, &attrib_request).unwrap(); pool::check_response_type(&response, ResponseType::REQNACK); - - utils::tear_down_with_wallet_and_pool(wallet_handle, pool_handle, "indy_attrib_request_works_for_unknown_did", &wallet_config); } #[test] #[cfg(feature = "local_nodes_pool")] fn indy_get_attrib_request_works_for_unknown_did() { - let (wallet_handle, pool_handle, wallet_config) = utils::setup_with_wallet_and_pool("indy_get_attrib_request_works_for_unknown_did"); - let (did, _) = did::create_and_store_my_did(wallet_handle, None).unwrap(); + let setup = Setup::wallet_and_pool(); + let (did, _) = did::create_and_store_my_did(setup.wallet_handle, None).unwrap(); let get_attrib_request = ledger::build_get_attrib_request(Some(&did), &did, Some("endpoint"), None, None).unwrap(); - let get_attrib_response = ledger::submit_request(pool_handle, &get_attrib_request).unwrap(); + let get_attrib_response = ledger::submit_request(setup.pool_handle, &get_attrib_request).unwrap(); let get_attrib_response: Reply = serde_json::from_str(&get_attrib_response).unwrap(); assert!(get_attrib_response.result.data.is_none()); - - utils::tear_down_with_wallet_and_pool(wallet_handle, pool_handle, "indy_get_attrib_request_works_for_unknown_did", &wallet_config); } #[test] #[cfg(feature = "local_nodes_pool")] fn indy_get_attrib_request_works_for_unknown_attribute() { - let (wallet_handle, pool_handle, did, _my_vk, wallet_config) = utils::setup_new_identity("indy_get_attrib_request_works_for_unknown_attribute"); + let setup = Setup::new_identity(); - let get_attrib_request = ledger::build_get_attrib_request(Some(&did), &did, Some("some_attribute"), None, None).unwrap(); - let get_attrib_response = ledger::submit_request(pool_handle, &get_attrib_request).unwrap(); + let get_attrib_request = ledger::build_get_attrib_request(Some(&setup.did), &setup.did, Some("some_attribute"), None, None).unwrap(); + let get_attrib_response = ledger::submit_request(setup.pool_handle, &get_attrib_request).unwrap(); let get_attrib_response: Reply = serde_json::from_str(&get_attrib_response).unwrap(); assert!(get_attrib_response.result.data.is_none()); - - utils::tear_down_with_wallet_and_pool(wallet_handle, pool_handle, "indy_get_attrib_request_works_for_unknown_attribute", &wallet_config); } @@ -3477,58 +3264,50 @@ mod medium_cases { #[test] #[cfg(feature = "local_nodes_pool")] fn indy_schema_request_works_for_unknown_did() { - let (wallet_handle, pool_handle, wallet_config) = utils::setup_with_wallet_and_pool("indy_schema_request_works_for_unknown_did"); - let (did, _) = did::create_and_store_my_did(wallet_handle, None).unwrap(); + let setup = Setup::wallet_and_pool(); + let (did, _) = did::create_and_store_my_did(setup.wallet_handle, None).unwrap(); let schema_request = ledger::build_schema_request(&did, SCHEMA_DATA).unwrap(); - let response = ledger::sign_and_submit_request(pool_handle, wallet_handle, &did, &schema_request).unwrap(); + let response = ledger::sign_and_submit_request(setup.pool_handle, setup.wallet_handle, &did, &schema_request).unwrap(); pool::check_response_type(&response, ResponseType::REQNACK); - - utils::tear_down_with_wallet_and_pool(wallet_handle, pool_handle, "indy_schema_request_works_for_unknown_did", &wallet_config); } #[test] #[cfg(feature = "local_nodes_pool")] fn indy_get_schema_request_works_for_unknown_schema() { - let (wallet_handle, pool_handle, wallet_config) = utils::setup_with_wallet_and_pool("indy_get_schema_request_works_for_unknown_schema"); + let setup = Setup::pool(); let get_schema_request = ledger::build_get_schema_request(Some(DID_TRUSTEE), &Schema::schema_id(DID, "other_schema", "1.0")).unwrap(); - let get_schema_response = ledger::submit_request(pool_handle, &get_schema_request).unwrap(); + let get_schema_response = ledger::submit_request(setup.pool_handle, &get_schema_request).unwrap(); let res = ledger::parse_get_schema_response(&get_schema_response); assert_code!(ErrorCode::LedgerNotFound, res); - - utils::tear_down_with_wallet_and_pool(wallet_handle, pool_handle, "indy_get_schema_request_works_for_unknown_schema", &wallet_config); } #[test] #[cfg(feature = "local_nodes_pool")] fn indy_get_parse_returns_error_for_wrong_type() { - let (wallet_handle, pool_handle, wallet_config) = utils::setup_with_wallet_and_pool("indy_get_parse_returns_error_for_wrong_type"); + let setup = Setup::pool(); let (schema_id, _, _) = ledger::post_entities(); let get_schema_request = ledger::build_get_schema_request(Some(DID_MY1), &schema_id).unwrap(); - let get_schema_response = ledger::submit_request(pool_handle, &get_schema_request).unwrap(); + let get_schema_response = ledger::submit_request(setup.pool_handle, &get_schema_request).unwrap(); let res = ledger::parse_get_cred_def_response(&get_schema_response); assert_code!(ErrorCode::LedgerInvalidTransaction, res); - - utils::tear_down_with_wallet_and_pool(wallet_handle, pool_handle, "indy_get_parse_returns_error_for_wrong_type", &wallet_config); } #[test] #[cfg(feature = "local_nodes_pool")] fn indy_get_parse_returns_error_for_wrong_type_and_unknown_schema() { - let (wallet_handle, pool_handle, wallet_config) = utils::setup_with_wallet_and_pool("indy_get_parse_returns_error_for_wrong_type_and_unknown_schema"); + let setup = Setup::pool(); let get_schema_request = ledger::build_get_schema_request(Some(DID_TRUSTEE), &Schema::schema_id(DID, "other_schema", "1.0")).unwrap(); - let get_schema_response = ledger::submit_request(pool_handle, &get_schema_request).unwrap(); + let get_schema_response = ledger::submit_request(setup.pool_handle, &get_schema_request).unwrap(); let res = ledger::parse_get_cred_def_response(&get_schema_response); assert_code!(ErrorCode::LedgerInvalidTransaction, res); - - utils::tear_down_with_wallet_and_pool(wallet_handle, pool_handle, "indy_get_parse_returns_error_for_wrong_type_and_unknown_schema", &wallet_config); } } @@ -3551,57 +3330,49 @@ mod medium_cases { #[test] #[cfg(feature = "local_nodes_pool")] fn indy_send_node_request_works_for_wrong_role() { - let (wallet_handle, pool_handle, did, wallet_config) = utils::setup_trustee("indy_send_node_request_works_for_wrong_role"); + let setup = Setup::trustee(); - let key = utils::crypto::create_key(wallet_handle, None).unwrap(); - let node_request = ledger::build_node_request(&did, &key, NODE_DATA).unwrap(); - let response = ledger::sign_and_submit_request(pool_handle, wallet_handle, &did, &node_request).unwrap(); + let key = utils::crypto::create_key(setup.wallet_handle, None).unwrap(); + let node_request = ledger::build_node_request(&setup.did, &key, NODE_DATA).unwrap(); + let response = ledger::sign_and_submit_request(setup.pool_handle, setup.wallet_handle, &setup.did, &node_request).unwrap(); pool::check_response_type(&response, ResponseType::REJECT); - - utils::tear_down_with_wallet_and_pool(wallet_handle, pool_handle, "indy_send_node_request_works_for_wrong_role", &wallet_config); } #[test] #[cfg(feature = "local_nodes_pool")] fn indy_submit_node_request_works_for_steward_already_has_node() { - let (wallet_handle, pool_handle, did, wallet_config) = utils::setup_steward("indy_submit_node_request_works_for_steward_already_has_node"); + let setup = Setup::steward(); - let key = utils::crypto::create_key(wallet_handle, None).unwrap(); - let node_request = ledger::build_node_request(&did, &key, NODE_DATA).unwrap(); - let response = ledger::sign_and_submit_request(pool_handle, wallet_handle, &did, &node_request).unwrap(); + let key = utils::crypto::create_key(setup.wallet_handle, None).unwrap(); + let node_request = ledger::build_node_request(&setup.did, &key, NODE_DATA).unwrap(); + let response = ledger::sign_and_submit_request(setup.pool_handle, setup.wallet_handle, &setup.did, &node_request).unwrap(); pool::check_response_type(&response, ResponseType::REJECT); - - utils::tear_down_with_wallet_and_pool(wallet_handle, pool_handle, "indy_submit_node_request_works_for_steward_already_has_node", &wallet_config); } #[test] #[cfg(feature = "local_nodes_pool")] fn indy_submit_node_request_works_for_new_node_without_bls_pop() { - let (wallet_handle, pool_handle, wallet_config) = utils::setup_with_wallet_and_pool("indy_submit_node_request_works_for_new_node_without_bls_pop"); + let setup = Setup::wallet_and_pool(); - let (my_did, _) = did::create_store_and_publish_my_did_from_steward(wallet_handle, pool_handle).unwrap(); + let (my_did, _) = did::create_store_and_publish_my_did_from_steward(setup.wallet_handle, setup.pool_handle).unwrap(); let node_data = r#"{"node_ip":"10.0.0.100", "node_port": 1, "client_ip": "10.0.0.100", "client_port": 2, "alias":"some", "services": ["VALIDATOR"], "blskey": "4N8aUNHSgjQVgkpm8nhNEfDf6txHznoYREg9kirmJrkivgL4oSEimFF6nsQ6M41QvhM2Z33nves5vfSn9n1UwNFJBYtWVnHYMATn76vLuL3zU88KyeAYcHfsih3He6UHcXDxcaecHVz6jhCYz1P2UZn2bDVruL5wXpehgBfBaLKm3Ba"}"#; let node_request = ledger::build_node_request(&my_did, DEST, node_data).unwrap(); - let response = ledger::sign_and_submit_request(pool_handle, wallet_handle, &my_did, &node_request).unwrap(); + let response = ledger::sign_and_submit_request(setup.pool_handle, setup.wallet_handle, &my_did, &node_request).unwrap(); pool::check_response_type(&response, ResponseType::REQNACK); - - utils::tear_down_with_wallet_and_pool(wallet_handle, pool_handle, "indy_submit_node_request_works_for_new_node_without_bls_pop", &wallet_config); } #[test] #[cfg(feature = "local_nodes_pool")] fn indy_submit_node_request_works_for_pop_not_correspond_blskey() { - let (wallet_handle, pool_handle, wallet_config) = utils::setup_with_wallet_and_pool("indy_submit_node_request_works_for_pop_not_correspond_blskey"); + let setup = Setup::wallet_and_pool(); - let (my_did, _) = did::create_store_and_publish_my_did_from_steward(wallet_handle, pool_handle).unwrap(); + let (my_did, _) = did::create_store_and_publish_my_did_from_steward(setup.wallet_handle, setup.pool_handle).unwrap(); let node_data = r#"{"node_ip":"10.0.0.100", "node_port": 1, "client_ip": "10.0.0.100", "client_port": 2, "alias":"some", "services": ["VALIDATOR"], "blskey": "4N8aUNHSgjQVgkpm8nhNEfDf6txHznoYREg9kirmJrkivgL4oSEimFF6nsQ6M41QvhM2Z33nves5vfSn9n1UwNFJBYtWVnHYMATn76vLuL3zU88KyeAYcHfsih3He6UHcXDxcaecHVz6jhCYz1P2UZn2bDVruL5wXpehgBfBaLKm3Ba", "blskey_pop": "RPLagxaR5xdimFzwmzYnz4ZhWtYQEj8iR5ZU53T2gitPCyCHQneUn2Huc4oeLd2B2HzkGnjAff4hWTJT6C7qHYB1Mv2wU5iHHGFWkhnTX9WsEAbunJCV2qcaXScKj4tTfvdDKfLiVuU2av6hbsMztirRze7LvYBkRHV3tGwyCptsrP"}"#; let node_request = ledger::build_node_request(&my_did, DEST, node_data).unwrap(); - let response = ledger::sign_and_submit_request(pool_handle, wallet_handle, &my_did, &node_request).unwrap(); + let response = ledger::sign_and_submit_request(setup.pool_handle, setup.wallet_handle, &my_did, &node_request).unwrap(); pool::check_response_type(&response, ResponseType::REQNACK); - - utils::tear_down_with_wallet_and_pool(wallet_handle, pool_handle, "indy_submit_node_request_works_for_pop_not_correspond_blskey", &wallet_config); } } @@ -3630,40 +3401,36 @@ mod medium_cases { #[test] #[cfg(feature = "local_nodes_pool")] fn indy_cred_def_requests_works_for_hash_field() { - let (wallet_handle, pool_handle, wallet_config) = utils::setup_with_wallet_and_pool("indy_cred_def_requests_works_for_hash_field"); - - let (issuer_did, _) = did::create_store_and_publish_my_did_from_trustee(wallet_handle, pool_handle).unwrap(); + let setup = Setup::new_identity(); - let (schema_id, schema_json) = anoncreds::issuer_create_schema(&issuer_did, + let (schema_id, schema_json) = anoncreds::issuer_create_schema(&setup.did, GVT_SCHEMA_NAME, SCHEMA_VERSION, r#"["enc", "raw", "hash"]"#).unwrap(); - let schema_request = ledger::build_schema_request(&issuer_did, &schema_json).unwrap(); - let schema_response = ledger::sign_and_submit_request(pool_handle, wallet_handle, &issuer_did, &schema_request).unwrap(); + let schema_request = ledger::build_schema_request(&setup.did, &schema_json).unwrap(); + let schema_response = ledger::sign_and_submit_request(setup.pool_handle, setup.wallet_handle, &setup.did, &schema_request).unwrap(); pool::check_response_type(&schema_response, ::utils::types::ResponseType::REPLY); - let get_schema_request = ledger::build_get_schema_request(Some(&issuer_did), &schema_id).unwrap(); - let get_schema_response = ledger::submit_request_with_retries(pool_handle, &get_schema_request, &schema_response).unwrap(); + let get_schema_request = ledger::build_get_schema_request(Some(&setup.did), &schema_id).unwrap(); + let get_schema_response = ledger::submit_request_with_retries(setup.pool_handle, &get_schema_request, &schema_response).unwrap(); let (_, schema_json) = ledger::parse_get_schema_response(&get_schema_response).unwrap(); - let (cred_def_id, cred_def_json) = anoncreds::issuer_create_credential_definition(wallet_handle, - &issuer_did, + let (cred_def_id, cred_def_json) = anoncreds::issuer_create_credential_definition(setup.wallet_handle, + &setup.did, &schema_json, TAG_1, None, Some(&anoncreds::default_cred_def_config())).unwrap(); - let cred_def_request = ledger::build_cred_def_txn(&issuer_did, &cred_def_json).unwrap(); - let cred_def_response = ledger::sign_and_submit_request(pool_handle, wallet_handle, &issuer_did, &cred_def_request).unwrap(); + let cred_def_request = ledger::build_cred_def_txn(&setup.did, &cred_def_json).unwrap(); + let cred_def_response = ledger::sign_and_submit_request(setup.pool_handle, setup.wallet_handle, &setup.did, &cred_def_request).unwrap(); pool::check_response_type(&cred_def_response, ::utils::types::ResponseType::REPLY); let get_cred_def_request = ledger::build_get_cred_def_request(Some(DID_MY1), &cred_def_id).unwrap(); - let get_cred_def_response = ledger::submit_request_with_retries(pool_handle, &get_cred_def_request, &cred_def_response).unwrap(); + let get_cred_def_response = ledger::submit_request_with_retries(setup.pool_handle, &get_cred_def_request, &cred_def_response).unwrap(); let (_, cred_def_json) = ledger::parse_get_cred_def_response(&get_cred_def_response).unwrap(); let _cred_def: CredentialDefinitionV1 = serde_json::from_str(&cred_def_json).unwrap(); - - utils::tear_down_with_wallet_and_pool(wallet_handle, pool_handle, "indy_cred_def_requests_works_for_hash_field", &wallet_config); } } } diff --git a/libindy/tests/non_secrets.rs b/libindy/tests/non_secrets.rs index 9e24ac11a4..033ec6d233 100644 --- a/libindy/tests/non_secrets.rs +++ b/libindy/tests/non_secrets.rs @@ -40,6 +40,7 @@ use api::INVALID_WALLET_HANDLE; pub const FORBIDDEN_TYPE: &'static str = "Indy::Test"; use utils::test::cleanup_wallet; +use utils::Setup; mod high_cases { use super::*; @@ -49,108 +50,86 @@ mod high_cases { #[test] fn indy_add_wallet_record_works() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("indy_add_wallet_record_works"); - - add_wallet_record(wallet_handle, TYPE, ID, VALUE, None).unwrap(); - - utils::tear_down_with_wallet(wallet_handle, "indy_add_wallet_record_works", &wallet_config); + let setup = Setup::wallet(); + add_wallet_record(setup.wallet_handle, TYPE, ID, VALUE, None).unwrap(); } #[test] fn indy_add_wallet_record_works_for_plugged_wallet() { - let (wallet_handle, wallet_config) = utils::setup_with_plugged_wallet("indy_add_wallet_record_works_for_plugged_wallet"); - - add_wallet_record(wallet_handle, TYPE, ID, VALUE, None).unwrap(); - - utils::tear_down_with_wallet(wallet_handle, "indy_add_wallet_record_works_for_plugged_wallet", &wallet_config); + let setup = Setup::plugged_wallet(); + add_wallet_record(setup.wallet_handle, TYPE, ID, VALUE, None).unwrap(); } #[test] fn indy_add_wallet_record_works_for_duplicate() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("indy_add_wallet_record_works_for_duplicate"); + let setup = Setup::wallet(); - add_wallet_record(wallet_handle, TYPE, ID, VALUE, None).unwrap(); + add_wallet_record(setup.wallet_handle, TYPE, ID, VALUE, None).unwrap(); - let res = add_wallet_record(wallet_handle, TYPE, ID, VALUE, None); + let res = add_wallet_record(setup.wallet_handle, TYPE, ID, VALUE, None); assert_code!(ErrorCode::WalletItemAlreadyExists, res); - - utils::tear_down_with_wallet(wallet_handle, "indy_add_wallet_record_works_for_duplicate", &wallet_config); } #[test] fn indy_add_wallet_record_works_for_tags() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("indy_add_wallet_record_works_for_tags"); - - add_wallet_record(wallet_handle, TYPE, ID, VALUE, Some(TAGS)).unwrap(); - check_record_field(wallet_handle, TYPE, ID, "tags", TAGS); + let setup = Setup::wallet(); - utils::tear_down_with_wallet(wallet_handle, "indy_add_wallet_record_works_for_tags", &wallet_config); + add_wallet_record(setup.wallet_handle, TYPE, ID, VALUE, Some(TAGS)).unwrap(); + check_record_field(setup.wallet_handle, TYPE, ID, "tags", TAGS); } #[test] fn indy_add_wallet_record_works_same_types_different_ids() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("indy_add_wallet_record_works_same_types_different_ids"); + let setup = Setup::wallet(); - add_wallet_record(wallet_handle, TYPE, ID, VALUE, None).unwrap(); - add_wallet_record(wallet_handle, TYPE, ID_2, VALUE, None).unwrap(); - - utils::tear_down_with_wallet(wallet_handle, "indy_add_wallet_record_works_same_types_different_ids", &wallet_config); + add_wallet_record(setup.wallet_handle, TYPE, ID, VALUE, None).unwrap(); + add_wallet_record(setup.wallet_handle, TYPE, ID_2, VALUE, None).unwrap(); } #[test] fn indy_add_wallet_record_works_same_ids_different_types() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("indy_add_wallet_record_works_same_ids_different_types"); - - add_wallet_record(wallet_handle, TYPE, ID, VALUE, None).unwrap(); - add_wallet_record(wallet_handle, TYPE_2, ID, VALUE, None).unwrap(); + let setup = Setup::wallet(); - utils::tear_down_with_wallet(wallet_handle, "indy_add_wallet_record_works_same_ids_different_types", &wallet_config); + add_wallet_record(setup.wallet_handle, TYPE, ID, VALUE, None).unwrap(); + add_wallet_record(setup.wallet_handle, TYPE_2, ID, VALUE, None).unwrap(); } #[test] fn indy_add_wallet_record_works_for_invalid_type() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("indy_add_wallet_record_works_for_invalid_type"); + let setup = Setup::wallet(); - let res = add_wallet_record(wallet_handle, FORBIDDEN_TYPE, ID, VALUE, None); + let res = add_wallet_record(setup.wallet_handle, FORBIDDEN_TYPE, ID, VALUE, None); assert_code!(ErrorCode::WalletAccessFailed, res); - - utils::tear_down_with_wallet(wallet_handle, "indy_add_wallet_record_works_for_invalid_type", &wallet_config); } #[test] fn indy_add_wallet_record_works_for_invalid_handle() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("indy_add_wallet_record_works_for_invalid_handle"); + Setup::empty(); let res = add_wallet_record(INVALID_WALLET_HANDLE, TYPE, ID, VALUE, None); assert_code!(ErrorCode::WalletInvalidHandle, res); - - utils::tear_down_with_wallet(wallet_handle, "indy_add_wallet_record_works_for_invalid_handle", &wallet_config); } #[test] fn indy_add_wallet_record_works_for_invalid_tags() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("indy_add_wallet_record_works_for_invalid_tags"); + let setup = Setup::wallet(); - let res = add_wallet_record(wallet_handle, TYPE, ID, VALUE, Some(r#"tag:1"#)); + let res = add_wallet_record(setup.wallet_handle, TYPE, ID, VALUE, Some(r#"tag:1"#)); assert_code!(ErrorCode::CommonInvalidStructure, res); - - utils::tear_down_with_wallet(wallet_handle, "indy_add_wallet_record_works_for_invalid_tags", &wallet_config); } #[test] fn indy_add_wallet_record_works_for_empty_params() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("indy_add_wallet_record_works_for_empty_params"); + let setup = Setup::wallet(); - let res = add_wallet_record(wallet_handle, "", ID, VALUE, None); + let res = add_wallet_record(setup.wallet_handle, "", ID, VALUE, None); assert_code!(ErrorCode::CommonInvalidParam3, res); - let res = add_wallet_record(wallet_handle, TYPE, "", VALUE, None); + let res = add_wallet_record(setup.wallet_handle, TYPE, "", VALUE, None); assert_code!(ErrorCode::CommonInvalidParam4, res); - let res = add_wallet_record(wallet_handle, TYPE, ID, "", None); + let res = add_wallet_record(setup.wallet_handle, TYPE, ID, "", None); assert_code!(ErrorCode::CommonInvalidParam5, res); - - utils::tear_down_with_wallet(wallet_handle, "indy_add_wallet_record_works_for_empty_params", &wallet_config); } } @@ -159,72 +138,58 @@ mod high_cases { #[test] fn indy_update_record_value_works() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("indy_update_record_value_works"); + let setup = Setup::wallet(); - add_wallet_record(wallet_handle, TYPE, ID, VALUE, None).unwrap(); - check_record_field(wallet_handle, TYPE, ID, "value", VALUE); + add_wallet_record(setup.wallet_handle, TYPE, ID, VALUE, None).unwrap(); + check_record_field(setup.wallet_handle, TYPE, ID, "value", VALUE); - update_wallet_record_value(wallet_handle, TYPE, ID, VALUE_2).unwrap(); - check_record_field(wallet_handle, TYPE, ID, "value", VALUE_2); - - utils::tear_down_with_wallet(wallet_handle, "indy_update_record_value_works", &wallet_config); + update_wallet_record_value(setup.wallet_handle, TYPE, ID, VALUE_2).unwrap(); + check_record_field(setup.wallet_handle, TYPE, ID, "value", VALUE_2); } #[test] fn indy_update_record_value_works_for_plugged_wallet() { - let (wallet_handle, wallet_config) = utils::setup_with_plugged_wallet("indy_update_record_value_works_for_plugged_wallet"); - - add_wallet_record(wallet_handle, TYPE, ID, VALUE, None).unwrap(); - check_record_field(wallet_handle, TYPE, ID, "value", VALUE); + let setup = Setup::plugged_wallet(); - update_wallet_record_value(wallet_handle, TYPE, ID, VALUE_2).unwrap(); - check_record_field(wallet_handle, TYPE, ID, "value", VALUE_2); + add_wallet_record(setup.wallet_handle, TYPE, ID, VALUE, None).unwrap(); + check_record_field(setup.wallet_handle, TYPE, ID, "value", VALUE); - utils::tear_down_with_wallet(wallet_handle, "indy_update_record_value_works_for_plugged_wallet", &wallet_config); + update_wallet_record_value(setup.wallet_handle, TYPE, ID, VALUE_2).unwrap(); + check_record_field(setup.wallet_handle, TYPE, ID, "value", VALUE_2); } #[test] fn indy_update_record_value_works_for_not_found_record() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("indy_update_record_value_works_for_not_found_record"); + let setup = Setup::wallet(); - let res = update_wallet_record_value(wallet_handle, TYPE, ID, VALUE); + let res = update_wallet_record_value(setup.wallet_handle, TYPE, ID, VALUE); assert_code!(ErrorCode::WalletItemNotFound, res); - - utils::tear_down_with_wallet(wallet_handle, "indy_update_record_value_works_for_not_found_record", &wallet_config); } #[test] fn indy_update_record_value_works_for_invalid_wallet_handle() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("indy_update_record_value_works_for_invalid_wallet_handle"); - - add_wallet_record(wallet_handle, TYPE, ID, VALUE, None).unwrap(); + Setup::empty(); let res = update_wallet_record_value(INVALID_WALLET_HANDLE, TYPE, ID, VALUE_2); assert_code!(ErrorCode::WalletInvalidHandle, res); - - utils::tear_down_with_wallet(wallet_handle, "indy_update_record_value_works_for_invalid_wallet_handle", &wallet_config); } #[test] fn indy_update_record_value_works_for_empty_value() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("indy_update_record_value_works_for_empty_value"); + let setup = Setup::wallet(); - add_wallet_record(wallet_handle, TYPE, ID, VALUE, None).unwrap(); + add_wallet_record(setup.wallet_handle, TYPE, ID, VALUE, None).unwrap(); - let res = update_wallet_record_value(wallet_handle, TYPE, ID, ""); + let res = update_wallet_record_value(setup.wallet_handle, TYPE, ID, ""); assert_code!(ErrorCode::CommonInvalidParam5, res); - - utils::tear_down_with_wallet(wallet_handle, "indy_update_record_value_works_for_empty_value", &wallet_config); } #[test] fn indy_update_record_value_works_for_invalid_type() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("indy_update_record_value_works_for_invalid_type"); + let setup = Setup::wallet(); - let res = update_wallet_record_value(wallet_handle, FORBIDDEN_TYPE, ID, VALUE); + let res = update_wallet_record_value(setup.wallet_handle, FORBIDDEN_TYPE, ID, VALUE); assert_code!(ErrorCode::WalletAccessFailed, res); - - utils::tear_down_with_wallet(wallet_handle, "indy_update_record_value_works_for_invalid_type", &wallet_config); } } @@ -233,75 +198,61 @@ mod high_cases { #[test] fn indy_update_wallet_record_tags_works() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("indy_update_wallet_record_tags_works"); + let setup = Setup::wallet(); - add_wallet_record(wallet_handle, TYPE, ID, VALUE, None).unwrap(); - check_record_field(wallet_handle, TYPE, ID, "tags", TAGS_EMPTY); + add_wallet_record(setup.wallet_handle, TYPE, ID, VALUE, None).unwrap(); + check_record_field(setup.wallet_handle, TYPE, ID, "tags", TAGS_EMPTY); - update_wallet_record_tags(wallet_handle, TYPE, ID, TAGS).unwrap(); - check_record_field(wallet_handle, TYPE, ID, "tags", TAGS); - - utils::tear_down_with_wallet(wallet_handle, "indy_update_wallet_record_tags_works", &wallet_config); + update_wallet_record_tags(setup.wallet_handle, TYPE, ID, TAGS).unwrap(); + check_record_field(setup.wallet_handle, TYPE, ID, "tags", TAGS); } #[test] fn indy_update_wallet_record_tags_works_for_twice() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("indy_update_wallet_record_tags_works_for_twice"); - - add_wallet_record(wallet_handle, TYPE, ID, VALUE, None).unwrap(); - check_record_field(wallet_handle, TYPE, ID, "tags", TAGS_EMPTY); + let setup = Setup::wallet(); - update_wallet_record_tags(wallet_handle, TYPE, ID, TAGS).unwrap(); - check_record_field(wallet_handle, TYPE, ID, "tags", TAGS); + add_wallet_record(setup.wallet_handle, TYPE, ID, VALUE, None).unwrap(); + check_record_field(setup.wallet_handle, TYPE, ID, "tags", TAGS_EMPTY); - update_wallet_record_tags(wallet_handle, TYPE, ID, "{}").unwrap(); - check_record_field(wallet_handle, TYPE, ID, "tags", TAGS_EMPTY); + update_wallet_record_tags(setup.wallet_handle, TYPE, ID, TAGS).unwrap(); + check_record_field(setup.wallet_handle, TYPE, ID, "tags", TAGS); - utils::tear_down_with_wallet(wallet_handle, "indy_update_wallet_record_tags_works_for_twice", &wallet_config); + update_wallet_record_tags(setup.wallet_handle, TYPE, ID, "{}").unwrap(); + check_record_field(setup.wallet_handle, TYPE, ID, "tags", TAGS_EMPTY); } #[test] fn indy_update_wallet_record_tags_works_for_not_found_record() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("indy_update_wallet_record_tags_works_for_not_found_record"); + let setup = Setup::wallet(); - let res = update_wallet_record_tags(wallet_handle, TYPE, ID, TAGS); + let res = update_wallet_record_tags(setup.wallet_handle, TYPE, ID, TAGS); assert_code!(ErrorCode::WalletItemNotFound, res); - - utils::tear_down_with_wallet(wallet_handle, "indy_update_wallet_record_tags_works_for_not_found_record", &wallet_config); } #[test] fn indy_update_wallet_record_tags_works_for_empty() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("indy_update_wallet_record_tags_works_for_empty"); + let setup = Setup::wallet(); - add_wallet_record(wallet_handle, TYPE, ID, VALUE, None).unwrap(); + add_wallet_record(setup.wallet_handle, TYPE, ID, VALUE, None).unwrap(); - let res = update_wallet_record_tags(wallet_handle, TYPE, ID, ""); + let res = update_wallet_record_tags(setup.wallet_handle, TYPE, ID, ""); assert_code!(ErrorCode::CommonInvalidParam5, res); - - utils::tear_down_with_wallet(wallet_handle, "indy_update_wallet_record_tags_works_for_empty", &wallet_config); } #[test] fn indy_update_wallet_record_tags_works_for_invalid_wallet_handle() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("indy_update_wallet_record_tags_works_for_invalid_wallet_handle"); - - add_wallet_record(wallet_handle, TYPE, ID, VALUE, None).unwrap(); + Setup::empty(); let res = update_wallet_record_tags(INVALID_WALLET_HANDLE, TYPE, ID, TAGS); assert_code!(ErrorCode::WalletInvalidHandle, res); - - utils::tear_down_with_wallet(wallet_handle, "indy_update_wallet_record_tags_works_for_invalid_wallet_handle", &wallet_config); } #[test] fn indy_update_wallet_record_tags_works_for_invalid_type() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("indy_update_wallet_record_tags_works_for_invalid_type"); + let setup = Setup::wallet(); - let res = update_wallet_record_tags(wallet_handle, FORBIDDEN_TYPE, ID, TAGS); + let res = update_wallet_record_tags(setup.wallet_handle, FORBIDDEN_TYPE, ID, TAGS); assert_code!(ErrorCode::WalletAccessFailed, res); - - utils::tear_down_with_wallet(wallet_handle, "indy_update_wallet_record_tags_works_for_invalid_type", &wallet_config); } } @@ -310,96 +261,80 @@ mod high_cases { #[test] fn indy_add_wallet_record_tags_works() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("indy_add_wallet_record_tags_works"); - - add_wallet_record(wallet_handle, TYPE, ID, VALUE, None).unwrap(); - check_record_field(wallet_handle, TYPE, ID, "tags", TAGS_EMPTY); + let setup = Setup::wallet(); - add_wallet_record_tags(wallet_handle, TYPE, ID, TAGS).unwrap(); - check_record_field(wallet_handle, TYPE, ID, "tags", TAGS); + add_wallet_record(setup.wallet_handle, TYPE, ID, VALUE, None).unwrap(); + check_record_field(setup.wallet_handle, TYPE, ID, "tags", TAGS_EMPTY); - utils::tear_down_with_wallet(wallet_handle, "indy_add_wallet_record_tags_works", &wallet_config); + add_wallet_record_tags(setup.wallet_handle, TYPE, ID, TAGS).unwrap(); + check_record_field(setup.wallet_handle, TYPE, ID, "tags", TAGS); } #[test] fn indy_add_wallet_record_tags_works_for_twice() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("indy_add_wallet_record_tags_works_for_twice"); + let setup = Setup::wallet(); - add_wallet_record(wallet_handle, TYPE, ID, VALUE, None).unwrap(); - check_record_field(wallet_handle, TYPE, ID, "tags", TAGS_EMPTY); + add_wallet_record(setup.wallet_handle, TYPE, ID, VALUE, None).unwrap(); + check_record_field(setup.wallet_handle, TYPE, ID, "tags", TAGS_EMPTY); let tags_json = r#"{"tagName1": "str1"}"#; - add_wallet_record_tags(wallet_handle, TYPE, ID, tags_json).unwrap(); - check_record_field(wallet_handle, TYPE, ID, "tags", tags_json); + add_wallet_record_tags(setup.wallet_handle, TYPE, ID, tags_json).unwrap(); + check_record_field(setup.wallet_handle, TYPE, ID, "tags", tags_json); let tags_json_2 = r#"{"tagName2": "str2"}"#; - add_wallet_record_tags(wallet_handle, TYPE, ID, tags_json_2).unwrap(); + add_wallet_record_tags(setup.wallet_handle, TYPE, ID, tags_json_2).unwrap(); let expected_tags = r#"{"tagName1": "str1", "tagName2": "str2"}"#; - check_record_field(wallet_handle, TYPE, ID, "tags", expected_tags); - - utils::tear_down_with_wallet(wallet_handle, "indy_add_wallet_record_tags_works_for_twice", &wallet_config); + check_record_field(setup.wallet_handle, TYPE, ID, "tags", expected_tags); } #[test] fn indy_add_wallet_record_tags_works_for_twice_add_same_tag() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("indy_add_wallet_record_tags_works_for_twice_add_same_tag"); - - add_wallet_record(wallet_handle, TYPE, ID, VALUE, Some(TAGS)).unwrap(); - check_record_field(wallet_handle, TYPE, ID, "tags", TAGS); + let setup = Setup::wallet(); - add_wallet_record_tags(wallet_handle, TYPE, ID, TAGS).unwrap(); - check_record_field(wallet_handle, TYPE, ID, "tags", TAGS); + add_wallet_record(setup.wallet_handle, TYPE, ID, VALUE, Some(TAGS)).unwrap(); + check_record_field(setup.wallet_handle, TYPE, ID, "tags", TAGS); - utils::tear_down_with_wallet(wallet_handle, "indy_add_wallet_record_tags_works_for_twice_add_same_tag", &wallet_config); + add_wallet_record_tags(setup.wallet_handle, TYPE, ID, TAGS).unwrap(); + check_record_field(setup.wallet_handle, TYPE, ID, "tags", TAGS); } #[test] fn indy_add_wallet_record_tags_works_for_rewrite_tag() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("indy_add_wallet_record_tags_works_for_rewrite_tag"); + let setup = Setup::wallet(); - add_wallet_record(wallet_handle, TYPE, ID, VALUE, Some(TAGS)).unwrap(); - check_record_field(wallet_handle, TYPE, ID, "tags", TAGS); + add_wallet_record(setup.wallet_handle, TYPE, ID, VALUE, Some(TAGS)).unwrap(); + check_record_field(setup.wallet_handle, TYPE, ID, "tags", TAGS); let tags_json = r#"{"tagName1": "str2"}"#; - add_wallet_record_tags(wallet_handle, TYPE, ID, tags_json).unwrap(); + add_wallet_record_tags(setup.wallet_handle, TYPE, ID, tags_json).unwrap(); let expected_result = r#"{"tagName1": "str2", "~tagName2": "5", "~tagName3": "8"}"#; - check_record_field(wallet_handle, TYPE, ID, "tags", expected_result); - - utils::tear_down_with_wallet(wallet_handle, "indy_add_wallet_record_tags_works_for_rewrite_tag", &wallet_config); + check_record_field(setup.wallet_handle, TYPE, ID, "tags", expected_result); } #[test] fn indy_add_wallet_record_tags_works_for_not_found_record() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("indy_add_wallet_record_tags_works_for_not_found_record"); + let setup = Setup::wallet(); - let res = add_wallet_record_tags(wallet_handle, TYPE, ID, TAGS); + let res = add_wallet_record_tags(setup.wallet_handle, TYPE, ID, TAGS); assert_code!(ErrorCode::WalletItemNotFound, res); - - utils::tear_down_with_wallet(wallet_handle, "indy_add_wallet_record_tags_works_for_not_found_record", &wallet_config); } #[test] fn indy_add_wallet_record_tags_works_for_not_invalid_handle() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("indy_add_wallet_record_tags_works_for_not_invalid_handle"); - - add_wallet_record(wallet_handle, TYPE, ID, VALUE, None).unwrap(); + Setup::empty(); let res = add_wallet_record_tags(INVALID_WALLET_HANDLE, TYPE, ID, TAGS); assert_code!(ErrorCode::WalletInvalidHandle, res); - - utils::tear_down_with_wallet(wallet_handle, "indy_add_wallet_record_tags_works_for_not_invalid_handle", &wallet_config); } #[test] fn indy_add_wallet_record_tags_works_for_not_invalid_type() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("indy_add_wallet_record_tags_works_for_not_invalid_type"); + let setup = Setup::wallet(); - let res = add_wallet_record_tags(wallet_handle, FORBIDDEN_TYPE, ID, TAGS); + let res = add_wallet_record_tags(setup.wallet_handle, FORBIDDEN_TYPE, ID, TAGS); assert_code!(ErrorCode::WalletAccessFailed, res); - - utils::tear_down_with_wallet(wallet_handle, "indy_add_wallet_record_tags_works_for_not_invalid_type", &wallet_config); } } @@ -408,97 +343,81 @@ mod high_cases { #[test] fn indy_delete_wallet_record_tags_works() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("indy_delete_wallet_record_tags_works"); + let setup = Setup::wallet(); - add_wallet_record(wallet_handle, TYPE, ID, VALUE, Some(TAGS)).unwrap(); - check_record_field(wallet_handle, TYPE, ID, "tags", TAGS); + add_wallet_record(setup.wallet_handle, TYPE, ID, VALUE, Some(TAGS)).unwrap(); + check_record_field(setup.wallet_handle, TYPE, ID, "tags", TAGS); - delete_wallet_record_tags(wallet_handle, TYPE, ID, r#"["tagName1"]"#).unwrap(); + delete_wallet_record_tags(setup.wallet_handle, TYPE, ID, r#"["tagName1"]"#).unwrap(); let expected_tags_json = r#"{"~tagName2": "5", "~tagName3": "8"}"#; - check_record_field(wallet_handle, TYPE, ID, "tags", expected_tags_json); - - utils::tear_down_with_wallet(wallet_handle, "indy_delete_wallet_record_tags_works", &wallet_config); + check_record_field(setup.wallet_handle, TYPE, ID, "tags", expected_tags_json); } #[test] fn indy_delete_wallet_record_tags_works_for_delete_all() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("indy_delete_wallet_record_tags_works_for_delete_all"); - - add_wallet_record(wallet_handle, TYPE, ID, VALUE, Some(TAGS)).unwrap(); + let setup = Setup::wallet(); - delete_wallet_record_tags(wallet_handle, TYPE, ID, r#"["tagName1", "~tagName2", "~tagName3"]"#).unwrap(); - check_record_field(wallet_handle, TYPE, ID, "tags", TAGS_EMPTY); + add_wallet_record(setup.wallet_handle, TYPE, ID, VALUE, Some(TAGS)).unwrap(); - utils::tear_down_with_wallet(wallet_handle, "indy_delete_wallet_record_tags_works_for_delete_all", &wallet_config); + delete_wallet_record_tags(setup.wallet_handle, TYPE, ID, r#"["tagName1", "~tagName2", "~tagName3"]"#).unwrap(); + check_record_field(setup.wallet_handle, TYPE, ID, "tags", TAGS_EMPTY); } #[test] fn indy_delete_wallet_record_tags_works_for_not_found_record() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("indy_delete_wallet_record_tags_works_for_not_found_record"); + let setup = Setup::wallet(); - let res = delete_wallet_record_tags(wallet_handle, TYPE, ID, r#"["tagName1"]"#); + let res = delete_wallet_record_tags(setup.wallet_handle, TYPE, ID, r#"["tagName1"]"#); assert_code!(ErrorCode::WalletItemNotFound, res); - - utils::tear_down_with_wallet(wallet_handle, "indy_delete_wallet_record_tags_works_for_not_found_record", &wallet_config); } #[test] fn indy_delete_wallet_record_tags_works_for_not_found_tag() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("indy_delete_wallet_record_tags_works_for_not_found_tag"); - - add_wallet_record(wallet_handle, TYPE, ID, VALUE, Some(TAGS_EMPTY)).unwrap(); + let setup = Setup::wallet(); - delete_wallet_record_tags(wallet_handle, TYPE, ID, r#"["tagName1"]"#).unwrap(); + add_wallet_record(setup.wallet_handle, TYPE, ID, VALUE, Some(TAGS_EMPTY)).unwrap(); - utils::tear_down_with_wallet(wallet_handle, "indy_delete_wallet_record_tags_works_for_not_found_tag", &wallet_config); + delete_wallet_record_tags(setup.wallet_handle, TYPE, ID, r#"["tagName1"]"#).unwrap(); } #[test] fn indy_delete_wallet_record_tags_works_for_twice_delete() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("indy_delete_wallet_record_tags_works_for_twice_delete"); + let setup = Setup::wallet(); - add_wallet_record(wallet_handle, TYPE, ID, VALUE, Some(TAGS)).unwrap(); + add_wallet_record(setup.wallet_handle, TYPE, ID, VALUE, Some(TAGS)).unwrap(); - delete_wallet_record_tags(wallet_handle, TYPE, ID, r#"["tagName1"]"#).unwrap(); - delete_wallet_record_tags(wallet_handle, TYPE, ID, r#"["~tagName2"]"#).unwrap(); + delete_wallet_record_tags(setup.wallet_handle, TYPE, ID, r#"["tagName1"]"#).unwrap(); + delete_wallet_record_tags(setup.wallet_handle, TYPE, ID, r#"["~tagName2"]"#).unwrap(); let expected_tags = r#"{"~tagName3": "8"}"#; - check_record_field(wallet_handle, TYPE, ID, "tags", expected_tags); - - utils::tear_down_with_wallet(wallet_handle, "indy_delete_wallet_record_tags_works_for_twice_delete", &wallet_config); + check_record_field(setup.wallet_handle, TYPE, ID, "tags", expected_tags); } #[test] fn indy_delete_wallet_record_tags_works_for_twice_delete_same_tag() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("indy_delete_wallet_record_tags_works_for_twice_delete_same_tag"); - - add_wallet_record(wallet_handle, TYPE, ID, VALUE, Some(TAGS)).unwrap(); + let setup = Setup::wallet(); - delete_wallet_record_tags(wallet_handle, TYPE, ID, r#"["tagName1"]"#).unwrap(); - delete_wallet_record_tags(wallet_handle, TYPE, ID, r#"["tagName1"]"#).unwrap(); + add_wallet_record(setup.wallet_handle, TYPE, ID, VALUE, Some(TAGS)).unwrap(); - utils::tear_down_with_wallet(wallet_handle, "indy_delete_wallet_record_tags_works_for_twice_delete_same_tag", &wallet_config); + delete_wallet_record_tags(setup.wallet_handle, TYPE, ID, r#"["tagName1"]"#).unwrap(); + delete_wallet_record_tags(setup.wallet_handle, TYPE, ID, r#"["tagName1"]"#).unwrap(); } #[test] fn indy_delete_wallet_record_tags_works_for_invalid_handle() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("indy_delete_wallet_record_tags_works_for_invalid_handle"); + Setup::empty(); let res = delete_wallet_record_tags(INVALID_WALLET_HANDLE, TYPE, ID, r#"["tagName1"]"#); assert_code!(ErrorCode::WalletInvalidHandle, res); - - utils::tear_down_with_wallet(wallet_handle, "indy_delete_wallet_record_tags_works_for_invalid_handle", &wallet_config); } #[test] fn indy_delete_wallet_record_tags_works_for_invalid_type() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("indy_delete_wallet_record_tags_works_for_invalid_type"); + let setup = Setup::wallet(); - let res = delete_wallet_record_tags(wallet_handle, FORBIDDEN_TYPE, ID, r#"["tagName1"]"#); + let res = delete_wallet_record_tags(setup.wallet_handle, FORBIDDEN_TYPE, ID, r#"["tagName1"]"#); assert_code!(ErrorCode::WalletAccessFailed, res); - - utils::tear_down_with_wallet(wallet_handle, "indy_delete_wallet_record_tags_works_for_invalid_type", &wallet_config); } } @@ -507,79 +426,65 @@ mod high_cases { #[test] fn indy_delete_wallet_record_works() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("indy_delete_wallet_record_works"); + let setup = Setup::wallet(); - add_wallet_record(wallet_handle, TYPE, ID, VALUE, None).unwrap(); + add_wallet_record(setup.wallet_handle, TYPE, ID, VALUE, None).unwrap(); - get_wallet_record(wallet_handle, TYPE, ID, "{}").unwrap(); + get_wallet_record(setup.wallet_handle, TYPE, ID, "{}").unwrap(); - delete_wallet_record(wallet_handle, TYPE, ID).unwrap(); + delete_wallet_record(setup.wallet_handle, TYPE, ID).unwrap(); - let res = get_wallet_record(wallet_handle, TYPE, ID, OPTIONS_EMPTY); + let res = get_wallet_record(setup.wallet_handle, TYPE, ID, OPTIONS_EMPTY); assert_code!(ErrorCode::WalletItemNotFound, res); - - utils::tear_down_with_wallet(wallet_handle, "indy_delete_wallet_record_works", &wallet_config); } #[test] fn indy_delete_wallet_record_works_for_not_found_record() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("indy_delete_wallet_record_works_for_not_found_record"); + let setup = Setup::wallet(); - let res = delete_wallet_record(wallet_handle, TYPE, ID); + let res = delete_wallet_record(setup.wallet_handle, TYPE, ID); assert_code!(ErrorCode::WalletItemNotFound, res); - - utils::tear_down_with_wallet(wallet_handle, "indy_delete_wallet_record_works_for_not_found_record", &wallet_config); } #[test] fn indy_delete_wallet_record_works_for_twice() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("indy_delete_wallet_record_works_for_twice"); + let setup = Setup::wallet(); - add_wallet_record(wallet_handle, TYPE, ID, VALUE, None).unwrap(); + add_wallet_record(setup.wallet_handle, TYPE, ID, VALUE, None).unwrap(); - get_wallet_record(wallet_handle, TYPE, ID, OPTIONS_EMPTY).unwrap(); + get_wallet_record(setup.wallet_handle, TYPE, ID, OPTIONS_EMPTY).unwrap(); - delete_wallet_record(wallet_handle, TYPE, ID).unwrap(); + delete_wallet_record(setup.wallet_handle, TYPE, ID).unwrap(); - let res = delete_wallet_record(wallet_handle, TYPE, ID); + let res = delete_wallet_record(setup.wallet_handle, TYPE, ID); assert_code!(ErrorCode::WalletItemNotFound, res); - - utils::tear_down_with_wallet(wallet_handle, "indy_delete_wallet_record_works_for_twice", &wallet_config); } #[test] fn indy_delete_wallet_record_works_for_invalid_handle() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("indy_delete_wallet_record_works_for_invalid_handle"); - - add_wallet_record(wallet_handle, TYPE, ID, VALUE, None).unwrap(); + Setup::empty(); let res = delete_wallet_record(INVALID_WALLET_HANDLE, TYPE, ID); assert_code!(ErrorCode::WalletInvalidHandle, res); - - utils::tear_down_with_wallet(wallet_handle, "indy_delete_wallet_record_works_for_invalid_handle", &wallet_config); } #[test] fn indy_delete_wallet_record_works_for_empty_params() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("indy_delete_wallet_record_works_for_empty_params"); + let setup = Setup::wallet(); - let res = delete_wallet_record(wallet_handle, "", ID); + let res = delete_wallet_record(setup.wallet_handle, "", ID); assert_code!(ErrorCode::CommonInvalidParam3, res); - let res = delete_wallet_record(wallet_handle, TYPE, ""); + let res = delete_wallet_record(setup.wallet_handle, TYPE, ""); assert_code!(ErrorCode::CommonInvalidParam4, res); - - utils::tear_down_with_wallet(wallet_handle, "indy_delete_wallet_record_works_for_empty_params", &wallet_config); } #[test] fn indy_delete_wallet_record_works_for_invalid_type() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("indy_delete_wallet_record_works_for_invalid_type"); + let setup = Setup::wallet(); - let res = delete_wallet_record(wallet_handle, FORBIDDEN_TYPE, ID); + let res = delete_wallet_record(setup.wallet_handle, FORBIDDEN_TYPE, ID); assert_code!(ErrorCode::WalletAccessFailed, res); - - utils::tear_down_with_wallet(wallet_handle, "indy_delete_wallet_record_works_for_invalid_type", &wallet_config); } } @@ -593,37 +498,33 @@ mod high_cases { #[test] fn indy_get_wallet_record_works_for_default_options() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("indy_get_wallet_record_works_for_default_options"); + let setup = Setup::wallet(); - add_wallet_record(wallet_handle, TYPE, ID, VALUE, None).unwrap(); + add_wallet_record(setup.wallet_handle, TYPE, ID, VALUE, None).unwrap(); - let record = get_wallet_record(wallet_handle, TYPE, ID, OPTIONS_EMPTY).unwrap(); + let record = get_wallet_record(setup.wallet_handle, TYPE, ID, OPTIONS_EMPTY).unwrap(); let expected_record = WalletRecord { id: ID.to_string(), value: Some(VALUE.to_string()), tags: None, type_: None }; check_record(&record, expected_record); - - utils::tear_down_with_wallet(wallet_handle, "indy_get_wallet_record_works_for_default_options", &wallet_config); } #[test] fn indy_get_wallet_record_works_for_plugged_wallet_default_options() { - let (wallet_handle, wallet_config) = utils::setup_with_plugged_wallet("indy_get_wallet_record_works_for_plugged_wallet_default_options"); + let setup = Setup::plugged_wallet(); - add_wallet_record(wallet_handle, TYPE, ID, VALUE, None).unwrap(); + add_wallet_record(setup.wallet_handle, TYPE, ID, VALUE, None).unwrap(); - let record = get_wallet_record(wallet_handle, TYPE, ID, OPTIONS_EMPTY).unwrap(); + let record = get_wallet_record(setup.wallet_handle, TYPE, ID, OPTIONS_EMPTY).unwrap(); let expected_record = WalletRecord { id: ID.to_string(), value: Some(VALUE.to_string()), tags: None, type_: None }; check_record(&record, expected_record); - - utils::tear_down_with_wallet(wallet_handle, "indy_get_wallet_record_works_for_plugged_wallet_default_options", &wallet_config); } #[test] fn indy_get_wallet_record_works_for_id_only() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("indy_get_wallet_record_works_for_id_only"); + let setup = Setup::wallet(); - add_wallet_record(wallet_handle, TYPE, ID, VALUE, None).unwrap(); + add_wallet_record(setup.wallet_handle, TYPE, ID, VALUE, None).unwrap(); let options = json!({ "retrieveType": false, @@ -631,19 +532,17 @@ mod high_cases { "retrieveTags": false }).to_string(); - let record = get_wallet_record(wallet_handle, TYPE, ID, &options).unwrap(); + let record = get_wallet_record(setup.wallet_handle, TYPE, ID, &options).unwrap(); let expected_record = WalletRecord { id: ID.to_string(), value: None, tags: None, type_: None }; check_record(&record, expected_record); - - utils::tear_down_with_wallet(wallet_handle, "indy_get_wallet_record_works_for_id_only", &wallet_config); } #[test] fn indy_get_wallet_record_works_for_id_value() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("indy_get_wallet_record_works_for_id_value"); + let setup = Setup::wallet(); - add_wallet_record(wallet_handle, TYPE, ID, VALUE, None).unwrap(); + add_wallet_record(setup.wallet_handle, TYPE, ID, VALUE, None).unwrap(); let options = json!({ "retrieveType": false, @@ -651,19 +550,17 @@ mod high_cases { "retrieveTags": false }).to_string(); - let record = get_wallet_record(wallet_handle, TYPE, ID, &options).unwrap(); + let record = get_wallet_record(setup.wallet_handle, TYPE, ID, &options).unwrap(); let expected_record = WalletRecord { id: ID.to_string(), value: Some(VALUE.to_string()), tags: None, type_: None }; check_record(&record, expected_record); - - utils::tear_down_with_wallet(wallet_handle, "indy_get_wallet_record_works_for_id_value", &wallet_config); } #[test] fn indy_get_wallet_record_works_for_id_tags() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("indy_get_wallet_record_works_for_id_tags"); + let setup = Setup::wallet(); - add_wallet_record(wallet_handle, TYPE, ID, VALUE, None).unwrap(); + add_wallet_record(setup.wallet_handle, TYPE, ID, VALUE, None).unwrap(); let options = json!({ "retrieveType": false, @@ -671,19 +568,17 @@ mod high_cases { "retrieveTags": true }).to_string(); - let record = get_wallet_record(wallet_handle, TYPE, ID, &options).unwrap(); + let record = get_wallet_record(setup.wallet_handle, TYPE, ID, &options).unwrap(); let expected_record = WalletRecord { id: ID.to_string(), value: None, tags: Some(HashMap::new()), type_: None }; check_record(&record, expected_record); - - utils::tear_down_with_wallet(wallet_handle, "indy_get_wallet_record_works_for_id_tags", &wallet_config); } #[test] fn indy_get_wallet_record_works_for_full() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("indy_get_wallet_record_works_for_full"); + let setup = Setup::wallet(); - add_wallet_record(wallet_handle, TYPE, ID, VALUE, None).unwrap(); + add_wallet_record(setup.wallet_handle, TYPE, ID, VALUE, None).unwrap(); let options = json!({ "retrieveType": true, @@ -691,45 +586,36 @@ mod high_cases { "retrieveTags": true }).to_string(); - let record = get_wallet_record(wallet_handle, TYPE, ID, &options).unwrap(); + let record = get_wallet_record(setup.wallet_handle, TYPE, ID, &options).unwrap(); let expected_record = WalletRecord { id: ID.to_string(), value: Some(VALUE.to_string()), tags: Some(HashMap::new()), type_: Some(TYPE.to_string()) }; check_record(&record, expected_record); - - utils::tear_down_with_wallet(wallet_handle, "indy_get_wallet_record_works_for_full", &wallet_config); } #[test] fn indy_get_wallet_record_works_for_not_found() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("indy_get_wallet_record_works_for_not_found"); + let setup = Setup::wallet(); - let res = get_wallet_record(wallet_handle, TYPE, ID, OPTIONS_EMPTY); + let res = get_wallet_record(setup.wallet_handle, TYPE, ID, OPTIONS_EMPTY); assert_code!(ErrorCode::WalletItemNotFound, res); - - wallet::close_wallet(wallet_handle).unwrap(); - wallet::delete_wallet(&wallet_config, WALLET_CREDENTIALS).unwrap(); } #[test] fn indy_get_wallet_record_works_for_invalid_options() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("indy_get_wallet_record_works_for_invalid_options"); + let setup = Setup::wallet(); - add_wallet_record(wallet_handle, TYPE, ID, VALUE, None).unwrap(); + add_wallet_record(setup.wallet_handle, TYPE, ID, VALUE, None).unwrap(); - let res = get_wallet_record(wallet_handle, TYPE, ID, "not_json"); + let res = get_wallet_record(setup.wallet_handle, TYPE, ID, "not_json"); assert_code!(ErrorCode::CommonInvalidStructure, res); - - utils::tear_down_with_wallet(wallet_handle, "indy_get_wallet_record_works_for_invalid_options", &wallet_config); } #[test] fn indy_get_wallet_record_works_for_invalid_type() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("indy_get_wallet_record_works_for_invalid_type"); + let setup = Setup::wallet(); - let res = get_wallet_record(wallet_handle, FORBIDDEN_TYPE, ID, OPTIONS_EMPTY); + let res = get_wallet_record(setup.wallet_handle, FORBIDDEN_TYPE, ID, OPTIONS_EMPTY); assert_code!(ErrorCode::WalletAccessFailed, res); - - utils::tear_down_with_wallet(wallet_handle, "indy_get_wallet_record_works_for_invalid_type", &wallet_config); } } @@ -1345,17 +1231,16 @@ mod medium_cases { #[test] pub fn transaction_works_during_opened_wallet_search() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("transaction_works_during_opened_wallet_search"); + let setup = Setup::wallet(); - add_wallet_record(wallet_handle, TYPE, ID, VALUE, None).unwrap(); - add_wallet_record(wallet_handle, TYPE, ID_2, VALUE_2, None).unwrap(); + add_wallet_record(setup.wallet_handle, TYPE, ID, VALUE, None).unwrap(); + add_wallet_record(setup.wallet_handle, TYPE, ID_2, VALUE_2, None).unwrap(); - let search_handle = open_wallet_search(wallet_handle, TYPE, QUERY_EMPTY, OPTIONS_EMPTY).unwrap(); + let search_handle = open_wallet_search(setup.wallet_handle, TYPE, QUERY_EMPTY, OPTIONS_EMPTY).unwrap(); - add_wallet_record(wallet_handle, TYPE, "IDSPEC", VALUE, Some(TAGS_2)).unwrap(); + add_wallet_record(setup.wallet_handle, TYPE, "IDSPEC", VALUE, Some(TAGS_2)).unwrap(); close_wallet_search(search_handle).unwrap(); - utils::tear_down_with_wallet(wallet_handle, "transaction_works_during_opened_wallet_search", &wallet_config); } } } diff --git a/libindy/tests/pairwise.rs b/libindy/tests/pairwise.rs index 280822ac5e..d3858065dd 100644 --- a/libindy/tests/pairwise.rs +++ b/libindy/tests/pairwise.rs @@ -29,6 +29,7 @@ mod utils; use utils::{did, pairwise}; use utils::constants::*; +use utils::Setup; use self::indy::ErrorCode; use api::INVALID_WALLET_HANDLE; @@ -41,74 +42,58 @@ mod high_cases { #[test] fn indy_create_pairwise_works() { - let (wallet_handle, my_did, wallet_config) = utils::setup_did("indy_create_pairwise_works"); + let setup = Setup::did(); - did::store_their_did_from_parts(wallet_handle, DID_TRUSTEE, VERKEY_TRUSTEE).unwrap(); + did::store_their_did_from_parts(setup.wallet_handle, DID_TRUSTEE, VERKEY_TRUSTEE).unwrap(); - pairwise::create_pairwise(wallet_handle, DID_TRUSTEE, &my_did, Some(METADATA)).unwrap(); - - utils::tear_down_with_wallet(wallet_handle, "indy_create_pairwise_works", &wallet_config); + pairwise::create_pairwise(setup.wallet_handle, DID_TRUSTEE, &setup.did, Some(METADATA)).unwrap(); } #[test] fn indy_create_pairwise_works_for_empty_metadata() { - let (wallet_handle, my_did, wallet_config) = utils::setup_did("indy_create_pairwise_works_for_empty_metadata"); - - did::store_their_did_from_parts(wallet_handle, DID_TRUSTEE, VERKEY_TRUSTEE).unwrap(); + let setup = Setup::did(); - pairwise::create_pairwise(wallet_handle, DID_TRUSTEE, &my_did, None).unwrap(); + did::store_their_did_from_parts(setup.wallet_handle, DID_TRUSTEE, VERKEY_TRUSTEE).unwrap(); - utils::tear_down_with_wallet(wallet_handle, "indy_create_pairwise_works_for_empty_metadata", &wallet_config); + pairwise::create_pairwise(setup.wallet_handle, DID_TRUSTEE, &setup.did, None).unwrap(); } #[test] fn indy_create_pairwise_works_for_not_found_my_did() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("indy_create_pairwise_works_for_not_found_my_did"); + let setup = Setup::wallet(); - did::store_their_did_from_parts(wallet_handle, DID_TRUSTEE, VERKEY_TRUSTEE).unwrap(); + did::store_their_did_from_parts(setup.wallet_handle, DID_TRUSTEE, VERKEY_TRUSTEE).unwrap(); - let res = pairwise::create_pairwise(wallet_handle, DID_TRUSTEE, DID, None); + let res = pairwise::create_pairwise(setup.wallet_handle, DID_TRUSTEE, DID, None); assert_code!(ErrorCode::WalletItemNotFound,res); - - utils::tear_down_with_wallet(wallet_handle, "indy_create_pairwise_works_for_not_found_my_did", &wallet_config); } #[test] fn indy_create_pairwise_works_for_not_found_their_did() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("indy_create_pairwise_works_for_not_found_their_did"); - - let (my_did, _) = did::create_and_store_my_did(wallet_handle, Some(MY1_SEED)).unwrap(); + let setup = Setup::did(); - let res = pairwise::create_pairwise(wallet_handle, DID, &my_did, None); + let res = pairwise::create_pairwise(setup.wallet_handle, DID, &setup.did, None); assert_code!(ErrorCode::WalletItemNotFound, res); - - utils::tear_down_with_wallet(wallet_handle, "indy_create_pairwise_works_for_not_found_their_did", &wallet_config); } #[test] fn indy_create_pairwise_works_for_invalid_wallet_handle() { - let (wallet_handle, my_did, wallet_config) = utils::setup_did("indy_create_pairwise_works_for_invalid_wallet_handle"); - - did::store_their_did_from_parts(wallet_handle, DID_TRUSTEE, VERKEY_TRUSTEE).unwrap(); + Setup::empty(); - let res = pairwise::create_pairwise(INVALID_WALLET_HANDLE, DID_TRUSTEE, &my_did, None); + let res = pairwise::create_pairwise(INVALID_WALLET_HANDLE, DID_TRUSTEE, DID, None); assert_code!(ErrorCode::WalletInvalidHandle, res); - - utils::tear_down_with_wallet(wallet_handle, "indy_create_pairwise_works_for_invalid_wallet_handle", &wallet_config); } #[test] fn indy_create_pairwise_works_for_twice() { - let (wallet_handle, my_did, wallet_config) = utils::setup_did("indy_create_pairwise_works_for_twice"); + let setup = Setup::did(); - did::store_their_did_from_parts(wallet_handle, DID_TRUSTEE, VERKEY_TRUSTEE).unwrap(); + did::store_their_did_from_parts(setup.wallet_handle, DID_TRUSTEE, VERKEY_TRUSTEE).unwrap(); - pairwise::create_pairwise(wallet_handle, DID_TRUSTEE, &my_did, Some(METADATA)).unwrap(); + pairwise::create_pairwise(setup.wallet_handle, DID_TRUSTEE, &setup.did, Some(METADATA)).unwrap(); - let res = pairwise::create_pairwise(wallet_handle, DID_TRUSTEE, &my_did, None); + let res = pairwise::create_pairwise(setup.wallet_handle, DID_TRUSTEE, &setup.did, None); assert_code!(ErrorCode::WalletItemAlreadyExists, res); - - utils::tear_down_with_wallet(wallet_handle, "indy_create_pairwise_works_for_twice", &wallet_config); } } @@ -117,45 +102,35 @@ mod high_cases { #[test] fn indy_list_pairwise_works() { - let (wallet_handle, my_did, wallet_config) = utils::setup_did("indy_list_pairwise_works"); + let setup = Setup::did(); - did::store_their_did_from_parts(wallet_handle, DID_TRUSTEE, VERKEY_TRUSTEE).unwrap(); + did::store_their_did_from_parts(setup.wallet_handle, DID_TRUSTEE, VERKEY_TRUSTEE).unwrap(); - pairwise::create_pairwise(wallet_handle, DID_TRUSTEE, &my_did, None).unwrap(); + pairwise::create_pairwise(setup.wallet_handle, DID_TRUSTEE, &setup.did, None).unwrap(); - let list_pairwise_json = pairwise::list_pairwise(wallet_handle).unwrap(); + let list_pairwise_json = pairwise::list_pairwise(setup.wallet_handle).unwrap(); let list_pairwise: Vec = serde_json::from_str(&list_pairwise_json).unwrap(); assert_eq!(list_pairwise.len(), 1); - assert!(list_pairwise.contains(&format!(r#"{{"my_did":"{}","their_did":"{}"}}"#, my_did, DID_TRUSTEE))); - - utils::tear_down_with_wallet(wallet_handle, "indy_list_pairwise_works", &wallet_config); + assert!(list_pairwise.contains(&format!(r#"{{"my_did":"{}","their_did":"{}"}}"#, setup.did, DID_TRUSTEE))); } #[test] fn indy_list_pairwise_works_for_empty_result() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("indy_list_pairwise_works_for_empty_result"); + let setup = Setup::wallet(); - let list_pairwise_json = pairwise::list_pairwise(wallet_handle).unwrap(); + let list_pairwise_json = pairwise::list_pairwise(setup.wallet_handle).unwrap(); let list_pairwise: Vec = serde_json::from_str(&list_pairwise_json).unwrap(); assert_eq!(list_pairwise.len(), 0); - - utils::tear_down_with_wallet(wallet_handle, "indy_list_pairwise_works_for_empty_result", &wallet_config); } #[test] fn indy_list_pairwise_works_for_invalid_handle() { - let (wallet_handle, my_did, wallet_config) = utils::setup_did("indy_list_pairwise_works_for_invalid_handle"); - - did::store_their_did_from_parts(wallet_handle, DID_TRUSTEE, VERKEY_TRUSTEE).unwrap(); - - pairwise::create_pairwise(wallet_handle, DID_TRUSTEE, &my_did, None).unwrap(); + Setup::empty(); let res = pairwise::list_pairwise(INVALID_WALLET_HANDLE); assert_code!(ErrorCode::WalletInvalidHandle, res); - - utils::tear_down_with_wallet(wallet_handle, "indy_list_pairwise_works_for_invalid_handle", &wallet_config); } } @@ -164,38 +139,28 @@ mod high_cases { #[test] fn indy_is_pairwise_exists_works() { - let (wallet_handle, my_did, wallet_config) = utils::setup_did("indy_is_pairwise_exists_works"); - - did::store_their_did_from_parts(wallet_handle, DID_TRUSTEE, VERKEY_TRUSTEE).unwrap(); + let setup = Setup::did(); - pairwise::create_pairwise(wallet_handle, DID_TRUSTEE, &my_did, None).unwrap(); + did::store_their_did_from_parts(setup.wallet_handle, DID_TRUSTEE, VERKEY_TRUSTEE).unwrap(); - assert!(pairwise::pairwise_exists(wallet_handle, DID_TRUSTEE).unwrap()); + pairwise::create_pairwise(setup.wallet_handle, DID_TRUSTEE, &setup.did, None).unwrap(); - utils::tear_down_with_wallet(wallet_handle, "indy_is_pairwise_exists_works", &wallet_config); + assert!(pairwise::pairwise_exists(setup.wallet_handle, DID_TRUSTEE).unwrap()); } #[test] fn indy_is_pairwise_exists_works_for_not_created() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("indy_is_pairwise_exists_works_for_not_created"); - - assert!(!pairwise::pairwise_exists(wallet_handle, DID_TRUSTEE).unwrap()); + let setup = Setup::wallet(); - utils::tear_down_with_wallet(wallet_handle, "indy_is_pairwise_exists_works_for_not_created", &wallet_config); + assert!(!pairwise::pairwise_exists(setup.wallet_handle, DID_TRUSTEE).unwrap()); } #[test] fn indy_is_pairwise_exists_works_for_invalid_handle() { - let (wallet_handle, my_did, wallet_config) = utils::setup_did("indy_is_pairwise_exists_works_for_invalid_handle"); - - did::store_their_did_from_parts(wallet_handle, DID_TRUSTEE, VERKEY_TRUSTEE).unwrap(); - - pairwise::create_pairwise(wallet_handle, DID_TRUSTEE, &my_did, None).unwrap(); + Setup::empty(); let res = pairwise::pairwise_exists(INVALID_WALLET_HANDLE, DID_TRUSTEE); assert_code!(ErrorCode::WalletInvalidHandle, res); - - utils::tear_down_with_wallet(wallet_handle, "indy_is_pairwise_exists_works_for_invalid_handle", &wallet_config); } } @@ -204,40 +169,30 @@ mod high_cases { #[test] fn indy_get_pairwise_works() { - let (wallet_handle, my_did, wallet_config) = utils::setup_did("indy_get_pairwise_works"); - - did::store_their_did_from_parts(wallet_handle, DID_TRUSTEE, VERKEY_TRUSTEE).unwrap(); + let setup = Setup::did(); - pairwise::create_pairwise(wallet_handle, DID_TRUSTEE, &my_did, Some(METADATA)).unwrap(); + did::store_their_did_from_parts(setup.wallet_handle, DID_TRUSTEE, VERKEY_TRUSTEE).unwrap(); - let pairwise_info_json = pairwise::get_pairwise(wallet_handle, DID_TRUSTEE).unwrap(); - assert_eq!(format!(r#"{{"my_did":"{}","metadata":"{}"}}"#, my_did, METADATA), pairwise_info_json); + pairwise::create_pairwise(setup.wallet_handle, DID_TRUSTEE, &setup.did, Some(METADATA)).unwrap(); - utils::tear_down_with_wallet(wallet_handle, "indy_get_pairwise_works", &wallet_config); + let pairwise_info_json = pairwise::get_pairwise(setup.wallet_handle, DID_TRUSTEE).unwrap(); + assert_eq!(format!(r#"{{"my_did":"{}","metadata":"{}"}}"#, setup.did, METADATA), pairwise_info_json); } #[test] fn indy_get_pairwise_works_for_not_created_pairwise() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("indy_get_pairwise_works_for_not_created_pairwise"); + let setup = Setup::wallet(); - let res = pairwise::get_pairwise(wallet_handle, DID_TRUSTEE); + let res = pairwise::get_pairwise(setup.wallet_handle, DID_TRUSTEE); assert_code!(ErrorCode::WalletItemNotFound, res); - - utils::tear_down_with_wallet(wallet_handle, "indy_get_pairwise_works_for_not_created_pairwise", &wallet_config); } #[test] fn indy_get_pairwise_works_for_invalid_handle() { - let (wallet_handle, my_did, wallet_config) = utils::setup_did("indy_get_pairwise_works_for_invalid_handle"); - - did::store_their_did_from_parts(wallet_handle, DID_TRUSTEE, VERKEY_TRUSTEE).unwrap(); - - pairwise::create_pairwise(wallet_handle, DID_TRUSTEE, &my_did, None).unwrap(); + Setup::empty(); let res = pairwise::get_pairwise(INVALID_WALLET_HANDLE, DID_TRUSTEE); assert_code!(ErrorCode::WalletInvalidHandle, res); - - utils::tear_down_with_wallet(wallet_handle, "indy_get_pairwise_works_for_invalid_handle", &wallet_config); } } @@ -246,66 +201,54 @@ mod high_cases { #[test] fn indy_set_pairwise_metadata_works() { - let (wallet_handle, my_did, wallet_config) = utils::setup_did("indy_set_pairwise_metadata_works"); + let setup = Setup::did(); - did::store_their_did_from_parts(wallet_handle, DID_TRUSTEE, VERKEY_TRUSTEE).unwrap(); + did::store_their_did_from_parts(setup.wallet_handle, DID_TRUSTEE, VERKEY_TRUSTEE).unwrap(); - pairwise::create_pairwise(wallet_handle, DID_TRUSTEE, &my_did, None).unwrap(); + pairwise::create_pairwise(setup.wallet_handle, DID_TRUSTEE, &setup.did, None).unwrap(); - let pairwise_info_without_metadata = pairwise::get_pairwise(wallet_handle, DID_TRUSTEE).unwrap(); - assert_eq!(format!(r#"{{"my_did":"{}"}}"#, my_did), pairwise_info_without_metadata); + let pairwise_info_without_metadata = pairwise::get_pairwise(setup.wallet_handle, DID_TRUSTEE).unwrap(); + assert_eq!(format!(r#"{{"my_did":"{}"}}"#, setup.did), pairwise_info_without_metadata); - pairwise::set_pairwise_metadata(wallet_handle, DID_TRUSTEE, Some(METADATA)).unwrap(); + pairwise::set_pairwise_metadata(setup.wallet_handle, DID_TRUSTEE, Some(METADATA)).unwrap(); - let pairwise_info_with_metadata = pairwise::get_pairwise(wallet_handle, DID_TRUSTEE).unwrap(); + let pairwise_info_with_metadata = pairwise::get_pairwise(setup.wallet_handle, DID_TRUSTEE).unwrap(); assert_ne!(pairwise_info_without_metadata, pairwise_info_with_metadata); - assert_eq!(format!(r#"{{"my_did":"{}","metadata":"{}"}}"#, my_did, METADATA), pairwise_info_with_metadata); - - utils::tear_down_with_wallet(wallet_handle, "indy_set_pairwise_metadata_works", &wallet_config); + assert_eq!(format!(r#"{{"my_did":"{}","metadata":"{}"}}"#, setup.did, METADATA), pairwise_info_with_metadata); } #[test] fn indy_set_pairwise_metadata_works_for_reset() { - let (wallet_handle, my_did, wallet_config) = utils::setup_did("indy_set_pairwise_metadata_works_for_reset"); + let setup = Setup::did(); - did::store_their_did_from_parts(wallet_handle, DID_TRUSTEE, VERKEY_TRUSTEE).unwrap(); + did::store_their_did_from_parts(setup.wallet_handle, DID_TRUSTEE, VERKEY_TRUSTEE).unwrap(); - pairwise::create_pairwise(wallet_handle, DID_TRUSTEE, &my_did, Some(METADATA)).unwrap(); + pairwise::create_pairwise(setup.wallet_handle, DID_TRUSTEE, &setup.did, Some(METADATA)).unwrap(); - let pairwise_info_with_metadata = pairwise::get_pairwise(wallet_handle, DID_TRUSTEE).unwrap(); - assert_eq!(format!(r#"{{"my_did":"{}","metadata":"{}"}}"#, my_did, METADATA), pairwise_info_with_metadata); + let pairwise_info_with_metadata = pairwise::get_pairwise(setup.wallet_handle, DID_TRUSTEE).unwrap(); + assert_eq!(format!(r#"{{"my_did":"{}","metadata":"{}"}}"#, setup.did, METADATA), pairwise_info_with_metadata); - pairwise::set_pairwise_metadata(wallet_handle, DID_TRUSTEE, None).unwrap(); + pairwise::set_pairwise_metadata(setup.wallet_handle, DID_TRUSTEE, None).unwrap(); - let pairwise_info_without_metadata = pairwise::get_pairwise(wallet_handle, DID_TRUSTEE).unwrap(); + let pairwise_info_without_metadata = pairwise::get_pairwise(setup.wallet_handle, DID_TRUSTEE).unwrap(); assert_ne!(pairwise_info_with_metadata, pairwise_info_without_metadata); - assert_eq!(format!(r#"{{"my_did":"{}"}}"#, my_did), pairwise_info_without_metadata); - - utils::tear_down_with_wallet(wallet_handle, "indy_set_pairwise_metadata_works_for_reset", &wallet_config); + assert_eq!(format!(r#"{{"my_did":"{}"}}"#, setup.did), pairwise_info_without_metadata); } #[test] fn indy_set_pairwise_metadata_works_for_not_created_pairwise() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("indy_set_pairwise_metadata_works_for_not_created_pairwise"); + let setup = Setup::wallet(); - let res = pairwise::set_pairwise_metadata(wallet_handle, DID_TRUSTEE, Some(METADATA)); + let res = pairwise::set_pairwise_metadata(setup.wallet_handle, DID_TRUSTEE, Some(METADATA)); assert_code!(ErrorCode::WalletItemNotFound, res); - - utils::tear_down_with_wallet(wallet_handle, "indy_set_pairwise_metadata_works_for_not_created_pairwise", &wallet_config); } #[test] fn indy_set_pairwise_metadata_works_for_invalid_wallet_handle() { - let (wallet_handle, my_did, wallet_config) = utils::setup_did("indy_set_pairwise_metadata_works_for_invalid_wallet_handle"); - - did::store_their_did_from_parts(wallet_handle, DID_TRUSTEE, VERKEY_TRUSTEE).unwrap(); - - pairwise::create_pairwise(wallet_handle, DID_TRUSTEE, &my_did, None).unwrap(); + Setup::empty(); let res = pairwise::set_pairwise_metadata(INVALID_WALLET_HANDLE, DID_TRUSTEE, Some(METADATA)); assert_code!(ErrorCode::WalletInvalidHandle, res); - - utils::tear_down_with_wallet(wallet_handle, "indy_set_pairwise_metadata_works_for_invalid_wallet_handle", &wallet_config); } } } diff --git a/libindy/tests/payments.rs b/libindy/tests/payments.rs index 3415c2268b..d8b0821e63 100644 --- a/libindy/tests/payments.rs +++ b/libindy/tests/payments.rs @@ -64,7 +64,7 @@ mod high_cases { #[test] fn register_payment_method_works() { - let _ = Setup::empty(); + Setup::empty(); let _res = payments::register_payment_method("register_payment_method_works", Some(payments::mock_method::create_payment_address::handle), @@ -703,7 +703,7 @@ mod high_cases { #[test] fn indy_get_request_info_for_requester_match_to_constraint() { - let _ = Setup::empty(); + Setup::empty(); let req_info = payments::get_request_info(&_auth_rule(), &_requester_info(), &_fees()).unwrap(); let req_info: serde_json::Value = serde_json::from_str(&req_info).unwrap(); @@ -722,7 +722,7 @@ mod high_cases { #[test] fn indy_get_request_info_for_requester_not_match_to_constraint() { - let _ = Setup::empty(); + Setup::empty(); let requester_info = json!({ "role": "101", @@ -736,7 +736,7 @@ mod high_cases { #[test] fn indy_get_request_info_for_no_fee() { - let _ = Setup::empty(); + Setup::empty(); let req_info = payments::get_request_info(&_auth_rule(), &_requester_info(), "{}").unwrap(); let req_info: serde_json::Value = serde_json::from_str(&req_info).unwrap(); @@ -785,7 +785,7 @@ mod medium_cases { #[test] fn register_payment_method_works_for_no_first_method() { - let _ = Setup::empty(); + Setup::empty(); let err = payments::register_payment_method(PAYMENT_METHOD_NAME, None, diff --git a/libindy/tests/pool.rs b/libindy/tests/pool.rs index 3969a60958..8b2e69aa44 100644 --- a/libindy/tests/pool.rs +++ b/libindy/tests/pool.rs @@ -32,6 +32,7 @@ use self::indy::ErrorCode; use utils::{environment, ledger, pool}; use utils::constants::*; +use utils::Setup; mod high_cases { use super::*; @@ -42,43 +43,37 @@ mod high_cases { #[test] fn create_pool_ledger_config_works() { - utils::setup("create_pool_ledger_config_works"); + Setup::empty(); let txn_file_path = pool::create_genesis_txn_file_for_test_pool("create_pool_ledger_config_works", None, None); let pool_config = pool::pool_config_json(txn_file_path.as_path()); pool::create_pool_ledger_config("create_pool_ledger_config_works", Some(pool_config.as_str())).unwrap(); - - utils::tear_down("create_pool_ledger_config_works"); } #[test] fn create_pool_ledger_config_works_for_empty_name() { - utils::setup("create_pool_ledger_config_works_for_empty_name"); + Setup::empty(); let pool_name = ""; let res = pool::create_pool_ledger_config(pool_name, None); assert_code!(ErrorCode::CommonInvalidParam2, res); - - utils::tear_down("create_pool_ledger_config_works_for_empty_name"); } #[test] fn create_pool_ledger_config_works_for_config_json() { - utils::setup("create_pool_ledger_config_works_for_config_json"); + Setup::empty(); let txn_file_path = pool::create_genesis_txn_file_for_test_pool("create_pool_ledger_config_works_for_config_json", None, None); let pool_config = pool::pool_config_json(txn_file_path.as_path()); pool::create_pool_ledger_config("create_pool_ledger_config_works_for_config_json", Some(pool_config.as_str())).unwrap(); - - utils::tear_down("create_pool_ledger_config_works_for_config_json"); } #[test] fn create_pool_ledger_config_works_for_specific_config() { - utils::setup("create_pool_ledger_config_works_for_specific_config"); + Setup::empty(); let txn_file_path = environment::tmp_file_path("specific_filename.txn"); let txn_file_path = pool::create_genesis_txn_file_for_test_pool("create_pool_ledger_config_works_for_specific_config", None, Some(txn_file_path.as_path())); @@ -87,19 +82,16 @@ mod high_cases { pool::create_pool_ledger_config("create_pool_ledger_config_works_for_specific_config", Some(pool_config.as_str())).unwrap(); let _ = fs::remove_file(txn_file_path); - utils::tear_down("create_pool_ledger_config_works_for_specific_config"); } #[test] fn create_pool_ledger_config_works_for_empty_genesis_txns() { - utils::setup("create_pool_ledger_config_works_for_empty_genesis_txns"); + Setup::empty(); let txn_file_path = pool::create_genesis_txn_file_for_test_pool("create_pool_ledger_config_works_for_empty_genesis_txns", Some(0), None); let pool_config = pool::pool_config_json(txn_file_path.as_path()); let res = pool::create_pool_ledger_config("create_pool_ledger_config_works_for_empty_genesis_txns", Some(pool_config.as_str())); assert_code!(ErrorCode::CommonInvalidStructure, res); - - utils::tear_down("create_pool_ledger_config_works_for_empty_genesis_txns"); } } @@ -109,7 +101,7 @@ mod high_cases { #[test] #[cfg(feature = "local_nodes_pool")] fn open_pool_ledger_works() { - utils::setup("open_pool_ledger_works"); + Setup::empty(); pool::set_protocol_version(PROTOCOL_VERSION).unwrap(); @@ -119,14 +111,12 @@ mod high_cases { pool::create_pool_ledger_config(pool_name, Some(pool_config.as_str())).unwrap(); pool::open_pool_ledger(pool_name, None).unwrap(); - - utils::tear_down("open_pool_ledger_works"); } #[test] #[cfg(feature = "local_nodes_pool")] fn open_pool_ledger_works_for_config() { - utils::setup("open_pool_ledger_works_for_config"); + Setup::empty(); pool::set_protocol_version(PROTOCOL_VERSION).unwrap(); @@ -138,28 +128,24 @@ mod high_cases { pool::create_pool_ledger_config(pool_name, Some(pool_config.as_str())).unwrap(); pool::open_pool_ledger(pool_name, Some(config)).unwrap(); - - utils::tear_down("open_pool_ledger_works_for_config"); } #[test] #[cfg(feature = "local_nodes_pool")] fn open_pool_ledger_works_for_twice() { - utils::setup("open_pool_ledger_works_for_twice"); + Setup::empty(); let pool_name = "open_pool_ledger_works_for_twice"; pool::create_and_open_pool_ledger(pool_name).unwrap(); let res = pool::open_pool_ledger(pool_name, None); assert_code!(ErrorCode::PoolLedgerInvalidPoolHandle, res); - - utils::tear_down("open_pool_ledger_works_for_twice"); } #[test] #[cfg(feature = "local_nodes_pool")] fn open_pool_ledger_works_for_two_nodes() { - utils::setup("open_pool_ledger_works_for_two_nodes"); + Setup::empty(); pool::set_protocol_version(PROTOCOL_VERSION).unwrap(); @@ -169,14 +155,12 @@ mod high_cases { pool::create_pool_ledger_config(pool_name, Some(pool_config.as_str())).unwrap(); pool::open_pool_ledger(pool_name, None).unwrap(); - - utils::tear_down("open_pool_ledger_works_for_two_nodes"); } #[test] #[cfg(feature = "local_nodes_pool")] fn open_pool_ledger_works_for_three_nodes() { - utils::setup("open_pool_ledger_works_for_three_nodes"); + Setup::empty(); pool::set_protocol_version(PROTOCOL_VERSION).unwrap(); @@ -186,14 +170,12 @@ mod high_cases { pool::create_pool_ledger_config(pool_name, Some(pool_config.as_str())).unwrap(); pool::open_pool_ledger(pool_name, None).unwrap(); - - utils::tear_down("open_pool_ledger_works_for_three_nodes"); } #[test] #[cfg(feature = "local_nodes_pool")] pub fn open_pool_ledger_works_for_cached_txns() { - utils::setup("open_pool_ledger_works_for_cached_txns"); + Setup::empty(); pool::set_protocol_version(PROTOCOL_VERSION).unwrap(); @@ -204,13 +186,11 @@ mod high_cases { pool::dump_correct_genesis_txns_to_cache(pool_name).unwrap(); pool::open_pool_ledger(pool_name, None).unwrap(); - - utils::tear_down("open_pool_ledger_works_for_cached_txns"); } #[test] pub fn open_pool_ledger_works_for_corrupted_cached_txns() { - utils::setup("open_pool_ledger_works_for_corrupted_cached_txns"); + Setup::empty(); pool::set_protocol_version(PROTOCOL_VERSION).unwrap(); @@ -221,8 +201,6 @@ mod high_cases { pool::dump_incorrect_genesis_txns_to_cache(pool_name).unwrap(); pool::open_pool_ledger(pool_name, None).unwrap(); - - utils::tear_down("open_pool_ledger_works_for_corrupted_cached_txns"); } } @@ -232,57 +210,51 @@ mod high_cases { #[test] #[cfg(feature = "local_nodes_pool")] fn indy_refresh_pool_ledger_works() { - let pool_handle = utils::setup_with_pool("indy_refresh_pool_ledger_works"); - - pool::refresh(pool_handle).unwrap(); - - utils::tear_down_with_pool(pool_handle, "indy_refresh_pool_ledger_works"); + let setup = Setup::pool(); + pool::refresh(setup.pool_handle).unwrap(); } } mod close { use super::*; + extern crate futures; + use self::futures::Future; #[test] #[cfg(feature = "local_nodes_pool")] fn indy_close_pool_ledger_works() { - let pool_handle = utils::setup_with_pool("indy_close_pool_ledger_works"); - - pool::close(pool_handle).unwrap(); - - utils::tear_down("indy_close_pool_ledger_works"); + Setup::pool(); } #[test] #[cfg(feature = "local_nodes_pool")] fn indy_close_pool_ledger_works_for_twice() { - let pool_handle = utils::setup_with_pool("indy_close_pool_ledger_works_for_twice"); + let setup = Setup::empty(); + + let pool_handle = pool::create_and_open_pool_ledger(&setup.name).unwrap(); pool::close(pool_handle).unwrap(); - let res= pool::close(pool_handle); + let res = pool::close(pool_handle); assert_code!(ErrorCode::PoolLedgerInvalidPoolHandle, res); - - utils::tear_down("indy_close_pool_ledger_works_for_twice"); } #[test] #[cfg(feature = "local_nodes_pool")] fn indy_close_pool_ledger_works_for_reopen_after_close() { - let pool_handle = utils::setup_with_pool("indy_close_pool_ledger_works_for_reopen_after_close"); - - pool::close(pool_handle).unwrap(); - let pool_handle = pool::open_pool_ledger("indy_close_pool_ledger_works_for_reopen_after_close", None).unwrap(); - pool::close(pool_handle).unwrap(); + let mut setup = Setup::pool(); - utils::tear_down("indy_close_pool_ledger_works_for_reopen_after_close"); + pool::close(setup.pool_handle).unwrap(); + setup.pool_handle = pool::open_pool_ledger(&setup.name, None).unwrap(); } #[test] #[cfg(feature = "local_nodes_pool")] fn indy_close_pool_ledger_works_for_pending_request() { - let pool_handle = utils::setup_with_pool("indy_close_pool_ledger_works_for_pending_request"); + let setup = Setup::empty(); + + let pool_handle = pool::create_and_open_pool_ledger(&setup.name).unwrap(); let get_nym_req = ledger::build_get_nym_request(Some(DID_MY1), DID_MY1).unwrap(); @@ -295,9 +267,7 @@ mod high_cases { /* Now any request to API can failed, if pool::close works incorrect in case of pending requests. For example try to delete the pool. */ - pool::delete("indy_close_pool_ledger_works_for_pending_request").unwrap(); - - utils::tear_down("indy_close_pool_ledger_works_for_pending_request"); + pool::delete(&setup.name).unwrap(); } } @@ -306,41 +276,31 @@ mod high_cases { #[test] fn indy_delete_pool_ledger_config_works() { - utils::setup("indy_delete_pool_ledger_config_works"); + Setup::empty(); let txn_file_path = pool::create_genesis_txn_file_for_test_pool("indy_delete_pool_ledger_config_works", None, None); let pool_config = pool::pool_config_json(txn_file_path.as_path()); pool::create_pool_ledger_config("indy_delete_pool_ledger_config_works", Some(pool_config.as_str())).unwrap(); pool::delete("indy_delete_pool_ledger_config_works").unwrap(); - - utils::tear_down("indy_delete_pool_ledger_config_works"); } #[test] #[cfg(feature = "local_nodes_pool")] fn indy_delete_pool_ledger_config_works_for_opened() { - utils::setup("indy_delete_pool_ledger_config_works_for_opened"); + let setup = Setup::pool(); - let pool_handle = pool::create_and_open_pool_ledger("indy_delete_pool_ledger_config_works_for_opened").unwrap(); - - let res = pool::delete("indy_delete_pool_ledger_config_works_for_opened"); + let res = pool::delete(&setup.name); assert_code!(ErrorCode::CommonInvalidState, res); - - pool::close(pool_handle).unwrap(); - - utils::tear_down("indy_delete_pool_ledger_config_works_for_opened"); } #[test] fn indy_delete_pool_ledger_config_works_for_closed() { - utils::setup("indy_delete_pool_ledger_config_works_for_closed"); + Setup::empty(); let pool_handle = pool::create_and_open_pool_ledger("indy_delete_pool_ledger_config_works_for_closed").unwrap(); pool::close(pool_handle).unwrap(); pool::delete("indy_delete_pool_ledger_config_works_for_closed").unwrap(); - - utils::tear_down("indy_delete_pool_ledger_config_works_for_closed"); } } @@ -362,51 +322,41 @@ mod medium_cases { #[test] fn create_pool_ledger_config_works_for_invalid_config_json() { - utils::setup("create_pool_ledger_config_works_for_invalid_config_json"); + let setup = Setup::empty(); - let config = r#"{}"#.to_string(); - - let res = pool::create_pool_ledger_config("create_pool_ledger_config_works_for_invalid_config_json", Some(config.as_str())); + let res = pool::create_pool_ledger_config(&setup.name, Some(r#"{}"#)); assert_code!(ErrorCode::CommonInvalidStructure, res); - - utils::tear_down("create_pool_ledger_config_works_for_invalid_config_json"); } #[test] fn create_pool_ledger_config_works_for_invalid_genesis_txn_path() { - utils::setup("create_pool_ledger_config_works_for_invalid_genesis_txn_path"); + let setup = Setup::empty(); let config = r#"{"genesis_txn": "path"}"#.to_string(); - let res = pool::create_pool_ledger_config("create_pool_ledger_config_works_for_invalid_genesis_txn_path", Some(config.as_str())); + let res = pool::create_pool_ledger_config(&setup.name, Some(config.as_str())); assert_code!(ErrorCode::CommonIOError, res); - - utils::tear_down("create_pool_ledger_config_works_for_invalid_genesis_txn_path"); } #[test] fn create_pool_ledger_config_works_for_twice() { - utils::setup("create_pool_ledger_config_works_for_twice"); + let setup = Setup::empty(); - let txn_file_path = pool::create_genesis_txn_file_for_test_pool("create_pool_ledger_config_works_for_twice", None, None); + let txn_file_path = pool::create_genesis_txn_file_for_test_pool(&setup.name, None, None); let pool_config = pool::pool_config_json(txn_file_path.as_path()); - pool::create_pool_ledger_config("create_pool_ledger_config_works_for_twice", Some(pool_config.as_str())).unwrap(); - let res = pool::create_pool_ledger_config("create_pool_ledger_config_works_for_twice", Some(pool_config.as_str())); + pool::create_pool_ledger_config(&setup.name, Some(pool_config.as_str())).unwrap(); + let res = pool::create_pool_ledger_config(&setup.name, Some(pool_config.as_str())); assert_code!(ErrorCode::PoolLedgerConfigAlreadyExistsError, res); - - utils::tear_down("create_pool_ledger_config_works_for_twice"); } #[test] fn create_pool_ledger_config_works_for_empty_lines_in_genesis_txn_file() { - utils::setup("create_pool_ledger_config_works_for_empty_lines_in_genesis_txn_file"); + let setup = Setup::empty(); - let txn_file_path = pool::create_genesis_txn_file_for_empty_lines("create_pool_ledger_config_works_for_empty_lines_in_genesis_txn_file", None); + let txn_file_path = pool::create_genesis_txn_file_for_empty_lines(&setup.name, None); let pool_config = pool::pool_config_json(txn_file_path.as_path()); - pool::create_pool_ledger_config("create_pool_ledger_config_works_for_empty_lines_in_genesis_txn_file", Some(pool_config.as_str())).unwrap(); - - utils::tear_down("create_pool_ledger_config_works_for_empty_lines_in_genesis_txn_file"); + pool::create_pool_ledger_config(&setup.name, Some(pool_config.as_str())).unwrap(); } } @@ -416,140 +366,121 @@ mod medium_cases { #[test] #[cfg(feature = "local_nodes_pool")] fn open_pool_ledger_works_for_invalid_name() { - utils::setup("open_pool_ledger_works_for_invalid_name"); + let setup = Setup::empty(); - let res = pool::open_pool_ledger("open_pool_ledger_works_for_invalid_name", None); + let res = pool::open_pool_ledger(&setup.name, None); assert_code!(ErrorCode::PoolLedgerNotCreatedError, res); - - utils::tear_down("open_pool_ledger_works_for_invalid_name"); } #[test] #[cfg(feature = "local_nodes_pool")] fn open_pool_ledger_works_after_error() { - utils::setup("open_pool_ledger_works_after_error"); + let setup = Setup::empty(); - let res = pool::open_pool_ledger("open_pool_ledger_works_after_error", None); + let res = pool::open_pool_ledger(&setup.name, None); assert_code!(ErrorCode::PoolLedgerNotCreatedError, res); - let pool_handle = pool::create_and_open_pool_ledger("open_pool_ledger_works_after_error").unwrap(); + let pool_handle = pool::create_and_open_pool_ledger(&setup.name).unwrap(); pool::close(pool_handle).unwrap(); - - utils::tear_down("open_pool_ledger_works_after_error"); } #[test] #[cfg(feature = "local_nodes_pool")] fn open_pool_ledger_works_for_invalid_nodes_file() { - utils::setup("open_pool_ledger_works_for_invalid_nodes_file"); + let setup = Setup::empty(); pool::set_protocol_version(PROTOCOL_VERSION).unwrap(); - let pool_name = "open_pool_ledger_works_for_invalid_nodes_file"; - let txn_file_path = pool::create_genesis_txn_file_for_test_pool_with_invalid_nodes(pool_name, None); + let txn_file_path = pool::create_genesis_txn_file_for_test_pool_with_invalid_nodes(&setup.name, None); let pool_config = pool::pool_config_json(txn_file_path.as_path()); - pool::create_pool_ledger_config(pool_name, Some(pool_config.as_str())).unwrap(); + pool::create_pool_ledger_config(&setup.name, Some(pool_config.as_str())).unwrap(); - let res = pool::open_pool_ledger(pool_name, Some(pool_config.as_str())); + let res = pool::open_pool_ledger(&setup.name, Some(pool_config.as_str())); assert_code!(ErrorCode::CommonInvalidState, res); - - utils::tear_down("open_pool_ledger_works_for_invalid_nodes_file"); } #[test] #[cfg(feature = "local_nodes_pool")] fn open_pool_ledger_works_for_wrong_alias() { - utils::setup("open_pool_ledger_works_for_wrong_alias"); + let setup = Setup::empty(); pool::set_protocol_version(PROTOCOL_VERSION).unwrap(); - let pool_name = "open_pool_ledger_works_for_wrong_alias"; - let txn_file_path = pool::create_genesis_txn_file_for_test_pool_with_wrong_alias(pool_name, None); + let txn_file_path = pool::create_genesis_txn_file_for_test_pool_with_wrong_alias(&setup.name, None); let pool_config = pool::pool_config_json(txn_file_path.as_path()); - pool::create_pool_ledger_config(pool_name, Some(pool_config.as_str())).unwrap(); + pool::create_pool_ledger_config(&setup.name, Some(pool_config.as_str())).unwrap(); - let res = pool::open_pool_ledger(pool_name, None); + let res = pool::open_pool_ledger(&setup.name, None); assert_code!(ErrorCode::CommonInvalidState, res); - - utils::tear_down("open_pool_ledger_works_for_wrong_alias"); } #[test] #[cfg(feature = "local_nodes_pool")] fn open_pool_ledger_works_for_invalid_config() { - utils::setup("open_pool_ledger_works_for_invalid_config"); - let name = "open_pool_ledger_works_for_invalid_config"; + let setup = Setup::empty(); + let config = r#"{"timeout": "true"}"#; pool::set_protocol_version(PROTOCOL_VERSION).unwrap(); - let txn_file_path = pool::create_genesis_txn_file_for_test_pool(name, None, None); + let txn_file_path = pool::create_genesis_txn_file_for_test_pool(&setup.name, None, None); let pool_config = pool::pool_config_json(txn_file_path.as_path()); - pool::create_pool_ledger_config(name, Some(pool_config.as_str())).unwrap(); + pool::create_pool_ledger_config(&setup.name, Some(pool_config.as_str())).unwrap(); - let res = pool::open_pool_ledger(name, Some(config)); + let res = pool::open_pool_ledger(&setup.name, Some(config)); assert_code!(ErrorCode::CommonInvalidStructure, res); - - utils::tear_down("open_pool_ledger_works_for_invalid_config"); } #[test] #[cfg(feature = "local_nodes_pool")] fn open_pool_ledger_works_for_incompatible_protocol_version() { - utils::setup("open_pool_ledger_works_for_incompatible_protocol_version"); + let setup = Setup::empty(); pool::set_protocol_version(1).unwrap(); - let txn_file_path = pool::create_genesis_txn_file_for_test_pool("open_pool_ledger_works_for_incompatible_protocol_version", None, None); + let txn_file_path = pool::create_genesis_txn_file_for_test_pool(&setup.name, None, None); let pool_config = pool::pool_config_json(txn_file_path.as_path()); - pool::create_pool_ledger_config("open_pool_ledger_works_for_incompatible_protocol_version", Some(pool_config.as_str())).unwrap(); + pool::create_pool_ledger_config(&setup.name, Some(pool_config.as_str())).unwrap(); - let res = pool::open_pool_ledger("open_pool_ledger_works_for_incompatible_protocol_version", None); + let res = pool::open_pool_ledger(&setup.name, None); assert_code!(ErrorCode::PoolIncompatibleProtocolVersion, res); - - utils::tear_down("open_pool_ledger_works_for_incompatible_protocol_version"); } #[test] #[cfg(feature = "local_nodes_pool")] fn open_pool_ledger_works_for_wrong_ips() { - utils::setup("open_pool_ledger_works_for_wrong_ips"); + let setup = Setup::empty(); pool::set_protocol_version(PROTOCOL_VERSION).unwrap(); - let txn_file_path = pool::create_genesis_txn_file_for_test_pool_with_wrong_ips("open_pool_ledger_works_for_wrong_ips", None); + let txn_file_path = pool::create_genesis_txn_file_for_test_pool_with_wrong_ips(&setup.name, None); let pool_config = pool::pool_config_json(txn_file_path.as_path()); - pool::create_pool_ledger_config("open_pool_ledger_works_for_wrong_ips", Some(pool_config.as_str())).unwrap(); + pool::create_pool_ledger_config(&setup.name, Some(pool_config.as_str())).unwrap(); - let res = pool::open_pool_ledger("open_pool_ledger_works_for_wrong_ips", None); + let res = pool::open_pool_ledger(&setup.name, None); assert_code!(ErrorCode::PoolLedgerTimeout, res); - - utils::tear_down("open_pool_ledger_works_for_wrong_ips"); } #[test] #[cfg(feature = "local_nodes_pool")] fn open_pool_ledger_works_for_config_read_nodes_count() { - utils::setup("open_pool_ledger_works_for_config_read_nodes_count"); + let setup = Setup::empty(); pool::set_protocol_version(PROTOCOL_VERSION).unwrap(); - let pool_name = "open_pool_ledger_works_for_config_read_nodes_count"; let config = json!({"read_nodes_count": 3}).to_string(); - let txn_file_path = pool::create_genesis_txn_file_for_test_pool(pool_name, None, None); + let txn_file_path = pool::create_genesis_txn_file_for_test_pool(&setup.name, None, None); let pool_config = pool::pool_config_json(txn_file_path.as_path()); - pool::create_pool_ledger_config(pool_name, Some(pool_config.as_str())).unwrap(); + pool::create_pool_ledger_config(&setup.name, Some(pool_config.as_str())).unwrap(); - let pool_handle = pool::open_pool_ledger(pool_name, Some(&config)).unwrap(); + let pool_handle = pool::open_pool_ledger(&setup.name, Some(&config)).unwrap(); let request = ledger::build_get_nym_request(None, DID_TRUSTEE).unwrap(); let _ = ledger::submit_request(pool_handle, &request).unwrap(); pool::close(pool_handle).unwrap(); - - utils::tear_down("open_pool_ledger_works_for_config_read_nodes_count"); } } @@ -559,12 +490,10 @@ mod medium_cases { #[test] #[cfg(feature = "local_nodes_pool")] fn indy_close_pool_ledger_works_for_invalid_handle() { - let pool_handle = utils::setup_with_pool("indy_close_pool_ledger_works_for_invalid_handle"); + Setup::empty(); - let res = pool::close(pool_handle + 1); + let res = pool::close(0); assert_code!(ErrorCode::PoolLedgerInvalidPoolHandle, res); - - utils::tear_down_with_pool(pool_handle, "indy_close_pool_ledger_works_for_invalid_handle"); } } @@ -573,25 +502,21 @@ mod medium_cases { #[test] fn indy_delete_pool_ledger_config_works_for_not_created() { - utils::setup("indy_delete_pool_ledger_config_works_for_not_created"); + let setup = Setup::empty(); - let res = pool::delete("indy_delete_pool_ledger_config_works_for_not_created"); + let res = pool::delete(&setup.name); assert_code!(ErrorCode::CommonIOError, res); - - utils::tear_down("indy_delete_pool_ledger_config_works_for_not_created"); } #[test] fn indy_delete_pool_ledger_config_works_for_twice() { - utils::setup("indy_delete_pool_ledger_config_works_for_twice"); + let setup = Setup::empty(); - let pool_handle = pool::create_and_open_pool_ledger("indy_delete_pool_ledger_config_works_for_twice").unwrap(); + let pool_handle = pool::create_and_open_pool_ledger(&setup.name).unwrap(); pool::close(pool_handle).unwrap(); - pool::delete("indy_delete_pool_ledger_config_works_for_twice").unwrap(); - let res = pool::delete("indy_delete_pool_ledger_config_works_for_twice"); + pool::delete(&setup.name).unwrap(); + let res = pool::delete(&setup.name); assert_code!(ErrorCode::CommonIOError, res); - - utils::tear_down("indy_delete_pool_ledger_config_works_for_twice"); } } @@ -601,17 +526,10 @@ mod medium_cases { #[test] #[cfg(feature = "local_nodes_pool")] fn indy_refresh_pool_ledger_works_for_invalid_handle() { - utils::setup("indy_refresh_pool_ledger_works_for_invalid_handle"); - - let pool_handle = pool::create_and_open_pool_ledger("indy_refresh_pool_ledger_works_for_invalid_handle").unwrap(); + Setup::empty(); - let invalid_pool_handle = pool_handle + 1; - let res = pool::refresh(invalid_pool_handle); + let res = pool::refresh(0); assert_code!(ErrorCode::PoolLedgerInvalidPoolHandle, res); - - pool::close(pool_handle).unwrap(); - - utils::tear_down("indy_refresh_pool_ledger_works_for_invalid_handle"); } } diff --git a/libindy/tests/utils/mod.rs b/libindy/tests/utils/mod.rs index e98757cfdd..cb95451e62 100644 --- a/libindy/tests/utils/mod.rs +++ b/libindy/tests/utils/mod.rs @@ -2,8 +2,6 @@ extern crate libc; -use utils::constants::WALLET_CREDENTIALS; - pub mod callback; #[path = "../../src/utils/environment.rs"] @@ -47,35 +45,17 @@ pub mod inmem_wallet; #[path = "../../src/domain/mod.rs"] pub mod domain; -pub fn setup(name: &str) { - test::cleanup_storage(name); - logger::set_default_logger(); -} - -pub fn setup_() -> String { +fn setup() -> String { let name = ::utils::rand_utils::get_rand_string(10); test::cleanup_storage(&name); logger::set_default_logger(); name } -pub fn tear_down_delete_wallet(wallet_config: &str) { - wallet::delete_wallet(wallet_config, WALLET_CREDENTIALS).unwrap(); -} - -pub fn tear_down_delete_wallet_with_credentials(wallet_config: &str, wallet_credentials: &str) { - wallet::delete_wallet(wallet_config, wallet_credentials).unwrap(); -} - -pub fn tear_down(name: &str) { +fn tear_down(name: &str) { test::cleanup_storage(name); } -pub fn setup_with_wallet(name: &str) -> (i32, String) { - setup(name); - wallet::create_and_open_default_wallet(name).unwrap() -} - pub struct Setup { pub name: String, pub wallet_config: String, @@ -87,37 +67,37 @@ pub struct Setup { impl Setup { pub fn empty() -> Setup { - let name = setup_(); + let name = setup(); Setup { name, wallet_config: String::new(), wallet_handle: 0, pool_handle: 0, did: String::new(), verkey: String::new() } } pub fn wallet() -> Setup { - let name = setup_(); + let name = setup(); let (wallet_handle, wallet_config) = wallet::create_and_open_default_wallet(&name).unwrap(); Setup { name, wallet_config, wallet_handle, pool_handle: 0, did: String::new(), verkey: String::new() } } pub fn plugged_wallet() -> Setup { - let name = setup_(); + let name = setup(); let (wallet_handle, wallet_config) = wallet::create_and_open_plugged_wallet().unwrap(); Setup { name, wallet_config, wallet_handle, pool_handle: 0, did: String::new(), verkey: String::new() } } pub fn pool() -> Setup { - let name = setup_(); + let name = setup(); let pool_handle = pool::create_and_open_pool_ledger(&name).unwrap(); Setup { name, wallet_config: String::new(), wallet_handle: 0, pool_handle, did: String::new(), verkey: String::new() } } pub fn wallet_and_pool() -> Setup { - let name = setup_(); + let name = setup(); let (wallet_handle, wallet_config) = wallet::create_and_open_default_wallet(&name).unwrap(); let pool_handle = pool::create_and_open_pool_ledger(&name).unwrap(); Setup { name, wallet_config, wallet_handle, pool_handle, did: String::new(), verkey: String::new() } } pub fn trustee() -> Setup { - let name = setup_(); + let name = setup(); let (wallet_handle, wallet_config) = wallet::create_and_open_default_wallet(&name).unwrap(); let pool_handle = pool::create_and_open_pool_ledger(&name).unwrap(); let (did, verkey) = did::create_and_store_my_did(wallet_handle, Some(constants::TRUSTEE_SEED)).unwrap(); @@ -125,7 +105,7 @@ impl Setup { } pub fn steward() -> Setup { - let name = setup_(); + let name = setup(); let (wallet_handle, wallet_config) = wallet::create_and_open_default_wallet(&name).unwrap(); let pool_handle = pool::create_and_open_pool_ledger(&name).unwrap(); let (did, verkey) = did::create_and_store_my_did(wallet_handle, Some(constants::STEWARD_SEED)).unwrap(); @@ -133,7 +113,7 @@ impl Setup { } pub fn endorser() -> Setup { - let name = setup_(); + let name = setup(); let (wallet_handle, wallet_config) = wallet::create_and_open_default_wallet(&name).unwrap(); let pool_handle = pool::create_and_open_pool_ledger(&name).unwrap(); let (did, verkey) = did::create_store_and_publish_did(wallet_handle, pool_handle, "ENDORSER").unwrap(); @@ -141,7 +121,7 @@ impl Setup { } pub fn new_identity() -> Setup { - let name = setup_(); + let name = setup(); let (wallet_handle, wallet_config) = wallet::create_and_open_default_wallet(&name).unwrap(); let pool_handle = pool::create_and_open_pool_ledger(&name).unwrap(); let (did, verkey) = did::create_store_and_publish_did(wallet_handle, pool_handle, "TRUSTEE").unwrap(); @@ -149,27 +129,27 @@ impl Setup { } pub fn did() -> Setup { - let name = setup_(); + let name = setup(); let (wallet_handle, wallet_config) = wallet::create_and_open_default_wallet(&name).unwrap(); let (did, verkey) = did::create_and_store_my_did(wallet_handle, None).unwrap(); Setup { name, wallet_config, wallet_handle, pool_handle: 0, did, verkey } } pub fn key() -> Setup { - let name = setup_(); + let name = setup(); let (wallet_handle, wallet_config) = wallet::create_and_open_default_wallet(&name).unwrap(); let verkey = crypto::create_key(wallet_handle, None).unwrap(); Setup { name, wallet_config, wallet_handle, pool_handle: 0, did: String::new(), verkey } } pub fn payment() -> Setup { - let name = setup_(); + let name = setup(); payments::mock_method::init(); Setup { name, wallet_config: String::new(), wallet_handle: 0, pool_handle: 0, did: String::new(), verkey: String::new() } } pub fn payment_wallet() -> Setup { - let name = setup_(); + let name = setup(); let (wallet_handle, wallet_config) = wallet::create_and_open_default_wallet(&name).unwrap(); payments::mock_method::init(); Setup { name, wallet_config, wallet_handle, pool_handle: 0, did: String::new(), verkey: String::new() } @@ -186,77 +166,4 @@ impl Drop for Setup { } tear_down(&self.name) } -} - - -pub fn setup_with_plugged_wallet(name: &str) -> (i32, String) { - setup(name); - wallet::create_and_open_plugged_wallet().unwrap() -} - -pub fn tear_down_with_wallet(wallet_handle: i32, name: &str, wallet_config: &str) { - wallet::close_wallet(wallet_handle).unwrap(); - wallet::delete_wallet(wallet_config, WALLET_CREDENTIALS).unwrap(); - tear_down(name); -} - -pub fn setup_with_pool(name: &str) -> i32 { - setup(name); - pool::create_and_open_pool_ledger(name).unwrap() -} - -pub fn tear_down_with_pool(pool_handle: i32, name: &str) { - pool::close(pool_handle).unwrap(); - tear_down(name); -} - -pub fn setup_with_wallet_and_pool(name: &str) -> (i32, i32, String) { - let (wallet_handle, config) = setup_with_wallet(name); - let pool_handle = pool::create_and_open_pool_ledger(name).unwrap(); - (wallet_handle, pool_handle, config) -} - -pub fn tear_down_with_wallet_and_pool(wallet_handle: i32, pool_handle: i32, name: &str, wallet_config: &str) { - pool::close(pool_handle).unwrap(); - tear_down_with_wallet(wallet_handle, name, wallet_config); -} - -pub fn setup_trustee(name: &str) -> (i32, i32, String, String) { - let (wallet_handle, pool_handle, config) = setup_with_wallet_and_pool(name); - let (did, _) = did::create_and_store_my_did(wallet_handle, Some(constants::TRUSTEE_SEED)).unwrap(); - (wallet_handle, pool_handle, did, config) -} - -pub fn setup_steward(name: &str) -> (i32, i32, String, String) { - let (wallet_handle, pool_handle, config) = setup_with_wallet_and_pool(name); - let (did, _) = did::create_and_store_my_did(wallet_handle, Some(constants::STEWARD_SEED)).unwrap(); - (wallet_handle, pool_handle, did, config) -} - -pub fn setup_did(name: &str) -> (i32, String, String) { - let (wallet_handle, config) = setup_with_wallet(name); - let (did, _) = did::create_and_store_my_did(wallet_handle, None).unwrap(); - (wallet_handle, did, config) -} - -pub fn setup_new_identity(name: &str) -> (i32, i32, String, String, String) { - let (wallet_handle, pool_handle, trustee_did, config) = setup_trustee(name); - - let (my_did, my_vk) = did::create_and_store_my_did(wallet_handle, None).unwrap(); - let nym = ledger::build_nym_request(&trustee_did, &my_did, Some(&my_vk), None, Some("TRUSTEE")).unwrap(); - let response = ledger::sign_and_submit_request(pool_handle, wallet_handle, &trustee_did, &nym).unwrap(); - pool::check_response_type(&response, types::ResponseType::REPLY); - - (wallet_handle, pool_handle, my_did, my_vk, config) -} - -pub fn setup_new_endorser(name: &str) -> (i32, i32, String, String, String) { - let (wallet_handle, pool_handle, trustee_did, config) = setup_trustee(name); - - let (my_did, my_vk) = did::create_and_store_my_did(wallet_handle, None).unwrap(); - let nym = ledger::build_nym_request(&trustee_did, &my_did, Some(&my_vk), None, Some("ENDORSER")).unwrap(); - let response = ledger::sign_and_submit_request(pool_handle, wallet_handle, &trustee_did, &nym).unwrap(); - pool::check_response_type(&response, types::ResponseType::REPLY); - - (wallet_handle, pool_handle, my_did, my_vk, config) } \ No newline at end of file diff --git a/libindy/tests/utils/wallet.rs b/libindy/tests/utils/wallet.rs index 1fb12b3580..cf00677c02 100644 --- a/libindy/tests/utils/wallet.rs +++ b/libindy/tests/utils/wallet.rs @@ -81,27 +81,6 @@ pub fn open_wallet(config: &str, credentials: &str) -> Result Result<(WalletHandle, String), IndyError> { - let config = json!({ - "id": format!("{}-{}", ::utils::rand_utils::get_rand_string(10), sequence::get_next_id()), - }).to_string(); - - create_wallet(&config, WALLET_CREDENTIALS)?; - let wallet_handle = open_wallet(&config, WALLET_CREDENTIALS).unwrap(); - Ok((wallet_handle, config)) -} - -pub fn create_and_open_wallet(storage_type: Option<&str>) -> Result<(WalletHandle, String), IndyError> { - let config = json!({ - "id": format!("default-wallet_id-{}", sequence::get_next_id()), - "storage_type": storage_type.unwrap_or(TYPE) - }).to_string(); - - create_wallet(&config, WALLET_CREDENTIALS)?; - let wallet_handle = open_wallet(&config, WALLET_CREDENTIALS).unwrap(); - Ok((wallet_handle, config)) -} - pub fn create_and_open_default_wallet(wallet_name: &str) -> Result<(WalletHandle, String), IndyError> { let config = json!({ "id": format!("default-wallet_id-{}-{}", wallet_name, sequence::get_next_id()), diff --git a/libindy/tests/wallet.rs b/libindy/tests/wallet.rs index e70486015d..77e6271576 100644 --- a/libindy/tests/wallet.rs +++ b/libindy/tests/wallet.rs @@ -30,6 +30,7 @@ mod utils; use utils::inmem_wallet::InmemWallet; use utils::{environment, wallet, test, did}; use utils::constants::*; +use utils::Setup; use self::indy::ErrorCode; use api::INVALID_WALLET_HANDLE; @@ -54,15 +55,14 @@ mod high_cases { #[test] fn indy_register_wallet_storage_works() { - utils::setup("indy_register_wallet_storage_works"); + let setup = Setup::empty(); - test::cleanup_storage("indy_register_wallet_storage_works"); + test::cleanup_storage(&setup.name); InmemWallet::cleanup(); wallet::register_wallet_storage(INMEM_TYPE, false).unwrap(); InmemWallet::cleanup(); - utils::tear_down("indy_register_wallet_storage_works"); } } @@ -71,16 +71,13 @@ mod high_cases { #[test] fn indy_create_wallet_works() { - utils::setup("indy_create_wallet_works"); - + Setup::empty(); wallet::create_wallet(DEFAULT_WALLET_CONFIG, WALLET_CREDENTIALS).unwrap(); - - utils::tear_down("indy_create_wallet_works"); } #[test] fn indy_create_wallet_works_for_custom_path() { - utils::setup("indy_create_wallet_works_for_custom_path"); + Setup::empty(); let config = json!({ "id": "wallet_1_indy_create_wallet_works_for_custom_path", @@ -91,40 +88,33 @@ mod high_cases { }).to_string(); wallet::create_wallet(&config, WALLET_CREDENTIALS).unwrap(); - - utils::tear_down("indy_create_wallet_works_for_custom_path"); } #[test] fn indy_create_wallet_works_for_plugged() { - utils::setup("indy_create_wallet_works_for_plugged"); + Setup::empty(); InmemWallet::cleanup(); wallet::register_wallet_storage(INMEM_TYPE, false).unwrap(); wallet::create_wallet(INMEM_WALLET_CONFIG, WALLET_CREDENTIALS).unwrap(); InmemWallet::cleanup(); - utils::tear_down("indy_create_wallet_works_for_plugged"); } #[test] fn indy_create_wallet_works_for_unknown_type() { - utils::setup("indy_create_wallet_works_for_unknown_type"); + Setup::empty(); let res = wallet::create_wallet(UNKNOWN_WALLET_CONFIG, WALLET_CREDENTIALS); assert_code!(ErrorCode::WalletUnknownTypeError, res); - - utils::tear_down("indy_create_wallet_works_for_unknown_type"); } #[test] fn indy_create_wallet_works_for_empty_type() { const WALLET_CONFIG: &str = r#"{"id":"indy_create_wallet_works_for_empty_type"}"#; - utils::setup("indy_create_wallet_works_for_empty_type"); + Setup::empty(); wallet::create_wallet(WALLET_CONFIG, WALLET_CREDENTIALS).unwrap(); - - utils::tear_down("indy_create_wallet_works_for_empty_type"); } } @@ -134,18 +124,16 @@ mod high_cases { #[test] fn indy_delete_wallet_works() { const WALLET_CONFIG: &str = r#"{"id":"indy_delete_wallet_works"}"#; - utils::setup("indy_delete_wallet_works"); + Setup::empty(); wallet::create_wallet(WALLET_CONFIG, WALLET_CREDENTIALS).unwrap(); wallet::delete_wallet(WALLET_CONFIG, WALLET_CREDENTIALS).unwrap(); wallet::create_wallet(WALLET_CONFIG, WALLET_CREDENTIALS).unwrap(); - - utils::tear_down("indy_delete_wallet_works"); } #[test] fn indy_delete_wallet_works_for_custom_path() { - utils::setup("indy_delete_wallet_works_for_custom_path"); + Setup::empty(); let config = json!({ "id": "wallet_1_indy_delete_wallet_works_for_custom_path", @@ -158,28 +146,24 @@ mod high_cases { wallet::create_wallet(&config, WALLET_CREDENTIALS).unwrap(); wallet::delete_wallet(&config, WALLET_CREDENTIALS).unwrap(); wallet::create_wallet(&config, WALLET_CREDENTIALS).unwrap(); - - utils::tear_down("indy_delete_wallet_works_for_custom_path"); } #[test] fn indy_delete_wallet_works_for_closed() { const WALLET_CONFIG: &str = r#"{"id":"indy_delete_wallet_works_for_closed"}"#; - utils::setup("indy_delete_wallet_works_for_closed"); + Setup::empty(); wallet::create_wallet(WALLET_CONFIG, WALLET_CREDENTIALS).unwrap(); let wallet_handle = wallet::open_wallet(WALLET_CONFIG, WALLET_CREDENTIALS).unwrap(); wallet::close_wallet(wallet_handle).unwrap(); wallet::delete_wallet(WALLET_CONFIG, WALLET_CREDENTIALS).unwrap(); wallet::create_wallet(WALLET_CONFIG, WALLET_CREDENTIALS).unwrap(); - - utils::tear_down("indy_delete_wallet_works_for_closed"); } #[test] fn indy_delete_wallet_works_for_opened() { const WALLET_CONFIG: &str = r#"{"id":"indy_delete_wallet_works_for_opened"}"#; - utils::setup("indy_delete_wallet_works_for_opened"); + Setup::empty(); wallet::create_wallet(WALLET_CONFIG, WALLET_CREDENTIALS).unwrap(); let wallet_handle = wallet::open_wallet(WALLET_CONFIG, WALLET_CREDENTIALS).unwrap(); @@ -187,13 +171,11 @@ mod high_cases { assert_code!(ErrorCode::CommonInvalidState, res); wallet::close_wallet(wallet_handle).unwrap(); - - utils::tear_down("indy_delete_wallet_works_for_opened"); } #[test] fn indy_delete_wallet_works_for_plugged() { - utils::setup("indy_delete_wallet_works_for_plugged"); + Setup::empty(); InmemWallet::cleanup(); wallet::register_wallet_storage(INMEM_TYPE, false).unwrap(); @@ -202,7 +184,6 @@ mod high_cases { wallet::create_wallet(INMEM_WALLET_CONFIG, WALLET_CREDENTIALS).unwrap(); InmemWallet::cleanup(); - utils::tear_down("indy_delete_wallet_works_for_plugged"); } } @@ -211,22 +192,12 @@ mod high_cases { #[test] fn indy_open_wallet_works() { - const WALLET_CONFIG: &str = r#"{"id":"indy_open_wallet_works"}"#; - utils::setup("indy_open_wallet_works"); - - let config = json!({ - "id": "indy_open_wallet_works", - "storage_type": "default" - }).to_string(); - wallet::create_wallet(WALLET_CONFIG, WALLET_CREDENTIALS).unwrap(); - let wallet_handle = wallet::open_wallet(WALLET_CONFIG, WALLET_CREDENTIALS).unwrap(); - - utils::tear_down_with_wallet(wallet_handle, "indy_open_wallet_works", &config); + Setup::wallet(); } #[test] fn indy_open_wallet_works_for_custom_path() { - utils::setup("indy_open_wallet_works_for_custom_path"); + Setup::empty(); let config = json!({ "id": "indy_open_wallet_works_for_custom_path", @@ -238,13 +209,13 @@ mod high_cases { wallet::create_wallet(&config, WALLET_CREDENTIALS).unwrap(); let wallet_handle = wallet::open_wallet(&config, WALLET_CREDENTIALS).unwrap(); - - utils::tear_down_with_wallet(wallet_handle, "indy_open_wallet_works_for_custom_path", &config); + wallet::close_wallet(wallet_handle).unwrap(); + wallet::delete_wallet(&config, WALLET_CREDENTIALS).unwrap(); } #[test] fn indy_open_wallet_works_for_plugged() { - utils::setup("indy_open_wallet_works_for_plugged"); + Setup::empty(); InmemWallet::cleanup(); wallet::register_wallet_storage(INMEM_TYPE, false).unwrap(); @@ -254,7 +225,6 @@ mod high_cases { wallet::close_wallet(wallet_handle).unwrap(); InmemWallet::cleanup(); - utils::tear_down("indy_open_wallet_works_for_plugged"); } } @@ -263,20 +233,23 @@ mod high_cases { #[test] fn indy_close_wallet_works() { - utils::setup("indy_close_wallet_works"); + let setup = Setup::empty(); - let (wallet_handle, wallet_config) = utils::setup_with_wallet("indy_close_wallet_works"); + let wallet_config = json!({"id": &setup.name}).to_string(); + wallet::create_wallet(&wallet_config, WALLET_CREDENTIALS).unwrap(); + let wallet_handle = wallet::open_wallet(&wallet_config, WALLET_CREDENTIALS).unwrap(); wallet::close_wallet(wallet_handle).unwrap(); let wallet_handle = wallet::open_wallet(&wallet_config, WALLET_CREDENTIALS).unwrap(); + wallet::close_wallet(wallet_handle).unwrap(); - utils::tear_down_with_wallet(wallet_handle, "indy_close_wallet_works", &wallet_config); + wallet::delete_wallet(&wallet_config, WALLET_CREDENTIALS).unwrap(); } #[test] fn indy_close_wallet_works_for_plugged() { - utils::setup("indy_close_wallet_works_for_plugged"); + Setup::empty(); InmemWallet::cleanup(); wallet::register_wallet_storage(INMEM_TYPE, false).unwrap(); @@ -289,7 +262,6 @@ mod high_cases { wallet::close_wallet(wallet_handle).unwrap(); InmemWallet::cleanup(); - utils::tear_down("indy_close_wallet_works_for_plugged"); } } @@ -298,21 +270,20 @@ mod high_cases { #[test] fn indy_export_wallet_works() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("indy_export_wallet_works"); + let setup = Setup::wallet(); let path = wallet::export_wallet_path("indy_export_wallet_works"); let config_json = wallet::prepare_export_wallet_config(&path); - did::create_my_did(wallet_handle, "{}").unwrap(); - did::create_my_did(wallet_handle, "{}").unwrap(); + did::create_my_did(setup.wallet_handle, "{}").unwrap(); + did::create_my_did(setup.wallet_handle, "{}").unwrap(); cleanup_file(&path); - wallet::export_wallet(wallet_handle, &config_json).unwrap(); + wallet::export_wallet(setup.wallet_handle, &config_json).unwrap(); assert!(path.exists()); test::cleanup_files(&path, "indy_export_wallet_works_export_wallet"); - utils::tear_down_with_wallet(wallet_handle, "indy_export_wallet_works", &wallet_config); } } @@ -322,7 +293,7 @@ mod high_cases { #[test] fn indy_import_wallet_works() { const WALLET_CONFIG: &str = r#"{"id":"indy_import_wallet_works"}"#; - utils::setup("indy_import_wallet_works"); + Setup::empty(); let path = wallet::export_wallet_path("indy_import_wallet_works"); let config_json = wallet::prepare_export_wallet_config(&path); @@ -349,7 +320,6 @@ mod high_cases { assert_eq!(did_with_meta, did_with_meta_after_import); cleanup_file(&path); - utils::tear_down_with_wallet(wallet_handle, "indy_import_wallet_works", WALLET_CONFIG); } } @@ -360,7 +330,7 @@ mod high_cases { #[test] fn indy_generate_wallet_key_works() { const WALLET_CONFIG: &str = r#"{"id":"indy_generate_wallet_key_works"}"#; - test::cleanup_storage("indy_generate_wallet_key_works"); + Setup::empty(); let key = wallet::generate_wallet_key(None).unwrap(); @@ -370,14 +340,12 @@ mod high_cases { let wallet_handle = wallet::open_wallet(WALLET_CONFIG, &credentials).unwrap(); wallet::close_wallet(wallet_handle).unwrap(); wallet::delete_wallet(WALLET_CONFIG, &credentials).unwrap(); - - test::cleanup_storage("indy_generate_wallet_key_works"); } #[test] fn indy_generate_wallet_key_works_for_seed() { const WALLET_CONFIG: &str = r#"{"id":"indy_generate_wallet_key_works_for_seed"}"#; - test::cleanup_storage("indy_generate_wallet_key_works_for_seed"); + Setup::empty(); let config = json!({"seed": MY1_SEED}).to_string(); let key = wallet::generate_wallet_key(Some(config.as_str())).unwrap(); @@ -389,8 +357,6 @@ mod high_cases { let wallet_handle = wallet::open_wallet(WALLET_CONFIG, &credentials).unwrap(); wallet::close_wallet(wallet_handle).unwrap(); wallet::delete_wallet(WALLET_CONFIG, &credentials).unwrap(); - - test::cleanup_storage("indy_generate_wallet_key_works_for_seed"); } } } @@ -406,7 +372,7 @@ mod medium_cases { #[test] fn indy_register_wallet_storage_does_not_work_twice_with_same_name() { - utils::setup("indy_register_wallet_storage_does_not_work_twice_with_same_name"); + Setup::empty(); InmemWallet::cleanup(); wallet::register_wallet_storage(INMEM_TYPE, false).unwrap(); @@ -414,12 +380,11 @@ mod medium_cases { assert_eq!(ErrorCode::WalletTypeAlreadyRegisteredError, res); InmemWallet::cleanup(); - utils::tear_down("indy_register_wallet_storage_does_not_work_twice_with_same_name"); } #[test] fn indy_register_wallet_storage_does_not_work_with_null_params() { - utils::setup("indy_register_wallet_storage_does_not_work_with_null_params"); + Setup::empty(); InmemWallet::cleanup(); let xtype = CString::new(INMEM_TYPE).unwrap(); @@ -433,7 +398,6 @@ mod medium_cases { assert_eq!(ErrorCode::CommonInvalidParam3, res); InmemWallet::cleanup(); - utils::tear_down("indy_register_wallet_storage_does_not_work_with_null_params"); } } @@ -443,46 +407,38 @@ mod medium_cases { #[test] fn indy_create_wallet_works_for_duplicate_name() { const WALLET_CONFIG: &str = r#"{"id":"indy_create_wallet_works_for_duplicate_name"}"#; - utils::setup("indy_create_wallet_works_for_duplicate_name"); + Setup::empty(); wallet::create_wallet(WALLET_CONFIG, WALLET_CREDENTIALS).unwrap(); let res = wallet::create_wallet(WALLET_CONFIG, WALLET_CREDENTIALS); assert_code!(ErrorCode::WalletAlreadyExistsError, res); - - test::cleanup_storage("indy_create_wallet_works_for_duplicate_name"); } #[test] fn indy_create_wallet_works_for_missed_key() { const WALLET_CONFIG: &str = r#"{"id":"indy_create_wallet_works_for_missed_key"}"#; - utils::setup("indy_create_wallet_works_for_missed_key"); + Setup::empty(); let res = wallet::create_wallet(WALLET_CONFIG, r#"{}"#); assert_code!(ErrorCode::CommonInvalidStructure, res); - - utils::tear_down("indy_create_wallet_works_for_missed_key"); } #[test] fn indy_create_wallet_works_for_empty_name() { - utils::setup("indy_create_wallet_works_for_empty_name"); + Setup::empty(); let res = wallet::create_wallet(r#"{"id": ""}"#, WALLET_CREDENTIALS); assert_code!(ErrorCode::CommonInvalidStructure, res); - - utils::tear_down("indy_create_wallet_works_for_empty_name"); } #[test] fn indy_create_wallet_works_for_raw_key_invalid_length() { const WALLET_CONFIG: &str = r#"{"id":"indy_create_wallet_works_for_raw_key_invalid_length"}"#; - test::cleanup_storage("indy_create_wallet_works_for_raw_key_invalid_length"); + Setup::empty(); let credentials = json!({"key": "key", "key_derivation_method": "RAW"}).to_string(); let res = wallet::create_wallet(WALLET_CONFIG, &credentials); assert_code!(ErrorCode::CommonInvalidStructure, res); - - test::cleanup_storage("indy_create_wallet_works_for_raw_key_invalid_length"); } } @@ -492,37 +448,31 @@ mod medium_cases { #[test] fn indy_delete_wallet_works_for_not_created() { const WALLET_CONFIG: &str = r#"{"id":"indy_delete_wallet_works_for_not_created"}"#; - utils::setup("indy_delete_wallet_works_for_not_created"); + Setup::empty(); let res = wallet::delete_wallet(WALLET_CONFIG, WALLET_CREDENTIALS); assert_code!(ErrorCode::WalletNotFoundError, res); - - utils::tear_down("indy_delete_wallet_works_for_not_created"); } #[test] fn indy_delete_wallet_works_for_twice() { const WALLET_CONFIG: &str = r#"{"id":"indy_delete_wallet_works_for_twice"}"#; - utils::setup("indy_delete_wallet_works_for_twice"); + Setup::empty(); wallet::create_wallet(WALLET_CONFIG, WALLET_CREDENTIALS).unwrap(); wallet::delete_wallet(WALLET_CONFIG, WALLET_CREDENTIALS).unwrap(); let res = wallet::delete_wallet(WALLET_CONFIG, WALLET_CREDENTIALS); assert_code!(ErrorCode::WalletNotFoundError, res); - - utils::tear_down("indy_delete_wallet_works_for_twice"); } #[test] fn indy_delete_wallet_works_for_wrong_credentials() { const WALLET_CONFIG: &str = r#"{"id":"indy_delete_wallet_works_for_wrong_credentials"}"#; - utils::setup("indy_delete_wallet_works_for_wrong_credentials"); + Setup::empty(); wallet::create_wallet(WALLET_CONFIG, r#"{"key":"key"}"#).unwrap(); let res = wallet::delete_wallet(WALLET_CONFIG, r#"{"key":"other_key"}"#); assert_code!(ErrorCode::WalletAccessFailed, res); - - utils::tear_down("indy_delete_wallet_works_for_wrong_credentials"); } } @@ -532,18 +482,16 @@ mod medium_cases { #[test] fn indy_open_wallet_works_for_not_created_wallet() { const WALLET_CONFIG: &'static str = r#"{"id":"indy_open_wallet_works_for_not_created_wallet"}"#; - utils::setup("indy_open_wallet_works_for_not_created_wallet"); + Setup::empty(); let res = wallet::open_wallet(WALLET_CONFIG, WALLET_CREDENTIALS); assert_code!(ErrorCode::WalletNotFoundError, res); - - utils::tear_down("indy_open_wallet_works_for_not_created_wallet"); } #[test] fn indy_open_wallet_works_for_twice() { const WALLET_CONFIG: &str = r#"{"id":"indy_open_wallet_works_for_twice"}"#; - utils::setup("indy_open_wallet_works_for_twice"); + Setup::empty(); wallet::create_wallet(WALLET_CONFIG, WALLET_CREDENTIALS).unwrap(); @@ -552,13 +500,11 @@ mod medium_cases { assert_code!(ErrorCode::WalletAlreadyOpenedError, res); wallet::close_wallet(wallet_handle).unwrap(); - - utils::tear_down("indy_open_wallet_works_for_twice"); } #[test] fn indy_open_wallet_works_for_two_wallets() { - utils::setup("indy_open_wallet_works_for_two_wallets"); + Setup::empty(); let wallet_config_1 = r#"{"id":"indy_open_wallet_works_for_two_wallets1"}"#; let wallet_config_2 = r#"{"id":"indy_open_wallet_works_for_two_wallets2"}"#; @@ -574,12 +520,11 @@ mod medium_cases { cleanup_wallet("indy_open_wallet_works_for_two_wallets1"); cleanup_wallet("indy_open_wallet_works_for_two_wallets2"); - utils::tear_down("indy_open_wallet_works_for_two_wallets"); } #[test] fn indy_open_wallet_works_for_two_wallets_with_same_ids_but_different_paths() { - utils::setup("indy_open_wallet_works_for_two_wallets_with_same_ids_but_different_paths"); + Setup::empty(); let wallet_config_1 = json!({ "id": "indy_open_wallet_works_for_two_wallets_with_same_ids_but_different_paths", @@ -604,26 +549,22 @@ mod medium_cases { wallet::delete_wallet(&wallet_config_1, WALLET_CREDENTIALS).unwrap(); wallet::delete_wallet(&wallet_config_2, WALLET_CREDENTIALS).unwrap(); - - utils::tear_down("indy_open_wallet_works_for_two_wallets_with_same_ids_but_different_paths"); } #[test] fn indy_open_wallet_works_for_invalid_credentials() { const WALLET_CONFIG: &'static str = r#"{"id":"indy_open_wallet_works_for_invalid_credentials"}"#; - utils::setup("indy_open_wallet_works_for_invalid_credentials"); + Setup::empty(); wallet::create_wallet(WALLET_CONFIG, r#"{"key":"key"}"#).unwrap(); let res = wallet::open_wallet(WALLET_CONFIG, r#"{"key":"other_key"}"#); assert_code!(ErrorCode::WalletAccessFailed, res); - - utils::tear_down("indy_open_wallet_works_for_invalid_credentials"); } #[test] fn indy_open_wallet_works_for_changing_credentials() { const WALLET_CONFIG: &'static str = r#"{"id":"indy_open_wallet_works_for_changing_credentials"}"#; - utils::setup("indy_open_wallet_works_for_changing_credentials"); + Setup::empty(); wallet::create_wallet(WALLET_CONFIG, r#"{"key":"key"}"#).unwrap(); let wallet_handle = wallet::open_wallet(WALLET_CONFIG, r#"{"key":"key", "rekey":"other_key"}"#).unwrap(); @@ -631,22 +572,18 @@ mod medium_cases { let wallet_handle = wallet::open_wallet(WALLET_CONFIG, r#"{"key":"other_key"}"#).unwrap(); wallet::close_wallet(wallet_handle).unwrap(); - - utils::tear_down("indy_open_wallet_works_for_changing_credentials"); } #[test] fn indy_open_wallet_works_for_invalid_config() { const WALLET_CONFIG: &'static str = r#"{"id":"indy_open_wallet_works_for_invalid_config"}"#; - utils::setup("indy_open_wallet_works_for_invalid_config"); + Setup::empty(); let config = r#"{"field":"value"}"#; wallet::create_wallet(WALLET_CONFIG, WALLET_CREDENTIALS).unwrap(); let res = wallet::open_wallet(config, WALLET_CREDENTIALS); assert_code!(ErrorCode::CommonInvalidStructure, res); - - utils::tear_down("indy_open_wallet_works_for_invalid_config"); } } @@ -655,23 +592,23 @@ mod medium_cases { #[test] fn indy_close_wallet_works_for_invalid_handle() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("indy_close_wallet_works_for_invalid_handle"); + Setup::empty(); let res = wallet::close_wallet(INVALID_WALLET_HANDLE); assert_code!(ErrorCode::WalletInvalidHandle, res); - - utils::tear_down_with_wallet(wallet_handle, "indy_close_wallet_works_for_invalid_handle", &wallet_config); } #[test] fn indy_close_wallet_works_for_twice() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("indy_close_wallet_works_for_twice"); + let setup = Setup::empty(); + + let (wallet_handle, config) = wallet::create_and_open_default_wallet(&setup.name).unwrap(); wallet::close_wallet(wallet_handle).unwrap(); let res = wallet::close_wallet(wallet_handle); assert_code!(ErrorCode::WalletInvalidHandle, res); - wallet::delete_wallet(&wallet_config, WALLET_CREDENTIALS).unwrap(); + wallet::delete_wallet(&config, WALLET_CREDENTIALS).unwrap(); } } @@ -681,43 +618,38 @@ mod medium_cases { #[test] fn indy_export_wallet_returns_error_if_path_exists() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("indy_export_wallet_returns_error_if_path_exists"); + let setup= Setup::wallet(); - let path = wallet::export_wallet_path("indy_export_wallet_returns_error_if_path_exists_export_wallet"); + let path = wallet::export_wallet_path(&setup.name); let config_json = wallet::prepare_export_wallet_config(&path); fs::DirBuilder::new() .recursive(true) .create(path.clone()).unwrap(); - let res = wallet::export_wallet(wallet_handle, &config_json); + let res = wallet::export_wallet(setup.wallet_handle, &config_json); assert_code!(ErrorCode::CommonIOError, res); fs::remove_dir_all(path).unwrap(); - utils::tear_down_with_wallet(wallet_handle, "indy_export_wallet_returns_error_if_path_exists", &wallet_config); } #[test] fn indy_export_wallet_returns_error_if_invalid_config() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("indy_export_wallet_returns_error_if_invalid_config"); + let setup= Setup::wallet(); - let res = wallet::export_wallet(wallet_handle, "{}"); + let res = wallet::export_wallet(setup.wallet_handle, "{}"); assert_code!(ErrorCode::CommonInvalidStructure, res); - - utils::tear_down_with_wallet(wallet_handle, "indy_export_wallet_returns_error_if_invalid_config", &wallet_config); } #[test] fn indy_export_wallet_returns_error_if_invalid_handle() { - let (wallet_handle, wallet_config) = utils::setup_with_wallet("indy_export_wallet_returns_error_if_invalid_handle"); + let setup= Setup::empty(); - let path = wallet::export_wallet_path("indy_export_wallet_returns_error_if_invalid_handle"); + let path = wallet::export_wallet_path(&setup.name); let config_json = wallet::prepare_export_wallet_config(&path); let res = wallet::export_wallet(INVALID_WALLET_HANDLE, &config_json); assert_code!(ErrorCode::WalletInvalidHandle, res); - - utils::tear_down_with_wallet(wallet_handle, "indy_export_wallet_returns_error_if_invalid_handle", &wallet_config); } } @@ -726,37 +658,34 @@ mod medium_cases { #[test] fn indy_import_wallet_returns_error_if_path_doesnt_exist() { - const WALLET_CONFIG: &str = r#"{"id":"indy_import_wallet_returns_error_if_path_doesnt_exist"}"#; - utils::setup("indy_import_wallet_returns_error_if_path_doesnt_exist"); + let setup= Setup::wallet(); + + let import_config = json!({"id": &setup.name}).to_string(); - let path = wallet::export_wallet_path("indy_import_wallet_returns_error_if_path_doesnt_exist"); + let path = wallet::export_wallet_path(&setup.name); let config_json = wallet::prepare_export_wallet_config(&path); - let wallet_config = r#"{"id":"indy_import_wallet_returns_error_if_path_doesnt_exist"}"#; - let res = wallet::import_wallet(WALLET_CONFIG, WALLET_CREDENTIALS, &config_json); + let wallet_config = r#"{"id":"indy_import_wallet_returns_error_if_path_doesnt_exist2"}"#; + let res = wallet::import_wallet(&import_config, WALLET_CREDENTIALS, &config_json); assert_code!(ErrorCode::CommonIOError, res); let res = wallet::open_wallet(wallet_config, WALLET_CREDENTIALS); assert_code!(ErrorCode::WalletNotFoundError, res); - - utils::tear_down("indy_import_wallet_returns_error_if_path_doesnt_exist"); } #[test] fn indy_import_wallet_returns_error_if_invalid_config() { const WALLET_CONFIG: &str = r#"{"id":"indy_import_wallet_returns_error_if_path_doesnt_exist"}"#; - utils::setup("indy_import_wallet_returns_error_if_path_doesnt_exist"); + Setup::empty(); let res = wallet::import_wallet(WALLET_CONFIG, WALLET_CREDENTIALS, "{}"); assert_code!(ErrorCode::CommonInvalidStructure, res); - - utils::tear_down("indy_import_wallet_returns_error_if_path_doesnt_exist"); } #[test] fn indy_import_wallet_works_for_other_key() { const WALLET_CONFIG: &str = r#"{"id":"indy_import_wallet_works_for_other_key"}"#; - utils::setup("indy_import_wallet_works_for_other_key"); + Setup::empty(); let path = wallet::export_wallet_path("indy_import_wallet_works_for_other_key_export_wallet"); let config_json = wallet::prepare_export_wallet_config(&path); @@ -781,13 +710,12 @@ mod medium_cases { assert_code!(ErrorCode::CommonInvalidStructure, res); cleanup_file(&path); - utils::tear_down("indy_import_wallet_works_for_other_key"); } #[test] fn indy_import_wallet_works_for_duplicate_name() { const WALLET_CONFIG: &str = r#"{"id":"indy_import_wallet_works_for_duplicate_name"}"#; - utils::setup("indy_import_wallet_works_for_duplicate_name"); + Setup::empty(); let path = wallet::export_wallet_path("indy_import_wallet_works_for_duplicate_name_export_wallet"); let config_json = wallet::prepare_export_wallet_config(&path); @@ -806,7 +734,6 @@ mod medium_cases { wallet::close_wallet(wallet_handle).unwrap(); cleanup_file(&path); - utils::tear_down("indy_import_wallet_works_for_duplicate_name"); } } } From 84dc7e506b7c3fd119d008722cdcf9128f6f6c4d Mon Sep 17 00:00:00 2001 From: "artem.ivanov" Date: Fri, 16 Aug 2019 14:05:51 +0300 Subject: [PATCH 241/320] Used better syntax Signed-off-by: artem.ivanov --- Jenkinsfile.cd | 12 +++++++----- Jenkinsfile.ci | 12 +++++++----- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/Jenkinsfile.cd b/Jenkinsfile.cd index 9dc0495d54..05311d4317 100644 --- a/Jenkinsfile.cd +++ b/Jenkinsfile.cd @@ -352,9 +352,11 @@ def linuxLibindyBuild(file, env_name, network_name, stashBuildResults, full_test testEnv.inside("--network=${network_name}") { def features_args = full_testing ? '--features sodium_static' : '--features "sodium_static only_high_cases"' - sh "cd libindy && " + - "RUST_BACKTRACE=1 cargo test --release -j 1 --no-run ${features_args} &&" + - "RUST_BACKTRACE=1 RUST_LOG=indy::=debug,zmq=trace RUST_TEST_THREADS=1 TEST_POOL_IP=10.0.0.2 cargo test --release -j 1 ${features_args}" + sh """ + cd libindy + RUST_BACKTRACE=1 cargo test --release --no-run ${features_args} + RUST_BACKTRACE=1 RUST_LOG=indy::=debug,zmq=trace RUST_TEST_THREADS=1 TEST_POOL_IP=10.0.0.2 cargo test --release ${features_args} + """ } echo "${env_name} Libnullpay Test: Test" @@ -416,7 +418,7 @@ def linuxVcxBuild(file, env_name, network_name, stashBuildResults) { echo "${env_name} Libvcx Test: Run tests" sh ''' cd vcx/libvcx - LIBRARY_PATH=./ LD_LIBRARY_PATH=./:${LD_LIBRARY_PATH} RUST_BACKTRACE=1 RUST_LOG=vcx=debug,indy=debug RUST_TEST_THREADS=1 TEST_POOL_IP=10.0.0.2 cargo test --release -j 1 --features "pool_tests agency" + LIBRARY_PATH=./ LD_LIBRARY_PATH=./:${LD_LIBRARY_PATH} RUST_BACKTRACE=1 RUST_LOG=vcx=debug,indy=debug RUST_TEST_THREADS=1 TEST_POOL_IP=10.0.0.2 cargo test --release --features "pool_tests agency" ''' } @@ -430,7 +432,7 @@ def linuxVcxBuild(file, env_name, network_name, stashBuildResults) { echo "${env_name} Libvcx Test: Run vcx demo test for protocol version 2.0" sh ''' cd vcx/libvcx - LIBRARY_PATH=./ LD_LIBRARY_PATH=./:${LD_LIBRARY_PATH} RUST_BACKTRACE=1 RUST_LOG=vcx=debug,indy=debug RUST_TEST_THREADS=1 TEST_POOL_IP=10.0.0.2 cargo test --release -j 1 --features "pool_tests agency_v2" tests::test_real_proof_for_protocol_type_v2 -- --exact + LIBRARY_PATH=./ LD_LIBRARY_PATH=./:${LD_LIBRARY_PATH} RUST_BACKTRACE=1 RUST_LOG=vcx=debug,indy=debug RUST_TEST_THREADS=1 TEST_POOL_IP=10.0.0.2 cargo test --release --features "pool_tests agency_v2" tests::test_real_proof_for_protocol_type_v2 -- --exact ''' } } diff --git a/Jenkinsfile.ci b/Jenkinsfile.ci index 88559671aa..24907e2452 100644 --- a/Jenkinsfile.ci +++ b/Jenkinsfile.ci @@ -494,9 +494,11 @@ def linuxLibindyBuild(file, env_name, network_name, full_testing) { testEnv.inside("--network=${network_name}") { def features_args = full_testing ? '--features sodium_static' : '--features "sodium_static only_high_cases"' - sh "cd libindy && " + - "RUST_BACKTRACE=1 cargo test -j 1 --no-run ${features_args} &&" + - "RUST_BACKTRACE=1 RUST_LOG=indy::=debug,zmq=trace RUST_TEST_THREADS=1 TEST_POOL_IP=10.0.0.2 cargo test -j 1 ${features_args}" + sh """ + cd libindy + RUST_BACKTRACE=1 cargo test --no-run ${features_args} + RUST_BACKTRACE=1 RUST_LOG=indy::=debug,zmq=trace RUST_TEST_THREADS=1 TEST_POOL_IP=10.0.0.2 cargo test ${features_args} + """ } echo "${env_name} Libnullpay Test: Test" @@ -555,7 +557,7 @@ def linuxVcxBuild(file, env_name, network_name) { echo "${env_name} Libvcx Test: Run tests" sh ''' cd vcx/libvcx - LIBRARY_PATH=./ LD_LIBRARY_PATH=./:${LD_LIBRARY_PATH} RUST_BACKTRACE=1 RUST_LOG=vcx=debug,indy=debug RUST_TEST_THREADS=1 TEST_POOL_IP=10.0.0.2 cargo test -j 1 --features "pool_tests agency" + LIBRARY_PATH=./ LD_LIBRARY_PATH=./:${LD_LIBRARY_PATH} RUST_BACKTRACE=1 RUST_LOG=vcx=debug,indy=debug RUST_TEST_THREADS=1 TEST_POOL_IP=10.0.0.2 cargo test --features "pool_tests agency" ''' } @@ -569,7 +571,7 @@ def linuxVcxBuild(file, env_name, network_name) { echo "${env_name} Libvcx Test: Run tests" sh ''' cd vcx/libvcx - LIBRARY_PATH=./ LD_LIBRARY_PATH=./:${LD_LIBRARY_PATH} RUST_BACKTRACE=1 RUST_LOG=vcx=debug,indy=debug RUST_TEST_THREADS=1 TEST_POOL_IP=10.0.0.2 cargo test -j 1 --features "pool_tests agency_v2" tests::test_real_proof_for_protocol_type_v2 -- --exact + LIBRARY_PATH=./ LD_LIBRARY_PATH=./:${LD_LIBRARY_PATH} RUST_BACKTRACE=1 RUST_LOG=vcx=debug,indy=debug RUST_TEST_THREADS=1 TEST_POOL_IP=10.0.0.2 cargo test --features "pool_tests agency_v2" tests::test_real_proof_for_protocol_type_v2 -- --exact ''' } } From 416da0e7553628c6f650d16d8eb1643ebaf6ca2a Mon Sep 17 00:00:00 2001 From: Axel Nennker Date: Fri, 16 Aug 2019 13:10:10 +0200 Subject: [PATCH 242/320] do not return an Err with the question mark operator Signed-off-by: Axel Nennker --- libindy/src/services/pool/merkle_tree_factory.rs | 12 ++++++------ libindy/src/services/wallet/export_import.rs | 6 +++--- libindy/src/services/wallet/mod.rs | 10 +++++----- .../src/utils/crypto/chacha20poly1305_ietf/sodium.rs | 2 +- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/libindy/src/services/pool/merkle_tree_factory.rs b/libindy/src/services/pool/merkle_tree_factory.rs index 4d05ff96b0..f070ca2bd9 100644 --- a/libindy/src/services/pool/merkle_tree_factory.rs +++ b/libindy/src/services/pool/merkle_tree_factory.rs @@ -64,7 +64,7 @@ fn _from_cache(file_name: &PathBuf) -> IndyResult { let bytes = match f.read_u64::() { Ok(bytes) => bytes, Err(ref e) if e.kind() == io::ErrorKind::UnexpectedEof => break, - Err(e) => Err(e.to_indy(IndyErrorKind::IOError, "Can't read from pool ledger cache file"))? + Err(e) => return Err(e.to_indy(IndyErrorKind::IOError, "Can't read from pool ledger cache file")) }; trace!("bytes: {:?}", bytes); @@ -73,8 +73,8 @@ fn _from_cache(file_name: &PathBuf) -> IndyResult { match f.read_exact(buf.as_mut()) { Ok(()) => (), Err(e) => match e.kind() { - io::ErrorKind::UnexpectedEof => Err(e.to_indy(IndyErrorKind::InvalidState, "Malformed pool ledger cache file"))?, - _ => Err(e.to_indy(IndyErrorKind::IOError, "Can't read from pool ledger cache file"))?, + io::ErrorKind::UnexpectedEof => return Err(e.to_indy(IndyErrorKind::InvalidState, "Malformed pool ledger cache file")), + _ => return Err(e.to_indy(IndyErrorKind::IOError, "Can't read from pool ledger cache file")) } } @@ -136,7 +136,7 @@ fn _dump_genesis_to_stored(p: &PathBuf, pool_name: &str) -> IndyResult<()> { if !p_genesis.exists() { trace!("here"); - Err(err_msg(IndyErrorKind::PoolNotCreated, format!("Pool is not created for name: {:?}", pool_name)))?; + return Err(err_msg(IndyErrorKind::PoolNotCreated, format!("Pool is not created for name: {:?}", pool_name))); } let mut file = fs::File::create(p) @@ -201,10 +201,10 @@ pub fn build_node_state(merkle_tree: &MerkleTree) -> IndyResult { if protocol_version != 1 { - Err(err_msg(IndyErrorKind::PoolIncompatibleProtocolVersion, + return Err(err_msg(IndyErrorKind::PoolIncompatibleProtocolVersion, format!("Libindy PROTOCOL_VERSION is {} but Pool Genesis Transactions are of version {}.\ Call indy_set_protocol_version(1) to set correct PROTOCOL_VERSION", - protocol_version, NodeTransactionV0::VERSION)))?; + protocol_version, NodeTransactionV0::VERSION))); } NodeTransactionV1::from(txn) } diff --git a/libindy/src/services/wallet/export_import.rs b/libindy/src/services/wallet/export_import.rs index a06a37dc87..ca9f98fb8b 100644 --- a/libindy/src/services/wallet/export_import.rs +++ b/libindy/src/services/wallet/export_import.rs @@ -95,7 +95,7 @@ pub(super) fn preparse_file_to_import(reader: T, passphrase: &str) -> IndyRes let header_len = reader.read_u32::().map_err(_map_io_err)? as usize; if header_len == 0 { - Err(err_msg(IndyErrorKind::InvalidStructure, "Invalid header length"))?; + return Err(err_msg(IndyErrorKind::InvalidStructure, "Invalid header length")); } let mut header_bytes = vec![0u8; header_len]; @@ -105,7 +105,7 @@ pub(super) fn preparse_file_to_import(reader: T, passphrase: &str) -> IndyRes .to_indy(IndyErrorKind::InvalidStructure, "Header is malformed json")?; if header.version != 0 { - Err(err_msg(IndyErrorKind::InvalidStructure, "Unsupported version"))?; + return Err(err_msg(IndyErrorKind::InvalidStructure, "Unsupported version")); } let key_derivation_method = match header.encryption_method { @@ -155,7 +155,7 @@ pub(super) fn finish_import(wallet: &Wallet, reader: BufReader, key: chach reader.read_exact(&mut header_hash).map_err(_map_io_err)?; if hash(&header_bytes)? != header_hash { - Err(err_msg(IndyErrorKind::InvalidStructure, "Invalid header hash"))?; + return Err(err_msg(IndyErrorKind::InvalidStructure, "Invalid header hash")); } loop { diff --git a/libindy/src/services/wallet/mod.rs b/libindy/src/services/wallet/mod.rs index 67294e0fd2..ea21688686 100644 --- a/libindy/src/services/wallet/mod.rs +++ b/libindy/src/services/wallet/mod.rs @@ -119,7 +119,7 @@ impl WalletService { trace!("create_wallet >>> config: {:?}, credentials: {:?}", config, secret!(credentials)); if config.id.is_empty() { - Err(err_msg(IndyErrorKind::InvalidStructure, "Wallet id is empty"))? + return Err(err_msg(IndyErrorKind::InvalidStructure, "Wallet id is empty")); } let storage_types = self.storage_types.borrow(); @@ -145,7 +145,7 @@ impl WalletService { trace!("delete_wallet >>> config: {:?}, credentials: {:?}", config, secret!(credentials)); if self.wallets.borrow_mut().values().any(|ref wallet| wallet.get_id() == WalletService::_get_wallet_id(config)) { - Err(err_msg(IndyErrorKind::InvalidState, format!("Wallet has to be closed before deleting: {:?}", WalletService::_get_wallet_id(config))))? + return Err(err_msg(IndyErrorKind::InvalidState, format!("Wallet has to be closed before deleting: {:?}", WalletService::_get_wallet_id(config)))); } // check credentials and close connection before deleting wallet @@ -422,7 +422,7 @@ impl WalletService { trace!("export_wallet >>> wallet_handle: {:?}, export_config: {:?}, version: {:?}", wallet_handle, secret!(export_config), version); if version != 0 { - Err(err_msg(IndyErrorKind::InvalidState, "Unsupported version"))?; + return Err(err_msg(IndyErrorKind::InvalidState, "Unsupported version")); } let (key_data, key) = key; @@ -526,11 +526,11 @@ impl WalletService { fn _is_id_from_config_not_used(&self, config: &Config) -> IndyResult<()> { if config.id.is_empty() { - Err(err_msg(IndyErrorKind::InvalidStructure, "Wallet id is empty"))? + return Err(err_msg(IndyErrorKind::InvalidStructure, "Wallet id is empty")); } if self.wallets.borrow_mut().values().any(|ref wallet| wallet.get_id() == WalletService::_get_wallet_id(config)) { - Err(err_msg(IndyErrorKind::WalletAlreadyOpened, format!("Wallet {} already opened", WalletService::_get_wallet_id(config))))? + return Err(err_msg(IndyErrorKind::WalletAlreadyOpened, format!("Wallet {} already opened", WalletService::_get_wallet_id(config)))); } Ok(()) diff --git a/libindy/src/utils/crypto/chacha20poly1305_ietf/sodium.rs b/libindy/src/utils/crypto/chacha20poly1305_ietf/sodium.rs index b44dc71745..4de6a7cbe6 100644 --- a/libindy/src/utils/crypto/chacha20poly1305_ietf/sodium.rs +++ b/libindy/src/utils/crypto/chacha20poly1305_ietf/sodium.rs @@ -187,7 +187,7 @@ impl Reader { Ok(0) => break, Ok(n) => read += n, Err(ref e) if e.kind() == io::ErrorKind::Interrupted => continue, - Err(e) => Err(e)? + Err(e) => return Err(e) } } From ad23e0a829cfc6053d3c67b0ae3f6e5516fe1116 Mon Sep 17 00:00:00 2001 From: Axel Nennker Date: Fri, 16 Aug 2019 13:15:44 +0200 Subject: [PATCH 243/320] remove unwrap Signed-off-by: Axel Nennker --- libindy/src/services/anoncreds/issuer.rs | 81 ++++++++++++------------ 1 file changed, 41 insertions(+), 40 deletions(-) diff --git a/libindy/src/services/anoncreds/issuer.rs b/libindy/src/services/anoncreds/issuer.rs index 80a9ecd325..1adadfad0a 100644 --- a/libindy/src/services/anoncreds/issuer.rs +++ b/libindy/src/services/anoncreds/issuer.rs @@ -102,46 +102,47 @@ impl Issuer { let credential_pub_key = CredentialPublicKey::build_from_parts(&cred_def.value.primary, cred_def.value.revocation.as_ref())?; let (credential_signature, signature_correctness_proof, rev_reg_delta) = - if rev_idx.is_some() { - let rev_idx = rev_idx.unwrap(); - - let rev_reg = rev_reg - .ok_or_else(||err_msg(IndyErrorKind::InvalidState, "RevocationRegistry not found"))?; - - let rev_key_priv = rev_key_priv - .ok_or_else(||err_msg(IndyErrorKind::InvalidState, "RevocationKeyPrivate not found"))?; - - let rev_reg_def = rev_reg_def - .ok_or_else(||err_msg(IndyErrorKind::InvalidState, "RevocationRegistryDefinitionValue not found"))?; - - let rev_tails_accessor = rev_tails_accessor - .ok_or_else(||err_msg(IndyErrorKind::InvalidState, "RevocationTailsAccessor not found"))?; - - CryptoIssuer::sign_credential_with_revoc(&cred_request.prover_did, - &cred_request.blinded_ms, - &cred_request.blinded_ms_correctness_proof, - cred_issuance_blinding_nonce, - &cred_request.nonce, - &credential_values, - &credential_pub_key, - &cred_priv_key, - rev_idx, - rev_reg_def.value.max_cred_num, - rev_reg_def.value.issuance_type.to_bool(), - rev_reg, - rev_key_priv, - rev_tails_accessor)? - } else { - let (signature, correctness_proof) = - CryptoIssuer::sign_credential(&cred_request.prover_did, - &cred_request.blinded_ms, - &cred_request.blinded_ms_correctness_proof, - cred_issuance_blinding_nonce, - &cred_request.nonce, - &credential_values, - &credential_pub_key, - &cred_priv_key)?; - (signature, correctness_proof, None) + match rev_idx { + Some(rev_idx) => { + let rev_reg = rev_reg + .ok_or_else(|| err_msg(IndyErrorKind::InvalidState, "RevocationRegistry not found"))?; + + let rev_key_priv = rev_key_priv + .ok_or_else(|| err_msg(IndyErrorKind::InvalidState, "RevocationKeyPrivate not found"))?; + + let rev_reg_def = rev_reg_def + .ok_or_else(|| err_msg(IndyErrorKind::InvalidState, "RevocationRegistryDefinitionValue not found"))?; + + let rev_tails_accessor = rev_tails_accessor + .ok_or_else(|| err_msg(IndyErrorKind::InvalidState, "RevocationTailsAccessor not found"))?; + + CryptoIssuer::sign_credential_with_revoc(&cred_request.prover_did, + &cred_request.blinded_ms, + &cred_request.blinded_ms_correctness_proof, + cred_issuance_blinding_nonce, + &cred_request.nonce, + &credential_values, + &credential_pub_key, + &cred_priv_key, + rev_idx, + rev_reg_def.value.max_cred_num, + rev_reg_def.value.issuance_type.to_bool(), + rev_reg, + rev_key_priv, + rev_tails_accessor)? + }, + None => { + let (signature, correctness_proof) = + CryptoIssuer::sign_credential(&cred_request.prover_did, + &cred_request.blinded_ms, + &cred_request.blinded_ms_correctness_proof, + cred_issuance_blinding_nonce, + &cred_request.nonce, + &credential_values, + &credential_pub_key, + &cred_priv_key)?; + (signature, correctness_proof, None) + } }; trace!("new_credential <<< credential_signature {:?}, signature_correctness_proof {:?}, rev_reg_delta {:?}", From e233bf440c3ddbe3cc85dd5a5a06dd4a38a18688 Mon Sep 17 00:00:00 2001 From: "artem.ivanov" Date: Fri, 16 Aug 2019 14:05:51 +0300 Subject: [PATCH 244/320] Used better syntax Signed-off-by: artem.ivanov --- Jenkinsfile.cd | 14 ++++++++------ Jenkinsfile.ci | 14 ++++++++------ 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/Jenkinsfile.cd b/Jenkinsfile.cd index 9dc0495d54..7bc8f2fa46 100644 --- a/Jenkinsfile.cd +++ b/Jenkinsfile.cd @@ -350,11 +350,13 @@ def linuxLibindyBuild(file, env_name, network_name, stashBuildResults, full_test echo "${env_name} Libindy Test: Test" testEnv.inside("--network=${network_name}") { - def features_args = full_testing ? '--features sodium_static' : '--features "sodium_static only_high_cases"' + def features_args = full_testing ? "--features sodium_static" : "--features 'sodium_static only_high_cases'" - sh "cd libindy && " + - "RUST_BACKTRACE=1 cargo test --release -j 1 --no-run ${features_args} &&" + - "RUST_BACKTRACE=1 RUST_LOG=indy::=debug,zmq=trace RUST_TEST_THREADS=1 TEST_POOL_IP=10.0.0.2 cargo test --release -j 1 ${features_args}" + sh """ + cd libindy + RUST_BACKTRACE=1 cargo test --release --no-run ${features_args} + RUST_BACKTRACE=1 RUST_LOG=indy::=debug,zmq=trace RUST_TEST_THREADS=1 TEST_POOL_IP=10.0.0.2 cargo test --release ${features_args} + """ } echo "${env_name} Libnullpay Test: Test" @@ -416,7 +418,7 @@ def linuxVcxBuild(file, env_name, network_name, stashBuildResults) { echo "${env_name} Libvcx Test: Run tests" sh ''' cd vcx/libvcx - LIBRARY_PATH=./ LD_LIBRARY_PATH=./:${LD_LIBRARY_PATH} RUST_BACKTRACE=1 RUST_LOG=vcx=debug,indy=debug RUST_TEST_THREADS=1 TEST_POOL_IP=10.0.0.2 cargo test --release -j 1 --features "pool_tests agency" + LIBRARY_PATH=./ LD_LIBRARY_PATH=./:${LD_LIBRARY_PATH} RUST_BACKTRACE=1 RUST_LOG=vcx=debug,indy=debug RUST_TEST_THREADS=1 TEST_POOL_IP=10.0.0.2 cargo test --release --features "pool_tests agency" ''' } @@ -430,7 +432,7 @@ def linuxVcxBuild(file, env_name, network_name, stashBuildResults) { echo "${env_name} Libvcx Test: Run vcx demo test for protocol version 2.0" sh ''' cd vcx/libvcx - LIBRARY_PATH=./ LD_LIBRARY_PATH=./:${LD_LIBRARY_PATH} RUST_BACKTRACE=1 RUST_LOG=vcx=debug,indy=debug RUST_TEST_THREADS=1 TEST_POOL_IP=10.0.0.2 cargo test --release -j 1 --features "pool_tests agency_v2" tests::test_real_proof_for_protocol_type_v2 -- --exact + LIBRARY_PATH=./ LD_LIBRARY_PATH=./:${LD_LIBRARY_PATH} RUST_BACKTRACE=1 RUST_LOG=vcx=debug,indy=debug RUST_TEST_THREADS=1 TEST_POOL_IP=10.0.0.2 cargo test --release --features "pool_tests agency_v2" tests::test_real_proof_for_protocol_type_v2 -- --exact ''' } } diff --git a/Jenkinsfile.ci b/Jenkinsfile.ci index 88559671aa..f5e6fcbb47 100644 --- a/Jenkinsfile.ci +++ b/Jenkinsfile.ci @@ -492,11 +492,13 @@ def linuxLibindyBuild(file, env_name, network_name, full_testing) { echo "${env_name} Libindy Test: Test" testEnv.inside("--network=${network_name}") { - def features_args = full_testing ? '--features sodium_static' : '--features "sodium_static only_high_cases"' + def features_args = full_testing ? "--features sodium_static" : "--features 'sodium_static only_high_cases'" - sh "cd libindy && " + - "RUST_BACKTRACE=1 cargo test -j 1 --no-run ${features_args} &&" + - "RUST_BACKTRACE=1 RUST_LOG=indy::=debug,zmq=trace RUST_TEST_THREADS=1 TEST_POOL_IP=10.0.0.2 cargo test -j 1 ${features_args}" + sh """ + cd libindy + RUST_BACKTRACE=1 cargo test --no-run ${features_args} + RUST_BACKTRACE=1 RUST_LOG=indy::=debug,zmq=trace RUST_TEST_THREADS=1 TEST_POOL_IP=10.0.0.2 cargo test ${features_args} + """ } echo "${env_name} Libnullpay Test: Test" @@ -555,7 +557,7 @@ def linuxVcxBuild(file, env_name, network_name) { echo "${env_name} Libvcx Test: Run tests" sh ''' cd vcx/libvcx - LIBRARY_PATH=./ LD_LIBRARY_PATH=./:${LD_LIBRARY_PATH} RUST_BACKTRACE=1 RUST_LOG=vcx=debug,indy=debug RUST_TEST_THREADS=1 TEST_POOL_IP=10.0.0.2 cargo test -j 1 --features "pool_tests agency" + LIBRARY_PATH=./ LD_LIBRARY_PATH=./:${LD_LIBRARY_PATH} RUST_BACKTRACE=1 RUST_LOG=vcx=debug,indy=debug RUST_TEST_THREADS=1 TEST_POOL_IP=10.0.0.2 cargo test --features "pool_tests agency" ''' } @@ -569,7 +571,7 @@ def linuxVcxBuild(file, env_name, network_name) { echo "${env_name} Libvcx Test: Run tests" sh ''' cd vcx/libvcx - LIBRARY_PATH=./ LD_LIBRARY_PATH=./:${LD_LIBRARY_PATH} RUST_BACKTRACE=1 RUST_LOG=vcx=debug,indy=debug RUST_TEST_THREADS=1 TEST_POOL_IP=10.0.0.2 cargo test -j 1 --features "pool_tests agency_v2" tests::test_real_proof_for_protocol_type_v2 -- --exact + LIBRARY_PATH=./ LD_LIBRARY_PATH=./:${LD_LIBRARY_PATH} RUST_BACKTRACE=1 RUST_LOG=vcx=debug,indy=debug RUST_TEST_THREADS=1 TEST_POOL_IP=10.0.0.2 cargo test --features "pool_tests agency_v2" tests::test_real_proof_for_protocol_type_v2 -- --exact ''' } } From 0c64ac469213c4787b3d0c29e1d3fe6704321d1f Mon Sep 17 00:00:00 2001 From: Nikita Khateev Date: Fri, 16 Aug 2019 14:36:50 +0300 Subject: [PATCH 245/320] IS-1316 -- Minor changes Signed-off-by: Nikita Khateev --- libindy/src/services/pool/state_proof/mod.rs | 24 ++++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/libindy/src/services/pool/state_proof/mod.rs b/libindy/src/services/pool/state_proof/mod.rs index 365328fe87..5affd7aec3 100644 --- a/libindy/src/services/pool/state_proof/mod.rs +++ b/libindy/src/services/pool/state_proof/mod.rs @@ -545,7 +545,7 @@ fn _verify_merkle_tree(proof_nodes: &[u8], root_hash: &[u8], kvs: &[(String, Opt } }; - let turns = _calculate_turns(length, seq_no); + let turns = _calculate_turns(length, seq_no - 1); trace!("_verify_merkle_tree >> turns: {:?}", turns); if hashes.len() != turns.len() { @@ -597,15 +597,15 @@ fn _verify_merkle_tree(proof_nodes: &[u8], root_hash: &[u8], kvs: &[(String, Opt // true is right // false is left fn _calculate_turns(length: u64, idx: u64) -> Vec { - let mut _idx: usize = (idx - 1) as usize; - let mut _length: usize = length as usize; + let mut idx = idx; + let mut length = length; let mut result: Vec = vec![]; - while _length != 1 { - let middle = _length.next_power_of_two()/2; - let right = _idx < middle; + while length != 1 { + let middle = length.next_power_of_two()/2; + let right = idx < middle; result.push(right); - _idx = if right {_idx} else {_idx - middle}; - _length = if right {middle} else {_length - middle}; + idx = if right {idx} else {idx - middle}; + length = if right {middle} else {length - middle}; } result.reverse(); result @@ -897,7 +897,7 @@ mod tests { fn audit_proof_verify_works_for_invalid_root_hash() { let nodes = json!( [ - "2ComdvG2GQbsGh6DntnUoxRFDCuWz6iSQdKfdd35jrUj", // wrong hash in this value + "2ComdvG2GQbsGh6DntnUoxRFDCuWz6iSQdKfdd35jrUj", "GfWc7bRJj7S4HpwCAzGCLXCftvyJzZkjFDS1cmrPnQFE", "6bjZk9jK6G368qqpVog8A9JNj48EYZTrNszMzMkwRUho" ] @@ -912,7 +912,7 @@ mod tests { fn audit_proof_verify_works_for_invalid_ledger_length() { let nodes = json!( [ - "2ComdvG2GQbsGh6DntnUoxRFDCuWz6iSQdKfdd35jrUj", // wrong hash in this value + "2ComdvG2GQbsGh6DntnUoxRFDCuWz6iSQdKfdd35jrUj", "GfWc7bRJj7S4HpwCAzGCLXCftvyJzZkjFDS1cmrPnQFE", "6bjZk9jK6G368qqpVog8A9JNj48EYZTrNszMzMkwRUho" ] @@ -927,7 +927,7 @@ mod tests { fn audit_proof_verify_works_for_invalid_value() { let nodes = json!( [ - "2ComdvG2GQbsGh6DntnUoxRFDCuWz6iSQdKfdd35jrUj", // wrong hash in this value + "2ComdvG2GQbsGh6DntnUoxRFDCuWz6iSQdKfdd35jrUj", "GfWc7bRJj7S4HpwCAzGCLXCftvyJzZkjFDS1cmrPnQFE", "6bjZk9jK6G368qqpVog8A9JNj48EYZTrNszMzMkwRUho" ] @@ -942,7 +942,7 @@ mod tests { fn audit_proof_verify_works_for_invalid_seqno() { let nodes = json!( [ - "2ComdvG2GQbsGh6DntnUoxRFDCuWz6iSQdKfdd35jrUj", // wrong hash in this value + "2ComdvG2GQbsGh6DntnUoxRFDCuWz6iSQdKfdd35jrUj", "GfWc7bRJj7S4HpwCAzGCLXCftvyJzZkjFDS1cmrPnQFE", "6bjZk9jK6G368qqpVog8A9JNj48EYZTrNszMzMkwRUho" ] From ec8edfca13d301ccc753f336fbd9e98c65375073 Mon Sep 17 00:00:00 2001 From: Nikita Khateev Date: Fri, 16 Aug 2019 16:07:54 +0300 Subject: [PATCH 246/320] IS-1316 -- Key fixes Signed-off-by: Nikita Khateev --- libindy/src/services/pool/state_proof/mod.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libindy/src/services/pool/state_proof/mod.rs b/libindy/src/services/pool/state_proof/mod.rs index 5affd7aec3..3af9f7da06 100644 --- a/libindy/src/services/pool/state_proof/mod.rs +++ b/libindy/src/services/pool/state_proof/mod.rs @@ -292,6 +292,7 @@ pub fn parse_key_from_request_for_builtin_sp(json_msg: &SJsonValue) -> Option vec![], _ => { if let Some(dest) = dest { dest.as_bytes().to_vec() @@ -399,7 +400,7 @@ fn _parse_reply_for_sp(json_msg: &SJsonValue, data: Option<&str>, parsed_data: & (proof, root_hash, KeyValueSimpleDataVerificationType::Simple, json_msg["state_proof"]["multi_signature"].clone()) } else { - let proof = if let Some(path) = parsed_data["audit_path"].as_array() { + let proof = if let Some(path) = parsed_data["auditPath"].as_array() { let path_str = json!(path).to_string(); trace!("TransactionHandler::parse_reply_for_builtin_sp: proof: {:?}", path); base64::encode(&path_str) @@ -407,14 +408,14 @@ fn _parse_reply_for_sp(json_msg: &SJsonValue, data: Option<&str>, parsed_data: & return Err("No proof".to_string()); }; - let root_hash = if let Some(root_hash) = parsed_data["root_hash"].as_str() { + let root_hash = if let Some(root_hash) = parsed_data["rootHash"].as_str() { trace!("TransactionHandler::parse_reply_for_builtin_sp: root_hash: {:?}", root_hash); root_hash } else { return Err("No root hash".to_string()); }; - let len = if let Some(len) = parsed_data["ledger_size"].as_u64() { + let len = if let Some(len) = parsed_data["ledgerSize"].as_u64() { trace!("Ledger length: {}", len); len } else { From ccbc40a044b62a2b71bfc1043a7e56aa83abd0a0 Mon Sep 17 00:00:00 2001 From: "artem.ivanov" Date: Fri, 16 Aug 2019 17:51:15 +0300 Subject: [PATCH 247/320] Moved part of integration test under medium cases block Signed-off-by: artem.ivanov --- libindy/tests/anoncreds.rs | 388 ++++++++++---------- libindy/tests/crypto.rs | 482 +++++++++++++----------- libindy/tests/did.rs | 413 +++++++++++---------- libindy/tests/interaction.rs | 193 +++++----- libindy/tests/ledger.rs | 693 ++++++++++++++++++----------------- libindy/tests/non_secrets.rs | 650 +++++++++++++++++--------------- libindy/tests/pairwise.rs | 153 ++++---- libindy/tests/pool.rs | 265 +++++++------- libindy/tests/wallet.rs | 249 ++++++------- 9 files changed, 1828 insertions(+), 1658 deletions(-) diff --git a/libindy/tests/anoncreds.rs b/libindy/tests/anoncreds.rs index e70c28893b..1160de170f 100644 --- a/libindy/tests/anoncreds.rs +++ b/libindy/tests/anoncreds.rs @@ -60,29 +60,11 @@ mod high_cases { mod issuer_create_and_store_credential_def { use super::*; - use indy_sys::INVALID_WALLET_HANDLE; #[test] fn issuer_create_and_store_credential_def_works() { anoncreds::init_common_wallet(); } - - #[test] - fn issuer_create_and_store_credential_def_works_for_invalid_wallet() { - anoncreds::init_common_wallet(); - - let wallet_handle = wallet::open_wallet(ANONCREDS_WALLET_CONFIG, WALLET_CREDENTIALS).unwrap(); - - let res = anoncreds::issuer_create_credential_definition(INVALID_WALLET_HANDLE, - ISSUER_DID, - &anoncreds::gvt_schema_json(), - TAG_1, - None, - Some(&anoncreds::default_cred_def_config())); - assert_code!(ErrorCode::WalletInvalidHandle, res); - - wallet::close_wallet(wallet_handle).unwrap(); - } } mod issuer_create_credential_offer { @@ -92,20 +74,6 @@ mod high_cases { fn issuer_create_credential_offer_works() { anoncreds::init_common_wallet(); } - - #[test] - fn issuer_create_credential_offer_works_for_invalid_wallet_handle() { - anoncreds::init_common_wallet(); - - let wallet_handle = wallet::open_wallet(ANONCREDS_WALLET_CONFIG, WALLET_CREDENTIALS).unwrap(); - - let invalid_wallet_handle = wallet_handle + 100; - let res = anoncreds::issuer_create_credential_offer(invalid_wallet_handle, - &anoncreds::issuer_1_gvt_cred_def_id()); - assert_code!(ErrorCode::WalletInvalidHandle, res); - - wallet::close_wallet(wallet_handle).unwrap(); - } } mod prover_create_master_secret { @@ -115,19 +83,6 @@ mod high_cases { fn prover_create_master_secret_works() { anoncreds::init_common_wallet(); } - - #[test] - fn prover_create_master_secret_works_invalid_wallet_handle() { - anoncreds::init_common_wallet(); - - let wallet_handle = wallet::open_wallet(ANONCREDS_WALLET_CONFIG, WALLET_CREDENTIALS).unwrap(); - - let invalid_wallet_handle = wallet_handle + 100; - let res = anoncreds::prover_create_master_secret(invalid_wallet_handle, COMMON_MASTER_SECRET); - assert_code!(ErrorCode::WalletInvalidHandle, res); - - wallet::close_wallet(wallet_handle).unwrap(); - } } mod prover_create_credential_req { @@ -137,44 +92,6 @@ mod high_cases { fn prover_create_credential_req_works() { anoncreds::init_common_wallet(); } - - #[test] - fn prover_create_credential_req_works_for_invalid_wallet() { - let (credential_def, credential_offer, _, _) = anoncreds::init_common_wallet(); - - let wallet_handle = wallet::open_wallet(ANONCREDS_WALLET_CONFIG, WALLET_CREDENTIALS).unwrap(); - - let invalid_wallet_handle = wallet_handle + 100; - let res = anoncreds::prover_create_credential_req(invalid_wallet_handle, - DID_MY1, - &credential_offer, - &credential_def, - COMMON_MASTER_SECRET); - assert_code!(ErrorCode::WalletInvalidHandle, res); - - wallet::close_wallet(wallet_handle).unwrap(); - } - - #[test] - fn prover_create_credential_req_works_for_credential_def_not_correspond_to_credential_offer() { - let (issuer1_gvt_credential_def, issuer1_gvt_credential_offer, _, _) = anoncreds::init_common_wallet(); - - let wallet_handle = wallet::open_wallet(ANONCREDS_WALLET_CONFIG, WALLET_CREDENTIALS).unwrap(); - - let mut issuer_create_credential_offer: serde_json::Value = serde_json::from_str(&issuer1_gvt_credential_offer).unwrap(); - issuer_create_credential_offer["key_correctness_proof"]["c"] = serde_json::Value::String("11111111".to_string()); - - let other_credential_offer = serde_json::to_string(&issuer_create_credential_offer).unwrap(); - - let res = anoncreds::prover_create_credential_req(wallet_handle, - DID_MY1, - &other_credential_offer, - &issuer1_gvt_credential_def, - COMMON_MASTER_SECRET); - assert_code!(ErrorCode::CommonInvalidStructure, res); - - wallet::close_wallet(wallet_handle).unwrap(); - } } mod issuer_create_credential { @@ -184,41 +101,6 @@ mod high_cases { fn issuer_create_credential_works() { anoncreds::init_common_wallet(); } - - #[test] - fn issuer_create_credential_works_for_credential_does_not_correspond_to_credential_values() { - let (_, credential_offer, credential_req, _) = anoncreds::init_common_wallet(); - - let wallet_handle = wallet::open_wallet(ANONCREDS_WALLET_CONFIG, WALLET_CREDENTIALS).unwrap(); - - let res = anoncreds::issuer_create_credential(wallet_handle, - &credential_offer, - &credential_req, - &anoncreds::xyz_credential_values_json(), - None, - None); - assert_code!(ErrorCode::CommonInvalidStructure, res); - - wallet::close_wallet(wallet_handle).unwrap(); - } - - #[test] - fn issuer_create_credential_works_for_for_invalid_wallet_handle() { - let (_, credential_offer, credential_req, _) = anoncreds::init_common_wallet(); - - let wallet_handle = wallet::open_wallet(ANONCREDS_WALLET_CONFIG, WALLET_CREDENTIALS).unwrap(); - - let invalid_wallet_handle = wallet_handle + 100; - let res = anoncreds::issuer_create_credential(invalid_wallet_handle, - &credential_offer, - &credential_req, - &anoncreds::gvt_credential_values_json(), - None, - None); - assert_code!(ErrorCode::WalletInvalidHandle, res); - - wallet::close_wallet(wallet_handle).unwrap(); - } } mod prover_store_credential { @@ -228,42 +110,6 @@ mod high_cases { fn prover_store_credential_works() { anoncreds::init_common_wallet(); } - - #[test] - fn prover_store_credential_works_for_invalid_wallet_handle() { - let (credential_def_json, credential_offer, _, _) = anoncreds::init_common_wallet(); - - let wallet_handle = wallet::open_wallet(ANONCREDS_WALLET_CONFIG, WALLET_CREDENTIALS).unwrap(); - let (prover_wallet_handle, prover_wallet_config) = wallet::create_and_open_default_wallet("prover_store_credential_works_for_invalid_wallet_handle").unwrap(); - - anoncreds::prover_create_master_secret(prover_wallet_handle, COMMON_MASTER_SECRET).unwrap(); - - let (credential_req, credential_req_meta) = anoncreds::prover_create_credential_req(prover_wallet_handle, - DID_MY1, - &credential_offer, - credential_def_json, - COMMON_MASTER_SECRET).unwrap(); - - let (credential_json, _, _) = anoncreds::issuer_create_credential(wallet_handle, - &credential_offer, - &credential_req, - &anoncreds::gvt_credential_values_json(), - None, - None).unwrap(); - - let invalid_wallet_handle = wallet_handle + 100; - let res = anoncreds::prover_store_credential(invalid_wallet_handle, - CREDENTIAL1_ID, - &credential_req_meta, - &credential_json, - &credential_def_json, - None); - assert_code!(ErrorCode::WalletInvalidHandle, res); - - wallet::close_wallet(wallet_handle).unwrap(); - wallet::close_wallet(prover_wallet_handle).unwrap(); - wallet::delete_wallet(&prover_wallet_config, WALLET_CREDENTIALS).unwrap(); - } } mod prover_get_credentials { @@ -3038,33 +2884,6 @@ mod high_cases { wallet::close_wallet(wallet_handle).unwrap(); } - - #[test] - fn prover_create_proof_works_for_invalid_wallet_handle() { - anoncreds::init_common_wallet(); - - let wallet_handle = wallet::open_wallet(ANONCREDS_WALLET_CONFIG, WALLET_CREDENTIALS).unwrap(); - - let requested_credentials_json = json!({ - "self_attested_attributes": json!({}), - "requested_attributes": json!({ - "attr1_referent": json!({ "cred_id": CREDENTIAL1_ID, "revealed":true }) - }), - "requested_predicates": json!({}) - }).to_string(); - - let invalid_wallet_handle = wallet_handle + 100; - let res = anoncreds::prover_create_proof(invalid_wallet_handle, - &anoncreds::proof_request_attr(), - &requested_credentials_json, - COMMON_MASTER_SECRET, - &anoncreds::schemas_for_proof(), - &anoncreds::cred_defs_for_proof(), - "{}"); - assert_code!(ErrorCode::WalletInvalidHandle, res); - - wallet::close_wallet(wallet_handle).unwrap(); - } } mod verifier_verify_proof { @@ -3105,19 +2924,6 @@ mod high_cases { "{}"); assert_code!(ErrorCode::CommonInvalidStructure, res); } - - #[test] - fn verifier_verify_proof_works_for_wrong_proof() { - let proof_json = anoncreds::proof_json().replace("1139481716457488690172217916278103335", "1111111111111111111111111111111111111"); - - let valid = anoncreds::verifier_verify_proof(&anoncreds::proof_request_attr(), - &proof_json, - &anoncreds::schemas_for_proof(), - &anoncreds::cred_defs_for_proof(), - "{}", - "{}").unwrap(); - assert!(!valid); - } } mod verifier_verify_proof_with_proof_req_restrictions { @@ -3573,6 +3379,7 @@ mod medium_cases { mod issuer_create_and_store_credential_def { use super::*; + use indy_sys::INVALID_WALLET_HANDLE; #[test] fn issuer_create_and_store_credential_def_works_for_invalid_schema() { @@ -3707,6 +3514,23 @@ mod medium_cases { wallet::close_wallet(wallet_handle).unwrap(); wallet::delete_wallet(&wallet_config, WALLET_CREDENTIALS).unwrap(); } + + #[test] + fn issuer_create_and_store_credential_def_works_for_invalid_wallet() { + anoncreds::init_common_wallet(); + + let wallet_handle = wallet::open_wallet(ANONCREDS_WALLET_CONFIG, WALLET_CREDENTIALS).unwrap(); + + let res = anoncreds::issuer_create_credential_definition(INVALID_WALLET_HANDLE, + ISSUER_DID, + &anoncreds::gvt_schema_json(), + TAG_1, + None, + Some(&anoncreds::default_cred_def_config())); + assert_code!(ErrorCode::WalletInvalidHandle, res); + + wallet::close_wallet(wallet_handle).unwrap(); + } } mod issuer_create_credential_offer { @@ -3723,6 +3547,20 @@ mod medium_cases { wallet::close_wallet(wallet_handle).unwrap(); } + + #[test] + fn issuer_create_credential_offer_works_for_invalid_wallet_handle() { + anoncreds::init_common_wallet(); + + let wallet_handle = wallet::open_wallet(ANONCREDS_WALLET_CONFIG, WALLET_CREDENTIALS).unwrap(); + + let invalid_wallet_handle = wallet_handle + 100; + let res = anoncreds::issuer_create_credential_offer(invalid_wallet_handle, + &anoncreds::issuer_1_gvt_cred_def_id()); + assert_code!(ErrorCode::WalletInvalidHandle, res); + + wallet::close_wallet(wallet_handle).unwrap(); + } } mod prover_create_master_secret { @@ -3739,6 +3577,19 @@ mod medium_cases { wallet::close_wallet(wallet_handle).unwrap(); } + + #[test] + fn prover_create_master_secret_works_invalid_wallet_handle() { + anoncreds::init_common_wallet(); + + let wallet_handle = wallet::open_wallet(ANONCREDS_WALLET_CONFIG, WALLET_CREDENTIALS).unwrap(); + + let invalid_wallet_handle = wallet_handle + 100; + let res = anoncreds::prover_create_master_secret(invalid_wallet_handle, COMMON_MASTER_SECRET); + assert_code!(ErrorCode::WalletInvalidHandle, res); + + wallet::close_wallet(wallet_handle).unwrap(); + } } mod prover_create_credential_req { @@ -3799,11 +3650,84 @@ mod medium_cases { wallet::close_wallet(wallet_handle).unwrap(); } + + #[test] + fn prover_create_credential_req_works_for_invalid_wallet() { + let (credential_def, credential_offer, _, _) = anoncreds::init_common_wallet(); + + let wallet_handle = wallet::open_wallet(ANONCREDS_WALLET_CONFIG, WALLET_CREDENTIALS).unwrap(); + + let invalid_wallet_handle = wallet_handle + 100; + let res = anoncreds::prover_create_credential_req(invalid_wallet_handle, + DID_MY1, + &credential_offer, + &credential_def, + COMMON_MASTER_SECRET); + assert_code!(ErrorCode::WalletInvalidHandle, res); + + wallet::close_wallet(wallet_handle).unwrap(); + } + + #[test] + fn prover_create_credential_req_works_for_credential_def_not_correspond_to_credential_offer() { + let (issuer1_gvt_credential_def, issuer1_gvt_credential_offer, _, _) = anoncreds::init_common_wallet(); + + let wallet_handle = wallet::open_wallet(ANONCREDS_WALLET_CONFIG, WALLET_CREDENTIALS).unwrap(); + + let mut issuer_create_credential_offer: serde_json::Value = serde_json::from_str(&issuer1_gvt_credential_offer).unwrap(); + issuer_create_credential_offer["key_correctness_proof"]["c"] = serde_json::Value::String("11111111".to_string()); + + let other_credential_offer = serde_json::to_string(&issuer_create_credential_offer).unwrap(); + + let res = anoncreds::prover_create_credential_req(wallet_handle, + DID_MY1, + &other_credential_offer, + &issuer1_gvt_credential_def, + COMMON_MASTER_SECRET); + assert_code!(ErrorCode::CommonInvalidStructure, res); + + wallet::close_wallet(wallet_handle).unwrap(); + } } mod issuer_create_credential { use super::*; + #[test] + fn issuer_create_credential_works_for_credential_does_not_correspond_to_credential_values() { + let (_, credential_offer, credential_req, _) = anoncreds::init_common_wallet(); + + let wallet_handle = wallet::open_wallet(ANONCREDS_WALLET_CONFIG, WALLET_CREDENTIALS).unwrap(); + + let res = anoncreds::issuer_create_credential(wallet_handle, + &credential_offer, + &credential_req, + &anoncreds::xyz_credential_values_json(), + None, + None); + assert_code!(ErrorCode::CommonInvalidStructure, res); + + wallet::close_wallet(wallet_handle).unwrap(); + } + + #[test] + fn issuer_create_credential_works_for_for_invalid_wallet_handle() { + let (_, credential_offer, credential_req, _) = anoncreds::init_common_wallet(); + + let wallet_handle = wallet::open_wallet(ANONCREDS_WALLET_CONFIG, WALLET_CREDENTIALS).unwrap(); + + let invalid_wallet_handle = wallet_handle + 100; + let res = anoncreds::issuer_create_credential(invalid_wallet_handle, + &credential_offer, + &credential_req, + &anoncreds::gvt_credential_values_json(), + None, + None); + assert_code!(ErrorCode::WalletInvalidHandle, res); + + wallet::close_wallet(wallet_handle).unwrap(); + } + #[test] fn issuer_create_credential_works_for_for_invalid_credential_req_json() { let (_, credential_offer, _, _) = anoncreds::init_common_wallet(); @@ -3854,6 +3778,42 @@ mod medium_cases { mod prover_store_credential { use super::*; + #[test] + fn prover_store_credential_works_for_invalid_wallet_handle() { + let (credential_def_json, credential_offer, _, _) = anoncreds::init_common_wallet(); + + let wallet_handle = wallet::open_wallet(ANONCREDS_WALLET_CONFIG, WALLET_CREDENTIALS).unwrap(); + let (prover_wallet_handle, prover_wallet_config) = wallet::create_and_open_default_wallet("prover_store_credential_works_for_invalid_wallet_handle").unwrap(); + + anoncreds::prover_create_master_secret(prover_wallet_handle, COMMON_MASTER_SECRET).unwrap(); + + let (credential_req, credential_req_meta) = anoncreds::prover_create_credential_req(prover_wallet_handle, + DID_MY1, + &credential_offer, + credential_def_json, + COMMON_MASTER_SECRET).unwrap(); + + let (credential_json, _, _) = anoncreds::issuer_create_credential(wallet_handle, + &credential_offer, + &credential_req, + &anoncreds::gvt_credential_values_json(), + None, + None).unwrap(); + + let invalid_wallet_handle = wallet_handle + 100; + let res = anoncreds::prover_store_credential(invalid_wallet_handle, + CREDENTIAL1_ID, + &credential_req_meta, + &credential_json, + &credential_def_json, + None); + assert_code!(ErrorCode::WalletInvalidHandle, res); + + wallet::close_wallet(wallet_handle).unwrap(); + wallet::close_wallet(prover_wallet_handle).unwrap(); + wallet::delete_wallet(&prover_wallet_config, WALLET_CREDENTIALS).unwrap(); + } + #[test] fn prover_store_credential_works_for_invalid_credential_json() { let (credential_def_json, credential_offer, _, _) = anoncreds::init_common_wallet(); @@ -3986,6 +3946,33 @@ mod medium_cases { mod prover_create_proof_works { use super::*; + #[test] + fn prover_create_proof_works_for_invalid_wallet_handle() { + anoncreds::init_common_wallet(); + + let wallet_handle = wallet::open_wallet(ANONCREDS_WALLET_CONFIG, WALLET_CREDENTIALS).unwrap(); + + let requested_credentials_json = json!({ + "self_attested_attributes": json!({}), + "requested_attributes": json!({ + "attr1_referent": json!({ "cred_id": CREDENTIAL1_ID, "revealed":true }) + }), + "requested_predicates": json!({}) + }).to_string(); + + let invalid_wallet_handle = wallet_handle + 100; + let res = anoncreds::prover_create_proof(invalid_wallet_handle, + &anoncreds::proof_request_attr(), + &requested_credentials_json, + COMMON_MASTER_SECRET, + &anoncreds::schemas_for_proof(), + &anoncreds::cred_defs_for_proof(), + "{}"); + assert_code!(ErrorCode::WalletInvalidHandle, res); + + wallet::close_wallet(wallet_handle).unwrap(); + } + #[test] fn prover_create_proof_works_for_invalid_master_secret() { anoncreds::init_common_wallet(); @@ -4091,6 +4078,19 @@ mod medium_cases { mod verifier_verify_proof { use super::*; + #[test] + fn verifier_verify_proof_works_for_wrong_proof() { + let proof_json = anoncreds::proof_json().replace("1139481716457488690172217916278103335", "1111111111111111111111111111111111111"); + + let valid = anoncreds::verifier_verify_proof(&anoncreds::proof_request_attr(), + &proof_json, + &anoncreds::schemas_for_proof(), + &anoncreds::cred_defs_for_proof(), + "{}", + "{}").unwrap(); + assert!(!valid); + } + #[test] fn verifier_verify_proof_works_for_invalid_proof_json_format() { let proof_json = r#"{"proof":{"proofs":{"credential::58479554-187f-40d9-b0a5-a95cfb0338c3":{"primary_proof":{"eq_proof":{"revealed_attrs":{"name":"1139481716457488690172217916278103335"},"a_prime":"80401564260558483983794628158664845806393125691167675024527906210615204776868092566789307767601325086260531777605457298059939671624755239928848057947875953445797869574854365751051663611984607735255307096920094357120779812375573500489773454634756645206823074153240319316758529163584251907107473703779754778699279153037094140428648169418133281187947677937472972061954089873405836249023133445286756991574802740614183730141450546881449500189789970102133738133443822618072337620343825908790734460412932921199267304555521397418007577171242880211812703320270140386219809818196744216958369397014610013338422295772654405475023","e":"31151798717381512709903464053695613005379725796031086912986270617392167764097422442809244590980303622977555221812111085160553241592792901","v":"524407431684833626723631303096063196973911986967748096669183384949467719053669910411426601230736351335262754473490498825342793551112426427823428399937548938048089615644972537564428344526295733169691240937176356626523864731701111189536269488496019586818879697981955044502664124964896796783428945944075084807859935155837238670987272778459356531608865162828109489758902085206073584532002909678902616210042778963974064479140826712481297584040209095459963718975102750913306565864485279810056629704077428898739021040190774575868853629858297299392839284660771662690107106553362040805152261505268111067408422298806905178826507224233050991301274817252924123120887017757639206512015559321675322509820081151404696713509158685022511201565062671933414307463988209696457343022378430051265752251403461414881325357657438328740471164157220698425309006894962942640219890219594168419276308074677144722217081026358892787770650248878952483621","m":{"age":"10477979077744818183854012231360633424177093192344587159214818537659704987539982653663361680650769087122324965941845552897155693994859927792964720675888893623940580527766661802170","sex":"15368219775809326116045200104269422566086585069798988383076685221700842794654771075432385446820819836777771517356551059931242867733879324915651894894695726945279462946826404864068","height":"268172143999991481637372321419290603042446269013750825098514042757459298040087626745653681785038933035820421862976371452111736537699176931068992453946771945552540798204580069806"},"m1":"119095745403940293668103184388411799541118279558928018597628509118163496000813590825371995586347826189221837428823000332905316924389185590810015031744029496470545254805993327676570037596326743185389101389800942263689809725968264069601565478411709555274081560719927118853299543998608664701485475703881376151770","m2":"3166313665375815600922385342096456465402430622944571045536207479553790085339726549928012930073803465171492637049498407367742103524723152099973753540483894420905314750248333232361"},"ge_proofs":[{"u":{"2":"6494171529848192644197417834173236605253723188808961394289041396341136802965710957759175642924978223517091081898946519122412445399638640485278379079647638538597635045303985779767","0":"7739508859260491061487569748588091139318989278758566530899756574128579312557203413565436003310787878172471425996601979342157451689172171025305431595131816910273398879776841751855","3":"9424758820140378077609053635383940574362083113571024891496206162696034958494400871955445981458978146571146602763357500412840538526390475379772903513687358736287298159312524034159","1":"9011979414559555265454106061917684716953356440811838475257096756618761731111646531136628099710567973381801256908067529269805992222342928842825929421929485785888403149296320711642"},"r":{"DELTA":"2119857977629302693157808821351328058251440215802746362450951329352726877165815663955490999790457576333458830301801261754696823614762123890412904169206391143688952648566814660498520188221060505840151491403269696751525874990487604723445355651918681212361562384420233903265612599812725766212744963540390806334870022328290970137051148373040320927100063898502086531019924715927190306801273252711777648467224661735618842887006436195147540705753550974655689586750013569294343535843195025962867299786380033532422131203367401906988124836294104501525520053613392691214421562815044433237816093079784307397782961917892254668290115653012265908717124278607660504580036193346698672079435538219972121355893074219968755049500875222141","2":"879097501989202140886939888802566536179834329508897124489020677433754766947767937608431979796722207676629625451150104784909666168153917345813160237337412296010679353735699663083287427507870244565918756969618964144516025526404618052053542009438548457492400344119561349471929199757453154204191407620539220514897529346602664135146454509169680801061111878075145734123580343470361019624175036825631373890661124315134340427076598351080893567995392248394683875116715114577054906406649006122102488431184007790011073389768061904597267545895265921673106871142463561948479668876241841045522543174660428236658891636170119227855493059358614089146415798861053408542832475696099851160385105386001523305465829676723036394820593263477","0":"1724016272047416140958096373304304971004826284109046259544344355102178044512441391364907122486655755929044720001281832600729467778103556397960700809066582436321515744527550472324028227472294258045699756170293405547851344921626775854114063087070898499913846456795761213291925373770081490280103876827479351849800210782799381740073719081199000612284788683993320623339686128531187019125095700122135094060470612862911102824801065698176788174959069186600426519872015152034176356923049531650418553748519941342115963599848111324793380438600664408464987023646615003553912544410140730587797458882329021327455905737414352355326238028222782957735440607899424838572541602600159016542488644761584240884783618700311735467659132540546","3":"2317535203964314926167241523636020444600002667629517624482931328850422196008281300859516069440995466415138723103558631951648519232327284208990029010060986032518946759289078833125920310350676484457972303378558158127406345804560689086460633931717939234025886786468170219981598030245042011840614339386724945679531091642132820284896626191109974537171662283750959028046143650291367908660204201563611944187723824430780626387525165408619587771059635528553832034409311888615502905143628507219523591091412192645348525327725381323865648645828460581593542176351568614465903523790649219812666979685223535464526901006270478687017672202058914176692964406859722580270696925877498058525086810338471380117323227744481903228027847825795","1":"1119193929864813751243160041764170298897380522230946444206167281178657213260394833843687899872857393015947283159245092452814155776571829885921814072299525859857844030379558685168895306445277750249341844789101670896570226707650318347992386244538723699686941887792682779028216548922683313576597384354842537728667739985216662699631842296096507821667149950956179957306177525178260912379909156360834120816956949271530622510333943914411903103069247646327625753995178999023427645468623522280255892736633780185163496867644317005801241786702434621502492159672660131289312665511793827552317714835658019088880972220344126692027952749318018900669839090109361161616086319604439015851316798257015063653414161203599184730094765941653"},"mj":"10477979077744818183854012231360633424177093192344587159214818537659704987539982653663361680650769087122324965941845552897155693994859927792964720675888893623940580527766661802170","alpha":"46280660038407959140964701167450659223532556136388451390393713283900546119670373626221864441898929302821705811144923685080534692512705456699843367809872982836890616398604933641265111106644805368974824737276965928297120628041257593166650593538539384316563258781595629888673792430276007730792093088812056156937735120078929629310611907731935101448992312370312134173482115524436767558802102266208152808607480693236511858269018733175523724309089010048330044458187371675333889670055578652283806685440133357512406700879353713629795062705271430695988191782837658895477702634883214188598350625843489120361660836956958750828038278027538830855628653513539929730230905015331221220017847248793929813230252015802389329428995718799619565984669228143200627972926117282688854152516298117476837960100343260648687249027349308513966440386556698667484082658689","t":{"DELTA":"46814992964714978733007076702016837564951956529003697497847838781899848384824991374342901164708655443686022921583406187082133141084994843502230809550055933825660668160300304112671478218513259983054489597176651737200716259733573469298437873515151377206364940530308167934399245072298875358347931404742292788785586833114480704138718996633638362933821933388459210678374952072108333767698704767907612549860590824123780096225591372365712106060039646448181221691765233478768574198237963457485496438076793333937013217675591500849193742006533651525421426481898699626618796271544860105422331629265388419155909716261466161258430","2":"59423006413504086085782234600502410213751379553855471973440165009200961757474676407242673622935614782362911290590560535490636029324125251850583605745046201217673654522625983661578962623803698461459190578519097656221453474955879823750445359506290522280566225253310030053812918275525607874059407284653434046369835156477189219911810464401689041140506062300317020407969423270374033482533711564673658146930272487464489365713112043565257807490520178903336328210031106311280471651300486164966423437275272281777742004535722142265580037959473078313965482591454009972765788975683031385823798895914265841131145707278751512534120","0":"56510878078818710798555570103060159621941668074271797077206591818472978018558098567975838757566260370093327989369045722406190165972775356924844244889146946158949660988214890388299203816110339909687790860564719380865809705044646711632599987968183128514431910561478715003212633874423067294596323864121737000450543142072142652163818450299889830999149821558252183477517484127000480272695698860647674027831262149565273068850774090998356019534296579838685977022988536930596918054160990243868372150609770079720240227817149126735182138479851227052696211125454858584118346950878092387488482897777914362341820607560926173967363","3":"63511079416489489495396586813126304469185174450150717746314545118902972011091412254834718868134635251731510764117528579641756327883640004345178347120290107941107152421856942264968771810665927914509411385404403747487862696526824127219640807008235054362138760656969613951620938020257273816713908815343872804442748694361381399025862438391456307852482826748664499083370705834755863016895566228300904018909174673301643617543662527772400085378252706897979609427451977654028887889811453690146157824251379525221390697200211891556653698308665831075787991412401737090471273439878635073797691350863566834141222438011402987450926","1":"30348838247529448929141877305241172943867610065951047292188826263950046630912426030349276970628525991007036685038199133783991618544554063310358191845473212966131475853690378885426974792306638181168558731807811629973716711132134244797541560013139884391800841941607502149630914097258613821336239993125960064136287579351403225717114920758719152701696123905042695943045383536065833292374624566478931465135875411483860059753175449604448434619593495399051968638830805689355610877075130302742512428461286121237297212174164897833936610857614962734658136750299346971377383141235020438750748045568800723867413392427848651081274"},"predicate":{"name":"age","p_type":"GE","p_value":18}}]},"non_revoc_proof":null}},"aggregated_proof":{"c_hash":"81135772044295974649282368084258333955993271555081206390568996949836231116301","c_list":[[2,124,231,47,189,36,247,160,61,220,165,35,97,165,203,185,133,253,81,239,67,127,156,49,189,16,140,30,177,161,221,54,154,0,127,143,98,212,114,193,188,85,206,171,198,140,9,192,10,254,218,120,201,182,40,141,80,35,81,148,204,192,41,5,186,33,50,77,211,163,124,130,32,219,193,167,79,43,181,76,19,249,53,79,70,221,205,36,180,50,120,255,161,227,196,204,71,106,221,131,220,7,73,86,128,208,48,58,123,63,82,24,170,141,143,56,221,96,151,108,105,38,185,243,224,112,177,101,195,87,208,201,39,123,165,125,92,104,234,188,54,92,31,158,178,152,52,205,26,156,237,241,23,15,76,220,168,32,175,230,157,197,225,70,57,237,8,81,13,17,95,70,143,56,162,223,203,8,48,153,51,51,118,116,32,139,187,222,146,86,165,111,125,107,203,18,212,28,168,22,62,69,204,207,122,148,25,30,92,120,83,214,116,221,204,120,230,70,128,139,181,110,69,93,253,240,69,16,113,224,246,41,142,0,83,237,186,4,50,156,206,199,89,74,96,168,249,240,101,16,103,234,162,219,52,218,207],[1,191,167,2,151,36,61,136,184,172,120,86,127,88,109,119,56,21,167,171,217,221,24,64,246,237,255,152,81,183,201,191,59,234,213,101,254,91,33,205,120,71,215,144,160,243,145,109,19,151,241,46,135,132,50,143,219,207,197,35,89,103,83,212,96,83,222,101,55,57,220,161,252,115,39,62,46,160,30,138,221,89,125,66,114,150,5,95,63,10,55,107,102,73,40,69,41,6,57,0,64,226,152,66,181,149,251,50,28,53,18,26,221,5,188,67,125,184,190,200,56,92,132,201,242,211,37,2,43,6,146,88,228,120,204,190,4,118,134,106,118,110,249,145,175,165,116,197,200,183,207,215,197,79,207,203,29,182,231,151,248,233,107,41,79,234,250,27,33,33,107,102,240,47,37,230,243,185,93,192,52,31,73,211,11,173,150,92,194,154,172,247,221,206,129,85,193,105,172,140,201,40,240,200,28,94,1,96,204,175,113,170,46,134,229,111,215,208,237,252,84,50,249,41,214,79,38,194,23,212,7,164,153,217,23,252,32,114,145,58,189,118,104,131,84,184,115,175,199,227,219,117,23,113,113,180,3],[240,104,187,71,84,144,129,123,12,181,215,233,27,55,56,54,94,57,17,42,111,42,112,234,192,23,226,103,118,198,189,175,175,1,102,64,128,100,221,201,134,106,83,239,69,43,150,172,95,206,145,224,207,239,39,193,30,200,90,125,175,125,59,47,250,224,193,21,64,112,101,131,128,249,96,165,73,33,174,64,69,252,209,158,130,53,23,158,217,173,69,51,12,145,70,174,15,206,13,181,50,246,50,110,223,65,250,44,39,33,8,47,169,242,147,3,190,164,110,20,68,5,142,133,38,198,151,161,167,0,219,128,126,120,190,23,153,22,250,78,114,241,252,181,74,142,65,123,225,153,75,159,78,84,28,110,203,105,231,238,75,138,121,233,75,163,221,69,106,143,1,217,251,43,147,252,189,122,19,124,189,180,206,91,165,199,41,172,233,102,14,91,162,254,16,142,60,230,39,200,208,236,101,69,101,152,233,217,100,206,31,120,211,191,90,56,205,40,180,120,47,210,224,86,153,34,86,237,204,11,183,227,0,224,15,201,32,228,4,210,43,156,68,246,137,150,103,197,191,150,155,181,78,5,134,58],[1,214,184,139,205,251,132,131,8,186,140,58,211,242,134,120,121,253,128,192,10,252,172,101,44,26,119,56,212,8,248,71,19,96,59,12,233,191,63,187,217,35,191,160,127,247,189,247,229,111,252,101,126,10,142,252,238,215,211,137,137,164,114,186,255,199,183,50,103,9,158,63,134,140,162,154,188,109,52,31,92,78,38,228,0,60,225,100,239,88,114,95,48,71,7,117,168,45,45,177,178,62,87,197,98,174,123,249,26,237,179,12,63,182,46,218,183,148,163,222,179,159,146,56,142,190,122,100,211,6,86,237,10,7,111,186,27,66,95,252,108,247,203,1,111,60,13,218,104,63,128,125,197,11,201,138,33,122,37,31,163,123,120,132,65,122,208,60,80,87,113,183,28,31,74,106,18,79,52,245,113,184,94,202,72,223,8,128,209,43,77,237,119,208,255,144,26,76,223,77,177,131,237,49,150,251,53,150,115,33,254,237,185,15,140,234,205,99,248,252,171,245,192,104,151,194,190,186,249,180,246,9,169,165,0,221,7,107,39,67,58,178,176,99,212,40,247,49,127,7,94,5,170,65,154,28,104],[1,247,26,202,244,120,131,95,151,52,56,38,141,232,178,50,61,45,235,61,12,68,11,180,174,222,110,211,141,253,198,204,248,192,40,99,237,1,45,170,79,208,3,13,135,89,195,65,3,228,224,146,181,198,14,79,78,237,168,81,108,151,68,12,88,242,120,200,120,193,253,51,167,140,43,175,59,18,160,190,233,21,213,135,162,76,38,48,163,110,155,197,97,93,211,183,95,42,172,249,98,59,161,136,70,39,142,48,242,44,154,103,186,161,214,215,0,254,166,150,111,71,242,102,209,125,25,65,144,223,211,137,223,239,50,96,185,171,120,155,171,98,204,23,102,253,68,141,91,240,127,170,199,249,217,165,164,37,174,212,159,232,140,196,216,140,205,102,84,104,220,223,9,249,75,245,78,157,245,203,235,154,73,34,77,12,227,138,93,105,178,114,255,210,88,216,202,64,69,128,220,211,113,51,15,185,103,236,52,187,49,29,162,20,35,21,65,188,33,46,11,172,59,15,221,36,33,213,14,121,36,218,76,80,97,197,83,64,145,73,194,43,233,144,251,86,112,209,230,67,234,116,172,219,123,50,46],[1,114,216,159,37,214,198,117,230,153,15,176,95,20,29,134,179,207,209,35,101,193,47,54,130,141,78,213,54,167,31,73,105,177,129,135,6,135,45,107,103,16,133,187,74,217,42,40,1,214,60,70,78,245,86,82,150,75,91,235,181,249,129,147,202,15,86,250,222,240,203,236,102,39,53,147,79,178,124,184,97,73,65,136,74,29,219,182,83,167,221,203,32,200,243,130,65,234,133,181,203,35,86,21,123,170,74,174,5,132,1,149,77,141,158,193,249,130,37,53,253,234,228,144,66,152,232,246,26,193,6,53,139,45,231,173,115,87,89,61,197,9,96,73,229,189,49,44,203,214,156,139,58,153,77,13,90,35,157,130,184,150,161,69,145,157,4,206,52,216,227,233,113,202,54,154,153,100,83,97,135,88,197,227,42,52,28,221,91,117,56,183,198,102,231,37,232,226,136,142,115,218,175,45,221,143,130,215,184,39,102,172,126,253,152,108,254,241,17,98,70,223,191,138,251,227,243,32,180,190,223,69,135,0,97,105,115,189,221,134,26,159,32,210,172,233,7,65,238,77,203,159,181,188,203,159,190]]}},"requested_proof":{"revealed_attrs":{"attr1_referent":["credential::58479554-187f-40d9-b0a5-a95cfb0338c3","Alex","1139481716457488690172217916278103335"]},"unrevealed_attrs":{},"self_attested_attrs":{},"predicates":{"predicate1_referent":"credential::58479554-187f-40d9-b0a5-a95cfb0338c3"}}}"#; diff --git a/libindy/tests/crypto.rs b/libindy/tests/crypto.rs index ce2af0bf88..d3ff12df3c 100644 --- a/libindy/tests/crypto.rs +++ b/libindy/tests/crypto.rs @@ -30,14 +30,12 @@ extern crate serde; #[macro_use] mod utils; -use utils::{wallet, crypto, did}; +use utils::crypto; use utils::constants::*; use utils::Setup; use self::indy::ErrorCode; -use api::INVALID_WALLET_HANDLE; - pub const ENCRYPTED_MESSAGE: &'static [u8; 45] = &[187, 227, 10, 29, 46, 178, 12, 179, 197, 69, 171, 70, 228, 204, 52, 22, 199, 54, 62, 13, 115, 5, 216, 66, 20, 131, 121, 29, 251, 224, 253, 201, 75, 73, 225, 237, 219, 133, 35, 217, 131, 135, 232, 129, 32]; pub const SIGNATURE: &'static [u8; 64] = &[169, 215, 8, 225, 7, 107, 110, 9, 193, 162, 202, 214, 162, 66, 238, 211, 63, 209, 12, 196, 8, 211, 55, 27, 120, 94, 204, 147, 53, 104, 103, 61, 60, 249, 237, 127, 103, 46, 220, 223, 10, 95, 75, 53, 245, 210, 241, 151, 191, 41, 48, 30, 9, 16, 78, 252, 157, 206, 210, 145, 125, 133, 109, 11]; @@ -61,13 +59,6 @@ mod high_cases { let verkey = crypto::create_key(setup.wallet_handle, None).unwrap(); assert_eq!(verkey.from_base58().unwrap().len(), 32); } - - #[test] - fn indy_create_key_works_for_invalid_wallet_handle() { - Setup::empty(); - let res = crypto::create_key(INVALID_WALLET_HANDLE, None); - assert_code!(ErrorCode::WalletInvalidHandle, res); - } } mod set_key_metadata { @@ -92,27 +83,6 @@ mod high_cases { let updated_metadata = crypto::get_key_metadata(setup.wallet_handle, &setup.verkey).unwrap(); assert_eq!(new_metadata, updated_metadata); } - - #[test] - fn indy_set_key_metadata_works_for_invalid_handle() { - let setup = Setup::did(); - let res = crypto::set_key_metadata(INVALID_WALLET_HANDLE, &setup.verkey, METADATA); - assert_code!(ErrorCode::WalletInvalidHandle, res); - } - - #[test] - fn indy_set_key_metadata_works_for_empty_string() { - let setup = Setup::did(); - crypto::set_key_metadata(setup.wallet_handle, &setup.verkey, "").unwrap(); - } - - - #[test] - fn indy_set_key_metadata_works_for_invalid_key() { - let setup = Setup::did(); - let res = crypto::set_key_metadata(setup.wallet_handle, INVALID_BASE58_VERKEY, METADATA); - assert_code!(ErrorCode::CommonInvalidStructure, res); - } } mod get_key_metadata { @@ -128,16 +98,6 @@ mod high_cases { assert_eq!(METADATA.to_string(), metadata); } - #[test] - fn indy_get_key_metadata_works_for_empty_string() { - let setup = Setup::did(); - - crypto::set_key_metadata(setup.wallet_handle, &setup.verkey, "").unwrap(); - - let metadata = crypto::get_key_metadata(setup.wallet_handle, &setup.verkey).unwrap(); - assert_eq!("", metadata); - } - #[test] fn indy_get_key_metadata_works_for_no_metadata() { let setup = Setup::did(); @@ -145,16 +105,6 @@ mod high_cases { let res = crypto::get_key_metadata(setup.wallet_handle, &setup.verkey); assert_code!(ErrorCode::WalletItemNotFound, res); } - - #[test] - fn indy_get_key_metadata_works_for_invalid_handle() { - let setup = Setup::did(); - - crypto::set_key_metadata(setup.wallet_handle, &setup.verkey, METADATA).unwrap(); - - let res = crypto::get_key_metadata(INVALID_WALLET_HANDLE, &setup.verkey); - assert_code!(ErrorCode::WalletInvalidHandle, res); - } } mod crypto_sign { @@ -176,13 +126,6 @@ mod high_cases { let res = crypto::sign(setup.wallet_handle, VERKEY, MESSAGE.as_bytes()); assert_code!(ErrorCode::WalletItemNotFound, res); } - - #[test] - fn indy_crypto_sign_works_for_invalid_wallet_handle() { - let setup = Setup::did(); - let res = crypto::sign(INVALID_WALLET_HANDLE, &setup.verkey, MESSAGE.as_bytes()); - assert_code!(ErrorCode::WalletInvalidHandle, res); - } } mod crypto_verify { @@ -194,21 +137,6 @@ mod high_cases { assert!(valid); } - #[test] - fn indy_crypto_verify_works_for_verkey_with_correct_crypto_type() { - let verkey = VERKEY_MY1.to_owned() + ":ed25519"; - let valid = crypto::verify(&verkey, MESSAGE.as_bytes(), SIGNATURE).unwrap(); - assert!(valid); - } - - #[test] - fn indy_crypto_verify_works_for_verkey_with_invalid_crypto_type() { - let verkey = VERKEY_MY1.to_owned() + ":unknown_crypto"; - let res = crypto::verify(&verkey, MESSAGE.as_bytes(), SIGNATURE); - assert_code!(ErrorCode::UnknownCryptoTypeError, res); - } - - #[test] fn indy_crypto_verify_works_for_other_signer() { let valid = crypto::verify(&VERKEY_MY2, MESSAGE.as_bytes(), SIGNATURE).unwrap(); @@ -239,33 +167,12 @@ mod high_cases { crypto::auth_crypt(setup.wallet_handle, &setup.verkey, VERKEY_MY2, MESSAGE.as_bytes()).unwrap(); } - #[test] - fn indy_crypto_auth_crypt_works_for_created_did_as_cid() { - let setup = Setup::wallet(); - let (_, verkey) = did::create_my_did(setup.wallet_handle, &json!({ "seed": MY1_SEED, "cid": true }).to_string()).unwrap(); - crypto::auth_crypt(setup.wallet_handle, &verkey, VERKEY_MY2, MESSAGE.as_bytes()).unwrap(); - } - #[test] fn indy_crypto_auth_crypt_works_for_unknown_sender_verkey() { let setup = Setup::wallet(); let res = crypto::auth_crypt(setup.wallet_handle, VERKEY_MY2, VERKEY, MESSAGE.as_bytes()); assert_code!(ErrorCode::WalletItemNotFound, res); } - - #[test] - fn indy_crypto_auth_crypt_works_for_invalid_wallet_handle() { - let setup = Setup::did(); - let res = crypto::auth_crypt(INVALID_WALLET_HANDLE, &setup.verkey, VERKEY, MESSAGE.as_bytes()); - assert_code!(ErrorCode::WalletInvalidHandle, res); - } - - #[test] - fn indy_crypto_auth_crypt_works_for_invalid_recipient_vk() { - let setup = Setup::did(); - let res = crypto::auth_crypt(setup.wallet_handle, &setup.verkey, INVALID_BASE58_VERKEY, MESSAGE.as_bytes()); - assert_code!(ErrorCode::CommonInvalidStructure, res); - } } mod auth_decrypt { @@ -283,20 +190,6 @@ mod high_cases { assert_eq!(sender_setup.verkey, vk); } - #[test] - fn indy_crypto_auth_decrypt_works_for_invalid_msg() { - let sender_setup = Setup::key(); - let recipient_setup = Setup::did(); - - did::store_their_did_from_parts(sender_setup.wallet_handle, &recipient_setup.did, &recipient_setup.verkey).unwrap(); - - let encrypted_msg = format!(r#"{{"nonce":"Th7MpTaRZVRYnPiabds81Y12","sender":"{:?}","msg":"{:?}"}}"#, VERKEY, ENCRYPTED_MESSAGE.to_vec()); - - let res = crypto::auth_decrypt(recipient_setup.wallet_handle, &recipient_setup.verkey, &encrypted_msg.as_bytes()); - assert_code!(ErrorCode::CommonInvalidStructure, res); - - } - #[test] fn indy_crypto_auth_decrypt_works_for_unknown_recipient_vk() { let setup = Setup::key(); @@ -306,17 +199,6 @@ mod high_cases { let res = crypto::anon_decrypt(setup.wallet_handle, &VERKEY_TRUSTEE, &encrypted_msg); assert_code!(ErrorCode::WalletItemNotFound, res); } - - #[test] - fn indy_crypto_auth_decrypt_works_invalid_handle() { - let sender_setup = Setup::key(); - let recipient_setup = Setup::key(); - - let encrypted_msg = crypto::auth_crypt(sender_setup.wallet_handle, &sender_setup.verkey, &recipient_setup.verkey, MESSAGE.as_bytes()).unwrap(); - - let res = crypto::auth_decrypt(INVALID_WALLET_HANDLE, &recipient_setup.verkey, &encrypted_msg); - assert_code!(ErrorCode::WalletInvalidHandle, res); - } } mod anon_crypt { @@ -327,17 +209,6 @@ mod high_cases { Setup::empty(); crypto::anon_crypt(VERKEY_MY2, &MESSAGE.as_bytes()).unwrap(); } - - #[test] - fn indy_anon_crypt_works_for_invalid_their_vk() { - Setup::empty(); - - let res = crypto::anon_crypt(INVALID_VERKEY_LENGTH, &MESSAGE.as_bytes()); - assert_code!(ErrorCode::CommonInvalidStructure, res); - - let res = crypto::anon_crypt(INVALID_BASE58_VERKEY, &MESSAGE.as_bytes()); - assert_code!(ErrorCode::CommonInvalidStructure, res); - } } mod anon_decrypt { @@ -353,14 +224,6 @@ mod high_cases { assert_eq!(MESSAGE.as_bytes().to_vec(), msg); } - #[test] - fn indy_crypto_anon_decrypt_works_for_invalid_msg() { - let setup = Setup::key(); - - let res = crypto::anon_decrypt(setup.wallet_handle, &setup.verkey, &"unencrypted message".as_bytes()); - assert_code!(ErrorCode::CommonInvalidStructure, res); - } - #[test] fn indy_crypto_anon_decrypt_works_for_unknown_verkey() { let setup = Setup::wallet(); @@ -370,16 +233,6 @@ mod high_cases { let res = crypto::anon_decrypt(setup.wallet_handle, &VERKEY_TRUSTEE, &encrypted_msg); assert_code!(ErrorCode::WalletItemNotFound, res); } - - #[test] - fn indy_crypto_anon_decrypt_works_invalid_handle() { - let setup = Setup::key(); - - let encrypted_msg = crypto::anon_crypt(&setup.verkey, MESSAGE.as_bytes()).unwrap(); - - let res = crypto::anon_decrypt(INVALID_WALLET_HANDLE, &setup.verkey, &encrypted_msg); - assert_code!(ErrorCode::WalletInvalidHandle, res); - } } mod pack_message_authcrypt { @@ -394,45 +247,6 @@ mod high_cases { let res = crypto::pack_message(setup.wallet_handle, message, &receiver_keys, Some(&setup.verkey)); assert!(res.is_ok()); } - - #[test] - fn indy_pack_message_authcrypt_fails_empty_message() { - let setup = Setup::key(); - let rec_key_vec = vec![VERKEY_MY1, VERKEY_MY2, VERKEY_TRUSTEE]; - let receiver_keys = serde_json::to_string(&rec_key_vec).unwrap(); - let message = "".as_bytes(); - let res = crypto::pack_message(setup.wallet_handle, message, &receiver_keys, Some(&setup.verkey)); - assert_code!(ErrorCode::CommonInvalidParam3, res); - } - - #[test] - fn indy_pack_message_authcrypt_fails_no_receivers() { - let setup = Setup::key(); - let receiver_keys = "[]"; - let message = "Hello World".as_bytes(); - let res = crypto::pack_message(setup.wallet_handle, message, &receiver_keys, Some(&setup.verkey)); - assert_code!(ErrorCode::CommonInvalidParam4, res); - } - - #[test] - fn indy_pack_message_authcrypt_fails_bad_wallet_handle() { - let setup = Setup::key(); - let rec_key_vec = vec![VERKEY_MY1, VERKEY_MY2, VERKEY_TRUSTEE]; - let receiver_keys = serde_json::to_string(&rec_key_vec).unwrap(); - let message = "Hello World".as_bytes(); - let res = crypto::pack_message(INVALID_WALLET_HANDLE, message, &receiver_keys, Some(&setup.verkey)); - assert_code!(ErrorCode::WalletInvalidHandle, res); - } - - #[test] - fn indy_pack_message_authcrypt_fails_invalid_verkey() { - let setup = Setup::wallet(); - let rec_key_vec = vec![VERKEY_MY1, VERKEY_MY2, VERKEY_TRUSTEE]; - let receiver_keys = serde_json::to_string(&rec_key_vec).unwrap(); - let message = "Hello World".as_bytes(); - let res = crypto::pack_message(setup.wallet_handle, message, &receiver_keys, Some(INVALID_BASE58_VERKEY)); - assert_code!(ErrorCode::CommonInvalidStructure, res); - } } mod pack_message_anoncrypt { @@ -447,35 +261,6 @@ mod high_cases { let res = crypto::pack_message(setup.wallet_handle, message, &receiver_keys, None); assert!(res.is_ok()); } - - #[test] - fn indy_pack_message_anoncrypt_fails_empty_message() { - let setup = Setup::wallet(); - let rec_key_vec = vec![VERKEY_MY1, VERKEY_MY2, VERKEY_TRUSTEE]; - let receiver_keys = serde_json::to_string(&rec_key_vec).unwrap(); - let message = "".as_bytes(); - let res = crypto::pack_message(setup.wallet_handle, message, &receiver_keys, None); - assert_code!(ErrorCode::CommonInvalidParam3, res); - } - - #[test] - fn indy_pack_message_anoncrypt_fails_no_receivers() { - let setup = Setup::wallet(); - let receiver_keys = "[]"; - let message = "Hello World".as_bytes(); - let res = crypto::pack_message(setup.wallet_handle, message, &receiver_keys, None); - assert_code!(ErrorCode::CommonInvalidParam4, res); - } - - #[test] - fn indy_pack_message_anoncrypt_passes_bad_wallet_handle() { - let rec_key_vec = vec![VERKEY_MY1, VERKEY_MY2, VERKEY_TRUSTEE]; - let receiver_keys = serde_json::to_string(&rec_key_vec).unwrap(); - let message = "Hello World".as_bytes(); - //The wallet_handle and sender aren't used in this case, so any wallet_handle whether inited or not will work - let res = crypto::pack_message(INVALID_WALLET_HANDLE, message, &receiver_keys, None); - assert!(res.is_ok()); - } } mod unpack_message_authcrypt { @@ -567,6 +352,269 @@ mod high_cases { } } +#[cfg(not(feature = "only_high_cases"))] +mod medium_cases { + use super::*; + use utils::did; + use api::INVALID_WALLET_HANDLE; + + mod create_key { + use super::*; + + #[test] + fn indy_create_key_works_for_invalid_wallet_handle() { + Setup::empty(); + let res = crypto::create_key(INVALID_WALLET_HANDLE, None); + assert_code!(ErrorCode::WalletInvalidHandle, res); + } + } + + mod set_key_metadata { + use super::*; + + #[test] + fn indy_set_key_metadata_works_for_invalid_handle() { + let setup = Setup::did(); + let res = crypto::set_key_metadata(INVALID_WALLET_HANDLE, &setup.verkey, METADATA); + assert_code!(ErrorCode::WalletInvalidHandle, res); + } + + #[test] + fn indy_set_key_metadata_works_for_empty_string() { + let setup = Setup::did(); + crypto::set_key_metadata(setup.wallet_handle, &setup.verkey, "").unwrap(); + } + + + #[test] + fn indy_set_key_metadata_works_for_invalid_key() { + let setup = Setup::did(); + let res = crypto::set_key_metadata(setup.wallet_handle, INVALID_BASE58_VERKEY, METADATA); + assert_code!(ErrorCode::CommonInvalidStructure, res); + } + } + + mod get_key_metadata { + use super::*; + + #[test] + fn indy_get_key_metadata_works_for_empty_string() { + let setup = Setup::did(); + + crypto::set_key_metadata(setup.wallet_handle, &setup.verkey, "").unwrap(); + + let metadata = crypto::get_key_metadata(setup.wallet_handle, &setup.verkey).unwrap(); + assert_eq!("", metadata); + } + + #[test] + fn indy_get_key_metadata_works_for_invalid_handle() { + let setup = Setup::did(); + + crypto::set_key_metadata(setup.wallet_handle, &setup.verkey, METADATA).unwrap(); + + let res = crypto::get_key_metadata(INVALID_WALLET_HANDLE, &setup.verkey); + assert_code!(ErrorCode::WalletInvalidHandle, res); + } + } + + mod crypto_sign { + use super::*; + + #[test] + fn indy_crypto_sign_works_for_invalid_wallet_handle() { + let setup = Setup::did(); + let res = crypto::sign(INVALID_WALLET_HANDLE, &setup.verkey, MESSAGE.as_bytes()); + assert_code!(ErrorCode::WalletInvalidHandle, res); + } + } + + mod crypto_verify { + use super::*; + + #[test] + fn indy_crypto_verify_works_for_verkey_with_correct_crypto_type() { + let verkey = VERKEY_MY1.to_owned() + ":ed25519"; + let valid = crypto::verify(&verkey, MESSAGE.as_bytes(), SIGNATURE).unwrap(); + assert!(valid); + } + + #[test] + fn indy_crypto_verify_works_for_verkey_with_invalid_crypto_type() { + let verkey = VERKEY_MY1.to_owned() + ":unknown_crypto"; + let res = crypto::verify(&verkey, MESSAGE.as_bytes(), SIGNATURE); + assert_code!(ErrorCode::UnknownCryptoTypeError, res); + } + } + + mod auth_crypt { + use super::*; + + #[test] + fn indy_crypto_auth_crypt_works_for_created_did_as_cid() { + let setup = Setup::wallet(); + let (_, verkey) = did::create_my_did(setup.wallet_handle, &json!({ "seed": MY1_SEED, "cid": true }).to_string()).unwrap(); + crypto::auth_crypt(setup.wallet_handle, &verkey, VERKEY_MY2, MESSAGE.as_bytes()).unwrap(); + } + + #[test] + fn indy_crypto_auth_crypt_works_for_invalid_wallet_handle() { + let setup = Setup::did(); + let res = crypto::auth_crypt(INVALID_WALLET_HANDLE, &setup.verkey, VERKEY, MESSAGE.as_bytes()); + assert_code!(ErrorCode::WalletInvalidHandle, res); + } + + #[test] + fn indy_crypto_auth_crypt_works_for_invalid_recipient_vk() { + let setup = Setup::did(); + let res = crypto::auth_crypt(setup.wallet_handle, &setup.verkey, INVALID_BASE58_VERKEY, MESSAGE.as_bytes()); + assert_code!(ErrorCode::CommonInvalidStructure, res); + } + } + + mod auth_decrypt { + use super::*; + + #[test] + fn indy_crypto_auth_decrypt_works_for_invalid_msg() { + let sender_setup = Setup::key(); + let recipient_setup = Setup::did(); + + did::store_their_did_from_parts(sender_setup.wallet_handle, &recipient_setup.did, &recipient_setup.verkey).unwrap(); + + let encrypted_msg = format!(r#"{{"nonce":"Th7MpTaRZVRYnPiabds81Y12","sender":"{:?}","msg":"{:?}"}}"#, VERKEY, ENCRYPTED_MESSAGE.to_vec()); + + let res = crypto::auth_decrypt(recipient_setup.wallet_handle, &recipient_setup.verkey, &encrypted_msg.as_bytes()); + assert_code!(ErrorCode::CommonInvalidStructure, res); + } + + #[test] + fn indy_crypto_auth_decrypt_works_invalid_handle() { + let sender_setup = Setup::key(); + let recipient_setup = Setup::key(); + + let encrypted_msg = crypto::auth_crypt(sender_setup.wallet_handle, &sender_setup.verkey, &recipient_setup.verkey, MESSAGE.as_bytes()).unwrap(); + + let res = crypto::auth_decrypt(INVALID_WALLET_HANDLE, &recipient_setup.verkey, &encrypted_msg); + assert_code!(ErrorCode::WalletInvalidHandle, res); + } + } + + mod anon_crypt { + use super::*; + + #[test] + fn indy_anon_crypt_works_for_invalid_their_vk() { + Setup::empty(); + + let res = crypto::anon_crypt(INVALID_VERKEY_LENGTH, &MESSAGE.as_bytes()); + assert_code!(ErrorCode::CommonInvalidStructure, res); + + let res = crypto::anon_crypt(INVALID_BASE58_VERKEY, &MESSAGE.as_bytes()); + assert_code!(ErrorCode::CommonInvalidStructure, res); + } + } + + mod anon_decrypt { + use super::*; + + #[test] + fn indy_crypto_anon_decrypt_works_for_invalid_msg() { + let setup = Setup::key(); + + let res = crypto::anon_decrypt(setup.wallet_handle, &setup.verkey, &"unencrypted message".as_bytes()); + assert_code!(ErrorCode::CommonInvalidStructure, res); + } + + #[test] + fn indy_crypto_anon_decrypt_works_invalid_handle() { + let setup = Setup::key(); + + let encrypted_msg = crypto::anon_crypt(&setup.verkey, MESSAGE.as_bytes()).unwrap(); + + let res = crypto::anon_decrypt(INVALID_WALLET_HANDLE, &setup.verkey, &encrypted_msg); + assert_code!(ErrorCode::WalletInvalidHandle, res); + } + } + + mod pack_message_authcrypt { + use super::*; + + #[test] + fn indy_pack_message_authcrypt_fails_empty_message() { + let setup = Setup::key(); + let rec_key_vec = vec![VERKEY_MY1, VERKEY_MY2, VERKEY_TRUSTEE]; + let receiver_keys = serde_json::to_string(&rec_key_vec).unwrap(); + let message = "".as_bytes(); + let res = crypto::pack_message(setup.wallet_handle, message, &receiver_keys, Some(&setup.verkey)); + assert_code!(ErrorCode::CommonInvalidParam3, res); + } + + #[test] + fn indy_pack_message_authcrypt_fails_no_receivers() { + let setup = Setup::key(); + let receiver_keys = "[]"; + let message = "Hello World".as_bytes(); + let res = crypto::pack_message(setup.wallet_handle, message, &receiver_keys, Some(&setup.verkey)); + assert_code!(ErrorCode::CommonInvalidParam4, res); + } + + #[test] + fn indy_pack_message_authcrypt_fails_bad_wallet_handle() { + let setup = Setup::key(); + let rec_key_vec = vec![VERKEY_MY1, VERKEY_MY2, VERKEY_TRUSTEE]; + let receiver_keys = serde_json::to_string(&rec_key_vec).unwrap(); + let message = "Hello World".as_bytes(); + let res = crypto::pack_message(INVALID_WALLET_HANDLE, message, &receiver_keys, Some(&setup.verkey)); + assert_code!(ErrorCode::WalletInvalidHandle, res); + } + + #[test] + fn indy_pack_message_authcrypt_fails_invalid_verkey() { + let setup = Setup::wallet(); + let rec_key_vec = vec![VERKEY_MY1, VERKEY_MY2, VERKEY_TRUSTEE]; + let receiver_keys = serde_json::to_string(&rec_key_vec).unwrap(); + let message = "Hello World".as_bytes(); + let res = crypto::pack_message(setup.wallet_handle, message, &receiver_keys, Some(INVALID_BASE58_VERKEY)); + assert_code!(ErrorCode::CommonInvalidStructure, res); + } + } + + mod pack_message_anoncrypt { + use super::*; + + #[test] + fn indy_pack_message_anoncrypt_fails_empty_message() { + let setup = Setup::wallet(); + let rec_key_vec = vec![VERKEY_MY1, VERKEY_MY2, VERKEY_TRUSTEE]; + let receiver_keys = serde_json::to_string(&rec_key_vec).unwrap(); + let message = "".as_bytes(); + let res = crypto::pack_message(setup.wallet_handle, message, &receiver_keys, None); + assert_code!(ErrorCode::CommonInvalidParam3, res); + } + + #[test] + fn indy_pack_message_anoncrypt_fails_no_receivers() { + let setup = Setup::wallet(); + let receiver_keys = "[]"; + let message = "Hello World".as_bytes(); + let res = crypto::pack_message(setup.wallet_handle, message, &receiver_keys, None); + assert_code!(ErrorCode::CommonInvalidParam4, res); + } + + #[test] + fn indy_pack_message_anoncrypt_passes_bad_wallet_handle() { + let rec_key_vec = vec![VERKEY_MY1, VERKEY_MY2, VERKEY_TRUSTEE]; + let receiver_keys = serde_json::to_string(&rec_key_vec).unwrap(); + let message = "Hello World".as_bytes(); + //The wallet_handle and sender aren't used in this case, so any wallet_handle whether inited or not will work + let res = crypto::pack_message(INVALID_WALLET_HANDLE, message, &receiver_keys, None); + assert!(res.is_ok()); + } + } +} + +#[cfg(not(feature = "only_high_cases"))] mod load { extern crate rand; @@ -579,6 +627,8 @@ mod load { use std::thread; use std::time::{Duration, SystemTime}; + use utils::{wallet, did}; + const AGENT_CNT: usize = 10; const DATA_SZ: usize = 10 * 1024; const OPERATIONS_CNT: usize = 10; diff --git a/libindy/tests/did.rs b/libindy/tests/did.rs index afc064a236..5665b59678 100644 --- a/libindy/tests/did.rs +++ b/libindy/tests/did.rs @@ -83,22 +83,6 @@ mod high_cases { let res = did::key_for_did(setup.pool_handle, setup.wallet_handle, DID); assert_code!(ErrorCode::WalletItemNotFound, res); } - - #[test] - fn indy_key_for_did_works_for_invalid_pool_handle() { - let setup = Setup::wallet(); - - let res = did::key_for_did(INVALID_POOL_HANDLE, setup.wallet_handle, DID_TRUSTEE); - assert_code!(ErrorCode::PoolLedgerInvalidPoolHandle, res); - } - - #[test] - fn indy_key_for_did_works_for_invalid_wallet_handle() { - Setup::empty(); - - let res = did::key_for_did(-1, INVALID_WALLET_HANDLE, DID); - assert_code!(ErrorCode::WalletInvalidHandle, res); - } } mod key_for_local_did { @@ -129,14 +113,6 @@ mod high_cases { let res = did::key_for_local_did(setup.wallet_handle, DID); assert_code!(ErrorCode::WalletItemNotFound, res); } - - #[test] - fn indy_key_for_local_did_works_for_invalid_wallet_handle() { - Setup::empty(); - - let res = did::key_for_local_did(INVALID_WALLET_HANDLE, DID_TRUSTEE); - assert_code!(ErrorCode::WalletInvalidHandle, res); - } } mod set_endpoint_for_did { @@ -147,49 +123,6 @@ mod high_cases { let setup = Setup::wallet(); did::set_endpoint_for_did(setup.wallet_handle, DID, ENDPOINT, VERKEY).unwrap(); } - - #[test] - fn indy_set_endpoint_for_did_works_for_replace() { - let setup = Setup::wallet_and_pool(); - - did::set_endpoint_for_did(setup.wallet_handle, DID, ENDPOINT, VERKEY).unwrap(); - let (endpoint, key) = did::get_endpoint_for_did(setup.wallet_handle, setup.pool_handle, DID).unwrap(); - assert_eq!(ENDPOINT, endpoint); - assert_eq!(VERKEY, key.unwrap()); - - let new_endpoint = "10.10.10.1:9710"; - did::set_endpoint_for_did(setup.wallet_handle, DID, new_endpoint, VERKEY_MY2).unwrap(); - let (updated_endpoint, updated_key) = did::get_endpoint_for_did(setup.wallet_handle, setup.pool_handle, DID).unwrap(); - assert_eq!(new_endpoint, updated_endpoint); - assert_eq!(VERKEY_MY2, updated_key.unwrap()); - } - - #[test] - fn indy_set_endpoint_for_did_works_for_invalid_did() { - let setup = Setup::wallet(); - - let res = did::set_endpoint_for_did(setup.wallet_handle, INVALID_BASE58_DID, ENDPOINT, VERKEY); - assert_code!(ErrorCode::CommonInvalidStructure, res); - } - - #[test] - fn indy_set_endpoint_for_did_works_for_invalid_transport_key() { - let setup = Setup::wallet(); - - let res = did::set_endpoint_for_did(setup.wallet_handle, DID, ENDPOINT, INVALID_BASE58_VERKEY); - assert_code!(ErrorCode::CommonInvalidStructure, res); - - let res = did::set_endpoint_for_did(setup.wallet_handle, DID, ENDPOINT, INVALID_VERKEY_LENGTH); - assert_code!(ErrorCode::CommonInvalidStructure, res); - } - - #[test] - fn indy_set_endpoint_for_did_works_for_invalid_handle() { - Setup::empty(); - - let res = did::set_endpoint_for_did(INVALID_WALLET_HANDLE, DID, ENDPOINT, VERKEY); - assert_code!(ErrorCode::WalletInvalidHandle, res); - } } mod get_endpoint_for_did { @@ -344,15 +277,6 @@ mod high_cases { assert_eq!(METADATA.to_string(), metadata); } - #[test] - fn indy_get_did_metadata_works_for_empty_string() { - let setup = Setup::did(); - - did::set_did_metadata(setup.wallet_handle, &setup.did, "").unwrap(); - let metadata = did::get_did_metadata(setup.wallet_handle, &setup.did).unwrap(); - assert_eq!("", metadata); - } - #[test] fn indy_get_did_metadata_works_for_no_metadata() { let setup = Setup::did(); @@ -368,14 +292,6 @@ mod high_cases { let res = did::get_did_metadata(setup.wallet_handle, DID); assert_code!(ErrorCode::WalletItemNotFound, res); } - - #[test] - fn indy_get_did_metadata_works_for_invalid_handle() { - Setup::empty(); - - let res = did::get_did_metadata(INVALID_WALLET_HANDLE, DID); - assert_code!(ErrorCode::WalletInvalidHandle, res); - } } mod get_my_did_metadata { @@ -445,39 +361,6 @@ mod high_cases { assert_eq!(my_verkey, "A16wi1xHBu5KT4SqNhZXrKZfoQbXJCbDozgSTJhUgu9x"); } - #[test] - fn indy_create_my_did_works_as_cid() { - let setup = Setup::wallet(); - - let (my_did, my_verkey) = did::create_my_did(setup.wallet_handle, r#"{"seed":"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa","cid":true}"#).unwrap(); - assert_eq!(my_did, VERKEY); - assert_eq!(my_verkey, VERKEY); - } - - #[test] - fn indy_create_my_did_works_with_passed_did() { - let setup = Setup::wallet(); - - let (my_did, my_verkey) = did::create_my_did(setup.wallet_handle, &format!(r#"{{"did":"{}","seed":"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"}}"#, DID)).unwrap(); - assert_eq!(my_did, DID); - assert_eq!(my_verkey, VERKEY); - } - - #[test] - fn indy_create_my_did_works_for_exists_crypto_type() { - let setup = Setup::wallet(); - - did::create_my_did(setup.wallet_handle, r#"{"crypto_type":"ed25519"}"#).unwrap(); - } - - #[test] - fn indy_create_my_did_works_for_invalid_wallet_handle() { - Setup::empty(); - - let res = did::create_my_did(INVALID_WALLET_HANDLE, "{}"); - assert_code!(ErrorCode::WalletInvalidHandle, res); - } - #[test] fn indy_create_my_did_works_for_duplicate() { let setup = Setup::wallet(); @@ -505,14 +388,6 @@ mod high_cases { assert_ne!(new_verkey, setup.verkey); } - #[test] - fn indy_replace_keys_start_works_for_invalid_wallet_handle() { - Setup::empty(); - - let res = did::replace_keys_start(INVALID_WALLET_HANDLE, DID, "{}"); - assert_code!(ErrorCode::WalletInvalidHandle, res); - } - #[test] fn indy_replace_keys_start_works_for_seed() { let setup = Setup::did(); @@ -552,14 +427,6 @@ mod high_cases { let res = did::replace_keys_apply(setup.wallet_handle, DID); assert_code!(ErrorCode::WalletItemNotFound, res); } - - #[test] - fn indy_replace_keys_apply_works_for_invalid_wallet_handle() { - Setup::empty(); - - let res = did::replace_keys_apply(INVALID_WALLET_HANDLE, DID); - assert_code!(ErrorCode::WalletInvalidHandle, res); - } } mod store_their_did { @@ -581,6 +448,223 @@ mod high_cases { did::store_their_did(setup.wallet_handle, &identity_json).unwrap(); } + #[test] + fn indy_store_their_did_works_twice() { + let setup = Setup::wallet(); + + let identity_json = json!({"did": DID}).to_string(); + did::store_their_did(setup.wallet_handle, &identity_json).unwrap(); + + let res = did::store_their_did(setup.wallet_handle, &identity_json); + assert_code!(ErrorCode::WalletItemAlreadyExists, res); + } + } + + mod replace_keys { + use super::*; + + #[test] + fn indy_replace_keys_demo() { + // 1. Create and open pool + // 2. Create and open wallet + // 3. Generate did from Trustee seed + // 4. Generate my did + // 5. Send Nym request to Ledger + let setup = Setup::new_identity(); + + // 6. Start replacing of keys + let new_verkey = did::replace_keys_start(setup.wallet_handle, &setup.did, "{}").unwrap(); + + // 7. Send Nym request to Ledger with new verkey + let nym_request = ledger::build_nym_request(&setup.did, &setup.did, Some(&new_verkey), None, None).unwrap(); + ledger::sign_and_submit_request(setup.pool_handle, setup.wallet_handle, &setup.did, &nym_request).unwrap(); + + // 8. Send Schema request before apply replacing of keys + let schema_request = ledger::build_schema_request(&setup.did, SCHEMA_DATA).unwrap(); + let response = ledger::sign_and_submit_request(setup.pool_handle, setup.wallet_handle, &setup.did, &schema_request).unwrap(); + pool::check_response_type(&response, ResponseType::REQNACK); + + // 9. Apply replacing of keys + did::replace_keys_apply(setup.wallet_handle, &setup.did).unwrap(); + + // 10. Send Schema request + ledger::sign_and_submit_request(setup.pool_handle, setup.wallet_handle, &setup.did, &schema_request).unwrap(); + } + } + + mod abbreviate_verkey { + use super::*; + + #[test] + fn indy_abbreviate_verkey_works_for_abbr_key() { + let setup = Setup::did(); + + let abbr_verkey = did::abbreviate_verkey(&setup.did, &setup.verkey).unwrap(); + assert_ne!(setup.verkey, abbr_verkey); + } + + #[test] + fn indy_abbreviate_verkey_works_for_not_abbr_key() { + let setup = Setup::wallet(); + + let (did, verkey) = did::create_my_did(setup.wallet_handle, &format!(r#"{{"did":{:?}}}"#, DID_TRUSTEE)).unwrap(); + + let full_verkey = did::abbreviate_verkey(&did, &verkey).unwrap(); + + assert_eq!(verkey, full_verkey); + } + } +} + +#[cfg(not(feature = "only_high_cases"))] +mod medium_cases { + use super::*; + + mod key_for_did { + use super::*; + + #[test] + fn indy_key_for_did_works_for_invalid_pool_handle() { + let setup = Setup::wallet(); + + let res = did::key_for_did(INVALID_POOL_HANDLE, setup.wallet_handle, DID_TRUSTEE); + assert_code!(ErrorCode::PoolLedgerInvalidPoolHandle, res); + } + + #[test] + fn indy_key_for_did_works_for_invalid_wallet_handle() { + Setup::empty(); + + let res = did::key_for_did(-1, INVALID_WALLET_HANDLE, DID); + assert_code!(ErrorCode::WalletInvalidHandle, res); + } + } + + mod key_for_local_did { + use super::*; + + #[test] + fn indy_key_for_local_did_works_for_invalid_wallet_handle() { + Setup::empty(); + + let res = did::key_for_local_did(INVALID_WALLET_HANDLE, DID_TRUSTEE); + assert_code!(ErrorCode::WalletInvalidHandle, res); + } + } + + mod set_endpoint_for_did { + use super::*; + #[test] + fn indy_set_endpoint_for_did_works_for_replace() { + let setup = Setup::wallet_and_pool(); + + did::set_endpoint_for_did(setup.wallet_handle, DID, ENDPOINT, VERKEY).unwrap(); + let (endpoint, key) = did::get_endpoint_for_did(setup.wallet_handle, setup.pool_handle, DID).unwrap(); + assert_eq!(ENDPOINT, endpoint); + assert_eq!(VERKEY, key.unwrap()); + + let new_endpoint = "10.10.10.1:9710"; + did::set_endpoint_for_did(setup.wallet_handle, DID, new_endpoint, VERKEY_MY2).unwrap(); + let (updated_endpoint, updated_key) = did::get_endpoint_for_did(setup.wallet_handle, setup.pool_handle, DID).unwrap(); + assert_eq!(new_endpoint, updated_endpoint); + assert_eq!(VERKEY_MY2, updated_key.unwrap()); + } + } + + mod get_did_metadata { + use super::*; + + #[test] + fn indy_get_did_metadata_works_for_empty_string() { + let setup = Setup::did(); + + did::set_did_metadata(setup.wallet_handle, &setup.did, "").unwrap(); + let metadata = did::get_did_metadata(setup.wallet_handle, &setup.did).unwrap(); + assert_eq!("", metadata); + } + + #[test] + fn indy_get_did_metadata_works_for_invalid_handle() { + Setup::empty(); + + let res = did::get_did_metadata(INVALID_WALLET_HANDLE, DID); + assert_code!(ErrorCode::WalletInvalidHandle, res); + } + } + + mod create_my_did { + use super::*; + + #[test] + fn indy_create_my_did_works_as_cid() { + let setup = Setup::wallet(); + + let (my_did, my_verkey) = did::create_my_did(setup.wallet_handle, r#"{"seed":"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa","cid":true}"#).unwrap(); + assert_eq!(my_did, VERKEY); + assert_eq!(my_verkey, VERKEY); + } + + #[test] + fn indy_create_my_did_works_with_passed_did() { + let setup = Setup::wallet(); + + let (my_did, my_verkey) = did::create_my_did(setup.wallet_handle, &format!(r#"{{"did":"{}","seed":"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"}}"#, DID)).unwrap(); + assert_eq!(my_did, DID); + assert_eq!(my_verkey, VERKEY); + } + + #[test] + fn indy_create_my_did_works_for_exists_crypto_type() { + let setup = Setup::wallet(); + + did::create_my_did(setup.wallet_handle, r#"{"crypto_type":"ed25519"}"#).unwrap(); + } + + #[test] + fn indy_create_my_did_works_for_invalid_wallet_handle() { + Setup::empty(); + + let res = did::create_my_did(INVALID_WALLET_HANDLE, "{}"); + assert_code!(ErrorCode::WalletInvalidHandle, res); + } + } + + mod replace_keys_start { + use super::*; + + #[test] + fn indy_replace_keys_start_works_for_invalid_wallet_handle() { + Setup::empty(); + + let res = did::replace_keys_start(INVALID_WALLET_HANDLE, DID, "{}"); + assert_code!(ErrorCode::WalletInvalidHandle, res); + } + + #[test] + fn indy_replace_keys_start_works_for_seed() { + let setup = Setup::did(); + + let new_verkey = did::replace_keys_start(setup.wallet_handle, &setup.did, r#"{"seed":"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"}"#).unwrap(); + assert_eq!(new_verkey, VERKEY); + assert_ne!(setup.verkey, new_verkey); + } + } + + mod replace_keys_apply { + use super::*; + + #[test] + fn indy_replace_keys_apply_works_for_invalid_wallet_handle() { + Setup::empty(); + + let res = did::replace_keys_apply(INVALID_WALLET_HANDLE, DID); + assert_code!(ErrorCode::WalletInvalidHandle, res); + } + } + + mod store_their_did { + use super::*; + #[test] fn indy_store_their_did_works_for_verkey_with_crypto_type() { let setup = Setup::wallet(); @@ -640,7 +724,6 @@ mod high_cases { assert_code!(ErrorCode::CommonInvalidStructure, res); } - #[test] fn indy_store_their_did_works_for_verkey_with_invalid_crypto_type() { let setup = Setup::wallet(); @@ -650,17 +733,6 @@ mod high_cases { assert_code!(ErrorCode::UnknownCryptoTypeError, res); } - #[test] - fn indy_store_their_did_works_twice() { - let setup = Setup::wallet(); - - let identity_json = json!({"did": DID}).to_string(); - did::store_their_did(setup.wallet_handle, &identity_json).unwrap(); - - let res = did::store_their_did(setup.wallet_handle, &identity_json); - assert_code!(ErrorCode::WalletItemAlreadyExists, res); - } - #[test] fn indy_store_their_did_works_for_is_802() { let setup = Setup::wallet(); @@ -686,34 +758,6 @@ mod high_cases { mod replace_keys { use super::*; - #[test] - fn indy_replace_keys_demo() { - // 1. Create and open pool - // 2. Create and open wallet - // 3. Generate did from Trustee seed - // 4. Generate my did - // 5. Send Nym request to Ledger - let setup = Setup::new_identity(); - - // 6. Start replacing of keys - let new_verkey = did::replace_keys_start(setup.wallet_handle, &setup.did, "{}").unwrap(); - - // 7. Send Nym request to Ledger with new verkey - let nym_request = ledger::build_nym_request(&setup.did, &setup.did, Some(&new_verkey), None, None).unwrap(); - ledger::sign_and_submit_request(setup.pool_handle, setup.wallet_handle, &setup.did, &nym_request).unwrap(); - - // 8. Send Schema request before apply replacing of keys - let schema_request = ledger::build_schema_request(&setup.did, SCHEMA_DATA).unwrap(); - let response = ledger::sign_and_submit_request(setup.pool_handle, setup.wallet_handle, &setup.did, &schema_request).unwrap(); - pool::check_response_type(&response, ResponseType::REQNACK); - - // 9. Apply replacing of keys - did::replace_keys_apply(setup.wallet_handle, &setup.did).unwrap(); - - // 10. Send Schema request - ledger::sign_and_submit_request(setup.pool_handle, setup.wallet_handle, &setup.did, &schema_request).unwrap(); - } - #[test] fn indy_replace_keys_without_nym_transaction() { let setup = Setup::wallet_and_pool(); @@ -729,28 +773,10 @@ mod high_cases { } } + mod abbreviate_verkey { use super::*; - #[test] - fn indy_abbreviate_verkey_works_for_abbr_key() { - let setup = Setup::did(); - - let abbr_verkey = did::abbreviate_verkey(&setup.did, &setup.verkey).unwrap(); - assert_ne!(setup.verkey, abbr_verkey); - } - - #[test] - fn indy_abbreviate_verkey_works_for_not_abbr_key() { - let setup = Setup::wallet(); - - let (did, verkey) = did::create_my_did(setup.wallet_handle, &format!(r#"{{"did":{:?}}}"#, DID_TRUSTEE)).unwrap(); - - let full_verkey = did::abbreviate_verkey(&did, &verkey).unwrap(); - - assert_eq!(verkey, full_verkey); - } - #[test] fn indy_abbreviate_verkey_works_for_invalid_did() { let res = did::abbreviate_verkey(INVALID_BASE58_DID, VERKEY_TRUSTEE); @@ -763,4 +789,5 @@ mod high_cases { assert_code!(ErrorCode::CommonInvalidStructure, res); } } -} + +} \ No newline at end of file diff --git a/libindy/tests/interaction.rs b/libindy/tests/interaction.rs index fcd4033e3f..40739bd782 100644 --- a/libindy/tests/interaction.rs +++ b/libindy/tests/interaction.rs @@ -31,6 +31,7 @@ mod utils; use utils::{wallet, anoncreds, blob_storage, pool, ledger, did}; use utils::anoncreds::{COMMON_MASTER_SECRET, CREDENTIAL1_ID}; #[cfg(any(feature = "force_full_interaction_tests", not(target_os = "android")))] +#[cfg(not(feature="only_high_cases"))] use utils::anoncreds::{CREDENTIAL2_ID, CREDENTIAL3_ID}; use utils::constants::*; @@ -53,38 +54,38 @@ use serde_json::Value; use core::borrow::Borrow; -struct Pool{ - pool_handle : i32 +struct Pool { + pool_handle: i32 } -struct Issuer{ +struct Issuer { issuer_wallet_handle: i32, - issuer_did : String, + issuer_did: String, - schema_id : String, - cred_def_id : String, - rev_reg_id : String, + schema_id: String, + cred_def_id: String, + rev_reg_id: String, issuance_type: String, tails_writer_config: String } -struct Prover{ +struct Prover { - wallet_handle : i32, + wallet_handle: i32, did: String, - verkey : String, - master_secret_id : String, - cred_def_id : Option, - cred_req_metadata_json : Option + verkey: String, + master_secret_id: String, + cred_def_id: Option, + cred_req_metadata_json: Option } -struct Verifier{ - proof_request : String +struct Verifier { + proof_request: String } @@ -92,7 +93,7 @@ impl Pool { pub fn new(pool_name: &str) -> Pool { - Pool{ pool_handle : pool::create_and_open_pool_ledger(pool_name).unwrap() } + Pool { pool_handle: pool::create_and_open_pool_ledger(pool_name).unwrap() } } pub fn close(self) { @@ -100,7 +101,7 @@ impl Pool { } - pub fn submit_nym(&self, issuer_did: &str, issuer_wallet_handle: i32, prover_did: &str, prover_verkey : Option<&str>) + pub fn submit_nym(&self, issuer_did: &str, issuer_wallet_handle: i32, prover_did: &str, prover_verkey: Option<&str>) { let nym_request = ledger::build_nym_request(issuer_did, prover_did, prover_verkey, None, None).unwrap(); ledger::sign_and_submit_request(self.pool_handle, issuer_wallet_handle, &issuer_did, &nym_request).unwrap(); @@ -111,7 +112,7 @@ impl Pool { ledger::sign_and_submit_request(self.pool_handle, issuer_wallet_handle, issuer_did, &schema_request).unwrap() } - pub fn get_schema(&self, did: Option<&str>, schema_id: &str) -> (String, String){ + pub fn get_schema(&self, did: Option<&str>, schema_id: &str) -> (String, String) { let get_schema_request = ledger::build_get_schema_request(did, schema_id).unwrap(); let get_schema_response = ledger::submit_request(self.pool_handle, &get_schema_request).unwrap(); ledger::parse_get_schema_response(&get_schema_response).unwrap() @@ -124,31 +125,31 @@ impl Pool { } - pub fn get_cred_def(&self, did : Option<&str>, cred_def_id : &str ) -> (String, String) /* (cred_def_id, cred_def_json) */{ + pub fn get_cred_def(&self, did: Option<&str>, cred_def_id: &str) -> (String, String) /* (cred_def_id, cred_def_json) */ { let get_cred_def_request = ledger::build_get_cred_def_request(did, cred_def_id).unwrap(); let get_cred_def_response = ledger::submit_request(self.pool_handle, &get_cred_def_request).unwrap(); ledger::parse_get_cred_def_response(&get_cred_def_response).unwrap() } - pub fn submit_revoc_reg_def(&self, issuer_did: &str, issuer_wallet_handle: i32, rev_reg_def_json : &str) -> String { + pub fn submit_revoc_reg_def(&self, issuer_did: &str, issuer_wallet_handle: i32, rev_reg_def_json: &str) -> String { let rev_reg_def_request = ledger::build_revoc_reg_def_request(issuer_did, rev_reg_def_json).unwrap(); ledger::sign_and_submit_request(self.pool_handle, issuer_wallet_handle, issuer_did, &rev_reg_def_request).unwrap() } - pub fn get_revoc_reg_def(&self, did: Option<&str>, revoc_reg_def_id : &str) -> (String, String) /* revoc_reg_def_id, revo_reg_def_json */ { + pub fn get_revoc_reg_def(&self, did: Option<&str>, revoc_reg_def_id: &str) -> (String, String) /* revoc_reg_def_id, revo_reg_def_json */ { let get_rev_reg_def_request = ledger::build_get_revoc_reg_def_request(did, &revoc_reg_def_id).unwrap(); let get_rev_reg_def_response = ledger::submit_request(self.pool_handle, &get_rev_reg_def_request).unwrap(); ledger::parse_get_revoc_reg_def_response(&get_rev_reg_def_response).unwrap() } - pub fn submit_revoc_reg_entry(&self, issuer_did: &str, issuer_wallet_handle: i32, rev_reg_id : &str, rev_reg_entry_json: &str) -> String{ + pub fn submit_revoc_reg_entry(&self, issuer_did: &str, issuer_wallet_handle: i32, rev_reg_id: &str, rev_reg_entry_json: &str) -> String { let rev_reg_entry_request = ledger::build_revoc_reg_entry_request(issuer_did, rev_reg_id, REVOC_REG_TYPE, rev_reg_entry_json).unwrap(); ledger::sign_and_submit_request(self.pool_handle, issuer_wallet_handle, issuer_did, &rev_reg_entry_request).unwrap() } - pub fn get_revoc_reg_delta(&self, did: Option<&str>, revoc_reg_def_id : &str, from : Option, to : u64) -> (String,String, u64) /* rev_reg_id, revoc_reg_delta_json, timestamp */ { + pub fn get_revoc_reg_delta(&self, did: Option<&str>, revoc_reg_def_id: &str, from: Option, to: u64) -> (String, String, u64) /* rev_reg_id, revoc_reg_delta_json, timestamp */ { let get_rev_reg_delta_request = ledger::build_get_revoc_reg_delta_request(did, revoc_reg_def_id, from, to).unwrap(); let get_rev_reg_delta_response = ledger::submit_request(self.pool_handle, &get_rev_reg_delta_request).unwrap(); ledger::parse_get_revoc_reg_delta_response(&get_rev_reg_delta_response).unwrap() @@ -161,7 +162,7 @@ impl Pool { impl Issuer { - pub fn new(pool: &Pool) -> Issuer{ + pub fn new(pool: &Pool) -> Issuer { let (wallet_handle, _wallet_config) = wallet::create_and_open_default_wallet(format!("wallet_for_pool_{}", pool.pool_handle).borrow()).unwrap(); Issuer { @@ -172,20 +173,20 @@ impl Issuer { issuer_did: did::create_store_and_publish_my_did_from_trustee(wallet_handle, pool.pool_handle).unwrap().0, schema_id: String::new(), - rev_reg_id : String::new(), - cred_def_id : String::new(), + rev_reg_id: String::new(), + cred_def_id: String::new(), - issuance_type : String::new(), - tails_writer_config : anoncreds::tails_writer_config() + issuance_type: String::new(), + tails_writer_config: anoncreds::tails_writer_config() } } // creates schema , credential definition and revocation registry - pub fn create_initial_ledger_state(& mut self, pool : &Pool, revoc_registry_config : &str) + pub fn create_initial_ledger_state(&mut self, pool: &Pool, revoc_registry_config: &str) { - let revoc_reg_config_value : Value = serde_json::from_str(revoc_registry_config).unwrap(); + let revoc_reg_config_value: Value = serde_json::from_str(revoc_registry_config).unwrap(); self.issuance_type = String::from(revoc_reg_config_value.as_object().unwrap().get("issuance_type").unwrap().as_str().unwrap()); // Issuer creates Schema @@ -197,12 +198,12 @@ impl Issuer { // !!IMPORTANT!! // It is important Post and Get Schema from Ledger and parse it to get the correct Schema JSON and correspondent it seq_no in Ledger // After that we can create CredentialDefinition for received Schema(not for result of indy_issuer_create_schema) - let _schema_response = pool.submit_schema(&self.issuer_did, self.issuer_wallet_handle,&schema_json); + let _schema_response = pool.submit_schema(&self.issuer_did, self.issuer_wallet_handle, &schema_json); ::std::thread::sleep(::std::time::Duration::from_secs(1)); // Issuer gets Schema from Ledger - let (_ , schema_json) = pool.get_schema(Some(&self.issuer_did),&schema_id); + let (_, schema_json) = pool.get_schema(Some(&self.issuer_did), &schema_id); self.schema_id = schema_id; @@ -215,7 +216,7 @@ impl Issuer { Some(&anoncreds::revocation_cred_def_config())).unwrap(); // Issuer post CredentialDefinition to Ledger - pool.submit_cred_def(&self.issuer_did,self.issuer_wallet_handle,&cred_def_json); + pool.submit_cred_def(&self.issuer_did, self.issuer_wallet_handle, &cred_def_json); self.cred_def_id = cred_def_id; @@ -238,7 +239,7 @@ impl Issuer { self.rev_reg_id = rev_reg_id; // Issuer posts RevocationRegistryEntry to Ledger - pool.submit_revoc_reg_entry(&self.issuer_did,self.issuer_wallet_handle, &self.rev_reg_id, &rev_reg_entry_json); + pool.submit_revoc_reg_entry(&self.issuer_did, self.issuer_wallet_handle, &self.rev_reg_id, &rev_reg_entry_json); } pub fn make_credential_offer(&self) -> String @@ -265,14 +266,14 @@ impl Issuer { // Issuer does not have to post rev_reg_delta to ledger in case of the strategy ISSUANCE_BY_DEFAULT - if &self.issuance_type == "ISSUANCE_ON_DEMAND" { + if &self.issuance_type == "ISSUANCE_ON_DEMAND" { pool.submit_revoc_reg_entry(&self.issuer_did, self.issuer_wallet_handle, &self.rev_reg_id, &revoc_reg_delta_json.clone().unwrap()); } (cred_json, cred_rev_id.unwrap(), revoc_reg_delta_json) } - pub fn revoke_credential(&self, pool : &Pool, cred_rev_id: &str) -> String + pub fn revoke_credential(&self, pool: &Pool, cred_rev_id: &str) -> String { // Issuer creates TailsReader @@ -282,7 +283,7 @@ impl Issuer { let rev_reg_delta_json = anoncreds::issuer_revoke_credential(self.issuer_wallet_handle, blob_storage_reader_handle, &self.rev_reg_id, &cred_rev_id).unwrap(); // Issuer post RevocationRegistryDelta to Ledger - pool.submit_revoc_reg_entry(&self.issuer_did,self.issuer_wallet_handle,&self.rev_reg_id,&rev_reg_delta_json); + pool.submit_revoc_reg_entry(&self.issuer_did, self.issuer_wallet_handle, &self.rev_reg_id, &rev_reg_delta_json); rev_reg_delta_json } @@ -296,7 +297,7 @@ impl Issuer { impl Prover { - pub fn new(master_secret_id : Option<&str>) -> Prover + pub fn new(master_secret_id: Option<&str>) -> Prover { // Prover creates wallet, gets wallet handle let (prover_wallet_handle, _prover_wallet_config) = wallet::create_and_open_default_wallet("interactions_prover").unwrap(); @@ -306,17 +307,18 @@ impl Prover let master_secret_id = master_secret_id.unwrap_or(COMMON_MASTER_SECRET); anoncreds::prover_create_master_secret(prover_wallet_handle, master_secret_id).unwrap(); - Prover{ wallet_handle: prover_wallet_handle, - did: prover_did.clone(), - verkey: prover_verkey.clone(), - master_secret_id : String::from(master_secret_id), - cred_def_id: None, - cred_req_metadata_json : None - } + Prover { + wallet_handle: prover_wallet_handle, + did: prover_did.clone(), + verkey: prover_verkey.clone(), + master_secret_id: String::from(master_secret_id), + cred_def_id: None, + cred_req_metadata_json: None + } } - pub fn make_credential_request(&mut self, pool: &Pool, cred_offer_json : &str ) -> String + pub fn make_credential_request(&mut self, pool: &Pool, cred_offer_json: &str) -> String { // Prover gets CredentialDefinition from Ledger let cred_offer: CredentialOffer = serde_json::from_str(&cred_offer_json).unwrap(); @@ -339,10 +341,10 @@ impl Prover let credential: Credential = serde_json::from_str(&cred_json).unwrap(); // Prover gets CredentialDefinition from Ledger - let (_ , cred_def_json) = pool.get_cred_def(Some(&self.did), &self.cred_def_id.clone().unwrap()); + let (_, cred_def_json) = pool.get_cred_def(Some(&self.did), &self.cred_def_id.clone().unwrap()); // Prover gets RevocationRegistryDefinition - let (_, revoc_reg_def_json) = pool.get_revoc_reg_def(None,&credential.rev_reg_id.unwrap()); + let (_, revoc_reg_def_json) = pool.get_revoc_reg_def(None, &credential.rev_reg_id.unwrap()); // Prover stores received Credential anoncreds::prover_store_credential(self.wallet_handle, @@ -353,20 +355,20 @@ impl Prover Some(&revoc_reg_def_json)).unwrap(); } - pub fn make_proof(&self, pool : &Pool, proof_request: &str, attr1_referent: &str, from: Option, to: u64 ) -> String + pub fn make_proof(&self, pool: &Pool, proof_request: &str, attr1_referent: &str, from: Option, to: u64) -> String { // Prover searches Credentials for Proof Request - let search_handle = anoncreds::prover_search_credentials_for_proof_req(self.wallet_handle, &proof_request, None).unwrap(); - let credentials_list = anoncreds::prover_fetch_next_credentials_for_proof_req(search_handle,attr1_referent,1).unwrap(); + let search_handle = anoncreds::prover_search_credentials_for_proof_req(self.wallet_handle, &proof_request, None).unwrap(); + let credentials_list = anoncreds::prover_fetch_next_credentials_for_proof_req(search_handle, attr1_referent, 1).unwrap(); - let credentials_list_value : Value = serde_json::from_str(&credentials_list).unwrap(); + let credentials_list_value: Value = serde_json::from_str(&credentials_list).unwrap(); // extract first result of the search as Value let credentials_first = &credentials_list_value.as_array().unwrap()[0]; // extract cred_info as Value from the result let cred_info_value = credentials_first.as_object().unwrap().get("cred_info").unwrap(); - let cred_info : CredentialInfo = serde_json::from_value(cred_info_value.clone()).unwrap(); + let cred_info: CredentialInfo = serde_json::from_value(cred_info_value.clone()).unwrap(); let _ = anoncreds::prover_close_credentials_search_for_proof_req(search_handle).unwrap(); @@ -381,13 +383,13 @@ impl Prover let (_, schema_json) = pool.get_schema(None, &schema_id); // Prover gets CredentialDefinition from Ledger - let (_ , cred_def_json) = pool.get_cred_def(Some(&self.did), &cred_def_id); + let (_, cred_def_json) = pool.get_cred_def(Some(&self.did), &cred_def_id); // Prover gets RevocationRegistryDefinition - let (_, revoc_reg_def_json) = pool.get_revoc_reg_def(None,&rev_reg_id); + let (_, revoc_reg_def_json) = pool.get_revoc_reg_def(None, &rev_reg_id); // Prover gets RevocationRegistryDelta from Ledger - let (_, revoc_reg_delta_json, timestamp) = pool.get_revoc_reg_delta(None,&rev_reg_id, from, to); + let (_, revoc_reg_delta_json, timestamp) = pool.get_revoc_reg_delta(None, &rev_reg_id, from, to); // Prover creates RevocationState @@ -399,13 +401,13 @@ impl Prover &cred_rev_id).unwrap(); - let proof_request_value : Value = serde_json::from_str(proof_request).unwrap(); - let requested_predicates = ! proof_request_value.as_object().unwrap().get("requested_predicates").unwrap().as_object().unwrap().is_empty(); + let proof_request_value: Value = serde_json::from_str(proof_request).unwrap(); + let requested_predicates = !proof_request_value.as_object().unwrap().get("requested_predicates").unwrap().as_object().unwrap().is_empty(); // Prover creates Proof let requested_credentials_json = if requested_predicates { - json!({ + json!({ "self_attested_attributes": json!({}), "requested_attributes": json!({ attr1_referent.clone(): json!({ "cred_id": cred_info.referent, "timestamp": timestamp, "revealed":true }) @@ -459,33 +461,33 @@ impl Prover -impl Verifier{ +impl Verifier { pub fn new(proof_request: &String) -> Verifier { - Verifier{ + Verifier { proof_request: proof_request.clone() } } - pub fn verify_revealed(&self, proof_json : &str, attr_name : &str, attr_value : &str) + pub fn verify_revealed(&self, proof_json: &str, attr_name: &str, attr_value: &str) { - let proof : Proof = serde_json::from_str(&proof_json).unwrap(); + let proof: Proof = serde_json::from_str(&proof_json).unwrap(); assert_eq!(attr_value, proof.requested_proof.revealed_attrs.get(attr_name).unwrap().raw) } - pub fn verify(&self, pool: &Pool, proof_json : &str) -> bool + pub fn verify(&self, pool: &Pool, proof_json: &str) -> bool { - let proof : Proof = serde_json::from_str(&proof_json).unwrap(); + let proof: Proof = serde_json::from_str(&proof_json).unwrap(); assert_eq!(1, proof.identifiers.len()); let identifier = proof.identifiers[0].clone(); // Verifier gets Schema from Ledger - let (schema_id, schema_json) = pool.get_schema(Some(DID_MY1), &identifier.schema_id ); + let (schema_id, schema_json) = pool.get_schema(Some(DID_MY1), &identifier.schema_id); // Verifier gets CredentialDefinition from Ledger let (cred_def_id, cred_def_json) = pool.get_cred_def(Some(DID_MY1), &identifier.cred_def_id); @@ -534,6 +536,7 @@ fn anoncreds_revocation_interaction_test_issuance_by_demand() { #[cfg(feature = "revocation_tests")] #[cfg(any(feature = "force_full_interaction_tests", not(target_os = "android")))] +#[cfg(not(feature="only_high_cases"))] #[test] fn anoncreds_revocation_interaction_test_issuance_by_default() { @@ -552,11 +555,11 @@ fn anoncreds_revocation_interaction_test_one_prover(pool_name: &str, revocation_ let mut prover = Prover::new(None); // Issuer publish Prover DID - pool.submit_nym(&issuer.issuer_did, issuer.issuer_wallet_handle, &prover.did,Some(&prover.verkey)); + pool.submit_nym(&issuer.issuer_did, issuer.issuer_wallet_handle, &prover.did, Some(&prover.verkey)); // ISSUER post to Ledger Schema, CredentialDefinition, RevocationRegistry - issuer.create_initial_ledger_state(&pool,revocation_registry_config); + issuer.create_initial_ledger_state(&pool, revocation_registry_config); /////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -566,10 +569,10 @@ fn anoncreds_revocation_interaction_test_one_prover(pool_name: &str, revocation_ let cred_offer_json = issuer.make_credential_offer(); // Prover makes credential request - let cred_req_json = prover.make_credential_request(&pool,&cred_offer_json); + let cred_req_json = prover.make_credential_request(&pool, &cred_offer_json); // Issuer issues credential - let (cred_json, cred_rev_id, _revoc_reg_delta_json) = issuer.issue_credential(&pool, &cred_offer_json, &cred_req_json, &anoncreds::gvt_credential_values_json() ); + let (cred_json, cred_rev_id, _revoc_reg_delta_json) = issuer.issue_credential(&pool, &cred_offer_json, &cred_req_json, &anoncreds::gvt_credential_values_json()); // Prover stores credentials prover.store_credentials(&pool, &cred_json, CREDENTIAL1_ID); @@ -607,14 +610,14 @@ fn anoncreds_revocation_interaction_test_one_prover(pool_name: &str, revocation_ // Verifier verifies revealed attribute - verifier.verify_revealed(&proof_json,"attr1_referent","Alex"); + verifier.verify_revealed(&proof_json, "attr1_referent", "Alex"); - let valid = verifier.verify(&pool,&proof_json); + let valid = verifier.verify(&pool, &proof_json); assert!(valid); ///////////////////////////////////////////////////////////////////////////////////////// // Issuer revokes cred_rev_id - let _rev_reg_delta_json = issuer.revoke_credential(&pool, &cred_rev_id ); + let _rev_reg_delta_json = issuer.revoke_credential(&pool, &cred_rev_id); // Verifying Prover Credential after Revocation thread::sleep(std::time::Duration::from_secs(1)); @@ -622,7 +625,7 @@ fn anoncreds_revocation_interaction_test_one_prover(pool_name: &str, revocation_ let from = to; let to = time::get_time().sec as u64; - let proof_json = prover.make_proof(&pool, &proof_request, "attr1_referent" , Some(from), to); + let proof_json = prover.make_proof(&pool, &proof_request, "attr1_referent", Some(from), to); let valid = verifier.verify(&pool, &proof_json); assert!(!valid); @@ -634,17 +637,17 @@ fn anoncreds_revocation_interaction_test_one_prover(pool_name: &str, revocation_ pool.close(); } - -fn multi_steps_create_revocation_credential(pool : &Pool, issuer: &Issuer, prover : &mut Prover, cred_values_json : &str , cred_id: &str) -> (String, Option) +#[cfg(not(feature="only_high_cases"))] +fn multi_steps_create_revocation_credential(pool: &Pool, issuer: &Issuer, prover: &mut Prover, cred_values_json: &str, cred_id: &str) -> (String, Option) { // Issuer creates Credential Offer let cred_offer_json = issuer.make_credential_offer(); // Prover makes credential request - let cred_req_json = prover.make_credential_request(&pool,&cred_offer_json); + let cred_req_json = prover.make_credential_request(&pool, &cred_offer_json); // Issuer issues credential - let (cred_json, cred_rev_id, revoc_reg_delta_json) = issuer.issue_credential(&pool, &cred_offer_json, &cred_req_json, cred_values_json ); + let (cred_json, cred_rev_id, revoc_reg_delta_json) = issuer.issue_credential(&pool, &cred_offer_json, &cred_req_json, cred_values_json); // Prover stores credentials prover.store_credentials(&pool, &cred_json, cred_id); @@ -655,6 +658,7 @@ fn multi_steps_create_revocation_credential(pool : &Pool, issuer: &Issuer, prove #[cfg(feature = "revocation_tests")] #[cfg(any(feature = "force_full_interaction_tests", not(target_os = "android")))] +#[cfg(not(feature="only_high_cases"))] #[test] fn anoncreds_revocation_interaction_test_issuance_by_demand_three_credentials_post_entry_three_times_proving_first() { Setup::empty(); @@ -669,26 +673,26 @@ fn anoncreds_revocation_interaction_test_issuance_by_demand_three_credentials_po // ISSUER post to Ledger Schema, CredentialDefinition, RevocationRegistry - issuer.create_initial_ledger_state(&pool,r#"{"max_cred_num":5, "issuance_type":"ISSUANCE_ON_DEMAND"}"#); + issuer.create_initial_ledger_state(&pool, r#"{"max_cred_num":5, "issuance_type":"ISSUANCE_ON_DEMAND"}"#); /*ISSUANCE CREDENTIAL FOR PROVER1*/ let (_prover1_cred_rev_id, _prover1_revoc_reg_delta1_json) = - multi_steps_create_revocation_credential(&pool, &issuer, &mut prover1, &anoncreds::gvt_credential_values_json(),CREDENTIAL1_ID); + multi_steps_create_revocation_credential(&pool, &issuer, &mut prover1, &anoncreds::gvt_credential_values_json(), CREDENTIAL1_ID); /*ISSUANCE CREDENTIAL FOR PROVER2*/ let (_prover2_cred_rev_id, _prover2_revoc_reg_delta1_json) = - multi_steps_create_revocation_credential(&pool, &issuer, &mut prover2, &anoncreds::gvt2_credential_values_json(),CREDENTIAL2_ID); + multi_steps_create_revocation_credential(&pool, &issuer, &mut prover2, &anoncreds::gvt2_credential_values_json(), CREDENTIAL2_ID); /*ISSUANCE CREDENTIAL FOR PROVER3*/ let (_prover3_cred_rev_id, _prover3_revoc_reg_delta1_json) = - multi_steps_create_revocation_credential(&pool, &issuer, &mut prover3, &anoncreds::gvt3_credential_values_json(),CREDENTIAL3_ID); + multi_steps_create_revocation_credential(&pool, &issuer, &mut prover3, &anoncreds::gvt3_credential_values_json(), CREDENTIAL3_ID); // Verifying Prover1 Credential @@ -715,9 +719,9 @@ fn anoncreds_revocation_interaction_test_issuance_by_demand_three_credentials_po // Verifier verifies revealed attribute - verifier.verify_revealed(&proof_json,"attr1_referent","Alex"); + verifier.verify_revealed(&proof_json, "attr1_referent", "Alex"); - let valid = verifier.verify(&pool,&proof_json); + let valid = verifier.verify(&pool, &proof_json); assert!(valid); @@ -731,6 +735,7 @@ fn anoncreds_revocation_interaction_test_issuance_by_demand_three_credentials_po #[cfg(feature = "revocation_tests")] #[cfg(any(feature = "force_full_interaction_tests", not(target_os = "android")))] +#[cfg(not(feature="only_high_cases"))] #[test] fn anoncreds_revocation_interaction_test_issuance_by_demand_three_credentials_post_common_entry_proving_all() { Setup::empty(); @@ -745,18 +750,18 @@ fn anoncreds_revocation_interaction_test_issuance_by_demand_three_credentials_po // ISSUER post to Ledger Schema, CredentialDefinition, RevocationRegistry - issuer.create_initial_ledger_state(&pool,r#"{"max_cred_num":5, "issuance_type":"ISSUANCE_ON_DEMAND"}"#); + issuer.create_initial_ledger_state(&pool, r#"{"max_cred_num":5, "issuance_type":"ISSUANCE_ON_DEMAND"}"#); /*ISSUANCE CREDENTIAL FOR PROVER1*/ - let (_prover1_cred_rev_id, revoc_reg_delta1_json) = multi_steps_create_revocation_credential(&pool, &issuer, &mut prover1, &anoncreds::gvt_credential_values_json(),CREDENTIAL1_ID); + let (_prover1_cred_rev_id, revoc_reg_delta1_json) = multi_steps_create_revocation_credential(&pool, &issuer, &mut prover1, &anoncreds::gvt_credential_values_json(), CREDENTIAL1_ID); let revoc_reg_delta1_json = revoc_reg_delta1_json.unwrap(); /*ISSUANCE CREDENTIAL FOR PROVER2*/ - let (_prover2_cred_rev_id, revoc_reg_delta2_json) = multi_steps_create_revocation_credential(&pool, &issuer, &mut prover2, &anoncreds::gvt2_credential_values_json(),CREDENTIAL2_ID); + let (_prover2_cred_rev_id, revoc_reg_delta2_json) = multi_steps_create_revocation_credential(&pool, &issuer, &mut prover2, &anoncreds::gvt2_credential_values_json(), CREDENTIAL2_ID); let revoc_reg_delta2_json = revoc_reg_delta2_json.unwrap(); // Issuer merge Revocation Registry Deltas @@ -764,7 +769,7 @@ fn anoncreds_revocation_interaction_test_issuance_by_demand_three_credentials_po /*ISSUANCE CREDENTIAL FOR PROVER3*/ - let (_prover3_cred_rev_id, revoc_reg_delta3_json) = multi_steps_create_revocation_credential(&pool, &issuer, &mut prover3, &anoncreds::gvt3_credential_values_json(),CREDENTIAL3_ID); + let (_prover3_cred_rev_id, revoc_reg_delta3_json) = multi_steps_create_revocation_credential(&pool, &issuer, &mut prover3, &anoncreds::gvt3_credential_values_json(), CREDENTIAL3_ID); let revoc_reg_delta3_json = revoc_reg_delta3_json.unwrap(); // Issuer merge Revocation Registry Deltas @@ -772,9 +777,9 @@ fn anoncreds_revocation_interaction_test_issuance_by_demand_three_credentials_po // TODO: test if the issuer can submit one delta instead of multiple deltas consequently -// let rev_reg_entry_request = -// ledger::build_revoc_reg_entry_request(&issuer_did, &rev_reg_id, REVOC_REG_TYPE, &revoc_reg_delta_json).unwrap(); -// ledger::sign_and_submit_request(pool_handle, issuer_wallet_handle, &issuer_did, &rev_reg_entry_request).unwrap(); + // let rev_reg_entry_request = + // ledger::build_revoc_reg_entry_request(&issuer_did, &rev_reg_id, REVOC_REG_TYPE, &revoc_reg_delta_json).unwrap(); + // ledger::sign_and_submit_request(pool_handle, issuer_wallet_handle, &issuer_did, &rev_reg_entry_request).unwrap(); // Verifying Prover1 Credential thread::sleep(std::time::Duration::from_secs(1)); @@ -798,7 +803,7 @@ fn anoncreds_revocation_interaction_test_issuance_by_demand_three_credentials_po let proof_json = prover1.make_proof(&pool, &proof_request, "attr1_referent", None, to); - verifier.verify_revealed(&proof_json,"attr1_referent", "Alex"); + verifier.verify_revealed(&proof_json, "attr1_referent", "Alex"); let valid = verifier.verify(&pool, &proof_json); assert!(valid); @@ -806,7 +811,7 @@ fn anoncreds_revocation_interaction_test_issuance_by_demand_three_credentials_po let proof_json = prover2.make_proof(&pool, &proof_request, "attr1_referent", None, to); // Verifier verifies proof from Prover2 - verifier.verify_revealed(&proof_json,"attr1_referent", "Alexander"); + verifier.verify_revealed(&proof_json, "attr1_referent", "Alexander"); let valid = verifier.verify(&pool, &proof_json); assert!(valid); @@ -815,7 +820,7 @@ fn anoncreds_revocation_interaction_test_issuance_by_demand_three_credentials_po let proof_json = prover3.make_proof(&pool, &proof_request, "attr1_referent", None, to); // Verifier verifies proof from Prover2 - verifier.verify_revealed(&proof_json,"attr1_referent", "Artem"); + verifier.verify_revealed(&proof_json, "attr1_referent", "Artem"); let valid = verifier.verify(&pool, &proof_json); assert!(valid); diff --git a/libindy/tests/ledger.rs b/libindy/tests/ledger.rs index 6356e9929c..c3ba2b32a5 100644 --- a/libindy/tests/ledger.rs +++ b/libindy/tests/ledger.rs @@ -38,8 +38,6 @@ use utils::types::*; use utils::constants::*; use utils::Setup; -use openssl::hash::{MessageDigest, Hasher}; -use sodiumoxide::crypto::secretbox; use self::rand::distributions::Alphanumeric; use utils::domain::ledger::constants; @@ -147,38 +145,6 @@ mod high_cases { ledger::submit_action(setup.pool_handle, &pool_request_request, None, None).unwrap(); } - #[test] - #[cfg(feature = "local_nodes_pool")] - fn indy_submit_action_works_for_validator_info() { - let setup = Setup::trustee(); - - let get_validator_info_request = ledger::build_get_validator_info_request(&setup.did).unwrap(); - let get_validator_info_request = ledger::sign_request(setup.wallet_handle, &setup.did, &get_validator_info_request).unwrap(); - ledger::submit_action(setup.pool_handle, &get_validator_info_request, None, None).unwrap(); - } - - #[test] - #[cfg(feature = "local_nodes_pool")] - fn indy_submit_action_works_for_not_supported_request_type() { - let setup = Setup::trustee(); - - let get_nym_request = ledger::build_get_nym_request(Some(&setup.did), &setup.did).unwrap(); - let res = ledger::submit_action(setup.pool_handle, &get_nym_request, None, None); - assert_code!(ErrorCode::CommonInvalidStructure, res); - } - - #[test] - #[cfg(feature = "local_nodes_pool")] - fn indy_submit_action_works_for_pool_restart_for_invalid_pool_handle() { - let setup = Setup::did(); - - let get_validator_info_request = ledger::build_get_validator_info_request(&setup.did).unwrap(); - let get_validator_info_request = ledger::sign_request(setup.wallet_handle, &setup.did, &get_validator_info_request).unwrap(); - - let res = ledger::submit_action(INVALID_POOL_HANDLE, &get_validator_info_request, None, None); - assert_code!(ErrorCode::PoolLedgerInvalidPoolHandle, res); - } - #[test] #[cfg(feature = "local_nodes_pool")] fn indy_submit_action_works_for_list_nodes() { @@ -228,22 +194,6 @@ mod high_cases { let res = ledger::sign_request(setup.wallet_handle, DID, REQUEST); assert_code!(ErrorCode::WalletItemNotFound, res); } - - #[test] - fn indy_sign_request_works_for_invalid_message_format() { - let setup = Setup::did(); - - let res = ledger::sign_request(setup.wallet_handle, &setup.did, "1495034346617224651"); - assert_code!(ErrorCode::CommonInvalidStructure, res); - } - - #[test] - fn indy_sign_request_works_for_invalid_handle() { - Setup::empty(); - - let res = ledger::sign_request(INVALID_WALLET_HANDLE, DID, MESSAGE); - assert_code!(ErrorCode::WalletInvalidHandle, res); - } } mod multi_sign_request { @@ -291,32 +241,8 @@ mod high_cases { let res = ledger::multi_sign_request(setup.wallet_handle, DID, REQUEST); assert_code!(ErrorCode::WalletItemNotFound, res); } - - #[test] - fn indy_multi_sign_request_works_for_invalid_message_format() { - let setup = Setup::did(); - - let res = ledger::multi_sign_request(setup.wallet_handle, &setup.did, "1495034346617224651"); - assert_code!(ErrorCode::CommonInvalidStructure, res); - } - - #[test] - fn indy_multi_sign_request_works_for_twice_use_same_did() { - let setup = Setup::wallet(); - - let (did, _) = did::create_and_store_my_did(setup.wallet_handle, Some(MY1_SEED)).unwrap(); - - let message = ledger::multi_sign_request(setup.wallet_handle, &did, REQUEST).unwrap(); - let message = ledger::multi_sign_request(setup.wallet_handle, &did, &message).unwrap(); - let msg: serde_json::Value = serde_json::from_str(&message).unwrap(); - let signatures = msg["signatures"].as_object().unwrap(); - - assert_eq!(1, signatures.len()); - assert_eq!(signatures[DID_MY1], r#"49aXkbrtTE3e522AefE76J51WzUiakw3ZbxxWzf44cv7RS21n8mMr4vJzi4TymuqDupzCz7wEtuGz6rA94Y73kKR"#); - } } - mod nym_requests { use super::*; @@ -382,17 +308,6 @@ mod high_cases { check_default_identifier(&request); } - #[test] - #[cfg(feature = "local_nodes_pool")] - fn indy_nym_request_works_without_signature() { - let setup = Setup::trustee(); - - let (did, _) = did::create_and_store_my_did(setup.wallet_handle, None).unwrap(); - let nym_request = ledger::build_nym_request(&setup.did, &did, None, None, None).unwrap(); - let response = ledger::submit_request(setup.pool_handle, &nym_request).unwrap(); - pool::check_response_type(&response, ResponseType::REQNACK); - } - #[test] #[cfg(feature = "local_nodes_pool")] fn indy_send_get_nym_request_works() { @@ -404,17 +319,6 @@ mod high_cases { assert!(get_nym_response.result.data.is_some()); } - #[test] - #[cfg(feature = "local_nodes_pool")] - fn indy_send_get_nym_request_works_default_submitter_did() { - let setup = Setup::trustee(); - - let get_nym_request = ledger::build_get_nym_request(None, DID_TRUSTEE).unwrap(); - let get_nym_response = ledger::submit_request(setup.pool_handle, &get_nym_request).unwrap(); - let get_nym_response: Reply = serde_json::from_str(&get_nym_response).unwrap(); - assert!(get_nym_response.result.data.is_some()); - } - #[test] #[cfg(feature = "local_nodes_pool")] fn indy_nym_requests_works() { @@ -531,16 +435,6 @@ mod high_cases { check_default_identifier(&request); } - #[test] - #[cfg(feature = "local_nodes_pool")] - fn indy_attrib_request_works_without_signature() { - let setup = Setup::trustee(); - - let attrib_request = ledger::build_attrib_request(&setup.did, &setup.did, None, Some(ATTRIB_RAW_DATA), None).unwrap(); - let response = ledger::submit_request(setup.pool_handle, &attrib_request).unwrap(); - pool::check_response_type(&response, ResponseType::REQNACK); - } - #[test] #[cfg(feature = "local_nodes_pool")] fn indy_attrib_requests_works_for_raw_value() { @@ -560,74 +454,6 @@ mod high_cases { let get_attrib_response: Reply = serde_json::from_str(&get_attrib_response).unwrap(); assert_eq!(get_attrib_response.result.data.unwrap().as_str(), ATTRIB_RAW_DATA); } - - #[test] - #[cfg(feature = "local_nodes_pool")] - fn indy_attrib_requests_works_for_hash_value() { - let setup = Setup::new_identity(); - - let mut ctx = Hasher::new(MessageDigest::sha256()).unwrap(); - ctx.update(&ATTRIB_RAW_DATA.as_bytes()).unwrap(); - let hashed_attr = hex::encode(ctx.finish().unwrap().as_ref()); - - let attrib_request = ledger::build_attrib_request(&setup.did, - &setup.did, - Some(&hashed_attr), - None, - None).unwrap(); - let attrib_req_resp = ledger::sign_and_submit_request(setup.pool_handle, setup.wallet_handle, &setup.did, &attrib_request).unwrap(); - pool::check_response_type(&attrib_req_resp, ResponseType::REPLY); - - let get_attrib_request = ledger::build_get_attrib_request(Some(&setup.did), &setup.did, None, Some(&hashed_attr), None).unwrap(); - let get_attrib_response = ledger::submit_request_with_retries(setup.pool_handle, &get_attrib_request, &attrib_req_resp).unwrap(); - - let get_attrib_response: Reply = serde_json::from_str(&get_attrib_response).unwrap(); - assert_eq!(get_attrib_response.result.data.unwrap().as_str(), hashed_attr.as_str()); - } - - #[test] - #[cfg(feature = "local_nodes_pool")] - fn indy_attrib_requests_works_for_encrypted_value() { - let setup = Setup::new_identity(); - - let key = secretbox::gen_key(); - let nonce = secretbox::gen_nonce(); - let encryted_attr = hex::encode(secretbox::seal(&ATTRIB_RAW_DATA.as_bytes(), &nonce, &key)); - - let attrib_request = ledger::build_attrib_request(&setup.did, - &setup.did, - None, - None, - Some(&encryted_attr)).unwrap(); - let attrib_req_resp = ledger::sign_and_submit_request(setup.pool_handle, setup.wallet_handle, &setup.did, &attrib_request).unwrap(); - pool::check_response_type(&attrib_req_resp, ResponseType::REPLY); - - let get_attrib_request = ledger::build_get_attrib_request(Some(&setup.did), &setup.did, None, None, Some(&encryted_attr)).unwrap(); - let get_attrib_response = ledger::submit_request_with_retries(setup.pool_handle, &get_attrib_request, &attrib_req_resp).unwrap(); - - let get_attrib_response: Reply = serde_json::from_str(&get_attrib_response).unwrap(); - assert_eq!(get_attrib_response.result.data.unwrap().as_str(), encryted_attr.as_str()); - } - - #[test] - #[cfg(feature = "local_nodes_pool")] - fn indy_get_attrib_requests_works_for_default_submitter_did() { - let setup = Setup::new_identity(); - - let attrib_request = ledger::build_attrib_request(&setup.did, - &setup.did, - None, - Some(ATTRIB_RAW_DATA), - None).unwrap(); - let attrib_req_resp = ledger::sign_and_submit_request(setup.pool_handle, setup.wallet_handle, &setup.did, &attrib_request).unwrap(); - pool::check_response_type(&attrib_req_resp, ResponseType::REPLY); - - let get_attrib_request = ledger::build_get_attrib_request(None, &setup.did, Some("endpoint"), None, None).unwrap(); - let get_attrib_response = ledger::submit_request_with_retries(setup.pool_handle, &get_attrib_request, &attrib_req_resp).unwrap(); - - let get_attrib_response: Reply = serde_json::from_str(&get_attrib_response).unwrap(); - assert_eq!(get_attrib_response.result.data.unwrap().as_str(), ATTRIB_RAW_DATA); - } } mod schema_requests { @@ -672,16 +498,6 @@ mod high_cases { check_default_identifier(&request); } - #[test] - #[cfg(feature = "local_nodes_pool")] - fn indy_schema_request_works_without_signature() { - let setup = Setup::trustee(); - - let schema_request = ledger::build_schema_request(&setup.did, SCHEMA_DATA).unwrap(); - let response = ledger::submit_request(setup.pool_handle, &schema_request).unwrap(); - pool::check_response_type(&response, ResponseType::REQNACK); - } - #[test] #[cfg(feature = "local_nodes_pool")] fn indy_schema_requests_works() { @@ -695,20 +511,6 @@ mod high_cases { let _schema: SchemaV1 = serde_json::from_str(&schema_json).unwrap(); } - - #[test] - #[cfg(feature = "local_nodes_pool")] - fn indy_get_schema_requests_works_for_default_submitter_did() { - let setup = Setup::pool(); - - let (schema_id, _, _) = ledger::post_entities(); - - let get_schema_request = ledger::build_get_schema_request(None, &schema_id).unwrap(); - let get_schema_response = ledger::submit_request(setup.pool_handle, &get_schema_request).unwrap(); - let (_, schema_json) = ledger::parse_get_schema_response(&get_schema_response).unwrap(); - - let _schema: SchemaV1 = serde_json::from_str(&schema_json).unwrap(); - } } mod node_request { @@ -735,16 +537,6 @@ mod high_cases { check_request(&request, expected_result); } - #[test] - #[cfg(feature = "local_nodes_pool")] - fn indy_send_node_request_works_without_signature() { - let setup = Setup::steward(); - - let node_request = ledger::build_node_request(&setup.did, &setup.did, NODE_DATA).unwrap(); - let response = ledger::submit_request(setup.pool_handle, &node_request).unwrap(); - pool::check_response_type(&response, ResponseType::REQNACK); - } - #[test] #[cfg(feature = "local_nodes_pool")] #[ignore] //FIXME currently unstable pool behaviour after new non-existing node was added @@ -831,16 +623,6 @@ mod high_cases { check_default_identifier(&request); } - #[test] - #[cfg(feature = "local_nodes_pool")] - fn indy_cred_def_request_works_without_signature() { - let setup = Setup::trustee(); - - let cred_def_request = ledger::build_cred_def_txn(&setup.did, &anoncreds::credential_def_json()).unwrap(); - let response = ledger::submit_request(setup.pool_handle, &cred_def_request).unwrap(); - pool::check_response_type(&response, ResponseType::REQNACK); - } - #[test] #[cfg(feature = "local_nodes_pool")] fn indy_cred_def_requests_works() { @@ -854,20 +636,6 @@ mod high_cases { let _cred_def: CredentialDefinitionV1 = serde_json::from_str(&cred_def_json).unwrap(); } - - #[test] - #[cfg(feature = "local_nodes_pool")] - fn indy_get_cred_def_requests_works_for_default_submitter_did() { - let setup = Setup::pool(); - - let (_, cred_def_id, _) = ledger::post_entities(); - - let get_cred_def_request = ledger::build_get_cred_def_request(None, &cred_def_id).unwrap(); - let get_cred_def_response = ledger::submit_request(setup.pool_handle, &get_cred_def_request).unwrap(); - let (_, cred_def_json) = ledger::parse_get_cred_def_response(&get_cred_def_response).unwrap(); - - let _cred_def: CredentialDefinitionV1 = serde_json::from_str(&cred_def_json).unwrap(); - } } mod get_validator_info { @@ -967,26 +735,6 @@ mod high_cases { let expected_schema_data: SchemaData = serde_json::from_str(r#"{"name":"gvt","version":"1.0","attr_names":["name", "age", "sex", "height"]}"#).unwrap(); assert_eq!(expected_schema_data, get_txn_schema_data); } - - #[test] - #[cfg(feature = "local_nodes_pool")] - fn indy_get_txn_request_works_for_invalid_seq_no() { - let setup = Setup::new_identity(); - - let schema_request = ledger::build_schema_request(&setup.did, &anoncreds::gvt_schema_json()).unwrap(); - let schema_response = ledger::sign_and_submit_request(setup.pool_handle, setup.wallet_handle, &setup.did, &schema_request).unwrap(); - pool::check_response_type(&schema_response, ResponseType::REPLY); - - let seq_no = ledger::extract_seq_no_from_reply(&schema_response).unwrap() as i32; - - thread::sleep(std::time::Duration::from_secs(1)); - - let get_txn_request = ledger::build_get_txn_request(Some(DID), seq_no + 1, None).unwrap(); - - let get_txn_response = ledger::submit_request(setup.pool_handle, &get_txn_request).unwrap(); - let get_txn_response: Reply = serde_json::from_str(&get_txn_response).unwrap(); - assert!(get_txn_response.result.data.is_none()); - } } mod pool_config { @@ -1280,24 +1028,10 @@ mod high_cases { let (_, revoc_reg_def_json) = ledger::parse_get_revoc_reg_def_response(&get_rev_reg_def_response).unwrap(); let _revoc_reg_def: RevocationRegistryDefinitionV1 = serde_json::from_str(&revoc_reg_def_json).unwrap(); } - - #[test] - #[cfg(feature = "local_nodes_pool")] - fn indy_revoc_get_reg_def_requests_works_for_default_submitter_did() { - let setup = Setup::pool(); - - let (_, _, rev_reg_id) = ledger::post_entities(); - - let get_rev_reg_def_request = ledger::build_get_revoc_reg_def_request(None, &rev_reg_id).unwrap(); - let get_rev_reg_def_response = ledger::submit_request(setup.pool_handle, &get_rev_reg_def_request).unwrap(); - - let (_, revoc_reg_def_json) = ledger::parse_get_revoc_reg_def_response(&get_rev_reg_def_response).unwrap(); - let _revoc_reg_def: RevocationRegistryDefinitionV1 = serde_json::from_str(&revoc_reg_def_json).unwrap(); - } - } - - mod revoc_reg_entry_request { - use super::*; + } + + mod revoc_reg_entry_request { + use super::*; #[test] fn indy_build_revoc_reg_entry_request() { @@ -1361,22 +1095,6 @@ mod high_cases { let (_, revoc_reg_json, _) = ledger::parse_get_revoc_reg_response(&get_rev_reg_resp).unwrap(); let _revoc_reg: RevocationRegistryV1 = serde_json::from_str(&revoc_reg_json).unwrap(); } - - #[test] - #[cfg(feature = "local_nodes_pool")] - fn indy_get_revoc_reg_request_works_for_default_submitter_did() { - let setup = Setup::pool(); - - let (_, _, rev_reg_id) = ledger::post_entities(); - - let timestamp = time::get_time().sec as u64 + 1000; - - let get_rev_reg_req = ledger::build_get_revoc_reg_request(None, &rev_reg_id, timestamp).unwrap(); - let get_rev_reg_resp = ledger::submit_request(setup.pool_handle, &get_rev_reg_req).unwrap(); - - let (_, revoc_reg_json, _) = ledger::parse_get_revoc_reg_response(&get_rev_reg_resp).unwrap(); - let _revoc_reg: RevocationRegistryV1 = serde_json::from_str(&revoc_reg_json).unwrap(); - } } mod get_revoc_reg_delta_request { @@ -1434,22 +1152,6 @@ mod high_cases { let _revoc_reg_delta: RevocationRegistryDeltaV1 = serde_json::from_str(&revoc_reg_delta_json).unwrap(); } - - #[test] - #[cfg(feature = "local_nodes_pool")] - fn indy_get_revoc_reg_delta_request_works_for_default_submitter_did() { - let setup = Setup::pool(); - - let (_, _, rev_reg_id) = ledger::post_entities(); - - let to = time::get_time().sec as u64 + 1000; - let get_rev_reg_delta_req = ledger::build_get_revoc_reg_delta_request(None, &rev_reg_id, None, to).unwrap(); - let get_rev_reg_delta_resp = ledger::submit_request(setup.pool_handle, &get_rev_reg_delta_req).unwrap(); - - let (_, revoc_reg_delta_json, _) = ledger::parse_get_revoc_reg_delta_response(&get_rev_reg_delta_resp).unwrap(); - - let _revoc_reg_delta: RevocationRegistryDeltaV1 = serde_json::from_str(&revoc_reg_delta_json).unwrap(); - } } mod indy_register_transaction_parser_for_sp { @@ -1548,33 +1250,6 @@ mod high_cases { _check_read_response_metadata(&response_metadata); } - #[test] - #[cfg(feature = "local_nodes_pool")] - fn get_response_metadata_works_for_invalid_response() { - Setup::empty(); - - let res = ledger::get_response_metadata("{}"); - assert_code!(ErrorCode::LedgerInvalidTransaction, res); - } - - #[test] - #[cfg(feature = "local_nodes_pool")] - fn get_response_metadata_works_for_not_found_response() { - let setup = Setup::wallet_and_pool(); - - let (did, _) = did::create_and_store_my_did(setup.wallet_handle, None).unwrap(); - - let get_nym_request = ledger::build_get_nym_request(Some(&did), &did).unwrap(); - let get_nym_response = ledger::submit_request(setup.pool_handle, &get_nym_request).unwrap(); - - let response_metadata = ledger::get_response_metadata(&get_nym_response).unwrap(); - let response_metadata: serde_json::Value = serde_json::from_str(&response_metadata).unwrap(); - - assert!(response_metadata["lastTxnTime"].as_u64().is_some()); - assert!(response_metadata["seqNo"].as_u64().is_none()); - assert!(response_metadata["txnTime"].as_u64().is_none()); - assert!(response_metadata["lastSeqNo"].as_u64().is_none()); - } fn _check_write_response_metadata(response_metadata: &str) { let response_metadata: serde_json::Value = serde_json::from_str(response_metadata).unwrap(); @@ -2111,6 +1786,7 @@ mod high_cases { #[test] #[cfg(feature = "local_nodes_pool")] + #[cfg(not(feature="only_high_cases"))] fn indy_auth_rule_requests_works_for_demote_trustee() { let setup = Setup::trustee(); @@ -2139,6 +1815,7 @@ mod high_cases { #[test] #[cfg(feature = "local_nodes_pool")] + #[cfg(not(feature="only_high_cases"))] fn indy_auth_rule_requests_works_for_promote_role_to_trustee() { let setup = Setup::trustee(); @@ -2167,6 +1844,7 @@ mod high_cases { #[test] #[cfg(feature = "local_nodes_pool")] + #[cfg(not(feature="only_high_cases"))] fn indy_auth_rule_requests_works_for_change_trustee_to_steward() { let setup = Setup::trustee(); @@ -2762,6 +2440,7 @@ mod high_cases { } #[test] + #[cfg(not(feature="only_high_cases"))] fn indy_reset_author_agreement_works() { let setup = Setup::trustee(); @@ -2808,6 +2487,7 @@ mod high_cases { } #[test] + #[cfg(not(feature="only_high_cases"))] fn indy_author_agreement_works_for_using_invalid_aml() { let setup = Setup::trustee(); @@ -2833,6 +2513,7 @@ mod high_cases { } #[test] + #[cfg(not(feature="only_high_cases"))] fn indy_author_agreement_works_for_using_not_last_taa() { let setup = Setup::trustee(); @@ -2920,6 +2601,7 @@ mod high_cases { } #[test] + #[cfg(not(feature="only_high_cases"))] fn indy_send_request_by_endorser_for_both_author_and_endorser_must_sign() { let setup = Setup::endorser(); let my_did = _setup_new_identity(setup.wallet_handle, setup.pool_handle); @@ -2946,6 +2628,8 @@ mod high_cases { #[cfg(not(feature="only_high_cases"))] mod medium_cases { use super::*; + use openssl::hash::{MessageDigest, Hasher}; + use sodiumoxide::crypto::secretbox; use utils::domain::anoncreds::schema::{Schema}; mod requests { @@ -2982,6 +2666,26 @@ mod medium_cases { mod submit_action { use super::*; + #[test] + #[cfg(feature = "local_nodes_pool")] + fn indy_submit_action_works_for_validator_info() { + let setup = Setup::trustee(); + + let get_validator_info_request = ledger::build_get_validator_info_request(&setup.did).unwrap(); + let get_validator_info_request = ledger::sign_request(setup.wallet_handle, &setup.did, &get_validator_info_request).unwrap(); + ledger::submit_action(setup.pool_handle, &get_validator_info_request, None, None).unwrap(); + } + + #[test] + #[cfg(feature = "local_nodes_pool")] + fn indy_submit_action_works_for_not_supported_request_type() { + let setup = Setup::trustee(); + + let get_nym_request = ledger::build_get_nym_request(Some(&setup.did), &setup.did).unwrap(); + let res = ledger::submit_action(setup.pool_handle, &get_nym_request, None, None); + assert_code!(ErrorCode::CommonInvalidStructure, res); + } + #[test] #[cfg(feature = "local_nodes_pool")] fn indy_submit_action_works_for_pool_restart_for_unknown_node_name() { @@ -3007,11 +2711,92 @@ mod medium_cases { let res = ledger::submit_action(setup.pool_handle, &get_validator_info_request, Some(nodes), None); assert_code!(ErrorCode::CommonInvalidStructure, res); } + + #[test] + #[cfg(feature = "local_nodes_pool")] + fn indy_submit_action_works_for_pool_restart_for_invalid_pool_handle() { + let setup = Setup::did(); + + let get_validator_info_request = ledger::build_get_validator_info_request(&setup.did).unwrap(); + let get_validator_info_request = ledger::sign_request(setup.wallet_handle, &setup.did, &get_validator_info_request).unwrap(); + + let res = ledger::submit_action(INVALID_POOL_HANDLE, &get_validator_info_request, None, None); + assert_code!(ErrorCode::PoolLedgerInvalidPoolHandle, res); + } + } + + mod sign_request { + use super::*; + + #[test] + fn indy_sign_request_works_for_invalid_message_format() { + let setup = Setup::did(); + + let res = ledger::sign_request(setup.wallet_handle, &setup.did, "1495034346617224651"); + assert_code!(ErrorCode::CommonInvalidStructure, res); + } + + #[test] + fn indy_sign_request_works_for_invalid_handle() { + Setup::empty(); + + let res = ledger::sign_request(INVALID_WALLET_HANDLE, DID, MESSAGE); + assert_code!(ErrorCode::WalletInvalidHandle, res); + } + } + + mod multi_sign_request { + use super::*; + + #[test] + fn indy_multi_sign_request_works_for_invalid_message_format() { + let setup = Setup::did(); + + let res = ledger::multi_sign_request(setup.wallet_handle, &setup.did, "1495034346617224651"); + assert_code!(ErrorCode::CommonInvalidStructure, res); + } + + #[test] + fn indy_multi_sign_request_works_for_twice_use_same_did() { + let setup = Setup::wallet(); + + let (did, _) = did::create_and_store_my_did(setup.wallet_handle, Some(MY1_SEED)).unwrap(); + + let message = ledger::multi_sign_request(setup.wallet_handle, &did, REQUEST).unwrap(); + let message = ledger::multi_sign_request(setup.wallet_handle, &did, &message).unwrap(); + let msg: serde_json::Value = serde_json::from_str(&message).unwrap(); + let signatures = msg["signatures"].as_object().unwrap(); + + assert_eq!(1, signatures.len()); + assert_eq!(signatures[DID_MY1], r#"49aXkbrtTE3e522AefE76J51WzUiakw3ZbxxWzf44cv7RS21n8mMr4vJzi4TymuqDupzCz7wEtuGz6rA94Y73kKR"#); + } } mod nym_requests { use super::*; + #[test] + #[cfg(feature = "local_nodes_pool")] + fn indy_send_get_nym_request_works_default_submitter_did() { + let setup = Setup::trustee(); + + let get_nym_request = ledger::build_get_nym_request(None, DID_TRUSTEE).unwrap(); + let get_nym_response = ledger::submit_request(setup.pool_handle, &get_nym_request).unwrap(); + let get_nym_response: Reply = serde_json::from_str(&get_nym_response).unwrap(); + assert!(get_nym_response.result.data.is_some()); + } + + #[test] + #[cfg(feature = "local_nodes_pool")] + fn indy_nym_request_works_without_signature() { + let setup = Setup::trustee(); + + let (did, _) = did::create_and_store_my_did(setup.wallet_handle, None).unwrap(); + let nym_request = ledger::build_nym_request(&setup.did, &did, None, None, None).unwrap(); + let response = ledger::submit_request(setup.pool_handle, &nym_request).unwrap(); + pool::check_response_type(&response, ResponseType::REQNACK); + } + #[test] #[cfg(feature = "local_nodes_pool")] fn indy_send_nym_request_works_for_only_required_fields() { @@ -3159,6 +2944,64 @@ mod medium_cases { mod attrib_requests { use super::*; + #[test] + #[cfg(feature = "local_nodes_pool")] + fn indy_attrib_requests_works_for_hash_value() { + let setup = Setup::new_identity(); + + let mut ctx = Hasher::new(MessageDigest::sha256()).unwrap(); + ctx.update(&ATTRIB_RAW_DATA.as_bytes()).unwrap(); + let hashed_attr = hex::encode(ctx.finish().unwrap().as_ref()); + + let attrib_request = ledger::build_attrib_request(&setup.did, + &setup.did, + Some(&hashed_attr), + None, + None).unwrap(); + let attrib_req_resp = ledger::sign_and_submit_request(setup.pool_handle, setup.wallet_handle, &setup.did, &attrib_request).unwrap(); + pool::check_response_type(&attrib_req_resp, ResponseType::REPLY); + + let get_attrib_request = ledger::build_get_attrib_request(Some(&setup.did), &setup.did, None, Some(&hashed_attr), None).unwrap(); + let get_attrib_response = ledger::submit_request_with_retries(setup.pool_handle, &get_attrib_request, &attrib_req_resp).unwrap(); + + let get_attrib_response: Reply = serde_json::from_str(&get_attrib_response).unwrap(); + assert_eq!(get_attrib_response.result.data.unwrap().as_str(), hashed_attr.as_str()); + } + + #[test] + #[cfg(feature = "local_nodes_pool")] + fn indy_attrib_requests_works_for_encrypted_value() { + let setup = Setup::new_identity(); + + let key = secretbox::gen_key(); + let nonce = secretbox::gen_nonce(); + let encryted_attr = hex::encode(secretbox::seal(&ATTRIB_RAW_DATA.as_bytes(), &nonce, &key)); + + let attrib_request = ledger::build_attrib_request(&setup.did, + &setup.did, + None, + None, + Some(&encryted_attr)).unwrap(); + let attrib_req_resp = ledger::sign_and_submit_request(setup.pool_handle, setup.wallet_handle, &setup.did, &attrib_request).unwrap(); + pool::check_response_type(&attrib_req_resp, ResponseType::REPLY); + + let get_attrib_request = ledger::build_get_attrib_request(Some(&setup.did), &setup.did, None, None, Some(&encryted_attr)).unwrap(); + let get_attrib_response = ledger::submit_request_with_retries(setup.pool_handle, &get_attrib_request, &attrib_req_resp).unwrap(); + + let get_attrib_response: Reply = serde_json::from_str(&get_attrib_response).unwrap(); + assert_eq!(get_attrib_response.result.data.unwrap().as_str(), encryted_attr.as_str()); + } + + #[test] + #[cfg(feature = "local_nodes_pool")] + fn indy_attrib_request_works_without_signature() { + let setup = Setup::trustee(); + + let attrib_request = ledger::build_attrib_request(&setup.did, &setup.did, None, Some(ATTRIB_RAW_DATA), None).unwrap(); + let response = ledger::submit_request(setup.pool_handle, &attrib_request).unwrap(); + pool::check_response_type(&response, ResponseType::REQNACK); + } + #[test] #[cfg(feature = "local_nodes_pool")] fn indy_attrib_request_works_for_unknown_did() { @@ -3172,6 +3015,26 @@ mod medium_cases { pool::check_response_type(&response, ResponseType::REQNACK); } + #[test] + #[cfg(feature = "local_nodes_pool")] + fn indy_get_attrib_requests_works_for_default_submitter_did() { + let setup = Setup::new_identity(); + + let attrib_request = ledger::build_attrib_request(&setup.did, + &setup.did, + None, + Some(ATTRIB_RAW_DATA), + None).unwrap(); + let attrib_req_resp = ledger::sign_and_submit_request(setup.pool_handle, setup.wallet_handle, &setup.did, &attrib_request).unwrap(); + pool::check_response_type(&attrib_req_resp, ResponseType::REPLY); + + let get_attrib_request = ledger::build_get_attrib_request(None, &setup.did, Some("endpoint"), None, None).unwrap(); + let get_attrib_response = ledger::submit_request_with_retries(setup.pool_handle, &get_attrib_request, &attrib_req_resp).unwrap(); + + let get_attrib_response: Reply = serde_json::from_str(&get_attrib_response).unwrap(); + assert_eq!(get_attrib_response.result.data.unwrap().as_str(), ATTRIB_RAW_DATA); + } + #[test] #[cfg(feature = "local_nodes_pool")] fn indy_get_attrib_request_works_for_unknown_did() { @@ -3228,6 +3091,30 @@ mod medium_cases { mod schemas_requests { use super::*; + #[test] + #[cfg(feature = "local_nodes_pool")] + fn indy_schema_request_works_without_signature() { + let setup = Setup::trustee(); + + let schema_request = ledger::build_schema_request(&setup.did, SCHEMA_DATA).unwrap(); + let response = ledger::submit_request(setup.pool_handle, &schema_request).unwrap(); + pool::check_response_type(&response, ResponseType::REQNACK); + } + + #[test] + #[cfg(feature = "local_nodes_pool")] + fn indy_get_schema_requests_works_for_default_submitter_did() { + let setup = Setup::pool(); + + let (schema_id, _, _) = ledger::post_entities(); + + let get_schema_request = ledger::build_get_schema_request(None, &schema_id).unwrap(); + let get_schema_response = ledger::submit_request(setup.pool_handle, &get_schema_request).unwrap(); + let (_, schema_json) = ledger::parse_get_schema_response(&get_schema_response).unwrap(); + + let _schema: SchemaV1 = serde_json::from_str(&schema_json).unwrap(); + } + #[test] #[cfg(feature = "local_nodes_pool")] fn indy_build_schema_requests_works_for_missed_field_in_data_json() { @@ -3316,6 +3203,16 @@ mod medium_cases { mod node_requests { use super::*; + #[test] + #[cfg(feature = "local_nodes_pool")] + fn indy_send_node_request_works_without_signature() { + let setup = Setup::steward(); + + let node_request = ledger::build_node_request(&setup.did, &setup.did, NODE_DATA).unwrap(); + let response = ledger::submit_request(setup.pool_handle, &node_request).unwrap(); + pool::check_response_type(&response, ResponseType::REQNACK); + } + #[test] fn indy_build_node_request_works_for_missed_fields_in_data_json() { let res = ledger::build_node_request(IDENTIFIER, DEST, r#"{ }"#); @@ -3381,6 +3278,30 @@ mod medium_cases { mod cred_def_requests { use super::*; + #[test] + #[cfg(feature = "local_nodes_pool")] + fn indy_cred_def_request_works_without_signature() { + let setup = Setup::trustee(); + + let cred_def_request = ledger::build_cred_def_txn(&setup.did, &anoncreds::credential_def_json()).unwrap(); + let response = ledger::submit_request(setup.pool_handle, &cred_def_request).unwrap(); + pool::check_response_type(&response, ResponseType::REQNACK); + } + + #[test] + #[cfg(feature = "local_nodes_pool")] + fn indy_get_cred_def_requests_works_for_default_submitter_did() { + let setup = Setup::pool(); + + let (_, cred_def_id, _) = ledger::post_entities(); + + let get_cred_def_request = ledger::build_get_cred_def_request(None, &cred_def_id).unwrap(); + let get_cred_def_response = ledger::submit_request(setup.pool_handle, &get_cred_def_request).unwrap(); + let (_, cred_def_json) = ledger::parse_get_cred_def_response(&get_cred_def_response).unwrap(); + + let _cred_def: CredentialDefinitionV1 = serde_json::from_str(&cred_def_json).unwrap(); + } + #[test] fn indy_build_cred_def_request_works_for_invalid_data_json() { let data = r#"{"primary":{"n":"1","s":"2","rms":"3","r":{"name":"1"}}}"#; @@ -3435,6 +3356,120 @@ mod medium_cases { let _cred_def: CredentialDefinitionV1 = serde_json::from_str(&cred_def_json).unwrap(); } } + + mod get_txn_requests { + use super::*; + + #[test] + #[cfg(feature = "local_nodes_pool")] + fn indy_get_txn_request_works_for_invalid_seq_no() { + let setup = Setup::new_identity(); + + let schema_request = ledger::build_schema_request(&setup.did, &anoncreds::gvt_schema_json()).unwrap(); + let schema_response = ledger::sign_and_submit_request(setup.pool_handle, setup.wallet_handle, &setup.did, &schema_request).unwrap(); + pool::check_response_type(&schema_response, ResponseType::REPLY); + + let seq_no = ledger::extract_seq_no_from_reply(&schema_response).unwrap() as i32; + + thread::sleep(std::time::Duration::from_secs(1)); + + let get_txn_request = ledger::build_get_txn_request(Some(DID), seq_no + 1, None).unwrap(); + + let get_txn_response = ledger::submit_request(setup.pool_handle, &get_txn_request).unwrap(); + let get_txn_response: Reply = serde_json::from_str(&get_txn_response).unwrap(); + assert!(get_txn_response.result.data.is_none()); + } + } + + mod revoc_reg_def_requests { + use super::*; + + #[test] + #[cfg(feature = "local_nodes_pool")] + fn indy_revoc_get_reg_def_requests_works_for_default_submitter_did() { + let setup = Setup::pool(); + + let (_, _, rev_reg_id) = ledger::post_entities(); + + let get_rev_reg_def_request = ledger::build_get_revoc_reg_def_request(None, &rev_reg_id).unwrap(); + let get_rev_reg_def_response = ledger::submit_request(setup.pool_handle, &get_rev_reg_def_request).unwrap(); + + let (_, revoc_reg_def_json) = ledger::parse_get_revoc_reg_def_response(&get_rev_reg_def_response).unwrap(); + let _revoc_reg_def: RevocationRegistryDefinitionV1 = serde_json::from_str(&revoc_reg_def_json).unwrap(); + } + } + + mod get_revoc_reg_request { + use super::*; + + #[test] + #[cfg(feature = "local_nodes_pool")] + fn indy_get_revoc_reg_request_works_for_default_submitter_did() { + let setup = Setup::pool(); + + let (_, _, rev_reg_id) = ledger::post_entities(); + + let timestamp = time::get_time().sec as u64 + 1000; + + let get_rev_reg_req = ledger::build_get_revoc_reg_request(None, &rev_reg_id, timestamp).unwrap(); + let get_rev_reg_resp = ledger::submit_request(setup.pool_handle, &get_rev_reg_req).unwrap(); + + let (_, revoc_reg_json, _) = ledger::parse_get_revoc_reg_response(&get_rev_reg_resp).unwrap(); + let _revoc_reg: RevocationRegistryV1 = serde_json::from_str(&revoc_reg_json).unwrap(); + } + } + + mod get_revoc_reg_delta_request { + use super::*; + + #[test] + #[cfg(feature = "local_nodes_pool")] + fn indy_get_revoc_reg_delta_request_works_for_default_submitter_did() { + let setup = Setup::pool(); + + let (_, _, rev_reg_id) = ledger::post_entities(); + + let to = time::get_time().sec as u64 + 1000; + let get_rev_reg_delta_req = ledger::build_get_revoc_reg_delta_request(None, &rev_reg_id, None, to).unwrap(); + let get_rev_reg_delta_resp = ledger::submit_request(setup.pool_handle, &get_rev_reg_delta_req).unwrap(); + + let (_, revoc_reg_delta_json, _) = ledger::parse_get_revoc_reg_delta_response(&get_rev_reg_delta_resp).unwrap(); + + let _revoc_reg_delta: RevocationRegistryDeltaV1 = serde_json::from_str(&revoc_reg_delta_json).unwrap(); + } + } + + mod get_response_metadata { + use super::*; + + #[test] + #[cfg(feature = "local_nodes_pool")] + fn get_response_metadata_works_for_invalid_response() { + Setup::empty(); + + let res = ledger::get_response_metadata("{}"); + assert_code!(ErrorCode::LedgerInvalidTransaction, res); + } + + #[test] + #[cfg(feature = "local_nodes_pool")] + fn get_response_metadata_works_for_not_found_response() { + let setup = Setup::wallet_and_pool(); + + let (did, _) = did::create_and_store_my_did(setup.wallet_handle, None).unwrap(); + + let get_nym_request = ledger::build_get_nym_request(Some(&did), &did).unwrap(); + let get_nym_response = ledger::submit_request(setup.pool_handle, &get_nym_request).unwrap(); + + let response_metadata = ledger::get_response_metadata(&get_nym_response).unwrap(); + let response_metadata: serde_json::Value = serde_json::from_str(&response_metadata).unwrap(); + + assert!(response_metadata["lastTxnTime"].as_u64().is_some()); + assert!(response_metadata["seqNo"].as_u64().is_none()); + assert!(response_metadata["txnTime"].as_u64().is_none()); + assert!(response_metadata["lastSeqNo"].as_u64().is_none()); + } + } } fn check_request(request: &str, expected_result: serde_json::Value) { diff --git a/libindy/tests/non_secrets.rs b/libindy/tests/non_secrets.rs index cd0850cfc0..62931227b5 100644 --- a/libindy/tests/non_secrets.rs +++ b/libindy/tests/non_secrets.rs @@ -35,7 +35,6 @@ use utils::types::{WalletRecord, SearchRecords}; use std::collections::HashMap; use self::indy::ErrorCode; -use api::INVALID_WALLET_HANDLE; pub const FORBIDDEN_TYPE: &'static str = "Indy::Test"; @@ -69,68 +68,6 @@ mod high_cases { let res = add_wallet_record(setup.wallet_handle, TYPE, ID, VALUE, None); assert_code!(ErrorCode::WalletItemAlreadyExists, res); } - - #[test] - fn indy_add_wallet_record_works_for_tags() { - let setup = Setup::wallet(); - - add_wallet_record(setup.wallet_handle, TYPE, ID, VALUE, Some(TAGS)).unwrap(); - check_record_field(setup.wallet_handle, TYPE, ID, "tags", TAGS); - } - - #[test] - fn indy_add_wallet_record_works_same_types_different_ids() { - let setup = Setup::wallet(); - - add_wallet_record(setup.wallet_handle, TYPE, ID, VALUE, None).unwrap(); - add_wallet_record(setup.wallet_handle, TYPE, ID_2, VALUE, None).unwrap(); - } - - #[test] - fn indy_add_wallet_record_works_same_ids_different_types() { - let setup = Setup::wallet(); - - add_wallet_record(setup.wallet_handle, TYPE, ID, VALUE, None).unwrap(); - add_wallet_record(setup.wallet_handle, TYPE_2, ID, VALUE, None).unwrap(); - } - - #[test] - fn indy_add_wallet_record_works_for_invalid_type() { - let setup = Setup::wallet(); - - let res = add_wallet_record(setup.wallet_handle, FORBIDDEN_TYPE, ID, VALUE, None); - assert_code!(ErrorCode::WalletAccessFailed, res); - } - - #[test] - fn indy_add_wallet_record_works_for_invalid_handle() { - Setup::empty(); - - let res = add_wallet_record(INVALID_WALLET_HANDLE, TYPE, ID, VALUE, None); - assert_code!(ErrorCode::WalletInvalidHandle, res); - } - - #[test] - fn indy_add_wallet_record_works_for_invalid_tags() { - let setup = Setup::wallet(); - - let res = add_wallet_record(setup.wallet_handle, TYPE, ID, VALUE, Some(r#"tag:1"#)); - assert_code!(ErrorCode::CommonInvalidStructure, res); - } - - #[test] - fn indy_add_wallet_record_works_for_empty_params() { - let setup = Setup::wallet(); - - let res = add_wallet_record(setup.wallet_handle, "", ID, VALUE, None); - assert_code!(ErrorCode::CommonInvalidParam3, res); - - let res = add_wallet_record(setup.wallet_handle, TYPE, "", VALUE, None); - assert_code!(ErrorCode::CommonInvalidParam4, res); - - let res = add_wallet_record(setup.wallet_handle, TYPE, ID, "", None); - assert_code!(ErrorCode::CommonInvalidParam5, res); - } } mod update_record_value { @@ -165,32 +102,6 @@ mod high_cases { let res = update_wallet_record_value(setup.wallet_handle, TYPE, ID, VALUE); assert_code!(ErrorCode::WalletItemNotFound, res); } - - #[test] - fn indy_update_record_value_works_for_invalid_wallet_handle() { - Setup::empty(); - - let res = update_wallet_record_value(INVALID_WALLET_HANDLE, TYPE, ID, VALUE_2); - assert_code!(ErrorCode::WalletInvalidHandle, res); - } - - #[test] - fn indy_update_record_value_works_for_empty_value() { - let setup = Setup::wallet(); - - add_wallet_record(setup.wallet_handle, TYPE, ID, VALUE, None).unwrap(); - - let res = update_wallet_record_value(setup.wallet_handle, TYPE, ID, ""); - assert_code!(ErrorCode::CommonInvalidParam5, res); - } - - #[test] - fn indy_update_record_value_works_for_invalid_type() { - let setup = Setup::wallet(); - - let res = update_wallet_record_value(setup.wallet_handle, FORBIDDEN_TYPE, ID, VALUE); - assert_code!(ErrorCode::WalletAccessFailed, res); - } } mod update_record_tags { @@ -228,32 +139,6 @@ mod high_cases { let res = update_wallet_record_tags(setup.wallet_handle, TYPE, ID, TAGS); assert_code!(ErrorCode::WalletItemNotFound, res); } - - #[test] - fn indy_update_wallet_record_tags_works_for_empty() { - let setup = Setup::wallet(); - - add_wallet_record(setup.wallet_handle, TYPE, ID, VALUE, None).unwrap(); - - let res = update_wallet_record_tags(setup.wallet_handle, TYPE, ID, ""); - assert_code!(ErrorCode::CommonInvalidParam5, res); - } - - #[test] - fn indy_update_wallet_record_tags_works_for_invalid_wallet_handle() { - Setup::empty(); - - let res = update_wallet_record_tags(INVALID_WALLET_HANDLE, TYPE, ID, TAGS); - assert_code!(ErrorCode::WalletInvalidHandle, res); - } - - #[test] - fn indy_update_wallet_record_tags_works_for_invalid_type() { - let setup = Setup::wallet(); - - let res = update_wallet_record_tags(setup.wallet_handle, FORBIDDEN_TYPE, ID, TAGS); - assert_code!(ErrorCode::WalletAccessFailed, res); - } } mod add_record_tags { @@ -288,31 +173,6 @@ mod high_cases { check_record_field(setup.wallet_handle, TYPE, ID, "tags", expected_tags); } - #[test] - fn indy_add_wallet_record_tags_works_for_twice_add_same_tag() { - let setup = Setup::wallet(); - - add_wallet_record(setup.wallet_handle, TYPE, ID, VALUE, Some(TAGS)).unwrap(); - check_record_field(setup.wallet_handle, TYPE, ID, "tags", TAGS); - - add_wallet_record_tags(setup.wallet_handle, TYPE, ID, TAGS).unwrap(); - check_record_field(setup.wallet_handle, TYPE, ID, "tags", TAGS); - } - - #[test] - fn indy_add_wallet_record_tags_works_for_rewrite_tag() { - let setup = Setup::wallet(); - - add_wallet_record(setup.wallet_handle, TYPE, ID, VALUE, Some(TAGS)).unwrap(); - check_record_field(setup.wallet_handle, TYPE, ID, "tags", TAGS); - - let tags_json = r#"{"tagName1": "str2"}"#; - add_wallet_record_tags(setup.wallet_handle, TYPE, ID, tags_json).unwrap(); - - let expected_result = r#"{"tagName1": "str2", "~tagName2": "5", "~tagName3": "8"}"#; - check_record_field(setup.wallet_handle, TYPE, ID, "tags", expected_result); - } - #[test] fn indy_add_wallet_record_tags_works_for_not_found_record() { let setup = Setup::wallet(); @@ -320,22 +180,6 @@ mod high_cases { let res = add_wallet_record_tags(setup.wallet_handle, TYPE, ID, TAGS); assert_code!(ErrorCode::WalletItemNotFound, res); } - - #[test] - fn indy_add_wallet_record_tags_works_for_not_invalid_handle() { - Setup::empty(); - - let res = add_wallet_record_tags(INVALID_WALLET_HANDLE, TYPE, ID, TAGS); - assert_code!(ErrorCode::WalletInvalidHandle, res); - } - - #[test] - fn indy_add_wallet_record_tags_works_for_not_invalid_type() { - let setup = Setup::wallet(); - - let res = add_wallet_record_tags(setup.wallet_handle, FORBIDDEN_TYPE, ID, TAGS); - assert_code!(ErrorCode::WalletAccessFailed, res); - } } mod delete_record_tags { @@ -380,45 +224,6 @@ mod high_cases { delete_wallet_record_tags(setup.wallet_handle, TYPE, ID, r#"["tagName1"]"#).unwrap(); } - - #[test] - fn indy_delete_wallet_record_tags_works_for_twice_delete() { - let setup = Setup::wallet(); - - add_wallet_record(setup.wallet_handle, TYPE, ID, VALUE, Some(TAGS)).unwrap(); - - delete_wallet_record_tags(setup.wallet_handle, TYPE, ID, r#"["tagName1"]"#).unwrap(); - delete_wallet_record_tags(setup.wallet_handle, TYPE, ID, r#"["~tagName2"]"#).unwrap(); - - let expected_tags = r#"{"~tagName3": "8"}"#; - check_record_field(setup.wallet_handle, TYPE, ID, "tags", expected_tags); - } - - #[test] - fn indy_delete_wallet_record_tags_works_for_twice_delete_same_tag() { - let setup = Setup::wallet(); - - add_wallet_record(setup.wallet_handle, TYPE, ID, VALUE, Some(TAGS)).unwrap(); - - delete_wallet_record_tags(setup.wallet_handle, TYPE, ID, r#"["tagName1"]"#).unwrap(); - delete_wallet_record_tags(setup.wallet_handle, TYPE, ID, r#"["tagName1"]"#).unwrap(); - } - - #[test] - fn indy_delete_wallet_record_tags_works_for_invalid_handle() { - Setup::empty(); - - let res = delete_wallet_record_tags(INVALID_WALLET_HANDLE, TYPE, ID, r#"["tagName1"]"#); - assert_code!(ErrorCode::WalletInvalidHandle, res); - } - - #[test] - fn indy_delete_wallet_record_tags_works_for_invalid_type() { - let setup = Setup::wallet(); - - let res = delete_wallet_record_tags(setup.wallet_handle, FORBIDDEN_TYPE, ID, r#"["tagName1"]"#); - assert_code!(ErrorCode::WalletAccessFailed, res); - } } mod delete_record { @@ -445,47 +250,6 @@ mod high_cases { let res = delete_wallet_record(setup.wallet_handle, TYPE, ID); assert_code!(ErrorCode::WalletItemNotFound, res); } - - #[test] - fn indy_delete_wallet_record_works_for_twice() { - let setup = Setup::wallet(); - - add_wallet_record(setup.wallet_handle, TYPE, ID, VALUE, None).unwrap(); - - get_wallet_record(setup.wallet_handle, TYPE, ID, OPTIONS_EMPTY).unwrap(); - - delete_wallet_record(setup.wallet_handle, TYPE, ID).unwrap(); - - let res = delete_wallet_record(setup.wallet_handle, TYPE, ID); - assert_code!(ErrorCode::WalletItemNotFound, res); - } - - #[test] - fn indy_delete_wallet_record_works_for_invalid_handle() { - Setup::empty(); - - let res = delete_wallet_record(INVALID_WALLET_HANDLE, TYPE, ID); - assert_code!(ErrorCode::WalletInvalidHandle, res); - } - - #[test] - fn indy_delete_wallet_record_works_for_empty_params() { - let setup = Setup::wallet(); - - let res = delete_wallet_record(setup.wallet_handle, "", ID); - assert_code!(ErrorCode::CommonInvalidParam3, res); - - let res = delete_wallet_record(setup.wallet_handle, TYPE, ""); - assert_code!(ErrorCode::CommonInvalidParam4, res); - } - - #[test] - fn indy_delete_wallet_record_works_for_invalid_type() { - let setup = Setup::wallet(); - - let res = delete_wallet_record(setup.wallet_handle, FORBIDDEN_TYPE, ID); - assert_code!(ErrorCode::WalletAccessFailed, res); - } } mod get_record { @@ -599,24 +363,6 @@ mod high_cases { let res = get_wallet_record(setup.wallet_handle, TYPE, ID, OPTIONS_EMPTY); assert_code!(ErrorCode::WalletItemNotFound, res); } - - #[test] - fn indy_get_wallet_record_works_for_invalid_options() { - let setup = Setup::wallet(); - - add_wallet_record(setup.wallet_handle, TYPE, ID, VALUE, None).unwrap(); - - let res = get_wallet_record(setup.wallet_handle, TYPE, ID, "not_json"); - assert_code!(ErrorCode::CommonInvalidStructure, res); - } - - #[test] - fn indy_get_wallet_record_works_for_invalid_type() { - let setup = Setup::wallet(); - - let res = get_wallet_record(setup.wallet_handle, FORBIDDEN_TYPE, ID, OPTIONS_EMPTY); - assert_code!(ErrorCode::WalletAccessFailed, res); - } } mod search { @@ -1096,9 +842,342 @@ mod high_cases { } } - #[test] - fn indy_wallet_search_for_fetch_twice() { - const SEARCH_WALLET_CONFIG: &str = r#"{"id":"indy_wallet_search_for_fetch_twice"}"#; + mod close { + use super::*; + + #[test] + fn indy_close_wallet_search_works() { + const SEARCH_WALLET_CONFIG: &str = r#"{"id":"indy_close_wallet_search_works"}"#; + let wallet_handle = setup("indy_close_wallet_search_works", SEARCH_WALLET_CONFIG); + + let search_handle = open_wallet_search(wallet_handle, TYPE, QUERY_EMPTY, OPTIONS_EMPTY).unwrap(); + + close_wallet_search(search_handle).unwrap(); + wallet::close_wallet(wallet_handle).unwrap(); + cleanup_wallet("indy_close_wallet_search_works"); + } + + #[test] + fn close_wallet_search_works_for_twice() { + const SEARCH_WALLET_CONFIG: &str = r#"{"id":"close_wallet_search_works_for_twice"}"#; + let wallet_handle = setup("close_wallet_search_works_for_twice", SEARCH_WALLET_CONFIG); + + let search_handle = open_wallet_search(wallet_handle, TYPE, QUERY_EMPTY, OPTIONS_EMPTY).unwrap(); + + close_wallet_search(search_handle).unwrap(); + + let res = close_wallet_search(search_handle); + assert_code!(ErrorCode::WalletInvalidHandle, res); + + wallet::close_wallet(wallet_handle).unwrap(); + cleanup_wallet("close_wallet_search_works_for_twice"); + } + } + } +} + +#[cfg(not(feature = "only_high_cases"))] +mod medium_cases { + use super::*; + use api::INVALID_WALLET_HANDLE; + + mod add_record { + use super::*; + + #[test] + fn indy_add_wallet_record_works_for_tags() { + let setup = Setup::wallet(); + + add_wallet_record(setup.wallet_handle, TYPE, ID, VALUE, Some(TAGS)).unwrap(); + check_record_field(setup.wallet_handle, TYPE, ID, "tags", TAGS); + } + + #[test] + fn indy_add_wallet_record_works_same_types_different_ids() { + let setup = Setup::wallet(); + + add_wallet_record(setup.wallet_handle, TYPE, ID, VALUE, None).unwrap(); + add_wallet_record(setup.wallet_handle, TYPE, ID_2, VALUE, None).unwrap(); + } + + #[test] + fn indy_add_wallet_record_works_same_ids_different_types() { + let setup = Setup::wallet(); + + add_wallet_record(setup.wallet_handle, TYPE, ID, VALUE, None).unwrap(); + add_wallet_record(setup.wallet_handle, TYPE_2, ID, VALUE, None).unwrap(); + } + + #[test] + fn indy_add_wallet_record_works_for_invalid_type() { + let setup = Setup::wallet(); + + let res = add_wallet_record(setup.wallet_handle, FORBIDDEN_TYPE, ID, VALUE, None); + assert_code!(ErrorCode::WalletAccessFailed, res); + } + + #[test] + fn indy_add_wallet_record_works_for_invalid_handle() { + Setup::empty(); + + let res = add_wallet_record(INVALID_WALLET_HANDLE, TYPE, ID, VALUE, None); + assert_code!(ErrorCode::WalletInvalidHandle, res); + } + + #[test] + fn indy_add_wallet_record_works_for_invalid_tags() { + let setup = Setup::wallet(); + + let res = add_wallet_record(setup.wallet_handle, TYPE, ID, VALUE, Some(r#"tag:1"#)); + assert_code!(ErrorCode::CommonInvalidStructure, res); + } + + #[test] + fn indy_add_wallet_record_works_for_empty_params() { + let setup = Setup::wallet(); + + let res = add_wallet_record(setup.wallet_handle, "", ID, VALUE, None); + assert_code!(ErrorCode::CommonInvalidParam3, res); + + let res = add_wallet_record(setup.wallet_handle, TYPE, "", VALUE, None); + assert_code!(ErrorCode::CommonInvalidParam4, res); + + let res = add_wallet_record(setup.wallet_handle, TYPE, ID, "", None); + assert_code!(ErrorCode::CommonInvalidParam5, res); + } + } + + mod update_record_value { + use super::*; + + #[test] + fn indy_update_record_value_works_for_invalid_wallet_handle() { + Setup::empty(); + + let res = update_wallet_record_value(INVALID_WALLET_HANDLE, TYPE, ID, VALUE_2); + assert_code!(ErrorCode::WalletInvalidHandle, res); + } + + #[test] + fn indy_update_record_value_works_for_empty_value() { + let setup = Setup::wallet(); + + add_wallet_record(setup.wallet_handle, TYPE, ID, VALUE, None).unwrap(); + + let res = update_wallet_record_value(setup.wallet_handle, TYPE, ID, ""); + assert_code!(ErrorCode::CommonInvalidParam5, res); + } + + #[test] + fn indy_update_record_value_works_for_invalid_type() { + let setup = Setup::wallet(); + + let res = update_wallet_record_value(setup.wallet_handle, FORBIDDEN_TYPE, ID, VALUE); + assert_code!(ErrorCode::WalletAccessFailed, res); + } + } + + mod update_record_tags { + use super::*; + + #[test] + fn indy_update_wallet_record_tags_works_for_empty() { + let setup = Setup::wallet(); + + add_wallet_record(setup.wallet_handle, TYPE, ID, VALUE, None).unwrap(); + + let res = update_wallet_record_tags(setup.wallet_handle, TYPE, ID, ""); + assert_code!(ErrorCode::CommonInvalidParam5, res); + } + + #[test] + fn indy_update_wallet_record_tags_works_for_invalid_wallet_handle() { + Setup::empty(); + + let res = update_wallet_record_tags(INVALID_WALLET_HANDLE, TYPE, ID, TAGS); + assert_code!(ErrorCode::WalletInvalidHandle, res); + } + + #[test] + fn indy_update_wallet_record_tags_works_for_invalid_type() { + let setup = Setup::wallet(); + + let res = update_wallet_record_tags(setup.wallet_handle, FORBIDDEN_TYPE, ID, TAGS); + assert_code!(ErrorCode::WalletAccessFailed, res); + } + } + + mod add_record_tags { + use super::*; + + #[test] + fn indy_add_wallet_record_tags_works_for_twice_add_same_tag() { + let setup = Setup::wallet(); + + add_wallet_record(setup.wallet_handle, TYPE, ID, VALUE, Some(TAGS)).unwrap(); + check_record_field(setup.wallet_handle, TYPE, ID, "tags", TAGS); + + add_wallet_record_tags(setup.wallet_handle, TYPE, ID, TAGS).unwrap(); + check_record_field(setup.wallet_handle, TYPE, ID, "tags", TAGS); + } + + #[test] + fn indy_add_wallet_record_tags_works_for_rewrite_tag() { + let setup = Setup::wallet(); + + add_wallet_record(setup.wallet_handle, TYPE, ID, VALUE, Some(TAGS)).unwrap(); + check_record_field(setup.wallet_handle, TYPE, ID, "tags", TAGS); + + let tags_json = r#"{"tagName1": "str2"}"#; + add_wallet_record_tags(setup.wallet_handle, TYPE, ID, tags_json).unwrap(); + + let expected_result = r#"{"tagName1": "str2", "~tagName2": "5", "~tagName3": "8"}"#; + check_record_field(setup.wallet_handle, TYPE, ID, "tags", expected_result); + } + + #[test] + fn indy_add_wallet_record_tags_works_for_not_invalid_handle() { + Setup::empty(); + + let res = add_wallet_record_tags(INVALID_WALLET_HANDLE, TYPE, ID, TAGS); + assert_code!(ErrorCode::WalletInvalidHandle, res); + } + + #[test] + fn indy_add_wallet_record_tags_works_for_not_invalid_type() { + let setup = Setup::wallet(); + + let res = add_wallet_record_tags(setup.wallet_handle, FORBIDDEN_TYPE, ID, TAGS); + assert_code!(ErrorCode::WalletAccessFailed, res); + } + } + + mod delete_record_tags { + use super::*; + + #[test] + fn indy_delete_wallet_record_tags_works_for_twice_delete() { + let setup = Setup::wallet(); + + add_wallet_record(setup.wallet_handle, TYPE, ID, VALUE, Some(TAGS)).unwrap(); + + delete_wallet_record_tags(setup.wallet_handle, TYPE, ID, r#"["tagName1"]"#).unwrap(); + delete_wallet_record_tags(setup.wallet_handle, TYPE, ID, r#"["~tagName2"]"#).unwrap(); + + let expected_tags = r#"{"~tagName3": "8"}"#; + check_record_field(setup.wallet_handle, TYPE, ID, "tags", expected_tags); + } + + #[test] + fn indy_delete_wallet_record_tags_works_for_twice_delete_same_tag() { + let setup = Setup::wallet(); + + add_wallet_record(setup.wallet_handle, TYPE, ID, VALUE, Some(TAGS)).unwrap(); + + delete_wallet_record_tags(setup.wallet_handle, TYPE, ID, r#"["tagName1"]"#).unwrap(); + delete_wallet_record_tags(setup.wallet_handle, TYPE, ID, r#"["tagName1"]"#).unwrap(); + } + + #[test] + fn indy_delete_wallet_record_tags_works_for_invalid_handle() { + Setup::empty(); + + let res = delete_wallet_record_tags(INVALID_WALLET_HANDLE, TYPE, ID, r#"["tagName1"]"#); + assert_code!(ErrorCode::WalletInvalidHandle, res); + } + + #[test] + fn indy_delete_wallet_record_tags_works_for_invalid_type() { + let setup = Setup::wallet(); + + let res = delete_wallet_record_tags(setup.wallet_handle, FORBIDDEN_TYPE, ID, r#"["tagName1"]"#); + assert_code!(ErrorCode::WalletAccessFailed, res); + } + } + + mod delete_record { + use super::*; + + #[test] + fn indy_delete_wallet_record_works_for_twice() { + let setup = Setup::wallet(); + + add_wallet_record(setup.wallet_handle, TYPE, ID, VALUE, None).unwrap(); + + get_wallet_record(setup.wallet_handle, TYPE, ID, OPTIONS_EMPTY).unwrap(); + + delete_wallet_record(setup.wallet_handle, TYPE, ID).unwrap(); + + let res = delete_wallet_record(setup.wallet_handle, TYPE, ID); + assert_code!(ErrorCode::WalletItemNotFound, res); + } + + #[test] + fn indy_delete_wallet_record_works_for_invalid_handle() { + Setup::empty(); + + let res = delete_wallet_record(INVALID_WALLET_HANDLE, TYPE, ID); + assert_code!(ErrorCode::WalletInvalidHandle, res); + } + + #[test] + fn indy_delete_wallet_record_works_for_empty_params() { + let setup = Setup::wallet(); + + let res = delete_wallet_record(setup.wallet_handle, "", ID); + assert_code!(ErrorCode::CommonInvalidParam3, res); + + let res = delete_wallet_record(setup.wallet_handle, TYPE, ""); + assert_code!(ErrorCode::CommonInvalidParam4, res); + } + + #[test] + fn indy_delete_wallet_record_works_for_invalid_type() { + let setup = Setup::wallet(); + + let res = delete_wallet_record(setup.wallet_handle, FORBIDDEN_TYPE, ID); + assert_code!(ErrorCode::WalletAccessFailed, res); + } + } + + mod get_record { + use super::*; + + #[test] + fn indy_get_wallet_record_works_for_invalid_options() { + let setup = Setup::wallet(); + + add_wallet_record(setup.wallet_handle, TYPE, ID, VALUE, None).unwrap(); + + let res = get_wallet_record(setup.wallet_handle, TYPE, ID, "not_json"); + assert_code!(ErrorCode::CommonInvalidStructure, res); + } + + #[test] + fn indy_get_wallet_record_works_for_invalid_type() { + let setup = Setup::wallet(); + + let res = get_wallet_record(setup.wallet_handle, FORBIDDEN_TYPE, ID, OPTIONS_EMPTY); + assert_code!(ErrorCode::WalletAccessFailed, res); + } + } + + mod search { + use super::*; + + fn setup(name: &str, wallet_config: &str) -> i32{ + init_non_secret_test_wallet(name, wallet_config); + wallet::open_wallet(wallet_config, WALLET_CREDENTIALS).unwrap() + } + + fn tear_down(wallet_handle: i32, search_handle: i32){ + close_wallet_search(search_handle).unwrap(); + wallet::close_wallet(wallet_handle).unwrap(); + } + + #[test] + fn indy_wallet_search_for_fetch_twice() { + const SEARCH_WALLET_CONFIG: &str = r#"{"id":"indy_wallet_search_for_fetch_twice"}"#; let wallet_handle = setup("indy_wallet_search_for_fetch_twice", SEARCH_WALLET_CONFIG); let search_handle = open_wallet_search(wallet_handle, TYPE, QUERY_EMPTY, OPTIONS_FULL).unwrap(); @@ -1173,58 +1252,21 @@ mod high_cases { cleanup_wallet("indy_wallet_search_for_invalid_type"); } - mod close { - use super::*; - - #[test] - fn indy_close_wallet_search_works() { - const SEARCH_WALLET_CONFIG: &str = r#"{"id":"indy_close_wallet_search_works"}"#; - let wallet_handle = setup("indy_close_wallet_search_works", SEARCH_WALLET_CONFIG); - - let search_handle = open_wallet_search(wallet_handle, TYPE, QUERY_EMPTY, OPTIONS_EMPTY).unwrap(); - - close_wallet_search(search_handle).unwrap(); - wallet::close_wallet(wallet_handle).unwrap(); - cleanup_wallet("indy_close_wallet_search_works"); - } - - #[test] - fn indy_close_wallet_search_works_for_invalid_handle() { - const SEARCH_WALLET_CONFIG: &str = r#"{"id":"indy_close_wallet_search_works_for_invalid_handle"}"#; - let wallet_handle = setup("indy_close_wallet_search_works_for_invalid_handle", SEARCH_WALLET_CONFIG); - - let search_handle = open_wallet_search(wallet_handle, TYPE, QUERY_EMPTY, OPTIONS_EMPTY).unwrap(); - - let res = close_wallet_search(search_handle + 1); - assert_code!(ErrorCode::WalletInvalidHandle, res); - - close_wallet_search(search_handle).unwrap(); - wallet::close_wallet(wallet_handle).unwrap(); - cleanup_wallet("indy_close_wallet_search_works_for_invalid_handle"); - } - - #[test] - fn close_wallet_search_works_for_twice() { - const SEARCH_WALLET_CONFIG: &str = r#"{"id":"close_wallet_search_works_for_twice"}"#; - let wallet_handle = setup("close_wallet_search_works_for_twice", SEARCH_WALLET_CONFIG); - - let search_handle = open_wallet_search(wallet_handle, TYPE, QUERY_EMPTY, OPTIONS_EMPTY).unwrap(); + #[test] + fn indy_close_wallet_search_works_for_invalid_handle() { + const SEARCH_WALLET_CONFIG: &str = r#"{"id":"indy_close_wallet_search_works_for_invalid_handle"}"#; + let wallet_handle = setup("indy_close_wallet_search_works_for_invalid_handle", SEARCH_WALLET_CONFIG); - close_wallet_search(search_handle).unwrap(); + let search_handle = open_wallet_search(wallet_handle, TYPE, QUERY_EMPTY, OPTIONS_EMPTY).unwrap(); - let res = close_wallet_search(search_handle); - assert_code!(ErrorCode::WalletInvalidHandle, res); + let res = close_wallet_search(search_handle + 1); + assert_code!(ErrorCode::WalletInvalidHandle, res); - wallet::close_wallet(wallet_handle).unwrap(); - cleanup_wallet("close_wallet_search_works_for_twice"); - } + close_wallet_search(search_handle).unwrap(); + wallet::close_wallet(wallet_handle).unwrap(); + cleanup_wallet("indy_close_wallet_search_works_for_invalid_handle"); } } -} - -#[cfg(not(feature="only_high_cases"))] -mod medium_cases { - use super::*; mod rusqlite_transaction_fix { use super::*; diff --git a/libindy/tests/pairwise.rs b/libindy/tests/pairwise.rs index d3858065dd..cece3da18b 100644 --- a/libindy/tests/pairwise.rs +++ b/libindy/tests/pairwise.rs @@ -32,7 +32,6 @@ use utils::constants::*; use utils::Setup; use self::indy::ErrorCode; -use api::INVALID_WALLET_HANDLE; mod high_cases { use super::*; @@ -49,15 +48,6 @@ mod high_cases { pairwise::create_pairwise(setup.wallet_handle, DID_TRUSTEE, &setup.did, Some(METADATA)).unwrap(); } - #[test] - fn indy_create_pairwise_works_for_empty_metadata() { - let setup = Setup::did(); - - did::store_their_did_from_parts(setup.wallet_handle, DID_TRUSTEE, VERKEY_TRUSTEE).unwrap(); - - pairwise::create_pairwise(setup.wallet_handle, DID_TRUSTEE, &setup.did, None).unwrap(); - } - #[test] fn indy_create_pairwise_works_for_not_found_my_did() { let setup = Setup::wallet(); @@ -75,26 +65,6 @@ mod high_cases { let res = pairwise::create_pairwise(setup.wallet_handle, DID, &setup.did, None); assert_code!(ErrorCode::WalletItemNotFound, res); } - - #[test] - fn indy_create_pairwise_works_for_invalid_wallet_handle() { - Setup::empty(); - - let res = pairwise::create_pairwise(INVALID_WALLET_HANDLE, DID_TRUSTEE, DID, None); - assert_code!(ErrorCode::WalletInvalidHandle, res); - } - - #[test] - fn indy_create_pairwise_works_for_twice() { - let setup = Setup::did(); - - did::store_their_did_from_parts(setup.wallet_handle, DID_TRUSTEE, VERKEY_TRUSTEE).unwrap(); - - pairwise::create_pairwise(setup.wallet_handle, DID_TRUSTEE, &setup.did, Some(METADATA)).unwrap(); - - let res = pairwise::create_pairwise(setup.wallet_handle, DID_TRUSTEE, &setup.did, None); - assert_code!(ErrorCode::WalletItemAlreadyExists, res); - } } mod list_pairwise { @@ -124,14 +94,6 @@ mod high_cases { assert_eq!(list_pairwise.len(), 0); } - - #[test] - fn indy_list_pairwise_works_for_invalid_handle() { - Setup::empty(); - - let res = pairwise::list_pairwise(INVALID_WALLET_HANDLE); - assert_code!(ErrorCode::WalletInvalidHandle, res); - } } mod pairwise_exists { @@ -154,14 +116,6 @@ mod high_cases { assert!(!pairwise::pairwise_exists(setup.wallet_handle, DID_TRUSTEE).unwrap()); } - - #[test] - fn indy_is_pairwise_exists_works_for_invalid_handle() { - Setup::empty(); - - let res = pairwise::pairwise_exists(INVALID_WALLET_HANDLE, DID_TRUSTEE); - assert_code!(ErrorCode::WalletInvalidHandle, res); - } } mod get_pairwise { @@ -186,14 +140,6 @@ mod high_cases { let res = pairwise::get_pairwise(setup.wallet_handle, DID_TRUSTEE); assert_code!(ErrorCode::WalletItemNotFound, res); } - - #[test] - fn indy_get_pairwise_works_for_invalid_handle() { - Setup::empty(); - - let res = pairwise::get_pairwise(INVALID_WALLET_HANDLE, DID_TRUSTEE); - assert_code!(ErrorCode::WalletInvalidHandle, res); - } } mod set_pairwise_metadata { @@ -217,6 +163,94 @@ mod high_cases { assert_eq!(format!(r#"{{"my_did":"{}","metadata":"{}"}}"#, setup.did, METADATA), pairwise_info_with_metadata); } + #[test] + fn indy_set_pairwise_metadata_works_for_not_created_pairwise() { + let setup = Setup::wallet(); + + let res = pairwise::set_pairwise_metadata(setup.wallet_handle, DID_TRUSTEE, Some(METADATA)); + assert_code!(ErrorCode::WalletItemNotFound, res); + } + } +} + +#[cfg(not(feature = "only_high_cases"))] +mod medium_cases { + use super::*; + use api::INVALID_WALLET_HANDLE; + + + mod create_pairwise { + use super::*; + + #[test] + fn indy_create_pairwise_works_for_empty_metadata() { + let setup = Setup::did(); + + did::store_their_did_from_parts(setup.wallet_handle, DID_TRUSTEE, VERKEY_TRUSTEE).unwrap(); + + pairwise::create_pairwise(setup.wallet_handle, DID_TRUSTEE, &setup.did, None).unwrap(); + } + + #[test] + fn indy_create_pairwise_works_for_invalid_wallet_handle() { + Setup::empty(); + + let res = pairwise::create_pairwise(INVALID_WALLET_HANDLE, DID_TRUSTEE, DID, None); + assert_code!(ErrorCode::WalletInvalidHandle, res); + } + + #[test] + fn indy_create_pairwise_works_for_twice() { + let setup = Setup::did(); + + did::store_their_did_from_parts(setup.wallet_handle, DID_TRUSTEE, VERKEY_TRUSTEE).unwrap(); + + pairwise::create_pairwise(setup.wallet_handle, DID_TRUSTEE, &setup.did, Some(METADATA)).unwrap(); + + let res = pairwise::create_pairwise(setup.wallet_handle, DID_TRUSTEE, &setup.did, None); + assert_code!(ErrorCode::WalletItemAlreadyExists, res); + } + } + + mod list_pairwise { + use super::*; + + #[test] + fn indy_list_pairwise_works_for_invalid_handle() { + Setup::empty(); + + let res = pairwise::list_pairwise(INVALID_WALLET_HANDLE); + assert_code!(ErrorCode::WalletInvalidHandle, res); + } + } + + mod pairwise_exists { + use super::*; + + #[test] + fn indy_is_pairwise_exists_works_for_invalid_handle() { + Setup::empty(); + + let res = pairwise::pairwise_exists(INVALID_WALLET_HANDLE, DID_TRUSTEE); + assert_code!(ErrorCode::WalletInvalidHandle, res); + } + } + + mod get_pairwise { + use super::*; + + #[test] + fn indy_get_pairwise_works_for_invalid_handle() { + Setup::empty(); + + let res = pairwise::get_pairwise(INVALID_WALLET_HANDLE, DID_TRUSTEE); + assert_code!(ErrorCode::WalletInvalidHandle, res); + } + } + + mod set_pairwise_metadata { + use super::*; + #[test] fn indy_set_pairwise_metadata_works_for_reset() { let setup = Setup::did(); @@ -235,14 +269,6 @@ mod high_cases { assert_eq!(format!(r#"{{"my_did":"{}"}}"#, setup.did), pairwise_info_without_metadata); } - #[test] - fn indy_set_pairwise_metadata_works_for_not_created_pairwise() { - let setup = Setup::wallet(); - - let res = pairwise::set_pairwise_metadata(setup.wallet_handle, DID_TRUSTEE, Some(METADATA)); - assert_code!(ErrorCode::WalletItemNotFound, res); - } - #[test] fn indy_set_pairwise_metadata_works_for_invalid_wallet_handle() { Setup::empty(); @@ -251,5 +277,4 @@ mod high_cases { assert_code!(ErrorCode::WalletInvalidHandle, res); } } -} - +} \ No newline at end of file diff --git a/libindy/tests/pool.rs b/libindy/tests/pool.rs index 79208d1160..9ceb2fce75 100644 --- a/libindy/tests/pool.rs +++ b/libindy/tests/pool.rs @@ -30,7 +30,7 @@ mod utils; use self::indy::ErrorCode; -use utils::{environment, ledger, pool}; +use utils::{environment, pool}; use utils::constants::*; use utils::Setup; @@ -43,56 +43,26 @@ mod high_cases { #[test] fn create_pool_ledger_config_works() { - Setup::empty(); - - let txn_file_path = pool::create_genesis_txn_file_for_test_pool("create_pool_ledger_config_works", None, None); - let pool_config = pool::pool_config_json(txn_file_path.as_path()); - - pool::create_pool_ledger_config("create_pool_ledger_config_works", Some(pool_config.as_str())).unwrap(); - } - - #[test] - fn create_pool_ledger_config_works_for_empty_name() { - Setup::empty(); - - let pool_name = ""; - let res = pool::create_pool_ledger_config(pool_name, None); - assert_code!(ErrorCode::CommonInvalidParam2, res); - } - - #[test] - fn create_pool_ledger_config_works_for_config_json() { - Setup::empty(); + let setup = Setup::empty(); - let txn_file_path = pool::create_genesis_txn_file_for_test_pool("create_pool_ledger_config_works_for_config_json", None, None); + let txn_file_path = pool::create_genesis_txn_file_for_test_pool(&setup.name, None, None); let pool_config = pool::pool_config_json(txn_file_path.as_path()); - pool::create_pool_ledger_config("create_pool_ledger_config_works_for_config_json", Some(pool_config.as_str())).unwrap(); + pool::create_pool_ledger_config(&setup.name, Some(pool_config.as_str())).unwrap(); } - #[test] fn create_pool_ledger_config_works_for_specific_config() { - Setup::empty(); + let setup = Setup::empty(); let txn_file_path = environment::tmp_file_path("specific_filename.txn"); - let txn_file_path = pool::create_genesis_txn_file_for_test_pool("create_pool_ledger_config_works_for_specific_config", None, Some(txn_file_path.as_path())); + let txn_file_path = pool::create_genesis_txn_file_for_test_pool(&setup.name, None, Some(txn_file_path.as_path())); let pool_config = pool::pool_config_json(txn_file_path.as_path()); - pool::create_pool_ledger_config("create_pool_ledger_config_works_for_specific_config", Some(pool_config.as_str())).unwrap(); + pool::create_pool_ledger_config(&setup.name, Some(pool_config.as_str())).unwrap(); let _ = fs::remove_file(txn_file_path); } - - #[test] - fn create_pool_ledger_config_works_for_empty_genesis_txns() { - Setup::empty(); - - let txn_file_path = pool::create_genesis_txn_file_for_test_pool("create_pool_ledger_config_works_for_empty_genesis_txns", Some(0), None); - let pool_config = pool::pool_config_json(txn_file_path.as_path()); - let res = pool::create_pool_ledger_config("create_pool_ledger_config_works_for_empty_genesis_txns", Some(pool_config.as_str())); - assert_code!(ErrorCode::CommonInvalidStructure, res); - } } mod open { @@ -101,106 +71,74 @@ mod high_cases { #[test] #[cfg(feature = "local_nodes_pool")] fn open_pool_ledger_works() { - Setup::empty(); + let setup = Setup::empty(); pool::set_protocol_version(PROTOCOL_VERSION).unwrap(); - let pool_name = "open_pool_ledger_works"; - let txn_file_path = pool::create_genesis_txn_file_for_test_pool(pool_name, None, None); + let txn_file_path = pool::create_genesis_txn_file_for_test_pool(&setup.name, None, None); let pool_config = pool::pool_config_json(txn_file_path.as_path()); - pool::create_pool_ledger_config(pool_name, Some(pool_config.as_str())).unwrap(); + pool::create_pool_ledger_config(&setup.name, Some(pool_config.as_str())).unwrap(); - pool::open_pool_ledger(pool_name, None).unwrap(); + pool::open_pool_ledger(&setup.name, None).unwrap(); } #[test] #[cfg(feature = "local_nodes_pool")] fn open_pool_ledger_works_for_config() { - Setup::empty(); + let setup = Setup::empty(); pool::set_protocol_version(PROTOCOL_VERSION).unwrap(); - let pool_name = "open_pool_ledger_works_for_config"; let config = r#"{"timeout": 20}"#; - let txn_file_path = pool::create_genesis_txn_file_for_test_pool(pool_name, None, None); + let txn_file_path = pool::create_genesis_txn_file_for_test_pool(&setup.name, None, None); let pool_config = pool::pool_config_json(txn_file_path.as_path()); - pool::create_pool_ledger_config(pool_name, Some(pool_config.as_str())).unwrap(); - - pool::open_pool_ledger(pool_name, Some(config)).unwrap(); - } - - #[test] - #[cfg(feature = "local_nodes_pool")] - fn open_pool_ledger_works_for_twice() { - Setup::empty(); - - let pool_name = "open_pool_ledger_works_for_twice"; - pool::create_and_open_pool_ledger(pool_name).unwrap(); + pool::create_pool_ledger_config(&setup.name, Some(pool_config.as_str())).unwrap(); - let res = pool::open_pool_ledger(pool_name, None); - assert_code!(ErrorCode::PoolLedgerInvalidPoolHandle, res); + pool::open_pool_ledger(&setup.name, Some(config)).unwrap(); } #[test] #[cfg(feature = "local_nodes_pool")] fn open_pool_ledger_works_for_two_nodes() { - Setup::empty(); + let setup = Setup::empty(); pool::set_protocol_version(PROTOCOL_VERSION).unwrap(); - let pool_name = "open_pool_ledger_works_for_two_nodes"; - let txn_file_path = pool::create_genesis_txn_file_for_test_pool(pool_name, Some(2), None); + let txn_file_path = pool::create_genesis_txn_file_for_test_pool(&setup.name, Some(2), None); let pool_config = pool::pool_config_json(txn_file_path.as_path()); - pool::create_pool_ledger_config(pool_name, Some(pool_config.as_str())).unwrap(); + pool::create_pool_ledger_config(&setup.name, Some(pool_config.as_str())).unwrap(); - pool::open_pool_ledger(pool_name, None).unwrap(); + pool::open_pool_ledger(&setup.name, None).unwrap(); } #[test] #[cfg(feature = "local_nodes_pool")] fn open_pool_ledger_works_for_three_nodes() { - Setup::empty(); + let setup = Setup::empty(); pool::set_protocol_version(PROTOCOL_VERSION).unwrap(); - let pool_name = "open_pool_ledger_works_for_three_nodes"; - let txn_file_path = pool::create_genesis_txn_file_for_test_pool(pool_name, Some(3), None); + let txn_file_path = pool::create_genesis_txn_file_for_test_pool(&setup.name, Some(3), None); let pool_config = pool::pool_config_json(txn_file_path.as_path()); - pool::create_pool_ledger_config(pool_name, Some(pool_config.as_str())).unwrap(); + pool::create_pool_ledger_config(&setup.name, Some(pool_config.as_str())).unwrap(); - pool::open_pool_ledger(pool_name, None).unwrap(); + pool::open_pool_ledger(&setup.name, None).unwrap(); } #[test] #[cfg(feature = "local_nodes_pool")] pub fn open_pool_ledger_works_for_cached_txns() { - Setup::empty(); - - pool::set_protocol_version(PROTOCOL_VERSION).unwrap(); - - let pool_name = "open_pool_ledger_works_for_cached_txns"; - let txn_file_path = pool::create_genesis_txn_file_for_test_pool(pool_name, None, None); - let pool_config = pool::pool_config_json(txn_file_path.as_path()); - pool::create_pool_ledger_config(pool_name, Some(pool_config.as_str())).unwrap(); - pool::dump_correct_genesis_txns_to_cache(pool_name).unwrap(); - - pool::open_pool_ledger(pool_name, None).unwrap(); - } - - #[test] - pub fn open_pool_ledger_works_for_corrupted_cached_txns() { - Setup::empty(); + let setup = Setup::empty(); pool::set_protocol_version(PROTOCOL_VERSION).unwrap(); - let pool_name = "open_pool_ledger_works_for_corrupted_cached_txns"; - let txn_file_path = pool::create_genesis_txn_file_for_test_pool(pool_name, None, None); + let txn_file_path = pool::create_genesis_txn_file_for_test_pool(&setup.name, None, None); let pool_config = pool::pool_config_json(txn_file_path.as_path()); - pool::create_pool_ledger_config(pool_name, Some(pool_config.as_str())).unwrap(); - pool::dump_incorrect_genesis_txns_to_cache(pool_name).unwrap(); + pool::create_pool_ledger_config(&setup.name, Some(pool_config.as_str())).unwrap(); + pool::dump_correct_genesis_txns_to_cache(&setup.name).unwrap(); - pool::open_pool_ledger(pool_name, None).unwrap(); + pool::open_pool_ledger(&setup.name, None).unwrap(); } } @@ -218,28 +156,12 @@ mod high_cases { mod close { use super::*; - extern crate futures; - - use self::futures::Future; - #[test] #[cfg(feature = "local_nodes_pool")] fn indy_close_pool_ledger_works() { Setup::pool(); } - #[test] - #[cfg(feature = "local_nodes_pool")] - fn indy_close_pool_ledger_works_for_twice() { - let setup = Setup::empty(); - - let pool_handle = pool::create_and_open_pool_ledger(&setup.name).unwrap(); - - pool::close(pool_handle).unwrap(); - let res = pool::close(pool_handle); - assert_code!(ErrorCode::PoolLedgerInvalidPoolHandle, res); - } - #[test] #[cfg(feature = "local_nodes_pool")] fn indy_close_pool_ledger_works_for_reopen_after_close() { @@ -248,27 +170,6 @@ mod high_cases { pool::close(setup.pool_handle).unwrap(); setup.pool_handle = pool::open_pool_ledger(&setup.name, None).unwrap(); } - - #[test] - #[cfg(feature = "local_nodes_pool")] - fn indy_close_pool_ledger_works_for_pending_request() { - let setup = Setup::empty(); - - let pool_handle = pool::create_and_open_pool_ledger(&setup.name).unwrap(); - - let get_nym_req = ledger::build_get_nym_request(Some(DID_MY1), DID_MY1).unwrap(); - - let submit_fut = indy::ledger::submit_request(pool_handle, &get_nym_req); - - pool::close(pool_handle).unwrap(); - - let res = submit_fut.wait(); - assert_code!(ErrorCode::PoolLedgerTerminated, res); - - /* Now any request to API can failed, if pool::close works incorrect in case of pending requests. - For example try to delete the pool. */ - pool::delete(&setup.name).unwrap(); - } } mod delete { @@ -276,13 +177,13 @@ mod high_cases { #[test] fn indy_delete_pool_ledger_config_works() { - Setup::empty(); + let setup = Setup::empty(); - let txn_file_path = pool::create_genesis_txn_file_for_test_pool("indy_delete_pool_ledger_config_works", None, None); + let txn_file_path = pool::create_genesis_txn_file_for_test_pool(&setup.name, None, None); let pool_config = pool::pool_config_json(txn_file_path.as_path()); - pool::create_pool_ledger_config("indy_delete_pool_ledger_config_works", Some(pool_config.as_str())).unwrap(); + pool::create_pool_ledger_config(&setup.name, Some(pool_config.as_str())).unwrap(); - pool::delete("indy_delete_pool_ledger_config_works").unwrap(); + pool::delete(&setup.name).unwrap(); } #[test] @@ -293,15 +194,6 @@ mod high_cases { let res = pool::delete(&setup.name); assert_code!(ErrorCode::CommonInvalidState, res); } - - #[test] - fn indy_delete_pool_ledger_config_works_for_closed() { - Setup::empty(); - - let pool_handle = pool::create_and_open_pool_ledger("indy_delete_pool_ledger_config_works_for_closed").unwrap(); - pool::close(pool_handle).unwrap(); - pool::delete("indy_delete_pool_ledger_config_works_for_closed").unwrap(); - } } mod set_protocol_version { @@ -314,13 +206,33 @@ mod high_cases { } } -#[cfg(not(feature="only_high_cases"))] +#[cfg(not(feature = "only_high_cases"))] mod medium_cases { use super::*; + use utils::ledger; mod create { use super::*; + #[test] + fn create_pool_ledger_config_works_for_empty_name() { + Setup::empty(); + + let pool_name = ""; + let res = pool::create_pool_ledger_config(pool_name, None); + assert_code!(ErrorCode::CommonInvalidParam2, res); + } + + #[test] + fn create_pool_ledger_config_works_for_empty_genesis_txns() { + let setup = Setup::empty(); + + let txn_file_path = pool::create_genesis_txn_file_for_test_pool(&setup.name, Some(0), None); + let pool_config = pool::pool_config_json(txn_file_path.as_path()); + let res = pool::create_pool_ledger_config(&setup.name, Some(pool_config.as_str())); + assert_code!(ErrorCode::CommonInvalidStructure, res); + } + #[test] fn create_pool_ledger_config_works_for_invalid_config_json() { let setup = Setup::empty(); @@ -364,6 +276,31 @@ mod medium_cases { mod open { use super::*; + #[test] + #[cfg(feature = "local_nodes_pool")] + fn open_pool_ledger_works_for_twice() { + let setup = Setup::empty(); + + pool::create_and_open_pool_ledger(&setup.name).unwrap(); + + let res = pool::open_pool_ledger(&setup.name, None); + assert_code!(ErrorCode::PoolLedgerInvalidPoolHandle, res); + } + + #[test] + pub fn open_pool_ledger_works_for_corrupted_cached_txns() { + let setup = Setup::empty(); + + pool::set_protocol_version(PROTOCOL_VERSION).unwrap(); + + let txn_file_path = pool::create_genesis_txn_file_for_test_pool(&setup.name, None, None); + let pool_config = pool::pool_config_json(txn_file_path.as_path()); + pool::create_pool_ledger_config(&setup.name, Some(pool_config.as_str())).unwrap(); + pool::dump_incorrect_genesis_txns_to_cache(&setup.name).unwrap(); + + pool::open_pool_ledger(&setup.name, None).unwrap(); + } + #[test] #[cfg(feature = "local_nodes_pool")] fn open_pool_ledger_works_for_invalid_name() { @@ -488,6 +425,43 @@ mod medium_cases { mod close { use super::*; + extern crate futures; + + use self::futures::Future; + + #[test] + #[cfg(feature = "local_nodes_pool")] + fn indy_close_pool_ledger_works_for_twice() { + let setup = Setup::empty(); + + let pool_handle = pool::create_and_open_pool_ledger(&setup.name).unwrap(); + + pool::close(pool_handle).unwrap(); + let res = pool::close(pool_handle); + assert_code!(ErrorCode::PoolLedgerInvalidPoolHandle, res); + } + + #[test] + #[cfg(feature = "local_nodes_pool")] + fn indy_close_pool_ledger_works_for_pending_request() { + let setup = Setup::empty(); + + let pool_handle = pool::create_and_open_pool_ledger(&setup.name).unwrap(); + + let get_nym_req = ledger::build_get_nym_request(Some(DID_MY1), DID_MY1).unwrap(); + + let submit_fut = indy::ledger::submit_request(pool_handle, &get_nym_req); + + pool::close(pool_handle).unwrap(); + + let res = submit_fut.wait(); + assert_code!(ErrorCode::PoolLedgerTerminated, res); + + /* Now any request to API can failed, if pool::close works incorrect in case of pending requests. + For example try to delete the pool. */ + pool::delete(&setup.name).unwrap(); + } + #[test] #[cfg(feature = "local_nodes_pool")] fn indy_close_pool_ledger_works_for_invalid_handle() { @@ -501,6 +475,15 @@ mod medium_cases { mod delete { use super::*; + #[test] + fn indy_delete_pool_ledger_config_works_for_closed() { + let setup = Setup::empty(); + + let pool_handle = pool::create_and_open_pool_ledger(&setup.name).unwrap(); + pool::close(pool_handle).unwrap(); + pool::delete(&setup.name).unwrap(); + } + #[test] fn indy_delete_pool_ledger_config_works_for_not_created() { let setup = Setup::empty(); diff --git a/libindy/tests/wallet.rs b/libindy/tests/wallet.rs index f75dd3baf2..e2a90a6539 100644 --- a/libindy/tests/wallet.rs +++ b/libindy/tests/wallet.rs @@ -36,14 +36,16 @@ use self::indy::ErrorCode; use std::path::PathBuf; use std::fs; -pub const CONFIG: &'static str = r#"{"freshness_time":1000}"#; - fn cleanup_file(path: &PathBuf) { if path.exists() { fs::remove_file(path).unwrap(); } } +fn config(name: &str) -> String { + json!({"id": name}).to_string() +} + mod high_cases { use super::*; @@ -68,19 +70,20 @@ mod high_cases { #[test] fn indy_create_wallet_works() { - Setup::empty(); - wallet::create_wallet(DEFAULT_WALLET_CONFIG, WALLET_CREDENTIALS).unwrap(); + let setup = Setup::empty(); + let config = config(&setup.name); + wallet::create_wallet(&config, WALLET_CREDENTIALS).unwrap(); } #[test] fn indy_create_wallet_works_for_custom_path() { - Setup::empty(); + let setup = Setup::empty(); let config = json!({ - "id": "wallet_1_indy_create_wallet_works_for_custom_path", + "id": &setup.name, "storage_type": "default", "storage_config": { - "path": _custom_path("indy_create_wallet_works_for_custom_path"), + "path": _custom_path(&setup.name), } }).to_string(); @@ -105,14 +108,6 @@ mod high_cases { let res = wallet::create_wallet(UNKNOWN_WALLET_CONFIG, WALLET_CREDENTIALS); assert_code!(ErrorCode::WalletUnknownTypeError, res); } - - #[test] - fn indy_create_wallet_works_for_empty_type() { - const WALLET_CONFIG: &str = r#"{"id":"indy_create_wallet_works_for_empty_type"}"#; - Setup::empty(); - - wallet::create_wallet(WALLET_CONFIG, WALLET_CREDENTIALS).unwrap(); - } } mod delete_wallet { @@ -120,23 +115,24 @@ mod high_cases { #[test] fn indy_delete_wallet_works() { - const WALLET_CONFIG: &str = r#"{"id":"indy_delete_wallet_works"}"#; - Setup::empty(); + let setup = Setup::empty(); + let config = config(&setup.name); - wallet::create_wallet(WALLET_CONFIG, WALLET_CREDENTIALS).unwrap(); - wallet::delete_wallet(WALLET_CONFIG, WALLET_CREDENTIALS).unwrap(); - wallet::create_wallet(WALLET_CONFIG, WALLET_CREDENTIALS).unwrap(); + wallet::create_wallet(&config, WALLET_CREDENTIALS).unwrap(); + wallet::delete_wallet(&config, WALLET_CREDENTIALS).unwrap(); + wallet::create_wallet(&config, WALLET_CREDENTIALS).unwrap(); + wallet::delete_wallet(&config, WALLET_CREDENTIALS).unwrap(); } #[test] fn indy_delete_wallet_works_for_custom_path() { - Setup::empty(); + let setup = Setup::empty(); let config = json!({ - "id": "wallet_1_indy_delete_wallet_works_for_custom_path", + "id": &setup.name, "storage_type": "default", "storage_config": { - "path": _custom_path("indy_delete_wallet_works_for_custom_path"), + "path": _custom_path(&setup.name), } }).to_string(); @@ -145,26 +141,14 @@ mod high_cases { wallet::create_wallet(&config, WALLET_CREDENTIALS).unwrap(); } - #[test] - fn indy_delete_wallet_works_for_closed() { - const WALLET_CONFIG: &str = r#"{"id":"indy_delete_wallet_works_for_closed"}"#; - Setup::empty(); - - wallet::create_wallet(WALLET_CONFIG, WALLET_CREDENTIALS).unwrap(); - let wallet_handle = wallet::open_wallet(WALLET_CONFIG, WALLET_CREDENTIALS).unwrap(); - wallet::close_wallet(wallet_handle).unwrap(); - wallet::delete_wallet(WALLET_CONFIG, WALLET_CREDENTIALS).unwrap(); - wallet::create_wallet(WALLET_CONFIG, WALLET_CREDENTIALS).unwrap(); - } - #[test] fn indy_delete_wallet_works_for_opened() { - const WALLET_CONFIG: &str = r#"{"id":"indy_delete_wallet_works_for_opened"}"#; - Setup::empty(); + let setup = Setup::empty(); + let config = config(&setup.name); - wallet::create_wallet(WALLET_CONFIG, WALLET_CREDENTIALS).unwrap(); - let wallet_handle = wallet::open_wallet(WALLET_CONFIG, WALLET_CREDENTIALS).unwrap(); - let res = wallet::delete_wallet(WALLET_CONFIG, WALLET_CREDENTIALS); + wallet::create_wallet(&config, WALLET_CREDENTIALS).unwrap(); + let wallet_handle = wallet::open_wallet(&config, WALLET_CREDENTIALS).unwrap(); + let res = wallet::delete_wallet(&config, WALLET_CREDENTIALS); assert_code!(ErrorCode::CommonInvalidState, res); wallet::close_wallet(wallet_handle).unwrap(); @@ -194,13 +178,13 @@ mod high_cases { #[test] fn indy_open_wallet_works_for_custom_path() { - Setup::empty(); + let setup = Setup::empty(); let config = json!({ - "id": "indy_open_wallet_works_for_custom_path", + "id": &setup.name, "storage_type": "default", "storage_config": { - "path": _custom_path("indy_open_wallet_works_for_custom_path"), + "path": _custom_path(&setup.name), } }).to_string(); @@ -231,17 +215,16 @@ mod high_cases { #[test] fn indy_close_wallet_works() { let setup = Setup::empty(); + let config = config(&setup.name); - let wallet_config = json!({"id": &setup.name}).to_string(); - - wallet::create_wallet(&wallet_config, WALLET_CREDENTIALS).unwrap(); - let wallet_handle = wallet::open_wallet(&wallet_config, WALLET_CREDENTIALS).unwrap(); + wallet::create_wallet(&config, WALLET_CREDENTIALS).unwrap(); + let wallet_handle = wallet::open_wallet(&config, WALLET_CREDENTIALS).unwrap(); wallet::close_wallet(wallet_handle).unwrap(); - let wallet_handle = wallet::open_wallet(&wallet_config, WALLET_CREDENTIALS).unwrap(); + let wallet_handle = wallet::open_wallet(&config, WALLET_CREDENTIALS).unwrap(); wallet::close_wallet(wallet_handle).unwrap(); - wallet::delete_wallet(&wallet_config, WALLET_CREDENTIALS).unwrap(); + wallet::delete_wallet(&config, WALLET_CREDENTIALS).unwrap(); } #[test] @@ -269,7 +252,7 @@ mod high_cases { fn indy_export_wallet_works() { let setup = Setup::wallet(); - let path = wallet::export_wallet_path("indy_export_wallet_works"); + let path = wallet::export_wallet_path(&setup.name); let config_json = wallet::prepare_export_wallet_config(&path); did::create_my_did(setup.wallet_handle, "{}").unwrap(); @@ -280,7 +263,7 @@ mod high_cases { assert!(path.exists()); - test::cleanup_files(&path, "indy_export_wallet_works_export_wallet"); + test::cleanup_files(&path, &setup.name); } } @@ -289,13 +272,13 @@ mod high_cases { #[test] fn indy_import_wallet_works() { - const WALLET_CONFIG: &str = r#"{"id":"indy_import_wallet_works"}"#; - Setup::empty(); + let setup = Setup::wallet(); + let config = config(&setup.name); - let path = wallet::export_wallet_path("indy_import_wallet_works"); + let path = wallet::export_wallet_path(&setup.name); let config_json = wallet::prepare_export_wallet_config(&path); - let (wallet_handle, wallet_config) = wallet::create_and_open_default_wallet("indy_import_wallet_works").unwrap(); + let (wallet_handle, wallet_config) = wallet::create_and_open_default_wallet(&setup.name).unwrap(); let (did, _) = did::create_my_did(wallet_handle, "{}").unwrap(); did::set_did_metadata(wallet_handle, &did, METADATA).unwrap(); @@ -308,9 +291,9 @@ mod high_cases { wallet::close_wallet(wallet_handle).unwrap(); wallet::delete_wallet(&wallet_config, WALLET_CREDENTIALS).unwrap(); - wallet::import_wallet(WALLET_CONFIG, WALLET_CREDENTIALS, &config_json).unwrap(); + wallet::import_wallet(&config, WALLET_CREDENTIALS, &config_json).unwrap(); - let wallet_handle = wallet::open_wallet(WALLET_CONFIG, WALLET_CREDENTIALS).unwrap(); + let wallet_handle = wallet::open_wallet(&config, WALLET_CREDENTIALS).unwrap(); let did_with_meta_after_import = did::get_my_did_with_metadata(wallet_handle, &did).unwrap(); @@ -326,34 +309,34 @@ mod high_cases { #[test] fn indy_generate_wallet_key_works() { - const WALLET_CONFIG: &str = r#"{"id":"indy_generate_wallet_key_works"}"#; - Setup::empty(); + let setup = Setup::wallet(); + let config = config(&setup.name); let key = wallet::generate_wallet_key(None).unwrap(); let credentials = json!({"key": key, "key_derivation_method": "RAW"}).to_string(); - wallet::create_wallet(WALLET_CONFIG, &credentials).unwrap(); + wallet::create_wallet(&config, &credentials).unwrap(); - let wallet_handle = wallet::open_wallet(WALLET_CONFIG, &credentials).unwrap(); + let wallet_handle = wallet::open_wallet(&config, &credentials).unwrap(); wallet::close_wallet(wallet_handle).unwrap(); - wallet::delete_wallet(WALLET_CONFIG, &credentials).unwrap(); + wallet::delete_wallet(&config, &credentials).unwrap(); } #[test] fn indy_generate_wallet_key_works_for_seed() { - const WALLET_CONFIG: &str = r#"{"id":"indy_generate_wallet_key_works_for_seed"}"#; - Setup::empty(); + let setup = Setup::wallet(); + let wallet_config = config(&setup.name); let config = json!({"seed": MY1_SEED}).to_string(); let key = wallet::generate_wallet_key(Some(config.as_str())).unwrap(); assert_eq!(key.from_base58().unwrap(), vec![177, 92, 220, 199, 104, 203, 161, 4, 218, 78, 105, 13, 7, 50, 66, 107, 154, 155, 108, 133, 1, 30, 87, 149, 233, 76, 39, 156, 178, 46, 230, 124]); let credentials = json!({"key": key, "key_derivation_method": "RAW"}).to_string(); - wallet::create_wallet(WALLET_CONFIG, &credentials).unwrap(); + wallet::create_wallet(&wallet_config, &credentials).unwrap(); - let wallet_handle = wallet::open_wallet(WALLET_CONFIG, &credentials).unwrap(); + let wallet_handle = wallet::open_wallet(&wallet_config, &credentials).unwrap(); wallet::close_wallet(wallet_handle).unwrap(); - wallet::delete_wallet(WALLET_CONFIG, &credentials).unwrap(); + wallet::delete_wallet(&wallet_config, &credentials).unwrap(); } } } @@ -405,40 +388,49 @@ mod medium_cases { mod create_wallet { use super::*; + #[test] + fn indy_create_wallet_works_for_empty_type() { + let setup = Setup::wallet(); + let config = config(&setup.name); + + wallet::create_wallet(&config, WALLET_CREDENTIALS).unwrap(); + } + #[test] fn indy_create_wallet_works_for_duplicate_name() { - const WALLET_CONFIG: &str = r#"{"id":"indy_create_wallet_works_for_duplicate_name"}"#; - Setup::empty(); + let setup = Setup::wallet(); + let config = config(&setup.name); - wallet::create_wallet(WALLET_CONFIG, WALLET_CREDENTIALS).unwrap(); - let res = wallet::create_wallet(WALLET_CONFIG, WALLET_CREDENTIALS); + wallet::create_wallet(&config, WALLET_CREDENTIALS).unwrap(); + let res = wallet::create_wallet(&config, WALLET_CREDENTIALS); assert_code!(ErrorCode::WalletAlreadyExistsError, res); } #[test] fn indy_create_wallet_works_for_missed_key() { - const WALLET_CONFIG: &str = r#"{"id":"indy_create_wallet_works_for_missed_key"}"#; - Setup::empty(); + let setup = Setup::empty(); + let config = config(&setup.name); - let res = wallet::create_wallet(WALLET_CONFIG, r#"{}"#); + let res = wallet::create_wallet(&config, r#"{}"#); assert_code!(ErrorCode::CommonInvalidStructure, res); } #[test] fn indy_create_wallet_works_for_empty_name() { Setup::empty(); + let config = config(""); - let res = wallet::create_wallet(r#"{"id": ""}"#, WALLET_CREDENTIALS); + let res = wallet::create_wallet(&config, WALLET_CREDENTIALS); assert_code!(ErrorCode::CommonInvalidStructure, res); } #[test] fn indy_create_wallet_works_for_raw_key_invalid_length() { - const WALLET_CONFIG: &str = r#"{"id":"indy_create_wallet_works_for_raw_key_invalid_length"}"#; - Setup::empty(); + let setup = Setup::empty(); + let config = config(&setup.name); let credentials = json!({"key": "key", "key_derivation_method": "RAW"}).to_string(); - let res = wallet::create_wallet(WALLET_CONFIG, &credentials); + let res = wallet::create_wallet(&config, &credentials); assert_code!(ErrorCode::CommonInvalidStructure, res); } } @@ -446,33 +438,45 @@ mod medium_cases { mod delete_wallet { use super::*; + #[test] + fn indy_delete_wallet_works_for_closed() { + let setup = Setup::empty(); + let config = config(&setup.name); + + wallet::create_wallet(&config, WALLET_CREDENTIALS).unwrap(); + let wallet_handle = wallet::open_wallet(&config, WALLET_CREDENTIALS).unwrap(); + wallet::close_wallet(wallet_handle).unwrap(); + wallet::delete_wallet(&config, WALLET_CREDENTIALS).unwrap(); + wallet::create_wallet(&config, WALLET_CREDENTIALS).unwrap(); + } + #[test] fn indy_delete_wallet_works_for_not_created() { - const WALLET_CONFIG: &str = r#"{"id":"indy_delete_wallet_works_for_not_created"}"#; - Setup::empty(); + let setup = Setup::empty(); + let config = config(&setup.name); - let res = wallet::delete_wallet(WALLET_CONFIG, WALLET_CREDENTIALS); + let res = wallet::delete_wallet(&config, WALLET_CREDENTIALS); assert_code!(ErrorCode::WalletNotFoundError, res); } #[test] fn indy_delete_wallet_works_for_twice() { - const WALLET_CONFIG: &str = r#"{"id":"indy_delete_wallet_works_for_twice"}"#; - Setup::empty(); + let setup = Setup::empty(); + let config = config(&setup.name); - wallet::create_wallet(WALLET_CONFIG, WALLET_CREDENTIALS).unwrap(); - wallet::delete_wallet(WALLET_CONFIG, WALLET_CREDENTIALS).unwrap(); - let res = wallet::delete_wallet(WALLET_CONFIG, WALLET_CREDENTIALS); + wallet::create_wallet(&config, WALLET_CREDENTIALS).unwrap(); + wallet::delete_wallet(&config, WALLET_CREDENTIALS).unwrap(); + let res = wallet::delete_wallet(&config, WALLET_CREDENTIALS); assert_code!(ErrorCode::WalletNotFoundError, res); } #[test] fn indy_delete_wallet_works_for_wrong_credentials() { - const WALLET_CONFIG: &str = r#"{"id":"indy_delete_wallet_works_for_wrong_credentials"}"#; - Setup::empty(); + let setup = Setup::empty(); + let config = config(&setup.name); - wallet::create_wallet(WALLET_CONFIG, r#"{"key":"key"}"#).unwrap(); - let res = wallet::delete_wallet(WALLET_CONFIG, r#"{"key":"other_key"}"#); + wallet::create_wallet(&config, r#"{"key":"key"}"#).unwrap(); + let res = wallet::delete_wallet(&config, r#"{"key":"other_key"}"#); assert_code!(ErrorCode::WalletAccessFailed, res); } } @@ -482,22 +486,22 @@ mod medium_cases { #[test] fn indy_open_wallet_works_for_not_created_wallet() { - const WALLET_CONFIG: &'static str = r#"{"id":"indy_open_wallet_works_for_not_created_wallet"}"#; - Setup::empty(); + let setup = Setup::empty(); + let config = config(&setup.name); - let res = wallet::open_wallet(WALLET_CONFIG, WALLET_CREDENTIALS); + let res = wallet::open_wallet(&config, WALLET_CREDENTIALS); assert_code!(ErrorCode::WalletNotFoundError, res); } #[test] fn indy_open_wallet_works_for_twice() { - const WALLET_CONFIG: &str = r#"{"id":"indy_open_wallet_works_for_twice"}"#; - Setup::empty(); + let setup = Setup::empty(); + let config = config(&setup.name); - wallet::create_wallet(WALLET_CONFIG, WALLET_CREDENTIALS).unwrap(); + wallet::create_wallet(&config, WALLET_CREDENTIALS).unwrap(); - let wallet_handle = wallet::open_wallet(WALLET_CONFIG, WALLET_CREDENTIALS).unwrap(); - let res = wallet::open_wallet(WALLET_CONFIG, WALLET_CREDENTIALS); + let wallet_handle = wallet::open_wallet(&config, WALLET_CREDENTIALS).unwrap(); + let res = wallet::open_wallet(&config, WALLET_CREDENTIALS); assert_code!(ErrorCode::WalletAlreadyOpenedError, res); wallet::close_wallet(wallet_handle).unwrap(); @@ -554,35 +558,34 @@ mod medium_cases { #[test] fn indy_open_wallet_works_for_invalid_credentials() { - const WALLET_CONFIG: &'static str = r#"{"id":"indy_open_wallet_works_for_invalid_credentials"}"#; - Setup::empty(); + let setup = Setup::empty(); + let config = config(&setup.name); - wallet::create_wallet(WALLET_CONFIG, r#"{"key":"key"}"#).unwrap(); - let res = wallet::open_wallet(WALLET_CONFIG, r#"{"key":"other_key"}"#); + wallet::create_wallet(&config, r#"{"key":"key"}"#).unwrap(); + let res = wallet::open_wallet(&config, r#"{"key":"other_key"}"#); assert_code!(ErrorCode::WalletAccessFailed, res); } #[test] fn indy_open_wallet_works_for_changing_credentials() { - const WALLET_CONFIG: &'static str = r#"{"id":"indy_open_wallet_works_for_changing_credentials"}"#; - Setup::empty(); + let setup = Setup::empty(); + let config = config(&setup.name); - wallet::create_wallet(WALLET_CONFIG, r#"{"key":"key"}"#).unwrap(); - let wallet_handle = wallet::open_wallet(WALLET_CONFIG, r#"{"key":"key", "rekey":"other_key"}"#).unwrap(); + wallet::create_wallet(&config, r#"{"key":"key"}"#).unwrap(); + let wallet_handle = wallet::open_wallet(&config, r#"{"key":"key", "rekey":"other_key"}"#).unwrap(); wallet::close_wallet(wallet_handle).unwrap(); - let wallet_handle = wallet::open_wallet(WALLET_CONFIG, r#"{"key":"other_key"}"#).unwrap(); + let wallet_handle = wallet::open_wallet(&config, r#"{"key":"other_key"}"#).unwrap(); wallet::close_wallet(wallet_handle).unwrap(); } #[test] fn indy_open_wallet_works_for_invalid_config() { - const WALLET_CONFIG: &'static str = r#"{"id":"indy_open_wallet_works_for_invalid_config"}"#; Setup::empty(); let config = r#"{"field":"value"}"#; - wallet::create_wallet(WALLET_CONFIG, WALLET_CREDENTIALS).unwrap(); + wallet::create_wallet(&config, WALLET_CREDENTIALS).unwrap(); let res = wallet::open_wallet(config, WALLET_CREDENTIALS); assert_code!(ErrorCode::CommonInvalidStructure, res); } @@ -676,23 +679,23 @@ mod medium_cases { #[test] fn indy_import_wallet_returns_error_if_invalid_config() { - const WALLET_CONFIG: &str = r#"{"id":"indy_import_wallet_returns_error_if_path_doesnt_exist"}"#; - Setup::empty(); + let setup = Setup::empty(); + let config = config(&setup.name); - let res = wallet::import_wallet(WALLET_CONFIG, WALLET_CREDENTIALS, "{}"); + let res = wallet::import_wallet(&config, WALLET_CREDENTIALS, "{}"); assert_code!(ErrorCode::CommonInvalidStructure, res); } #[test] fn indy_import_wallet_works_for_other_key() { - const WALLET_CONFIG: &str = r#"{"id":"indy_import_wallet_works_for_other_key"}"#; - Setup::empty(); + let setup = Setup::empty(); + let config = config(&setup.name); let path = wallet::export_wallet_path("indy_import_wallet_works_for_other_key_export_wallet"); let config_json = wallet::prepare_export_wallet_config(&path); - wallet::create_wallet(WALLET_CONFIG, WALLET_CREDENTIALS).unwrap(); - let wallet_handle = wallet::open_wallet(WALLET_CONFIG, WALLET_CREDENTIALS).unwrap(); + wallet::create_wallet(&config, WALLET_CREDENTIALS).unwrap(); + let wallet_handle = wallet::open_wallet(&config, WALLET_CREDENTIALS).unwrap(); did::create_my_did(wallet_handle, "{}").unwrap(); @@ -700,14 +703,14 @@ mod medium_cases { wallet::export_wallet(wallet_handle, &config_json).unwrap(); wallet::close_wallet(wallet_handle).unwrap(); - wallet::delete_wallet(WALLET_CONFIG, WALLET_CREDENTIALS).unwrap(); + wallet::delete_wallet(&config, WALLET_CREDENTIALS).unwrap(); let config_json = json!({ "path": path.to_str().unwrap(), "key": "other_key", }).to_string(); - let res = wallet::import_wallet(WALLET_CONFIG, WALLET_CREDENTIALS, &config_json); + let res = wallet::import_wallet(&config, WALLET_CREDENTIALS, &config_json); assert_code!(ErrorCode::CommonInvalidStructure, res); cleanup_file(&path); @@ -715,21 +718,21 @@ mod medium_cases { #[test] fn indy_import_wallet_works_for_duplicate_name() { - const WALLET_CONFIG: &str = r#"{"id":"indy_import_wallet_works_for_duplicate_name"}"#; - Setup::empty(); + let setup = Setup::empty(); + let config = config(&setup.name); let path = wallet::export_wallet_path("indy_import_wallet_works_for_duplicate_name_export_wallet"); let config_json = wallet::prepare_export_wallet_config(&path); - wallet::create_wallet(WALLET_CONFIG, WALLET_CREDENTIALS).unwrap(); - let wallet_handle = wallet::open_wallet(WALLET_CONFIG, WALLET_CREDENTIALS).unwrap(); + wallet::create_wallet(&config, WALLET_CREDENTIALS).unwrap(); + let wallet_handle = wallet::open_wallet(&config, WALLET_CREDENTIALS).unwrap(); did::create_my_did(wallet_handle, "{}").unwrap(); cleanup_file(&path); wallet::export_wallet(wallet_handle, &config_json).unwrap(); - let res = wallet::import_wallet(WALLET_CONFIG, WALLET_CREDENTIALS, &config_json); + let res = wallet::import_wallet(&config, WALLET_CREDENTIALS, &config_json); assert_code!(ErrorCode::WalletAlreadyExistsError, res); wallet::close_wallet(wallet_handle).unwrap(); From 0dd775e4dbd98a4e419567c8f068ad245ce0cb50 Mon Sep 17 00:00:00 2001 From: "artem.ivanov" Date: Thu, 22 Aug 2019 09:37:02 +0300 Subject: [PATCH 248/320] IS-912: UX: Early static validation - types for SchemaId, CredDefId, RevRegId Signed-off-by: artem.ivanov --- libindy/src/api/anoncreds.rs | 87 ++++---- libindy/src/api/cache.rs | 7 +- libindy/src/api/ledger.rs | 22 +- libindy/src/commands/anoncreds/issuer.rs | 196 +++++++++--------- libindy/src/commands/anoncreds/prover.rs | 42 ++-- libindy/src/commands/anoncreds/verifier.rs | 24 +-- libindy/src/commands/cache.rs | 20 +- libindy/src/commands/ledger.rs | 38 ++-- libindy/src/domain/anoncreds/credential.rs | 55 +++-- .../domain/anoncreds/credential_definition.rs | 101 ++++++--- .../src/domain/anoncreds/credential_offer.rs | 17 +- .../domain/anoncreds/credential_request.rs | 17 +- libindy/src/domain/anoncreds/master_secret.rs | 4 + libindy/src/domain/anoncreds/proof.rs | 21 +- libindy/src/domain/anoncreds/proof_request.rs | 40 +++- .../domain/anoncreds/requested_credential.rs | 11 + .../domain/anoncreds/revocation_registry.rs | 28 ++- .../revocation_registry_definition.rs | 63 ++++-- .../anoncreds/revocation_registry_delta.rs | 4 + .../src/domain/anoncreds/revocation_state.rs | 16 ++ libindy/src/domain/anoncreds/schema.rs | 51 +++-- libindy/src/domain/ledger/cred_def.rs | 2 +- libindy/src/domain/ledger/rev_reg.rs | 27 +-- libindy/src/domain/ledger/rev_reg_def.rs | 17 +- libindy/src/services/anoncreds/prover.rs | 18 +- libindy/src/services/anoncreds/verifier.rs | 46 ++-- libindy/src/services/ledger/mod.rs | 95 ++++----- libindy/src/utils/validation.rs | 4 +- libindy/tests/anoncreds.rs | 16 +- libindy/tests/cache.rs | 4 +- libindy/tests/interaction.rs | 28 +-- libindy/tests/ledger.rs | 5 +- libindy/tests/utils/anoncreds.rs | 34 +-- 33 files changed, 698 insertions(+), 462 deletions(-) diff --git a/libindy/src/api/anoncreds.rs b/libindy/src/api/anoncreds.rs index 63f23d137d..c959cb8ed5 100644 --- a/libindy/src/api/anoncreds.rs +++ b/libindy/src/api/anoncreds.rs @@ -5,24 +5,23 @@ use commands::anoncreds::AnoncredsCommand; use commands::anoncreds::issuer::IssuerCommand; use commands::anoncreds::prover::ProverCommand; use commands::anoncreds::verifier::VerifierCommand; -use domain::anoncreds::schema::{Schema, AttributeNames}; -use domain::anoncreds::credential_definition::{CredentialDefinition, CredentialDefinitionConfig}; +use domain::anoncreds::schema::{Schema, AttributeNames, Schemas}; +use domain::anoncreds::credential_definition::{CredentialDefinition, CredentialDefinitionConfig, CredentialDefinitionId, CredentialDefinitions}; use domain::anoncreds::credential_offer::CredentialOffer; use domain::anoncreds::credential_request::{CredentialRequest, CredentialRequestMetadata}; use domain::anoncreds::credential_attr_tag_policy::CredentialAttrTagPolicy; use domain::anoncreds::credential::{Credential, CredentialValues}; -use domain::anoncreds::revocation_registry_definition::{RevocationRegistryConfig, RevocationRegistryDefinition}; +use domain::anoncreds::revocation_registry_definition::{RevocationRegistryConfig, RevocationRegistryDefinition, RevocationRegistryId, RevocationRegistryDefinitions}; use domain::anoncreds::revocation_registry_delta::RevocationRegistryDelta; use domain::anoncreds::proof::Proof; use domain::anoncreds::proof_request::{ProofRequest, ProofRequestExtraQuery}; use domain::anoncreds::requested_credential::RequestedCredentials; -use domain::anoncreds::revocation_registry::RevocationRegistry; -use domain::anoncreds::revocation_state::RevocationState; +use domain::anoncreds::revocation_registry::RevocationRegistries; +use domain::anoncreds::revocation_state::{RevocationState, RevocationStates}; use utils::ctypes; use libc::c_char; use std::ptr; -use std::collections::HashMap; use utils::validation::Validatable; @@ -171,7 +170,7 @@ pub extern fn indy_issuer_create_and_store_credential_def(command_handle: Comman check_useful_validatable_json!(schema_json, ErrorCode::CommonInvalidParam4, Schema); check_useful_c_str!(tag, ErrorCode::CommonInvalidParam5); check_useful_opt_c_str!(signature_type, ErrorCode::CommonInvalidParam6); - check_useful_opt_json!(config_json, ErrorCode::CommonInvalidParam7, CredentialDefinitionConfig); + check_useful_opt_validatable_json!(config_json, ErrorCode::CommonInvalidParam7, CredentialDefinitionConfig); check_useful_c_callback!(cb, ErrorCode::CommonInvalidParam8); trace!("indy_issuer_create_and_store_credential_def: entities >>> wallet_handle: {:?}, issuer_did: {:?}, schema_json: {:?}, tag: {:?}, \ @@ -238,8 +237,8 @@ pub extern fn indy_issuer_rotate_credential_def_start(command_handle: CommandHan trace!("indy_issuer_rotate_credential_def_start: >>> wallet_handle: {:?}, cred_def_id: {:?}, config_json: {:?}", wallet_handle, cred_def_id, config_json); - check_useful_c_str!(cred_def_id, ErrorCode::CommonInvalidParam3); - check_useful_opt_json!(config_json, ErrorCode::CommonInvalidParam4, CredentialDefinitionConfig); + check_useful_validatable_json!(cred_def_id, ErrorCode::CommonInvalidParam3, CredentialDefinitionId); + check_useful_opt_validatable_json!(config_json, ErrorCode::CommonInvalidParam4, CredentialDefinitionConfig); check_useful_c_callback!(cb, ErrorCode::CommonInvalidParam5); trace!("indy_issuer_rotate_credential_def_start: entities >>> wallet_handle: {:?}, cred_def_id: {:?}, config_json: {:?}", @@ -291,7 +290,7 @@ pub extern fn indy_issuer_rotate_credential_def_apply(command_handle: CommandHan trace!("indy_issuer_rotate_credential_def_apply: >>> wallet_handle: {:?}, cred_def_id: {:?}", wallet_handle, cred_def_id); - check_useful_c_str!(cred_def_id, ErrorCode::CommonInvalidParam3); + check_useful_validatable_json!(cred_def_id, ErrorCode::CommonInvalidParam3, CredentialDefinitionId); check_useful_c_callback!(cb, ErrorCode::CommonInvalidParam4); trace!("indy_issuer_rotate_credential_def_apply: entities >>> wallet_handle: {:?}, cred_def_id: {:?}", @@ -412,7 +411,7 @@ pub extern fn indy_issuer_create_and_store_revoc_reg(command_handle: CommandHand check_useful_c_str!(issuer_did, ErrorCode::CommonInvalidParam3); check_useful_opt_c_str!(revoc_def_type, ErrorCode::CommonInvalidParam4); check_useful_c_str!(tag, ErrorCode::CommonInvalidParam5); - check_useful_c_str!(cred_def_id, ErrorCode::CommonInvalidParam6); + check_useful_validatable_json!(cred_def_id, ErrorCode::CommonInvalidParam6, CredentialDefinitionId); check_useful_validatable_json!(config_json, ErrorCode::CommonInvalidParam7, RevocationRegistryConfig); check_useful_c_callback!(cb, ErrorCode::CommonInvalidParam9); @@ -482,7 +481,7 @@ pub extern fn indy_issuer_create_credential_offer(command_handle: CommandHandle, cred_offer_json: *const c_char)>) -> ErrorCode { trace!("indy_issuer_create_credential_offer: >>> wallet_handle: {:?}, cred_def_id: {:?}", wallet_handle, cred_def_id); - check_useful_c_str!(cred_def_id, ErrorCode::CommonInvalidParam3); + check_useful_validatable_json!(cred_def_id, ErrorCode::CommonInvalidParam3, CredentialDefinitionId); check_useful_c_callback!(cb, ErrorCode::CommonInvalidParam4); trace!("indy_issuer_create_credential_offer: entities >>> wallet_handle: {:?}, cred_def_id: {:?}", wallet_handle, cred_def_id); @@ -566,10 +565,10 @@ pub extern fn indy_issuer_create_credential(command_handle: CommandHandle, trace!("indy_issuer_create_credential: >>> wallet_handle: {:?}, cred_offer_json: {:?}, cred_req_json: {:?}, cred_values_json: {:?}, rev_reg_id: {:?}, \ blob_storage_reader_handle: {:?}", wallet_handle, cred_offer_json, cred_req_json, cred_values_json, rev_reg_id, blob_storage_reader_handle); - check_useful_json!(cred_offer_json, ErrorCode::CommonInvalidParam3, CredentialOffer); - check_useful_json!(cred_req_json, ErrorCode::CommonInvalidParam4, CredentialRequest); + check_useful_validatable_json!(cred_offer_json, ErrorCode::CommonInvalidParam3, CredentialOffer); + check_useful_validatable_json!(cred_req_json, ErrorCode::CommonInvalidParam4, CredentialRequest); check_useful_validatable_json!(cred_values_json, ErrorCode::CommonInvalidParam5, CredentialValues); - check_useful_opt_c_str!(rev_reg_id, ErrorCode::CommonInvalidParam6); + check_useful_opt_validatable_json!(rev_reg_id, ErrorCode::CommonInvalidParam6, RevocationRegistryId); check_useful_c_callback!(cb, ErrorCode::CommonInvalidParam8); let blob_storage_reader_handle = if blob_storage_reader_handle != -1 { Some(blob_storage_reader_handle) } else { None }; @@ -641,7 +640,7 @@ pub extern fn indy_issuer_revoke_credential(command_handle: CommandHandle, trace!("indy_issuer_revoke_credential: >>> wallet_handle: {:?}, blob_storage_reader_cfg_handle: {:?}, rev_reg_id: {:?}, cred_revoc_id: {:?}", wallet_handle, blob_storage_reader_cfg_handle, rev_reg_id, cred_revoc_id); - check_useful_c_str!(rev_reg_id, ErrorCode::CommonInvalidParam4); + check_useful_validatable_json!(rev_reg_id, ErrorCode::CommonInvalidParam4, RevocationRegistryId); check_useful_c_str!(cred_revoc_id, ErrorCode::CommonInvalidParam5); check_useful_c_callback!(cb, ErrorCode::CommonInvalidParam6); @@ -745,8 +744,8 @@ pub extern fn indy_issuer_merge_revocation_registry_deltas(command_handle: Comma trace!("indy_issuer_merge_revocation_registry_deltas: >>> rev_reg_delta_json: {:?}, other_rev_reg_delta_json: {:?}", rev_reg_delta_json, other_rev_reg_delta_json); - check_useful_json!(rev_reg_delta_json, ErrorCode::CommonInvalidParam2, RevocationRegistryDelta); - check_useful_json!(other_rev_reg_delta_json, ErrorCode::CommonInvalidParam3, RevocationRegistryDelta); + check_useful_validatable_json!(rev_reg_delta_json, ErrorCode::CommonInvalidParam2, RevocationRegistryDelta); + check_useful_validatable_json!(other_rev_reg_delta_json, ErrorCode::CommonInvalidParam3, RevocationRegistryDelta); check_useful_c_callback!(cb, ErrorCode::CommonInvalidParam4); trace!("indy_issuer_merge_revocation_registry_deltas: entities >>> rev_reg_delta_json: {:?}, other_rev_reg_delta_json: {:?}", @@ -862,8 +861,8 @@ pub extern fn indy_prover_create_credential_req(command_handle: CommandHandle, wallet_handle, prover_did, cred_offer_json, cred_def_json, master_secret_id); check_useful_c_str!(prover_did, ErrorCode::CommonInvalidParam3); - check_useful_json!(cred_offer_json, ErrorCode::CommonInvalidParam4, CredentialOffer); - check_useful_json!(cred_def_json, ErrorCode::CommonInvalidParam5, CredentialDefinition); + check_useful_validatable_json!(cred_offer_json, ErrorCode::CommonInvalidParam4, CredentialOffer); + check_useful_validatable_json!(cred_def_json, ErrorCode::CommonInvalidParam5, CredentialDefinition); check_useful_c_str!(master_secret_id, ErrorCode::CommonInvalidParam6); check_useful_c_callback!(cb, ErrorCode::CommonInvalidParam7); @@ -940,7 +939,7 @@ pub extern fn indy_prover_set_credential_attr_tag_policy(command_handle: Command cb: Option) -> ErrorCode { trace!("indy_prover_set_credential_attr_tag_policy: >>> wallet_handle: {:?}, cred_def_id: {:?}, tag_attrs_json: {:?}, retroactive: {:?}", wallet_handle, cred_def_id, tag_attrs_json, retroactive); - check_useful_c_str!(cred_def_id, ErrorCode::CommonInvalidParam3); + check_useful_validatable_json!(cred_def_id, ErrorCode::CommonInvalidParam3, CredentialDefinitionId); check_useful_opt_json!(tag_attrs_json, ErrorCode::CommonInvalidParam4, CredentialAttrTagPolicy); check_useful_c_callback!(cb, ErrorCode::CommonInvalidParam6); @@ -996,7 +995,7 @@ pub extern fn indy_prover_get_credential_attr_tag_policy(command_handle: Command catpol_json: *const c_char)>) -> ErrorCode { trace!("indy_prover_get_credential_attr_tag_policy: >>> wallet_handle: {:?}, cred_def_id: {:?}", wallet_handle, cred_def_id); - check_useful_c_str!(cred_def_id, ErrorCode::CommonInvalidParam3); + check_useful_validatable_json!(cred_def_id, ErrorCode::CommonInvalidParam3, CredentialDefinitionId); check_useful_c_callback!(cb, ErrorCode::CommonInvalidParam4); trace!("indy_prover_get_credential_attr_tag_policy: entities >>> wallet_handle: {:?}, cred_def_id: {:?}", wallet_handle, cred_def_id); @@ -1065,10 +1064,10 @@ pub extern fn indy_prover_store_credential(command_handle: CommandHandle, cred_def_json: {:?}", wallet_handle, cred_id, cred_req_metadata_json, cred_json, cred_def_json, rev_reg_def_json); check_useful_opt_c_str!(cred_id, ErrorCode::CommonInvalidParam3); - check_useful_json!(cred_req_metadata_json, ErrorCode::CommonInvalidParam4, CredentialRequestMetadata); - check_useful_json!(cred_json, ErrorCode::CommonInvalidParam5, Credential); - check_useful_json!(cred_def_json, ErrorCode::CommonInvalidParam6, CredentialDefinition); - check_useful_opt_json!(rev_reg_def_json, ErrorCode::CommonInvalidParam7, RevocationRegistryDefinition); + check_useful_validatable_json!(cred_req_metadata_json, ErrorCode::CommonInvalidParam4, CredentialRequestMetadata); + check_useful_validatable_json!(cred_json, ErrorCode::CommonInvalidParam5, Credential); + check_useful_validatable_json!(cred_def_json, ErrorCode::CommonInvalidParam6, CredentialDefinition); + check_useful_opt_validatable_json!(rev_reg_def_json, ErrorCode::CommonInvalidParam7, RevocationRegistryDefinition); check_useful_c_callback!(cb, ErrorCode::CommonInvalidParam8); trace!("indy_prover_store_credential: entities >>> wallet_handle: {:?}, cred_id: {:?}, cred_req_metadata_json: {:?}, cred_json: {:?}, cred_def_json: {:?}, \ @@ -1490,7 +1489,7 @@ pub extern fn indy_prover_get_credentials_for_proof_req(command_handle: CommandH credentials_json: *const c_char)>) -> ErrorCode { trace!("indy_prover_get_credentials_for_proof_req: >>> wallet_handle: {:?}, proof_request_json: {:?}", wallet_handle, proof_request_json); - check_useful_json!(proof_request_json, ErrorCode::CommonInvalidParam3, ProofRequest); + check_useful_validatable_json!(proof_request_json, ErrorCode::CommonInvalidParam3, ProofRequest); check_useful_c_callback!(cb, ErrorCode::CommonInvalidParam5); trace!("indy_prover_get_credentials_for_proof_req: entities >>> wallet_handle: {:?}, proof_request_json: {:?}", @@ -1563,7 +1562,7 @@ pub extern fn indy_prover_search_credentials_for_proof_req(command_handle: Comma search_handle: SearchHandle)>) -> ErrorCode { trace!("indy_prover_search_credentials_for_proof_req: >>> wallet_handle: {:?}, proof_request_json: {:?}, extra_query_json: {:?}", wallet_handle, proof_request_json, extra_query_json); - check_useful_json!(proof_request_json, ErrorCode::CommonInvalidParam3, ProofRequest); + check_useful_validatable_json!(proof_request_json, ErrorCode::CommonInvalidParam3, ProofRequest); check_useful_opt_json!(extra_query_json, ErrorCode::CommonInvalidParam4, ProofRequestExtraQuery); check_useful_c_callback!(cb, ErrorCode::CommonInvalidParam5); @@ -1847,12 +1846,12 @@ pub extern fn indy_prover_create_proof(command_handle: CommandHandle, schemas_json: {:?}, credential_defs_json: {:?}, rev_states_json: {:?}", wallet_handle, proof_req_json, requested_credentials_json, master_secret_id, schemas_json, credential_defs_json, rev_states_json); - check_useful_json!(proof_req_json, ErrorCode::CommonInvalidParam3, ProofRequest); - check_useful_json!(requested_credentials_json, ErrorCode::CommonInvalidParam4, RequestedCredentials); + check_useful_validatable_json!(proof_req_json, ErrorCode::CommonInvalidParam3, ProofRequest); + check_useful_validatable_json!(requested_credentials_json, ErrorCode::CommonInvalidParam4, RequestedCredentials); check_useful_c_str!(master_secret_id, ErrorCode::CommonInvalidParam5); - check_useful_json!(schemas_json, ErrorCode::CommonInvalidParam6, HashMap); - check_useful_json!(credential_defs_json, ErrorCode::CommonInvalidParam7, HashMap); - check_useful_json!(rev_states_json, ErrorCode::CommonInvalidParam8, HashMap>); + check_useful_json!(schemas_json, ErrorCode::CommonInvalidParam6, Schemas); + check_useful_json!(credential_defs_json, ErrorCode::CommonInvalidParam7, CredentialDefinitions); + check_useful_json!(rev_states_json, ErrorCode::CommonInvalidParam8, RevocationStates); check_useful_c_callback!(cb, ErrorCode::CommonInvalidParam9); trace!("indy_prover_create_proof: entities >>> wallet_handle: {:?}, proof_req_json: {:?}, requested_credentials_json: {:?}, master_secret_id: {:?}, \ @@ -1979,12 +1978,12 @@ pub extern fn indy_verifier_verify_proof(command_handle: CommandHandle, trace!("indy_verifier_verify_proof: >>> proof_request_json: {:?}, proof_json: {:?}, schemas_json: {:?}, credential_defs_json: {:?}, \ rev_reg_defs_json: {:?}, rev_regs_json: {:?}", proof_request_json, proof_json, schemas_json, credential_defs_json, rev_reg_defs_json, rev_regs_json); - check_useful_json!(proof_request_json, ErrorCode::CommonInvalidParam2, ProofRequest); - check_useful_json!(proof_json, ErrorCode::CommonInvalidParam3, Proof); - check_useful_json!(schemas_json, ErrorCode::CommonInvalidParam4, HashMap); - check_useful_json!(credential_defs_json, ErrorCode::CommonInvalidParam5, HashMap); - check_useful_json!(rev_reg_defs_json, ErrorCode::CommonInvalidParam6, HashMap); - check_useful_json!(rev_regs_json, ErrorCode::CommonInvalidParam7, HashMap>); + check_useful_validatable_json!(proof_request_json, ErrorCode::CommonInvalidParam2, ProofRequest); + check_useful_validatable_json!(proof_json, ErrorCode::CommonInvalidParam3, Proof); + check_useful_json!(schemas_json, ErrorCode::CommonInvalidParam4, Schemas); + check_useful_json!(credential_defs_json, ErrorCode::CommonInvalidParam5, CredentialDefinitions); + check_useful_json!(rev_reg_defs_json, ErrorCode::CommonInvalidParam6, RevocationRegistryDefinitions); + check_useful_json!(rev_regs_json, ErrorCode::CommonInvalidParam7, RevocationRegistries); check_useful_c_callback!(cb, ErrorCode::CommonInvalidParam8); trace!("indy_verifier_verify_proof: entities >>> proof_request_json: {:?}, proof_json: {:?}, schemas_json: {:?}, credential_defs_json: {:?}, \ @@ -2050,8 +2049,8 @@ pub extern fn indy_create_revocation_state(command_handle: CommandHandle, trace!("indy_create_revocation_state: >>> blob_storage_reader_handle: {:?}, rev_reg_def_json: {:?}, rev_reg_delta_json: {:?}, timestamp: {:?}, \ cred_rev_id: {:?}", blob_storage_reader_handle, rev_reg_def_json, rev_reg_delta_json, timestamp, cred_rev_id); - check_useful_json!(rev_reg_def_json, ErrorCode::CommonInvalidParam3, RevocationRegistryDefinition); - check_useful_json!(rev_reg_delta_json, ErrorCode::CommonInvalidParam4, RevocationRegistryDelta); + check_useful_validatable_json!(rev_reg_def_json, ErrorCode::CommonInvalidParam3, RevocationRegistryDefinition); + check_useful_validatable_json!(rev_reg_delta_json, ErrorCode::CommonInvalidParam4, RevocationRegistryDelta); check_useful_c_str!(cred_rev_id, ErrorCode::CommonInvalidParam6); check_useful_c_callback!(cb, ErrorCode::CommonInvalidParam7); @@ -2115,9 +2114,9 @@ pub extern fn indy_update_revocation_state(command_handle: CommandHandle, trace!("indy_update_revocation_state: >>> blob_storage_reader_handle: {:?}, rev_state_json: {:?}, rev_reg_def_json: {:?}, rev_reg_delta_json: {:?}, \ timestamp: {:?}, cred_rev_id: {:?}", blob_storage_reader_handle, rev_state_json, rev_reg_def_json, rev_reg_delta_json, timestamp, cred_rev_id); - check_useful_json!(rev_state_json, ErrorCode::CommonInvalidParam3, RevocationState); - check_useful_json!(rev_reg_def_json, ErrorCode::CommonInvalidParam4, RevocationRegistryDefinition); - check_useful_json!(rev_reg_delta_json, ErrorCode::CommonInvalidParam5, RevocationRegistryDelta); + check_useful_validatable_json!(rev_state_json, ErrorCode::CommonInvalidParam3, RevocationState); + check_useful_validatable_json!(rev_reg_def_json, ErrorCode::CommonInvalidParam4, RevocationRegistryDefinition); + check_useful_validatable_json!(rev_reg_delta_json, ErrorCode::CommonInvalidParam5, RevocationRegistryDelta); check_useful_c_str!(cred_rev_id, ErrorCode::CommonInvalidParam7); check_useful_c_callback!(cb, ErrorCode::CommonInvalidParam8); diff --git a/libindy/src/api/cache.rs b/libindy/src/api/cache.rs index 40327a51d3..c58c6a8a75 100644 --- a/libindy/src/api/cache.rs +++ b/libindy/src/api/cache.rs @@ -4,6 +4,9 @@ use commands::cache::CacheCommand; use errors::prelude::*; use utils::ctypes; use domain::cache::{GetCacheOptions, PurgeOptions}; +use domain::anoncreds::schema::SchemaId; +use domain::anoncreds::credential_definition::CredentialDefinitionId; +use utils::validation::Validatable; use libc::c_char; @@ -40,7 +43,7 @@ pub extern fn indy_get_cred_def(command_handle: CommandHandle, pool_handle, wallet_handle, submitter_did, id, options_json); check_useful_c_str!(submitter_did, ErrorCode::CommonInvalidParam4); - check_useful_c_str!(id, ErrorCode::CommonInvalidParam5); + check_useful_validatable_json!(id, ErrorCode::CommonInvalidParam5, CredentialDefinitionId); check_useful_json!(options_json, ErrorCode::CommonInvalidParam6, GetCacheOptions); check_useful_c_callback!(cb, ErrorCode::CommonInvalidParam7); @@ -98,7 +101,7 @@ pub extern fn indy_get_schema(command_handle: CommandHandle, pool_handle, wallet_handle, submitter_did, id, options_json); check_useful_c_str!(submitter_did, ErrorCode::CommonInvalidParam4); - check_useful_c_str!(id, ErrorCode::CommonInvalidParam5); + check_useful_validatable_json!(id, ErrorCode::CommonInvalidParam5, SchemaId); check_useful_json!(options_json, ErrorCode::CommonInvalidParam6, GetCacheOptions); check_useful_c_callback!(cb, ErrorCode::CommonInvalidParam7); diff --git a/libindy/src/api/ledger.rs b/libindy/src/api/ledger.rs index a4fe0e9281..7292af3701 100644 --- a/libindy/src/api/ledger.rs +++ b/libindy/src/api/ledger.rs @@ -2,9 +2,9 @@ use api::{ErrorCode, CommandHandle, WalletHandle, PoolHandle}; use errors::prelude::*; use commands::{Command, CommandExecutor}; use commands::ledger::LedgerCommand; -use domain::anoncreds::credential_definition::CredentialDefinition; -use domain::anoncreds::schema::Schema; -use domain::anoncreds::revocation_registry_definition::RevocationRegistryDefinition; +use domain::anoncreds::credential_definition::{CredentialDefinition, CredentialDefinitionId}; +use domain::anoncreds::schema::{Schema, SchemaId}; +use domain::anoncreds::revocation_registry_definition::{RevocationRegistryDefinition, RevocationRegistryId}; use domain::anoncreds::revocation_registry_delta::RevocationRegistryDelta; use domain::ledger::author_agreement::{GetTxnAuthorAgreementData, AcceptanceMechanisms}; use domain::ledger::node::NodeOperationData; @@ -622,7 +622,7 @@ pub extern fn indy_build_get_schema_request(command_handle: CommandHandle, trace!("indy_build_get_schema_request: >>> submitter_did: {:?}, id: {:?}", submitter_did, id); check_useful_opt_c_str!(submitter_did, ErrorCode::CommonInvalidParam2); - check_useful_c_str!(id, ErrorCode::CommonInvalidParam3); + check_useful_validatable_json!(id, ErrorCode::CommonInvalidParam3, SchemaId); check_useful_c_callback!(cb, ErrorCode::CommonInvalidParam4); trace!("indy_build_get_schema_request: entities >>> submitter_did: {:?}, id: {:?}", submitter_did, id); @@ -729,7 +729,7 @@ pub extern fn indy_build_cred_def_request(command_handle: CommandHandle, trace!("indy_build_cred_def_request: >>> submitter_did: {:?}, data: {:?}", submitter_did, data); check_useful_c_str!(submitter_did, ErrorCode::CommonInvalidParam2); - check_useful_json!(data, ErrorCode::CommonInvalidParam3, CredentialDefinition); + check_useful_validatable_json!(data, ErrorCode::CommonInvalidParam3, CredentialDefinition); check_useful_c_callback!(cb, ErrorCode::CommonInvalidParam4); trace!("indy_build_cred_def_request: entities >>> submitter_did: {:?}, data: {:?}", submitter_did, data); @@ -772,7 +772,7 @@ pub extern fn indy_build_get_cred_def_request(command_handle: CommandHandle, trace!("indy_build_get_cred_def_request: >>> submitter_did: {:?}, id: {:?}", submitter_did, id); check_useful_opt_c_str!(submitter_did, ErrorCode::CommonInvalidParam2); - check_useful_c_str!(id, ErrorCode::CommonInvalidParam3); + check_useful_validatable_json!(id, ErrorCode::CommonInvalidParam3, CredentialDefinitionId); check_useful_c_callback!(cb, ErrorCode::CommonInvalidParam4); trace!("indy_build_get_cred_def_request: entities >>> submitter_did: {:?}, id: {:?}", submitter_did, id); @@ -1213,7 +1213,7 @@ pub extern fn indy_build_revoc_reg_def_request(command_handle: CommandHandle, trace!("indy_build_revoc_reg_def_request: >>> submitter_did: {:?}, data: {:?}", submitter_did, data); check_useful_c_str!(submitter_did, ErrorCode::CommonInvalidParam2); - check_useful_json!(data, ErrorCode::CommonInvalidParam3, RevocationRegistryDefinition); + check_useful_validatable_json!(data, ErrorCode::CommonInvalidParam3, RevocationRegistryDefinition); check_useful_c_callback!(cb, ErrorCode::CommonInvalidParam4); trace!("indy_build_revoc_reg_def_request: entities >>> submitter_did: {:?}, data: {:?}", submitter_did, data); @@ -1256,7 +1256,7 @@ pub extern fn indy_build_get_revoc_reg_def_request(command_handle: CommandHandle trace!("indy_build_get_revoc_reg_def_request: >>> submitter_did: {:?}, id: {:?}", submitter_did, id); check_useful_opt_c_str!(submitter_did, ErrorCode::CommonInvalidParam2); - check_useful_c_str!(id, ErrorCode::CommonInvalidParam3); + check_useful_validatable_json!(id, ErrorCode::CommonInvalidParam3, RevocationRegistryId); check_useful_c_callback!(cb, ErrorCode::CommonInvalidParam4); trace!("indy_build_get_revoc_reg_def_request: entities>>> submitter_did: {:?}, id: {:?}", submitter_did, id); @@ -1377,7 +1377,7 @@ pub extern fn indy_build_revoc_reg_entry_request(command_handle: CommandHandle, submitter_did, revoc_reg_def_id, rev_def_type, value); check_useful_c_str!(submitter_did, ErrorCode::CommonInvalidParam2); - check_useful_c_str!(revoc_reg_def_id, ErrorCode::CommonInvalidParam3); + check_useful_validatable_json!(revoc_reg_def_id, ErrorCode::CommonInvalidParam3, RevocationRegistryId); check_useful_c_str!(rev_def_type, ErrorCode::CommonInvalidParam4); check_useful_json!(value, ErrorCode::CommonInvalidParam5, RevocationRegistryDelta); check_useful_c_callback!(cb, ErrorCode::CommonInvalidParam6); @@ -1427,7 +1427,7 @@ pub extern fn indy_build_get_revoc_reg_request(command_handle: CommandHandle, trace!("indy_build_get_revoc_reg_request: >>> submitter_did: {:?}, revoc_reg_def_id: {:?}, timestamp: {:?}", submitter_did, revoc_reg_def_id, timestamp); check_useful_opt_c_str!(submitter_did, ErrorCode::CommonInvalidParam2); - check_useful_c_str!(revoc_reg_def_id, ErrorCode::CommonInvalidParam3); + check_useful_validatable_json!(revoc_reg_def_id, ErrorCode::CommonInvalidParam3, RevocationRegistryId); check_useful_c_callback!(cb, ErrorCode::CommonInvalidParam5); trace!("indy_build_get_revoc_reg_request: entities >>> submitter_did: {:?}, revoc_reg_def_id: {:?}, timestamp: {:?}", submitter_did, revoc_reg_def_id, timestamp); @@ -1531,7 +1531,7 @@ pub extern fn indy_build_get_revoc_reg_delta_request(command_handle: CommandHand submitter_did, revoc_reg_def_id, from, to); check_useful_opt_c_str!(submitter_did, ErrorCode::CommonInvalidParam2); - check_useful_c_str!(revoc_reg_def_id, ErrorCode::CommonInvalidParam3); + check_useful_validatable_json!(revoc_reg_def_id, ErrorCode::CommonInvalidParam3, RevocationRegistryId); check_useful_c_callback!(cb, ErrorCode::CommonInvalidParam5); let from = if from != -1 { Some(from) } else { None }; diff --git a/libindy/src/commands/anoncreds/issuer.rs b/libindy/src/commands/anoncreds/issuer.rs index cbf14a5a8e..28843fe418 100644 --- a/libindy/src/commands/anoncreds/issuer.rs +++ b/libindy/src/commands/anoncreds/issuer.rs @@ -21,6 +21,7 @@ use domain::anoncreds::credential_definition::{ CredentialDefinitionV1, SignatureType, TemporaryCredentialDefinition, + CredentialDefinitionId }; use domain::anoncreds::credential_offer::CredentialOffer; use domain::anoncreds::credential_request::CredentialRequest; @@ -37,12 +38,13 @@ use domain::anoncreds::revocation_registry_definition::{ RevocationRegistryDefinitionV1, RevocationRegistryDefinitionValue, RevocationRegistryInfo, + RevocationRegistryId }; use domain::anoncreds::revocation_registry_delta::{ RevocationRegistryDelta, RevocationRegistryDeltaV1, }; -use domain::anoncreds::schema::{AttributeNames, Schema, SchemaV1}; +use domain::anoncreds::schema::{AttributeNames, Schema, SchemaV1, SchemaId}; use domain::wallet::Tags; use errors::prelude::*; use services::anoncreds::AnoncredsService; @@ -72,24 +74,24 @@ pub enum IssuerCommand { Box) + Send>), CreateAndStoreCredentialDefinitionContinue( WalletHandle, - SchemaV1, // credentials - String, - String, - String, - SignatureType, + SchemaV1, // schema + SchemaId, // schema_id + CredentialDefinitionId, // cred_def_id + String, // tag + SignatureType, // signature_type IndyResult<(CredentialDefinitionData, CredentialPrivateKey, CredentialKeyCorrectnessProof)>, CommandHandle), RotateCredentialDefinitionStart( WalletHandle, - String, // cred def id + CredentialDefinitionId, // cred def id Option, // config Box) + Send>), RotateCredentialDefinitionStartComplete( WalletHandle, - String, - String, + SchemaId, // schema id + CredentialDefinitionId, // cred def id String, SignatureType, IndyResult<(CredentialDefinitionData, @@ -98,33 +100,33 @@ pub enum IssuerCommand { CommandHandle), RotateCredentialDefinitionApply( WalletHandle, - String, // cred def did + CredentialDefinitionId, // cred def id Box) + Send>), CreateAndStoreRevocationRegistry( WalletHandle, String, // issuer did Option, // type String, // tag - String, // credential definition id + CredentialDefinitionId, // credential definition id RevocationRegistryConfig, // config i32, // tails writer handle Box) + Send>), CreateCredentialOffer( WalletHandle, - String, // credential definition id + CredentialDefinitionId, // credential definition id Box) + Send>), CreateCredential( WalletHandle, CredentialOffer, // credential offer CredentialRequest, // credential request CredentialValues, // credential values - Option, // revocation registry id + Option, // revocation registry id Option, // blob storage reader config handle Box, Option)>) + Send>), RevokeCredential( WalletHandle, i32, // blob storage reader config handle - String, //revocation revoc id + RevocationRegistryId, //revocation registry id String, //credential revoc id Box) + Send>), /* RecoverCredential( @@ -210,7 +212,7 @@ impl IssuerCommandExecutor { } IssuerCommand::CreateCredential(wallet_handle, cred_offer, cred_req, cred_values, rev_reg_id, blob_storage_reader_handle, cb) => { info!(target: "issuer_command_executor", "CreateCredential command received"); - cb(self.new_credential(wallet_handle, &cred_offer, &cred_req, &cred_values, rev_reg_id.as_ref().map(String::as_str), blob_storage_reader_handle)); + cb(self.new_credential(wallet_handle, &cred_offer, &cred_req, &cred_values, rev_reg_id.as_ref(), blob_storage_reader_handle)); } IssuerCommand::RevokeCredential(wallet_handle, blob_storage_reader_handle, rev_reg_id, cred_revoc_id, cb) => { info!(target: "issuer_command_executor", "RevokeCredential command received"); @@ -237,7 +239,7 @@ impl IssuerCommandExecutor { self.crypto_service.validate_did(issuer_did)?; - let schema_id = Schema::schema_id(issuer_did, name, version); + let schema_id = SchemaId::new(issuer_did, name, version); let schema = Schema::SchemaV1(SchemaV1 { id: schema_id.clone(), @@ -252,7 +254,7 @@ impl IssuerCommandExecutor { debug!("create_schema <<< schema_id: {:?}, schema_json: {:?}", schema_id, schema_json); - Ok((schema_id, schema_json)) + Ok((schema_id.0, schema_json)) } fn create_and_store_credential_definition(&self, @@ -270,8 +272,8 @@ impl IssuerCommandExecutor { let (cred_def_config, schema_id, cred_def_id, signature_type) = try_cb!(self._prepare_create_and_store_credential_definition(issuer_did, schema, tag, type_, config), cb); - if let Ok(cred_def) = self.wallet_service.get_indy_record_value::(wallet_handle, &cred_def_id, &RecordOptions::id_value()) { - return cb(Ok((cred_def_id, cred_def))); + if let Ok(cred_def) = self.wallet_service.get_indy_record_value::(wallet_handle, &cred_def_id.0, &RecordOptions::id_value()) { + return cb(Ok((cred_def_id.0, cred_def))); } let cb_id = next_command_handle(); @@ -303,8 +305,8 @@ impl IssuerCommandExecutor { attr_names: &AttributeNames, support_revocation: bool, cb: Box) + Send>) { + CredentialPrivateKey, + CredentialKeyCorrectnessProof)>) + Send>) { let attr_names = attr_names.clone(); ::commands::THREADPOOL.lock().unwrap().execute(move || cb(::services::anoncreds::issuer::Issuer::new_credential_definition(&attr_names, support_revocation))); } @@ -313,8 +315,8 @@ impl IssuerCommandExecutor { cb_id: CommandHandle, wallet_handle: WalletHandle, schema: &SchemaV1, - schema_id: &str, - cred_def_id: &str, + schema_id: &SchemaId, + cred_def_id: &CredentialDefinitionId, tag: &str, signature_type: &SignatureType, result: IndyResult<(CredentialDefinitionData, @@ -332,7 +334,7 @@ impl IssuerCommandExecutor { schema: &SchemaV1, tag: &str, type_: Option<&str>, - config: Option<&CredentialDefinitionConfig>) -> IndyResult<(CredentialDefinitionConfig, String, String, SignatureType)> { + config: Option<&CredentialDefinitionConfig>) -> IndyResult<(CredentialDefinitionConfig, SchemaId, CredentialDefinitionId, SignatureType)> { self.crypto_service.validate_did(issuer_did)?; let default_cred_def_config = CredentialDefinitionConfig::default(); @@ -345,9 +347,9 @@ impl IssuerCommandExecutor { SignatureType::CL }; - let schema_id = schema.seq_no.map(|n| n.to_string()).unwrap_or_else(|| schema.id.clone()); + let schema_id = schema.seq_no.map(|n| SchemaId(n.to_string())).unwrap_or_else(|| schema.id.clone()); - let cred_def_id = CredentialDefinition::cred_def_id(issuer_did, &schema_id, &signature_type.to_str(), tag); + let cred_def_id = CredentialDefinitionId::new(issuer_did, &schema_id, &signature_type.to_str(), tag); Ok((cred_def_config.clone(), schema_id, cred_def_id, signature_type)) } @@ -355,8 +357,8 @@ impl IssuerCommandExecutor { fn _complete_create_and_store_credential_definition(&self, wallet_handle: WalletHandle, schema: &SchemaV1, - schema_id: &str, - cred_def_id: &str, + schema_id: &SchemaId, + cred_def_id: &CredentialDefinitionId, tag: &str, signature_type: SignatureType, res: (::domain::anoncreds::credential_definition::CredentialDefinitionData, @@ -367,8 +369,8 @@ impl IssuerCommandExecutor { let cred_def = CredentialDefinition::CredentialDefinitionV1( CredentialDefinitionV1 { - id: cred_def_id.to_string(), - schema_id: schema_id.to_string(), + id: cred_def_id.clone(), + schema_id: schema_id.clone(), signature_type, tag: tag.to_string(), value: credential_definition_value, @@ -384,33 +386,33 @@ impl IssuerCommandExecutor { let schema_ = Schema::SchemaV1(schema.clone()); - let cred_def_json = self.wallet_service.add_indy_object(wallet_handle, &cred_def_id, &cred_def, &HashMap::new())?; - self.wallet_service.add_indy_object(wallet_handle, &cred_def_id, &cred_def_priv_key, &HashMap::new())?; - self.wallet_service.add_indy_object(wallet_handle, &cred_def_id, &cred_def_correctness_proof, &HashMap::new())?; - let _ = self.wallet_service.add_indy_object(wallet_handle, &schema_id, &schema_, &HashMap::new()).ok(); + let cred_def_json = self.wallet_service.add_indy_object(wallet_handle, &cred_def_id.0, &cred_def, &HashMap::new())?; + self.wallet_service.add_indy_object(wallet_handle, &cred_def_id.0, &cred_def_priv_key, &HashMap::new())?; + self.wallet_service.add_indy_object(wallet_handle, &cred_def_id.0, &cred_def_correctness_proof, &HashMap::new())?; + let _ = self.wallet_service.add_indy_object(wallet_handle, &schema_id.0, &schema_, &HashMap::new()).ok(); let schema_id = schema.id.clone(); - self._wallet_set_schema_id(wallet_handle, &cred_def_id, &schema_id)?; // TODO: FIXME delete temporary storing of schema id + self._wallet_set_schema_id(wallet_handle, &cred_def_id.0, &schema_id)?; // TODO: FIXME delete temporary storing of schema id debug!("create_and_store_credential_definition <<< cred_def_id: {:?}, cred_def_json: {:?}", cred_def_id, cred_def_json); - Ok((cred_def_id.to_string(), cred_def_json)) + Ok((cred_def_id.0.clone(), cred_def_json)) } fn rotate_credential_definition_start(&self, wallet_handle: WalletHandle, - cred_def_id: &str, + cred_def_id: &CredentialDefinitionId, cred_def_config: Option<&CredentialDefinitionConfig>, cb: Box) + Send>) { debug!("rotate_credential_definition_start >>> wallet_handle: {:?}, cred_def_id: {:?}, cred_def_config: {:?}", wallet_handle, cred_def_id, cred_def_config); - let cred_def: CredentialDefinitionV1 = match self.wallet_service.get_indy_object::(wallet_handle, &cred_def_id, &RecordOptions::id_value()) { + let cred_def: CredentialDefinitionV1 = match self.wallet_service.get_indy_object::(wallet_handle, &cred_def_id.0, &RecordOptions::id_value()) { Ok(cred_def) => CredentialDefinitionV1::from(cred_def), Err(err) => return cb(Err(err)) }; - if let Ok(temp_cred_def) = self.wallet_service.get_indy_object::(wallet_handle, &cred_def_id, &RecordOptions::id_value()) { + if let Ok(temp_cred_def) = self.wallet_service.get_indy_object::(wallet_handle, &cred_def_id.0, &RecordOptions::id_value()) { debug!("Temporary Credential Definition already exists. Return it: {:?}", temp_cred_def.cred_def); let cred_def_json = try_cb!(::serde_json::to_string(&temp_cred_def.cred_def) @@ -419,7 +421,7 @@ impl IssuerCommandExecutor { return cb(Ok(cred_def_json)); } - let schema: SchemaV1 = match self.wallet_service.get_indy_object::(wallet_handle, &cred_def.schema_id, &RecordOptions::id_value()) { + let schema: SchemaV1 = match self.wallet_service.get_indy_object::(wallet_handle, &cred_def.schema_id.0, &RecordOptions::id_value()) { Ok(schema) => SchemaV1::from(schema), Err(err) => return cb(Err(err)) }; @@ -449,8 +451,8 @@ impl IssuerCommandExecutor { fn rotate_credential_definition_start_complete(&self, cb_id: CommandHandle, wallet_handle: WalletHandle, - schema_id: &str, - cred_def_id: &str, + schema_id: &SchemaId, + cred_def_id: &CredentialDefinitionId, tag: &str, signature_type: &SignatureType, result: IndyResult<(CredentialDefinitionData, @@ -465,8 +467,8 @@ impl IssuerCommandExecutor { fn _rotate_credential_definition_start_complete(&self, wallet_handle: WalletHandle, - schema_id: &str, - cred_def_id: &str, + schema_id: &SchemaId, + cred_def_id: &CredentialDefinitionId, tag: &str, signature_type: SignatureType, res: (CredentialDefinitionData, @@ -480,8 +482,8 @@ impl IssuerCommandExecutor { let cred_def = CredentialDefinition::CredentialDefinitionV1( CredentialDefinitionV1 { - id: cred_def_id.to_string(), - schema_id: schema_id.to_string(), + id: cred_def_id.clone(), + schema_id: schema_id.clone(), signature_type, tag: tag.to_string(), value: credential_definition_value, @@ -504,7 +506,7 @@ impl IssuerCommandExecutor { cred_def_correctness_proof, }; - self.wallet_service.add_indy_object(wallet_handle, &cred_def_id, &temp_cred_def, &HashMap::new())?; + self.wallet_service.add_indy_object(wallet_handle, &cred_def_id.0, &temp_cred_def, &HashMap::new())?; debug!("_rotate_credential_definition_start_complete <<< cred_def_id: {:?}, cred_def_json: {:?}", cred_def_id, cred_def_json); Ok(cred_def_json) @@ -512,17 +514,17 @@ impl IssuerCommandExecutor { fn rotate_credential_definition_apply(&self, wallet_handle: WalletHandle, - cred_def_id: &str) -> IndyResult<()> { + cred_def_id: &CredentialDefinitionId) -> IndyResult<()> { debug!("rotate_credential_definition_apply >>> wallet_handle: {:?}, cred_def_id: {:?}", wallet_handle, cred_def_id); - let _cred_def: CredentialDefinition = self.wallet_service.get_indy_object(wallet_handle, &cred_def_id, &RecordOptions::id_value())?; - let temp_cred_def: TemporaryCredentialDefinition = self.wallet_service.get_indy_object(wallet_handle, &cred_def_id, &RecordOptions::id_value())?; + let _cred_def: CredentialDefinition = self.wallet_service.get_indy_object(wallet_handle, &cred_def_id.0, &RecordOptions::id_value())?; + let temp_cred_def: TemporaryCredentialDefinition = self.wallet_service.get_indy_object(wallet_handle, &cred_def_id.0, &RecordOptions::id_value())?; - self.wallet_service.update_indy_object(wallet_handle, &cred_def_id, &temp_cred_def.cred_def)?; - self.wallet_service.update_indy_object(wallet_handle, &cred_def_id, &temp_cred_def.cred_def_priv_key)?; - self.wallet_service.update_indy_object(wallet_handle, &cred_def_id, &temp_cred_def.cred_def_correctness_proof)?; + self.wallet_service.update_indy_object(wallet_handle, &cred_def_id.0, &temp_cred_def.cred_def)?; + self.wallet_service.update_indy_object(wallet_handle, &cred_def_id.0, &temp_cred_def.cred_def_priv_key)?; + self.wallet_service.update_indy_object(wallet_handle, &cred_def_id.0, &temp_cred_def.cred_def_correctness_proof)?; - self.wallet_service.delete_indy_record::(wallet_handle, &cred_def_id)?; + self.wallet_service.delete_indy_record::(wallet_handle, &cred_def_id.0)?; debug!("rotate_credential_definition_apply <<<"); @@ -534,7 +536,7 @@ impl IssuerCommandExecutor { issuer_did: &str, type_: Option<&str>, tag: &str, - cred_def_id: &str, + cred_def_id: &CredentialDefinitionId, config: &RevocationRegistryConfig, tails_writer_handle: i32) -> IndyResult<(String, String, String)> { debug!("create_and_store_revocation_registry >>> wallet_handle: {:?}, issuer_did: {:?}, type_: {:?}, tag: {:?}, cred_def_id: {:?}, config: {:?}, \ @@ -550,14 +552,14 @@ impl IssuerCommandExecutor { let issuance_type = config.issuance_type.clone().unwrap_or(IssuanceType::ISSUANCE_ON_DEMAND); let max_cred_num = config.max_cred_num.unwrap_or(100000); - let rev_reg_id = RevocationRegistryDefinition::rev_reg_id(issuer_did, cred_def_id, &rev_reg_type, tag); + let rev_reg_id = RevocationRegistryId::new(issuer_did, &cred_def_id.0, &rev_reg_type, tag); - if let (Ok(rev_reg_def), Ok(rev_reg)) = (self.wallet_service.get_indy_record_value::(wallet_handle, &rev_reg_id, &RecordOptions::id_value()), - self.wallet_service.get_indy_record_value::(wallet_handle, &rev_reg_id, &RecordOptions::id_value())) { - return Ok((cred_def_id.to_string(), rev_reg_def, rev_reg)); + if let (Ok(rev_reg_def), Ok(rev_reg)) = (self.wallet_service.get_indy_record_value::(wallet_handle, &rev_reg_id.0, &RecordOptions::id_value()), + self.wallet_service.get_indy_record_value::(wallet_handle, &rev_reg_id.0, &RecordOptions::id_value())) { + return Ok((cred_def_id.0.to_string(), rev_reg_def, rev_reg)); } - let cred_def: CredentialDefinition = self.wallet_service.get_indy_object(wallet_handle, &cred_def_id, &RecordOptions::id_value())?; + let cred_def: CredentialDefinition = self.wallet_service.get_indy_object(wallet_handle, &cred_def_id.0, &RecordOptions::id_value())?; let (revoc_public_keys, revoc_key_private, revoc_registry, mut revoc_tails_generator) = self.anoncreds_service.issuer.new_revocation_registry(&CredentialDefinitionV1::from(cred_def), @@ -582,7 +584,7 @@ impl IssuerCommandExecutor { id: rev_reg_id.clone(), revoc_def_type: rev_reg_type, tag: tag.to_string(), - cred_def_id: cred_def_id.to_string(), + cred_def_id: cred_def_id.clone(), value: revoc_reg_def_value, }); @@ -597,11 +599,11 @@ impl IssuerCommandExecutor { value: revoc_key_private }; - let revoc_reg_def_json = self.wallet_service.add_indy_object(wallet_handle, &rev_reg_id, &revoc_reg_def, &HashMap::new())?; + let revoc_reg_def_json = self.wallet_service.add_indy_object(wallet_handle, &rev_reg_id.0, &revoc_reg_def, &HashMap::new())?; - let revoc_reg_json = self.wallet_service.add_indy_object(wallet_handle, &rev_reg_id, &revoc_reg, &HashMap::new())?; + let revoc_reg_json = self.wallet_service.add_indy_object(wallet_handle, &rev_reg_id.0, &revoc_reg, &HashMap::new())?; - self.wallet_service.add_indy_object(wallet_handle, &rev_reg_id, &revoc_reg_def_priv, &HashMap::new())?; + self.wallet_service.add_indy_object(wallet_handle, &rev_reg_id.0, &revoc_reg_def_priv, &HashMap::new())?; let rev_reg_info = RevocationRegistryInfo { id: rev_reg_id.clone(), @@ -609,29 +611,29 @@ impl IssuerCommandExecutor { used_ids: HashSet::new(), }; - self.wallet_service.add_indy_object(wallet_handle, &rev_reg_id, &rev_reg_info, &HashMap::new())?; + self.wallet_service.add_indy_object(wallet_handle, &rev_reg_id.0, &rev_reg_info, &HashMap::new())?; debug!("create_and_store_revocation_registry <<< rev_reg_id: {:?}, revoc_reg_def_json: {:?}, revoc_reg_json: {:?}", rev_reg_id, revoc_reg_def_json, revoc_reg_json); - Ok((rev_reg_id, revoc_reg_def_json, revoc_reg_json)) + Ok((rev_reg_id.0, revoc_reg_def_json, revoc_reg_json)) } fn create_credential_offer(&self, wallet_handle: WalletHandle, - cred_def_id: &str) -> IndyResult { + cred_def_id: &CredentialDefinitionId) -> IndyResult { debug!("create_credential_offer >>> wallet_handle: {:?}, cred_def_id: {:?}", wallet_handle, cred_def_id); let cred_def_correctness_proof: CredentialDefinitionCorrectnessProof = - self.wallet_service.get_indy_object(wallet_handle, &cred_def_id, &RecordOptions::id_value())?; + self.wallet_service.get_indy_object(wallet_handle, &cred_def_id.0, &RecordOptions::id_value())?; let nonce = new_nonce()?; - let schema_id = self._wallet_get_schema_id(wallet_handle, &cred_def_id)?; // TODO: FIXME get CredDef from wallet and use CredDef.schema_id + let schema_id = self._wallet_get_schema_id(wallet_handle, &cred_def_id.0)?; // TODO: FIXME get CredDef from wallet and use CredDef.schema_id let credential_offer = CredentialOffer { - schema_id: schema_id.to_string(), - cred_def_id: cred_def_id.to_string(), + schema_id: schema_id.clone(), + cred_def_id: cred_def_id.clone(), key_correctness_proof: cred_def_correctness_proof.value, nonce, }; @@ -649,19 +651,19 @@ impl IssuerCommandExecutor { cred_offer: &CredentialOffer, cred_request: &CredentialRequest, cred_values: &CredentialValues, - rev_reg_id: Option<&str>, + rev_reg_id: Option<&RevocationRegistryId>, blob_storage_reader_handle: Option) -> IndyResult<(String, Option, Option)> { debug!("new_credential >>> wallet_handle: {:?}, cred_offer: {:?}, cred_req: {:?}, cred_values_json: {:?}, rev_reg_id: {:?}, blob_storage_reader_handle: {:?}", wallet_handle, secret!(&cred_offer), secret!(&cred_request), secret!(&cred_values), rev_reg_id, blob_storage_reader_handle); let cred_def: CredentialDefinitionV1 = CredentialDefinitionV1::from( - self.wallet_service.get_indy_object::(wallet_handle, &cred_offer.cred_def_id, &RecordOptions::id_value())?); + self.wallet_service.get_indy_object::(wallet_handle, &cred_offer.cred_def_id.0, &RecordOptions::id_value())?); let cred_def_priv_key: CredentialDefinitionPrivateKey = - self.wallet_service.get_indy_object(wallet_handle, &cred_request.cred_def_id, &RecordOptions::id_value())?; + self.wallet_service.get_indy_object(wallet_handle, &cred_request.cred_def_id.0, &RecordOptions::id_value())?; - let schema_id = self._wallet_get_schema_id(wallet_handle, &cred_offer.cred_def_id)?; // TODO: FIXME get CredDef from wallet and use CredDef.schema_id + let schema_id = self._wallet_get_schema_id(wallet_handle, &cred_offer.cred_def_id.0)?; // TODO: FIXME get CredDef from wallet and use CredDef.schema_id let (rev_reg_def, mut rev_reg, rev_reg_def_priv, sdk_tails_accessor, rev_reg_info) = match rev_reg_id { @@ -675,7 +677,7 @@ impl IssuerCommandExecutor { self._wallet_get_rev_reg(wallet_handle, &r_reg_id)?); let rev_key_priv: RevocationRegistryDefinitionPrivate = - self.wallet_service.get_indy_object(wallet_handle, &r_reg_id, &RecordOptions::id_value())?; + self.wallet_service.get_indy_object(wallet_handle, &r_reg_id.0, &RecordOptions::id_value())?; let mut rev_reg_info = self._wallet_get_rev_reg_info(wallet_handle, &r_reg_id)?; @@ -733,7 +735,7 @@ impl IssuerCommandExecutor { let credential = Credential { schema_id, cred_def_id: cred_request.cred_def_id.clone(), - rev_reg_id: rev_reg_id.map(String::from), + rev_reg_id: rev_reg_id.cloned(), values: cred_values.clone(), signature: credential_signature, signature_correctness_proof, @@ -754,8 +756,8 @@ impl IssuerCommandExecutor { if let (Some(r_reg), Some(r_reg_id), Some(r_reg_info)) = (credential.rev_reg, rev_reg_id, rev_reg_info.clone()) { let revoc_reg = RevocationRegistry::RevocationRegistryV1(RevocationRegistryV1 { value: r_reg }); - self.wallet_service.update_indy_object(wallet_handle, &r_reg_id, &revoc_reg)?; - self.wallet_service.update_indy_object(wallet_handle, &r_reg_id, &r_reg_info)?; + self.wallet_service.update_indy_object(wallet_handle, &r_reg_id.0, &revoc_reg)?; + self.wallet_service.update_indy_object(wallet_handle, &r_reg_id.0, &r_reg_info)?; }; let cred_rev_id = rev_reg_info.map(|r_reg_info| r_reg_info.curr_id.to_string()); @@ -768,7 +770,7 @@ impl IssuerCommandExecutor { fn revoke_credential(&self, wallet_handle: WalletHandle, blob_storage_reader_handle: i32, - rev_reg_id: &str, + rev_reg_id: &RevocationRegistryId, cred_revoc_id: &str) -> IndyResult { debug!("revoke_credential >>> wallet_handle: {:?}, blob_storage_reader_handle: {:?}, rev_reg_id: {:?}, cred_revoc_id: {:?}", wallet_handle, blob_storage_reader_handle, rev_reg_id, secret!(cred_revoc_id)); @@ -816,8 +818,8 @@ impl IssuerCommandExecutor { let rev_reg = RevocationRegistry::RevocationRegistryV1(rev_reg); - self.wallet_service.update_indy_object(wallet_handle, &rev_reg_id, &rev_reg)?; - self.wallet_service.update_indy_object(wallet_handle, &rev_reg_id, &rev_reg_info)?; + self.wallet_service.update_indy_object(wallet_handle, &rev_reg_id.0, &rev_reg)?; + self.wallet_service.update_indy_object(wallet_handle, &rev_reg_id.0, &rev_reg_info)?; debug!("revoke_credential <<< rev_reg_delta_json: {:?}", rev_reg_delta_json); @@ -827,7 +829,7 @@ impl IssuerCommandExecutor { fn _recovery_credential(&self, wallet_handle: WalletHandle, blob_storage_reader_handle: i32, - rev_reg_id: &str, + rev_reg_id: &RevocationRegistryId, cred_revoc_id: &str) -> IndyResult { debug!("recovery_credential >>> wallet_handle: {:?}, blob_storage_reader_handle: {:?}, rev_reg_id: {:?}, cred_revoc_id: {:?}", wallet_handle, blob_storage_reader_handle, rev_reg_id, secret!(cred_revoc_id)); @@ -875,8 +877,8 @@ impl IssuerCommandExecutor { let rev_reg = RevocationRegistry::RevocationRegistryV1(rev_reg); - self.wallet_service.update_indy_object(wallet_handle, &rev_reg_id, &rev_reg)?; - self.wallet_service.update_indy_object(wallet_handle, &rev_reg_id, &rev_reg_info)?; + self.wallet_service.update_indy_object(wallet_handle, &rev_reg_id.0, &rev_reg)?; + self.wallet_service.update_indy_object(wallet_handle, &rev_reg_id.0, &rev_reg_info)?; debug!("recovery_credential <<< rev_reg_delta_json: {:?}", rev_reg_delta_json); @@ -901,26 +903,28 @@ impl IssuerCommandExecutor { } // TODO: DELETE IT - fn _wallet_set_schema_id(&self, wallet_handle: WalletHandle, id: &str, schema_id: &str) -> IndyResult<()> { - self.wallet_service.add_record(wallet_handle, &self.wallet_service.add_prefix("SchemaId"), id, schema_id, &Tags::new()) + fn _wallet_set_schema_id(&self, wallet_handle: WalletHandle, id: &str, schema_id: &SchemaId) -> IndyResult<()> { + self.wallet_service.add_record(wallet_handle, &self.wallet_service.add_prefix("SchemaId"), id, &schema_id.0, &Tags::new()) } // TODO: DELETE IT - fn _wallet_get_schema_id(&self, wallet_handle: WalletHandle, key: &str) -> IndyResult { + fn _wallet_get_schema_id(&self, wallet_handle: WalletHandle, key: &str) -> IndyResult { let schema_id_record = self.wallet_service.get_record(wallet_handle, &self.wallet_service.add_prefix("SchemaId"), &key, &RecordOptions::id_value())?; - Ok(schema_id_record.get_value() - .ok_or(err_msg(IndyErrorKind::InvalidStructure, format!("SchemaId not found for id: {}", key)))?.to_string()) + schema_id_record + .get_value() + .map(|id| SchemaId(id.to_string())) + .ok_or(err_msg(IndyErrorKind::InvalidStructure, format!("SchemaId not found for id: {}", key))) } - fn _wallet_get_rev_reg_def(&self, wallet_handle: WalletHandle, key: &str) -> IndyResult { - self.wallet_service.get_indy_object(wallet_handle, &key, &RecordOptions::id_value()) + fn _wallet_get_rev_reg_def(&self, wallet_handle: WalletHandle, key: &RevocationRegistryId) -> IndyResult { + self.wallet_service.get_indy_object(wallet_handle, &key.0, &RecordOptions::id_value()) } - fn _wallet_get_rev_reg(&self, wallet_handle: WalletHandle, key: &str) -> IndyResult { - self.wallet_service.get_indy_object(wallet_handle, &key, &RecordOptions::id_value()) + fn _wallet_get_rev_reg(&self, wallet_handle: WalletHandle, key: &RevocationRegistryId) -> IndyResult { + self.wallet_service.get_indy_object(wallet_handle, &key.0, &RecordOptions::id_value()) } - fn _wallet_get_rev_reg_info(&self, wallet_handle: WalletHandle, key: &str) -> IndyResult { - self.wallet_service.get_indy_object(wallet_handle, &key, &RecordOptions::id_value()) + fn _wallet_get_rev_reg_info(&self, wallet_handle: WalletHandle, key: &RevocationRegistryId) -> IndyResult { + self.wallet_service.get_indy_object(wallet_handle, &key.0, &RecordOptions::id_value()) } } diff --git a/libindy/src/commands/anoncreds/prover.rs b/libindy/src/commands/anoncreds/prover.rs index c75518b300..a79c1e5df3 100644 --- a/libindy/src/commands/anoncreds/prover.rs +++ b/libindy/src/commands/anoncreds/prover.rs @@ -8,7 +8,7 @@ use serde_json::Value; use domain::anoncreds::credential_attr_tag_policy::CredentialAttrTagPolicy; use domain::anoncreds::credential::{Credential, CredentialInfo}; -use domain::anoncreds::credential_definition::{cred_defs_map_to_cred_defs_v1_map, CredentialDefinition, CredentialDefinitionV1}; +use domain::anoncreds::credential_definition::{cred_defs_map_to_cred_defs_v1_map, CredentialDefinition, CredentialDefinitionV1, CredentialDefinitionId, CredentialDefinitions}; use domain::anoncreds::credential_for_proof_request::{CredentialsForProofRequest, RequestedCredential}; use domain::anoncreds::credential_offer::CredentialOffer; use domain::anoncreds::credential_request::{CredentialRequest, CredentialRequestMetadata}; @@ -17,8 +17,8 @@ use domain::anoncreds::proof_request::{NonRevocedInterval, PredicateInfo, ProofR use domain::anoncreds::requested_credential::RequestedCredentials; use domain::anoncreds::revocation_registry_definition::{RevocationRegistryDefinition, RevocationRegistryDefinitionV1}; use domain::anoncreds::revocation_registry_delta::{RevocationRegistryDelta, RevocationRegistryDeltaV1}; -use domain::anoncreds::revocation_state::RevocationState; -use domain::anoncreds::schema::{Schema, schemas_map_to_schemas_v1_map, SchemaV1}; +use domain::anoncreds::revocation_state::{RevocationState, RevocationStates}; +use domain::anoncreds::schema::{schemas_map_to_schemas_v1_map, SchemaV1, SchemaId, Schemas}; use errors::prelude::*; use services::anoncreds::AnoncredsService; use services::anoncreds::helpers::{parse_cred_rev_id, get_non_revoc_interval}; @@ -44,13 +44,13 @@ pub enum ProverCommand { Box) + Send>), SetCredentialAttrTagPolicy( WalletHandle, - String, // credential definition id + CredentialDefinitionId, // credential definition id Option, // credential attr tag policy bool, // retroactive Box) + Send>), GetCredentialAttrTagPolicy( WalletHandle, - String, // credential definition id + CredentialDefinitionId, // credential definition id Box) + Send>), StoreCredential( WalletHandle, @@ -105,9 +105,9 @@ pub enum ProverCommand { ProofRequest, // proof request RequestedCredentials, // requested credentials String, // master secret name - HashMap, // schemas - HashMap, // credential defs - HashMap>, // revocation states + Schemas, // schemas + CredentialDefinitions, // credential defs + RevocationStates, // revocation states Box) + Send>), CreateRevocationState( i32, // blob storage reader handle @@ -325,25 +325,25 @@ impl ProverCommandExecutor { fn set_credential_attr_tag_policy(&self, wallet_handle: WalletHandle, - cred_def_id: &str, + cred_def_id: &CredentialDefinitionId, catpol: Option<&CredentialAttrTagPolicy>, retroactive: bool) -> IndyResult<()> { debug!("set_credential_attr_tag_policy >>> wallet_handle: {:?}, cred_def_id: {:?}, catpol: {:?}, retroactive: {:?}", wallet_handle, cred_def_id, catpol, retroactive); match catpol { Some(pol) => { - self.wallet_service.upsert_indy_object(wallet_handle, cred_def_id, pol)?; + self.wallet_service.upsert_indy_object(wallet_handle, &cred_def_id.0, pol)?; }, None => { - if self.wallet_service.record_exists::(wallet_handle, cred_def_id)? { - self.wallet_service.delete_indy_record::(wallet_handle, cred_def_id)?; + if self.wallet_service.record_exists::(wallet_handle, &cred_def_id.0)? { + self.wallet_service.delete_indy_record::(wallet_handle, &cred_def_id.0)?; } } }; // Cascade whether we updated policy or not: could be a retroactive cred attr tags reset to existing policy if retroactive { - let query_json = format!(r#"{{"cred_def_id": "{}"}}"#, cred_def_id); + let query_json = format!(r#"{{"cred_def_id": "{}"}}"#, cred_def_id.0); let mut credentials_search = self.wallet_service.search_indy_records::(wallet_handle, query_json.as_str(), &SearchOptions::id_value())?; while let Some(credential_record) = credentials_search.fetch_next_record()? { @@ -360,10 +360,10 @@ impl ProverCommandExecutor { fn get_credential_attr_tag_policy(&self, wallet_handle: WalletHandle, - cred_def_id: &str) -> IndyResult { + cred_def_id: &CredentialDefinitionId) -> IndyResult { debug!("get_credential_attr_tag_policy >>> wallet_handle: {:?}, cred_def_id: {:?}", wallet_handle, cred_def_id); - let catpol_json = match self.wallet_service.get_indy_opt_object::(wallet_handle, cred_def_id, &RecordOptions::id_value())? { + let catpol_json = match self.wallet_service.get_indy_opt_object::(wallet_handle, &cred_def_id.0, &RecordOptions::id_value())? { Some(catpol) => { serde_json::to_string(&catpol).to_indy(IndyErrorKind::InvalidState, "Cannot serialize CredentialAttrTagPolicy")? } @@ -399,7 +399,7 @@ impl ProverCommandExecutor { let out_cred_id = cred_id.map(String::from).unwrap_or_else(|| uuid::Uuid::new_v4().to_string()); - let catpol_json = self.get_credential_attr_tag_policy(wallet_handle, credential.cred_def_id.as_str())?; + let catpol_json = self.get_credential_attr_tag_policy(wallet_handle, &credential.cred_def_id)?; let catpol: Option = if catpol_json.ne("null") { Some(serde_json::from_str(catpol_json.as_str()).to_indy(IndyErrorKind::InvalidState, "Cannot deserialize CredentialAttrTagPolicy")?) } else { @@ -656,9 +656,9 @@ impl ProverCommandExecutor { proof_req: &ProofRequest, requested_credentials: &RequestedCredentials, master_secret_id: &str, - schemas: &HashMap, - cred_defs: &HashMap, - rev_states: &HashMap>) -> IndyResult { + schemas: &HashMap, + cred_defs: &HashMap, + rev_states: &RevocationStates) -> IndyResult { debug!("create_proof >>> wallet_handle: {:?}, proof_req: {:?}, requested_credentials: {:?}, master_secret_id: {:?}, schemas: {:?}, \ cred_defs: {:?}, rev_states: {:?}", wallet_handle, proof_req, requested_credentials, master_secret_id, schemas, cred_defs, rev_states); @@ -692,7 +692,7 @@ impl ProverCommandExecutor { &master_secret.value, schemas, cred_defs, - &rev_states)?; + rev_states)?; let proof_json = serde_json::to_string(&proof) .to_indy(IndyErrorKind::InvalidState, "Cannot serialize FullProof")?; @@ -784,7 +784,7 @@ impl ProverCommandExecutor { attrs: credential_values, schema_id: credential.schema_id, cred_def_id: credential.cred_def_id, - rev_reg_id: credential.rev_reg_id.as_ref().map(|s| s.to_string()), + rev_reg_id: credential.rev_reg_id.clone(), cred_rev_id: credential.signature.extract_index().map(|idx| idx.to_string()) } } diff --git a/libindy/src/commands/anoncreds/verifier.rs b/libindy/src/commands/anoncreds/verifier.rs index 8a0064cb89..99d8f9a0d5 100644 --- a/libindy/src/commands/anoncreds/verifier.rs +++ b/libindy/src/commands/anoncreds/verifier.rs @@ -1,12 +1,12 @@ use std::collections::HashMap; use std::rc::Rc; -use domain::anoncreds::credential_definition::{cred_defs_map_to_cred_defs_v1_map, CredentialDefinition, CredentialDefinitionV1}; +use domain::anoncreds::credential_definition::{cred_defs_map_to_cred_defs_v1_map, CredentialDefinitionV1, CredentialDefinitionId, CredentialDefinitions}; use domain::anoncreds::proof::Proof; use domain::anoncreds::proof_request::ProofRequest; -use domain::anoncreds::revocation_registry::{rev_regs_map_to_rev_regs_local_map, RevocationRegistry, RevocationRegistryV1}; -use domain::anoncreds::revocation_registry_definition::{rev_reg_defs_map_to_rev_reg_defs_v1_map, RevocationRegistryDefinition, RevocationRegistryDefinitionV1}; -use domain::anoncreds::schema::{Schema, schemas_map_to_schemas_v1_map, SchemaV1}; +use domain::anoncreds::revocation_registry::{rev_regs_map_to_rev_regs_local_map, RevocationRegistryV1, RevocationRegistries}; +use domain::anoncreds::revocation_registry_definition::{rev_reg_defs_map_to_rev_reg_defs_v1_map, RevocationRegistryDefinitionV1, RevocationRegistryId, RevocationRegistryDefinitions}; +use domain::anoncreds::schema::{schemas_map_to_schemas_v1_map, SchemaV1, SchemaId, Schemas}; use errors::prelude::*; use services::anoncreds::AnoncredsService; @@ -14,10 +14,10 @@ pub enum VerifierCommand { VerifyProof( ProofRequest, // proof request Proof, // proof - HashMap, // credential schemas - HashMap, // credential defs - HashMap, // rev reg defs - HashMap>, // rev reg entries + Schemas, // credential schemas + CredentialDefinitions, // credential defs + RevocationRegistryDefinitions, // rev reg defs + RevocationRegistries, // rev reg entries Box) + Send>), GenerateNonce( Box) + Send>) @@ -54,10 +54,10 @@ impl VerifierCommandExecutor { fn verify_proof(&self, proof_req: ProofRequest, proof: Proof, - schemas: &HashMap, - cred_defs: &HashMap, - rev_reg_defs: &HashMap, - rev_regs: &HashMap>) -> IndyResult { + schemas: &HashMap, + cred_defs: &HashMap, + rev_reg_defs: &HashMap, + rev_regs: &HashMap>) -> IndyResult { debug!("verify_proof >>> proof_req: {:?}, proof: {:?}, schemas: {:?}, cred_defs: {:?}, \ rev_reg_defs: {:?}, rev_regs: {:?}", proof_req, proof, schemas, cred_defs, rev_reg_defs, rev_regs); diff --git a/libindy/src/commands/cache.rs b/libindy/src/commands/cache.rs index 8d66c9e661..a5fd0c29ab 100644 --- a/libindy/src/commands/cache.rs +++ b/libindy/src/commands/cache.rs @@ -4,6 +4,8 @@ use std::rc::Rc; use std::time::{SystemTime, UNIX_EPOCH}; use domain::wallet::Tags; +use domain::anoncreds::schema::SchemaId; +use domain::anoncreds::credential_definition::CredentialDefinitionId; use errors::prelude::*; use services::wallet::{WalletService, WalletRecord}; use api::{WalletHandle, PoolHandle, CommandHandle}; @@ -20,7 +22,7 @@ pub enum CacheCommand { GetSchema(PoolHandle, WalletHandle, String, // submitter_did - String, // id + SchemaId, // id GetCacheOptions, // options Box) + Send>), GetSchemaContinue( @@ -32,7 +34,7 @@ pub enum CacheCommand { GetCredDef(PoolHandle, WalletHandle, String, // submitter_did - String, // id + CredentialDefinitionId, // id GetCacheOptions, // options Box) + Send>), GetCredDefContinue( @@ -117,13 +119,13 @@ impl CacheCommandExecutor { pool_handle: PoolHandle, wallet_handle: WalletHandle, submitter_did: &str, - id: &str, + id: &SchemaId, options: GetCacheOptions, cb: Box) + Send>) { trace!("get_schema >>> pool_handle: {:?}, wallet_handle: {:?}, submitter_did: {:?}, id: {:?}, options: {:?}", pool_handle, wallet_handle, submitter_did, id, options); - let cache = self.get_record_from_cache(wallet_handle, id, &options, SCHEMA_CACHE); + let cache = self.get_record_from_cache(wallet_handle, &id.0, &options, SCHEMA_CACHE); let cache = try_cb!(cache, cb); check_cache!(cache, options, cb); @@ -140,7 +142,7 @@ impl CacheCommandExecutor { LedgerCommand::GetSchema( pool_handle, Some(submitter_did.to_string()), - id.to_string(), + id.clone(), Box::new(move |ledger_response| { CommandExecutor::instance().send( Command::Cache( @@ -199,13 +201,13 @@ impl CacheCommandExecutor { pool_handle: PoolHandle, wallet_handle: WalletHandle, submitter_did: &str, - id: &str, + id: &CredentialDefinitionId, options: GetCacheOptions, cb: Box) + Send>) { trace!("get_cred_def >>> pool_handle: {:?}, wallet_handle: {:?}, submitter_did: {:?}, id: {:?}, options: {:?}", pool_handle, wallet_handle, submitter_did, id, options); - let cache = self.get_record_from_cache(wallet_handle, id, &options, CRED_DEF_CACHE); + let cache = self.get_record_from_cache(wallet_handle, &id.0, &options, CRED_DEF_CACHE); let cache = try_cb!(cache, cb); check_cache!(cache, options, cb); @@ -222,7 +224,7 @@ impl CacheCommandExecutor { LedgerCommand::GetCredDef( pool_handle, Some(submitter_did.to_string()), - id.to_string(), + id.clone(), Box::new(move |ledger_response| { CommandExecutor::instance().send( Command::Cache( @@ -247,7 +249,7 @@ impl CacheCommandExecutor { "retrieveValue": true, "retrieveTags": true, }).to_string(); - match self.wallet_service.get_record(wallet_handle, which_cache, id, &options_json) { + match self.wallet_service.get_record(wallet_handle, which_cache, &id, &options_json) { Ok(record) => Ok(Some(record)), Err(err) => if err.kind() == IndyErrorKind::WalletItemNotFound { Ok(None) } else { Err(err) } } diff --git a/libindy/src/commands/ledger.rs b/libindy/src/commands/ledger.rs index 332ed18f66..968a12141b 100644 --- a/libindy/src/commands/ledger.rs +++ b/libindy/src/commands/ledger.rs @@ -6,10 +6,10 @@ use serde_json; use serde_json::Value; use api::ledger::{CustomFree, CustomTransactionParser}; -use domain::anoncreds::credential_definition::{CredentialDefinition, CredentialDefinitionV1}; -use domain::anoncreds::revocation_registry_definition::{RevocationRegistryDefinition, RevocationRegistryDefinitionV1}; +use domain::anoncreds::credential_definition::{CredentialDefinition, CredentialDefinitionV1, CredentialDefinitionId}; +use domain::anoncreds::revocation_registry_definition::{RevocationRegistryDefinition, RevocationRegistryDefinitionV1, RevocationRegistryId}; use domain::anoncreds::revocation_registry_delta::{RevocationRegistryDelta, RevocationRegistryDeltaV1}; -use domain::anoncreds::schema::{Schema, SchemaV1}; +use domain::anoncreds::schema::{Schema, SchemaV1, SchemaId}; use domain::crypto::did::Did; use domain::crypto::key::Key; use domain::ledger::node::NodeOperationData; @@ -96,7 +96,7 @@ pub enum LedgerCommand { Box) + Send>), BuildGetSchemaRequest( Option, // submitter did - String, // id + SchemaId, // id Box) + Send>), ParseGetSchemaResponse( String, // get schema response json @@ -107,7 +107,7 @@ pub enum LedgerCommand { Box) + Send>), BuildGetCredDefRequest( Option, // submitter did - String, // id + CredentialDefinitionId, // id Box) + Send>), ParseGetCredDefResponse( String, // get cred definition response @@ -154,20 +154,20 @@ pub enum LedgerCommand { Box) + Send>), BuildGetRevocRegDefRequest( Option, // submitter did - String, // revocation registry definition id + RevocationRegistryId, // revocation registry definition id Box) + Send>), ParseGetRevocRegDefResponse( String, // get revocation registry definition response Box) + Send>), BuildRevocRegEntryRequest( String, // submitter did - String, // revocation registry definition id + RevocationRegistryId, // revocation registry definition id String, // revocation registry definition type RevocationRegistryDelta, // value Box) + Send>), BuildGetRevocRegRequest( Option, // submitter did - String, // revocation registry definition id + RevocationRegistryId, // revocation registry definition id i64, // timestamp Box) + Send>), ParseGetRevocRegResponse( @@ -175,7 +175,7 @@ pub enum LedgerCommand { Box) + Send>), BuildGetRevocRegDeltaRequest( Option, // submitter did - String, // revocation registry definition id + RevocationRegistryId, // revocation registry definition id Option, // from i64, // to Box) + Send>), @@ -214,7 +214,7 @@ pub enum LedgerCommand { GetSchema( PoolHandle, Option, - String, + SchemaId, Box) + Send>, ), GetSchemaContinue( @@ -224,7 +224,7 @@ pub enum LedgerCommand { GetCredDef( PoolHandle, Option, - String, + CredentialDefinitionId, Box) + Send>, ), GetCredDefContinue( @@ -758,7 +758,7 @@ impl LedgerCommandExecutor { fn build_get_schema_request(&self, submitter_did: Option<&str>, - id: &str) -> IndyResult { + id: &SchemaId) -> IndyResult { debug!("build_get_schema_request >>> submitter_did: {:?}, id: {:?}", submitter_did, id); self.validate_opt_did(submitter_did)?; @@ -798,7 +798,7 @@ impl LedgerCommandExecutor { fn build_get_cred_def_request(&self, submitter_did: Option<&str>, - id: &str) -> IndyResult { + id: &CredentialDefinitionId) -> IndyResult { debug!("build_get_cred_def_request >>> submitter_did: {:?}, id: {:?}", submitter_did, id); self.validate_opt_did(submitter_did)?; @@ -937,7 +937,7 @@ impl LedgerCommandExecutor { fn build_get_revoc_reg_def_request(&self, submitter_did: Option<&str>, - id: &str) -> IndyResult { + id: &RevocationRegistryId) -> IndyResult { debug!("build_get_revoc_reg_def_request >>> submitter_did: {:?}, id: {:?}", submitter_did, id); self.validate_opt_did(submitter_did)?; @@ -962,7 +962,7 @@ impl LedgerCommandExecutor { fn build_revoc_reg_entry_request(&self, submitter_did: &str, - revoc_reg_def_id: &str, + revoc_reg_def_id: &RevocationRegistryId, revoc_def_type: &str, value: RevocationRegistryDeltaV1) -> IndyResult { debug!("build_revoc_reg_entry_request >>> submitter_did: {:?}, revoc_reg_def_id: {:?}, revoc_def_type: {:?}, value: {:?}", @@ -979,7 +979,7 @@ impl LedgerCommandExecutor { fn build_get_revoc_reg_request(&self, submitter_did: Option<&str>, - revoc_reg_def_id: &str, + revoc_reg_def_id: &RevocationRegistryId, timestamp: i64) -> IndyResult { debug!("build_get_revoc_reg_request >>> submitter_did: {:?}, revoc_reg_def_id: {:?}, timestamp: {:?}", submitter_did, revoc_reg_def_id, timestamp); @@ -1005,7 +1005,7 @@ impl LedgerCommandExecutor { fn build_get_revoc_reg_delta_request(&self, submitter_did: Option<&str>, - revoc_reg_def_id: &str, + revoc_reg_def_id: &RevocationRegistryId, from: Option, to: i64) -> IndyResult { debug!("build_get_revoc_reg_delta_request >>> submitter_did: {:?}, revoc_reg_def_id: {:?}, from: {:?}, to: {:?}", submitter_did, revoc_reg_def_id, from, to); @@ -1207,7 +1207,7 @@ impl LedgerCommandExecutor { } } - fn get_schema(&self, pool_handle: i32, submitter_did: Option<&str>, id: &str, cb: Box) + Send>) { + fn get_schema(&self, pool_handle: i32, submitter_did: Option<&str>, id: &SchemaId, cb: Box) + Send>) { let request_json = try_cb!(self.build_get_schema_request(submitter_did, id), cb); let cb_id = next_command_handle(); @@ -1231,7 +1231,7 @@ impl LedgerCommandExecutor { cb(self.parse_get_schema_response(&pool_response)); } - fn get_cred_def(&self, pool_handle: i32, submitter_did: Option<&str>, id: &str, cb: Box) + Send>) { + fn get_cred_def(&self, pool_handle: i32, submitter_did: Option<&str>, id: &CredentialDefinitionId, cb: Box) + Send>) { let request_json = try_cb!(self.build_get_cred_def_request(submitter_did, id), cb); let cb_id = next_command_handle(); diff --git a/libindy/src/domain/anoncreds/credential.rs b/libindy/src/domain/anoncreds/credential.rs index abe3fcb1b3..83d8a90e27 100644 --- a/libindy/src/domain/anoncreds/credential.rs +++ b/libindy/src/domain/anoncreds/credential.rs @@ -6,6 +6,9 @@ use ursa::cl::{ }; use super::DELIMITER; +use super::schema::SchemaId; +use super::credential_definition::CredentialDefinitionId; +use super::revocation_registry_definition::RevocationRegistryId; use std::collections::HashMap; use named_type::NamedType; @@ -14,10 +17,10 @@ use utils::validation::Validatable; #[derive(Debug, Deserialize, Serialize, NamedType)] pub struct Credential { - pub schema_id: String, - pub cred_def_id: String, - pub rev_reg_id: Option, - pub values: HashMap, + pub schema_id: SchemaId, + pub cred_def_id: CredentialDefinitionId, + pub rev_reg_id: Option, + pub values: CredentialValues, pub signature: CredentialSignature, pub signature_correctness_proof: SignatureCorrectnessProof, pub rev_reg: Option, @@ -26,40 +29,42 @@ pub struct Credential { impl Credential { fn schema_parts(&self) -> Vec<&str> { - self.schema_id.split_terminator(DELIMITER).collect::>() + self.schema_id.0.split_terminator(DELIMITER).collect::>() } - pub fn schema_id(&self) -> String { self.schema_id.to_string() } + pub fn schema_id(&self) -> String { self.schema_id.0.to_string() } pub fn schema_issuer_did(&self) -> String { - self.schema_parts().get(0).map(|s| s.to_string()).unwrap_or_default() + self.schema_parts().get(0).map(|val| val.to_string()).unwrap_or_default() } pub fn schema_name(&self) -> String { - self.schema_parts().get(2).map(|s| s.to_string()).unwrap_or_default() + self.schema_parts().get(2).map(|val| val.to_string()).unwrap_or_default() } pub fn schema_version(&self) -> String { - self.schema_parts().get(3).map(|s| s.to_string()).unwrap_or_default() + self.schema_parts().get(3).map(|val| val.to_string()).unwrap_or_default() } pub fn issuer_did(&self) -> String { - self.cred_def_id.split_terminator(DELIMITER).collect::>()[0].to_string() + self.cred_def_id.0.split_terminator(DELIMITER).collect::>()[0].to_string() } - pub fn cred_def_id(&self) -> String { self.cred_def_id.to_string() } + pub fn cred_def_id(&self) -> String { self.cred_def_id.0.to_string() } } #[derive(Clone, Debug, Deserialize, Serialize, Eq, PartialEq)] pub struct CredentialInfo { pub referent: String, - pub attrs: HashMap, - pub schema_id: String, - pub cred_def_id: String, - pub rev_reg_id: Option, + pub attrs: ShortCredentialValues, + pub schema_id: SchemaId, + pub cred_def_id: CredentialDefinitionId, + pub rev_reg_id: Option, pub cred_rev_id: Option } +pub type ShortCredentialValues = HashMap; + pub type CredentialValues = HashMap; #[derive(Debug, Clone, Deserialize, Serialize, Eq, PartialEq)] @@ -71,7 +76,25 @@ pub struct AttributeValues { impl Validatable for CredentialValues { fn validate(&self) -> Result<(), String> { if self.is_empty() { - return Err(String::from("Empty list of Credential Values has been passed")); + return Err(String::from("CredentialValues validation failed: empty list has been passed")); + } + + Ok(()) + } +} + +impl Validatable for Credential { + fn validate(&self) -> Result<(), String> { + self.schema_id.validate()?; + self.cred_def_id.validate()?; + self.values.validate()?; + + if self.rev_reg_id.is_some() && (self.witness.is_none() ||self.rev_reg.is_none()){ + return Err(String::from("Credential validation failed: `witness` and `rev_reg` must be passed for revocable Credential")); + } + + if self.values.is_empty() { + return Err(String::from("Credential validation failed: `values` is empty")); } Ok(()) diff --git a/libindy/src/domain/anoncreds/credential_definition.rs b/libindy/src/domain/anoncreds/credential_definition.rs index 0c381b91a2..5cb55172f8 100644 --- a/libindy/src/domain/anoncreds/credential_definition.rs +++ b/libindy/src/domain/anoncreds/credential_definition.rs @@ -1,6 +1,9 @@ use super::DELIMITER; +use super::schema::SchemaId; use super::super::ledger::request::ProtocolVersion; +use utils::validation::Validatable; + use ursa::cl::{ CredentialPrimaryPublicKey, CredentialRevocationPublicKey, @@ -51,8 +54,8 @@ pub struct CredentialDefinitionData { #[derive(Deserialize, Debug, Serialize)] #[serde(rename_all = "camelCase")] pub struct CredentialDefinitionV1 { - pub id: String, - pub schema_id: String, + pub id: CredentialDefinitionId, + pub schema_id: SchemaId, #[serde(rename = "type")] pub signature_type: SignatureType, pub tag: String, @@ -73,20 +76,6 @@ pub struct TemporaryCredentialDefinition { pub cred_def_correctness_proof: CredentialDefinitionCorrectnessProof } -impl CredentialDefinition { - pub fn cred_def_id(did: &str, schema_id: &str, signature_type: &str, tag: &str) -> String { - if ProtocolVersion::is_node_1_3() { - format!("{}{}{}{}{}{}{}", did, DELIMITER, CRED_DEF_MARKER, DELIMITER, signature_type, DELIMITER, schema_id) - } else { - format!("{}{}{}{}{}{}{}{}{}", did, DELIMITER, CRED_DEF_MARKER, DELIMITER, signature_type, DELIMITER, schema_id, DELIMITER, tag) - } - } - - pub fn issuer_did(cred_def_id: &str) -> Option { - cred_def_id.split(':').next().map(String::from) - } -} - impl From for CredentialDefinitionV1 { fn from(cred_def: CredentialDefinition) -> Self { match cred_def { @@ -95,14 +84,13 @@ impl From for CredentialDefinitionV1 { } } -pub fn cred_defs_map_to_cred_defs_v1_map(cred_defs: HashMap) -> HashMap { - let mut cred_defs_v1: HashMap = HashMap::new(); - - for (cred_def_id, cred_def) in cred_defs { - cred_defs_v1.insert(cred_def_id, CredentialDefinitionV1::from(cred_def)); - } +pub type CredentialDefinitions = HashMap; - cred_defs_v1 +pub fn cred_defs_map_to_cred_defs_v1_map(cred_defs: CredentialDefinitions) -> HashMap { + cred_defs + .into_iter() + .map(|(cred_def_id, cred_def)| (cred_def_id, CredentialDefinitionV1::from(cred_def))) + .collect() } #[derive(Debug, Serialize, Deserialize, NamedType)] @@ -113,4 +101,69 @@ pub struct CredentialDefinitionPrivateKey { #[derive(Debug, Serialize, Deserialize, NamedType)] pub struct CredentialDefinitionCorrectnessProof { pub value: CredentialKeyCorrectnessProof -} \ No newline at end of file +} + +impl Validatable for CredentialDefinition { + fn validate(&self) -> Result<(), String> { + match self { + CredentialDefinition::CredentialDefinitionV1(cred_def) => { + cred_def.id.validate()?; + cred_def.schema_id.validate()?; + Ok(()) + } + } + } +} + +#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, Hash)] +pub struct CredentialDefinitionId(pub String); + +impl CredentialDefinitionId { + pub fn new(did: &str, schema_id: &SchemaId, signature_type: &str, tag: &str) -> CredentialDefinitionId { + if ProtocolVersion::is_node_1_3() { + CredentialDefinitionId(format!("{}{}{}{}{}{}{}", did, DELIMITER, CRED_DEF_MARKER, DELIMITER, signature_type, DELIMITER, schema_id.0)) + } else { + CredentialDefinitionId(format!("{}{}{}{}{}{}{}{}{}", did, DELIMITER, CRED_DEF_MARKER, DELIMITER, signature_type, DELIMITER, schema_id.0, DELIMITER, tag)) + } + } + + pub fn issuer_did(&self) -> Option { + self.0.split(DELIMITER).next().map(String::from) + } +} + +impl Validatable for CredentialDefinitionId { + fn validate(&self) -> Result<(), String> { + let parts: Vec<&str> = self.0.split_terminator(DELIMITER).collect::>(); + + parts.get(0).ok_or(format!("Credential Definition Id validation failed: issuer DID not found in: {}", self.0))?; + parts.get(1).ok_or(format!("Credential Definition Id validation failed: marker not found in: {}", self.0))?; + parts.get(2).ok_or(format!("Credential Definition Id validation failed: signature type not found in: {}", self.0))?; + + if parts.len() == 4 { + // NcYxiDXkpYi6ov5FcYDi1e:3:CL:1 + parts.get(3) + .ok_or(format!("Credential Definition Id validation failed: schema id not found in: {}", self.0))? + .parse::() + .map_err(|_| format!("Credential Definition Id validation failed: schema id is invalid number: {}", self.0))?; + } else if parts.len() == 5 { + // NcYxiDXkpYi6ov5FcYDi1e:3:CL:1:tag + parts.get(7) + .ok_or(format!("Credential Definition Id validation failed: schema id not found in: {}", self.0))? + .parse::() + .map_err(|_| format!("Credential Definition Id validation failed: schema id is invalid number: {}", self.0))?; + } else if parts.len() == 7 { + // NcYxiDXkpYi6ov5FcYDi1e:3:CL:NcYxiDXkpYi6ov5FcYDi1e:2:gvt:1.0 + // nothing to do + } else if parts.len() == 8 { + // NcYxiDXkpYi6ov5FcYDi1e:3:CL:NcYxiDXkpYi6ov5FcYDi1e:2:gvt:1.0:TAG_1 + parts.get(7).ok_or(format!("Credential Definition Id validation failed: tag not found in: {}", self.0))?; + } else { + return Err("Credential Definition Id validation failed: too much parts".to_string()); + } + + Ok(()) + } +} + +impl Validatable for CredentialDefinitionConfig {} \ No newline at end of file diff --git a/libindy/src/domain/anoncreds/credential_offer.rs b/libindy/src/domain/anoncreds/credential_offer.rs index 10129ec656..c27ca6738f 100644 --- a/libindy/src/domain/anoncreds/credential_offer.rs +++ b/libindy/src/domain/anoncreds/credential_offer.rs @@ -1,9 +1,22 @@ use ursa::cl::{CredentialKeyCorrectnessProof, Nonce}; +use super::schema::SchemaId; +use super::credential_definition::CredentialDefinitionId; + +use utils::validation::Validatable; + #[derive(Debug, Deserialize, Serialize)] pub struct CredentialOffer { - pub schema_id: String, - pub cred_def_id: String, + pub schema_id: SchemaId, + pub cred_def_id: CredentialDefinitionId, pub key_correctness_proof: CredentialKeyCorrectnessProof, pub nonce: Nonce +} + +impl Validatable for CredentialOffer { + fn validate(&self) -> Result<(), String> { + self.schema_id.validate()?; + self.cred_def_id.validate()?; + Ok(()) + } } \ No newline at end of file diff --git a/libindy/src/domain/anoncreds/credential_request.rs b/libindy/src/domain/anoncreds/credential_request.rs index 8f81f77cdf..c7ef9e392e 100644 --- a/libindy/src/domain/anoncreds/credential_request.rs +++ b/libindy/src/domain/anoncreds/credential_request.rs @@ -5,10 +5,14 @@ use ursa::cl::{ Nonce }; +use super::credential_definition::CredentialDefinitionId; + +use utils::validation::Validatable; + #[derive(Debug, Serialize, Deserialize)] pub struct CredentialRequest { pub prover_did: String, - pub cred_def_id: String, + pub cred_def_id: CredentialDefinitionId, pub blinded_ms: BlindedCredentialSecrets, pub blinded_ms_correctness_proof: BlindedCredentialSecretsCorrectnessProof, pub nonce: Nonce, @@ -19,4 +23,13 @@ pub struct CredentialRequestMetadata { pub master_secret_blinding_data: CredentialSecretsBlindingFactors, pub nonce: Nonce, pub master_secret_name: String -} \ No newline at end of file +} + +impl Validatable for CredentialRequest { + fn validate(&self) -> Result<(), String> { + self.cred_def_id.validate()?; + Ok(()) + } +} + +impl Validatable for CredentialRequestMetadata {} \ No newline at end of file diff --git a/libindy/src/domain/anoncreds/master_secret.rs b/libindy/src/domain/anoncreds/master_secret.rs index 2e2d3c08ad..004be4fd3e 100644 --- a/libindy/src/domain/anoncreds/master_secret.rs +++ b/libindy/src/domain/anoncreds/master_secret.rs @@ -2,7 +2,11 @@ use ursa::cl::MasterSecret as CryptoMasterSecret; use named_type::NamedType; +use utils::validation::Validatable; + #[derive(Debug, Deserialize, Serialize, NamedType)] pub struct MasterSecret { pub value: CryptoMasterSecret, } + +impl Validatable for MasterSecret {} diff --git a/libindy/src/domain/anoncreds/proof.rs b/libindy/src/domain/anoncreds/proof.rs index 8eaf5fce47..a9cc7684bc 100644 --- a/libindy/src/domain/anoncreds/proof.rs +++ b/libindy/src/domain/anoncreds/proof.rs @@ -1,6 +1,11 @@ use std::collections::HashMap; -use ursa::cl::{Proof as CryptoProof}; +use ursa::cl::Proof as CryptoProof; + +use super::schema::SchemaId; +use super::credential_definition::CredentialDefinitionId; +use super::revocation_registry_definition::RevocationRegistryId; +use utils::validation::Validatable; #[derive(Debug, Serialize, Deserialize)] pub struct Proof { @@ -30,12 +35,12 @@ impl Default for RequestedProof { #[derive(Clone, Debug, Deserialize, Serialize)] pub struct SubProofReferent { - pub sub_proof_index: i32, + pub sub_proof_index: u32, } #[derive(Debug, Deserialize, Serialize)] pub struct RevealedAttributeInfo { - pub sub_proof_index: i32, + pub sub_proof_index: u32, pub raw: String, pub encoded: String } @@ -43,8 +48,10 @@ pub struct RevealedAttributeInfo { #[derive(Debug, Clone, Deserialize, Serialize, PartialEq, Eq, Hash)] pub struct Identifier { - pub schema_id: String, - pub cred_def_id: String, - pub rev_reg_id: Option, + pub schema_id: SchemaId, + pub cred_def_id: CredentialDefinitionId, + pub rev_reg_id: Option, pub timestamp: Option -} \ No newline at end of file +} + +impl Validatable for Proof {} \ No newline at end of file diff --git a/libindy/src/domain/anoncreds/proof_request.rs b/libindy/src/domain/anoncreds/proof_request.rs index 4a05e02b87..311c409633 100644 --- a/libindy/src/domain/anoncreds/proof_request.rs +++ b/libindy/src/domain/anoncreds/proof_request.rs @@ -3,6 +3,8 @@ use std::collections::HashMap; use std::fmt; use ursa::cl::Nonce; +use utils::validation::Validatable; + #[derive(Debug, Deserialize, Serialize)] pub struct ProofRequest { pub nonce: Nonce, @@ -50,14 +52,14 @@ pub enum PredicateTypes { } impl fmt::Display for PredicateTypes { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - match *self { - PredicateTypes::GE => write!(f, "GE"), - PredicateTypes::GT => write!(f, "GT"), - PredicateTypes::LE => write!(f, "LE"), - PredicateTypes::LT => write!(f, "LT") - } - } + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match *self { + PredicateTypes::GE => write!(f, "GE"), + PredicateTypes::GT => write!(f, "GT"), + PredicateTypes::LE => write!(f, "LE"), + PredicateTypes::LT => write!(f, "LT") + } + } } #[derive(Clone, Debug, Deserialize, Serialize)] @@ -71,4 +73,26 @@ pub struct RequestedAttributeInfo { pub struct RequestedPredicateInfo { pub predicate_referent: String, pub predicate_info: PredicateInfo +} + +impl Validatable for ProofRequest { + fn validate(&self) -> Result<(), String> { + if self.requested_attributes.is_empty() && self.requested_predicates.is_empty() { + return Err(String::from("Proof Request validation failed: both `requested_attributes` and `requested_predicates` are empty")); + } + + for (_, requested_attribute) in self.requested_attributes.iter() { + if requested_attribute.name.is_empty() { + return Err(format!("Proof Request validation failed: there is empty requested attribute: {:?}", requested_attribute)); + } + } + + for (_, requested_predicate) in self.requested_predicates.iter() { + if requested_predicate.name.is_empty() { + return Err(format!("Proof Request validation failed: there is empty requested attribute: {:?}", requested_predicate)); + } + } + + Ok(()) + } } \ No newline at end of file diff --git a/libindy/src/domain/anoncreds/requested_credential.rs b/libindy/src/domain/anoncreds/requested_credential.rs index 7b81cdb211..4b84b4554f 100644 --- a/libindy/src/domain/anoncreds/requested_credential.rs +++ b/libindy/src/domain/anoncreds/requested_credential.rs @@ -1,5 +1,7 @@ use std::collections::HashMap; +use utils::validation::Validatable; + #[derive(Debug, Deserialize, Serialize)] pub struct RequestedCredentials { pub self_attested_attributes: HashMap, @@ -19,3 +21,12 @@ pub struct ProvingCredentialKey { pub cred_id: String, pub timestamp: Option } + +impl Validatable for RequestedCredentials { + fn validate(&self) -> Result<(), String> { + if self.self_attested_attributes.is_empty() && self.requested_attributes.is_empty() && self.requested_predicates.is_empty() { + return Err(String::from("Requested Credentials validation failed: `self_attested_attributes` and `requested_attributes` and `requested_predicates` are empty")); + } + Ok(()) + } +} \ No newline at end of file diff --git a/libindy/src/domain/anoncreds/revocation_registry.rs b/libindy/src/domain/anoncreds/revocation_registry.rs index 92ab00bbd1..52d3dee09d 100644 --- a/libindy/src/domain/anoncreds/revocation_registry.rs +++ b/libindy/src/domain/anoncreds/revocation_registry.rs @@ -3,6 +3,10 @@ use named_type::NamedType; use std::collections::HashMap; +use utils::validation::Validatable; + +use super::revocation_registry_definition::RevocationRegistryId; + #[derive(Debug, Serialize, Deserialize)] pub struct RevocationRegistryV1 { pub value: CryptoRevocationRegistry @@ -23,16 +27,20 @@ impl From for RevocationRegistryV1 { } } -pub fn rev_regs_map_to_rev_regs_local_map(rev_regs: HashMap>) -> HashMap> { - let mut rev_regs_local: HashMap> = HashMap::new(); +pub type RevocationRegistries = HashMap>; - for (rev_reg_id, rev_reg_to_timespams) in rev_regs { - let mut rev_regs_for_id: HashMap = HashMap::new(); - for (timestamp, rev_reg) in rev_reg_to_timespams { - rev_regs_for_id.insert(timestamp, RevocationRegistryV1::from(rev_reg)); - } - rev_regs_local.insert(rev_reg_id, rev_regs_for_id); - } - rev_regs_local +pub fn rev_regs_map_to_rev_regs_local_map(rev_regs: RevocationRegistries) -> HashMap> { + rev_regs + .into_iter() + .map(|(rev_reg_id, rev_reg_to_timespams)| { + let val = rev_reg_to_timespams + .into_iter() + .map(|(timestamp, rev_reg)| (timestamp, RevocationRegistryV1::from(rev_reg))) + .collect(); + (rev_reg_id, val) + }) + .collect() } + +impl Validatable for RevocationRegistry {} diff --git a/libindy/src/domain/anoncreds/revocation_registry_definition.rs b/libindy/src/domain/anoncreds/revocation_registry_definition.rs index 5a9c179c04..60dc60b815 100644 --- a/libindy/src/domain/anoncreds/revocation_registry_definition.rs +++ b/libindy/src/domain/anoncreds/revocation_registry_definition.rs @@ -1,6 +1,7 @@ use ursa::cl::{RevocationKeyPublic, RevocationKeyPrivate}; use super::DELIMITER; +use super::credential_definition::CredentialDefinitionId; use std::collections::{HashMap, HashSet}; use named_type::NamedType; @@ -62,10 +63,10 @@ pub struct RevocationRegistryDefinitionValuePublicKeys { #[derive(Deserialize, Debug, Serialize)] #[serde(rename_all = "camelCase")] pub struct RevocationRegistryDefinitionV1 { - pub id: String, + pub id: RevocationRegistryId, pub revoc_def_type: RegistryType, pub tag: String, - pub cred_def_id: String, + pub cred_def_id: CredentialDefinitionId, pub value: RevocationRegistryDefinitionValue } @@ -76,12 +77,6 @@ pub enum RevocationRegistryDefinition { RevocationRegistryDefinitionV1(RevocationRegistryDefinitionV1) } -impl RevocationRegistryDefinition { - pub fn rev_reg_id(did: &str, cred_def_id: &str, rev_reg_type: &RegistryType, tag: &str) -> String { - format!("{}{}{}{}{}{}{}{}{}", did, DELIMITER, REV_REG_DEG_MARKER, DELIMITER, cred_def_id, DELIMITER, rev_reg_type.to_str(), DELIMITER, tag) - } -} - impl From for RevocationRegistryDefinitionV1 { fn from(rev_reg_def: RevocationRegistryDefinition) -> Self { match rev_reg_def { @@ -90,14 +85,13 @@ impl From for RevocationRegistryDefinitionV1 { } } -pub fn rev_reg_defs_map_to_rev_reg_defs_v1_map(rev_reg_defs: HashMap) -> HashMap { - let mut rev_reg_defs_v1: HashMap = HashMap::new(); +pub type RevocationRegistryDefinitions = HashMap; - for (rev_reg_id, rev_reg_def) in rev_reg_defs { - rev_reg_defs_v1.insert(rev_reg_id, RevocationRegistryDefinitionV1::from(rev_reg_def)); - } - - rev_reg_defs_v1 +pub fn rev_reg_defs_map_to_rev_reg_defs_v1_map(rev_reg_defs: RevocationRegistryDefinitions) -> HashMap { + rev_reg_defs + .into_iter() + .map(|(rev_reg_id, rev_reg_def)| (rev_reg_id, RevocationRegistryDefinitionV1::from(rev_reg_def))) + .collect() } #[derive(Debug, Serialize, Deserialize, NamedType)] @@ -107,17 +101,52 @@ pub struct RevocationRegistryDefinitionPrivate { #[derive(Debug, Deserialize, Serialize, Clone, NamedType)] pub struct RevocationRegistryInfo { - pub id: String, + pub id: RevocationRegistryId, pub curr_id: u32, pub used_ids: HashSet } +#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, Hash)] +pub struct RevocationRegistryId(pub String); + +impl RevocationRegistryId { + pub fn new(did: &str, cred_def_id: &str, rev_reg_type: &RegistryType, tag: &str) -> RevocationRegistryId { + RevocationRegistryId(format!("{}{}{}{}{}{}{}{}{}", did, DELIMITER, REV_REG_DEG_MARKER, DELIMITER, cred_def_id, DELIMITER, rev_reg_type.to_str(), DELIMITER, tag)) + } +} impl Validatable for RevocationRegistryConfig { fn validate(&self) -> Result<(), String> { if let Some(num_) = self.max_cred_num { if num_ == 0 { - return Err(String::from("`max_cred_num` must be greater than 0")); + return Err(String::from("RevocationRegistryConfig validation failed: `max_cred_num` must be greater than 0")); + } + } + Ok(()) + } +} + +impl Validatable for RevocationRegistryId { + fn validate(&self) -> Result<(), String> { + let parts: Vec<&str> = self.0.split_terminator(DELIMITER).collect::>(); + + parts.get(0).ok_or(format!("Revocation Registry Id validation failed: issuer DID not found in: {}", self.0))?; + parts.get(1).ok_or(format!("Revocation Registry Id validation failed: marker not found in: {}", self.0))?; + parts.get(2).ok_or(format!("Revocation Registry Id validation failed: signature type not found in: {}", self.0))?; + + if parts.len() != 8 && parts.len() != 9 && parts.len() != 11 && parts.len() != 12 { + return Err("Revocation Registry Id validation failed: invalid number of parts".to_string()); + } + + Ok(()) + } +} + +impl Validatable for RevocationRegistryDefinition { + fn validate(&self) -> Result<(), String> { + match self { + RevocationRegistryDefinition::RevocationRegistryDefinitionV1(revoc_reg_def) => { + revoc_reg_def.id.validate()?; } } Ok(()) diff --git a/libindy/src/domain/anoncreds/revocation_registry_delta.rs b/libindy/src/domain/anoncreds/revocation_registry_delta.rs index e5122136b8..5e1a3baeb6 100644 --- a/libindy/src/domain/anoncreds/revocation_registry_delta.rs +++ b/libindy/src/domain/anoncreds/revocation_registry_delta.rs @@ -1,5 +1,7 @@ use ursa::cl::RevocationRegistryDelta as RegistryDelta; +use utils::validation::Validatable; + #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct RevocationRegistryDeltaV1 { @@ -20,3 +22,5 @@ impl From for RevocationRegistryDeltaV1 { } } } + +impl Validatable for RevocationRegistryDelta {} \ No newline at end of file diff --git a/libindy/src/domain/anoncreds/revocation_state.rs b/libindy/src/domain/anoncreds/revocation_state.rs index d22e4bb138..3b8841c0d9 100644 --- a/libindy/src/domain/anoncreds/revocation_state.rs +++ b/libindy/src/domain/anoncreds/revocation_state.rs @@ -1,10 +1,26 @@ use ursa::cl::{Witness, RevocationRegistry}; +use std::collections::HashMap; use named_type::NamedType; +use utils::validation::Validatable; + +use super::revocation_registry_definition::RevocationRegistryId; + #[derive(Clone, Debug, Serialize, Deserialize, NamedType)] pub struct RevocationState { pub witness: Witness, pub rev_reg: RevocationRegistry, pub timestamp: u64 } + +impl Validatable for RevocationState { + fn validate(&self) -> Result<(), String> { + if self.timestamp == 0 { + return Err(String::from("RevocationState validation failed: `timestamp` must be greater than 0")); + } + Ok(()) + } +} + +pub type RevocationStates = HashMap>; diff --git a/libindy/src/domain/anoncreds/schema.rs b/libindy/src/domain/anoncreds/schema.rs index 71cb1c5de0..15de2c5862 100644 --- a/libindy/src/domain/anoncreds/schema.rs +++ b/libindy/src/domain/anoncreds/schema.rs @@ -11,7 +11,7 @@ pub const MAX_ATTRIBUTES_COUNT: usize = 125; #[derive(Debug, Serialize, Deserialize, Clone)] #[serde(rename_all = "camelCase")] pub struct SchemaV1 { - pub id: String, + pub id: SchemaId, pub name: String, pub version: String, #[serde(rename = "attrNames")] @@ -26,16 +26,6 @@ pub enum Schema { SchemaV1(SchemaV1) } -impl Schema { - pub fn schema_id(did: &str, name: &str, version: &str) -> String { - format!("{}{}{}{}{}{}{}", did, DELIMITER, SCHEMA_MARKER, DELIMITER, name, DELIMITER, version) - } - - pub fn issuer_did(schema_id: &str) -> Option { - schema_id.split(':').next().map(String::from) - } -} - impl From for SchemaV1 { fn from(schema: Schema) -> Self { match schema { @@ -44,16 +34,25 @@ impl From for SchemaV1 { } } -pub fn schemas_map_to_schemas_v1_map(schemas: HashMap) -> HashMap { +pub type Schemas = HashMap; + +pub fn schemas_map_to_schemas_v1_map(schemas: Schemas) -> HashMap { schemas.into_iter().map(|(schema_id, schema)| { (schema_id, SchemaV1::from(schema)) }).collect() } pub type AttributeNames = HashSet; +#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, Hash)] +pub struct SchemaId(pub String); + impl Validatable for Schema { fn validate(&self) -> Result<(), String> { match self { - Schema::SchemaV1(schema) => schema.attr_names.validate() + Schema::SchemaV1(schema) => { + schema.attr_names.validate()?; + schema.id.validate()?; + Ok(()) + } } } } @@ -67,6 +66,32 @@ impl Validatable for AttributeNames { if self.len() > MAX_ATTRIBUTES_COUNT { return Err(format!("The number of Schema attributes {} cannot be greater than {}", self.len(), MAX_ATTRIBUTES_COUNT)); } + Ok(()) + } +} + +impl SchemaId { + pub fn new(did: &str, name: &str, version: &str) -> SchemaId{ + SchemaId(format!("{}{}{}{}{}{}{}", did, DELIMITER, SCHEMA_MARKER, DELIMITER, name, DELIMITER, version)) + } + + pub fn issuer_did(&self) -> Option { + self.0.split(DELIMITER).next().map(String::from) + } +} + +impl Validatable for SchemaId { + fn validate(&self) -> Result<(), String> { + let parts: Vec<&str> = self.0.split_terminator(DELIMITER).collect::>(); + if parts.len() > 4 { + return Err("SchemaId validation failed: too much parts".to_string()); + } + + parts.get(0).ok_or(format!("Schema Id validation failed: issuer DID not found in: {}", self.0))?; + parts.get(1).ok_or(format!("Schema Id validation failed: marker not found in: {}", self.0))?; + parts.get(2).ok_or(format!("Schema Id validation failed: name not found in: {}", self.0))?; + parts.get(3).ok_or(format!("Schema Id validation failed: version not found in: {}", self.0))?; + Ok(()) } } \ No newline at end of file diff --git a/libindy/src/domain/ledger/cred_def.rs b/libindy/src/domain/ledger/cred_def.rs index b218c2912f..7942e7bc72 100644 --- a/libindy/src/domain/ledger/cred_def.rs +++ b/libindy/src/domain/ledger/cred_def.rs @@ -18,7 +18,7 @@ pub struct CredDefOperation { impl CredDefOperation { pub fn new(data: CredentialDefinitionV1) -> CredDefOperation { CredDefOperation { - _ref: data.schema_id.parse::().unwrap_or(0), + _ref: data.schema_id.0.parse::().unwrap_or(0), signature_type: data.signature_type.to_str().to_string(), data: data.value, tag: if ProtocolVersion::is_node_1_3() { None } else { Some(data.tag.clone()) }, diff --git a/libindy/src/domain/ledger/rev_reg.rs b/libindy/src/domain/ledger/rev_reg.rs index 847d1db781..ffeb0fa864 100644 --- a/libindy/src/domain/ledger/rev_reg.rs +++ b/libindy/src/domain/ledger/rev_reg.rs @@ -3,6 +3,7 @@ use super::constants::{REVOC_REG_ENTRY, GET_REVOC_REG, GET_REVOC_REG_DELTA}; use ursa::cl::{RevocationRegistry, RevocationRegistryDelta}; use super::response::{GetReplyResultV1, ReplyType}; +use super::super::anoncreds::revocation_registry_definition::RevocationRegistryId; use super::super::anoncreds::revocation_registry::RevocationRegistryV1; use super::super::anoncreds::revocation_registry_delta::RevocationRegistryDeltaV1; @@ -13,17 +14,17 @@ use std::collections::HashSet; pub struct RevRegEntryOperation { #[serde(rename = "type")] pub _type: String, - pub revoc_reg_def_id: String, + pub revoc_reg_def_id: RevocationRegistryId, pub revoc_def_type: String, pub value: RevocationRegistryDelta, } impl RevRegEntryOperation { - pub fn new(rev_def_type: &str, revoc_reg_def_id: &str, value: RevocationRegistryDeltaV1) -> RevRegEntryOperation { + pub fn new(rev_def_type: &str, revoc_reg_def_id: &RevocationRegistryId, value: RevocationRegistryDeltaV1) -> RevRegEntryOperation { RevRegEntryOperation { _type: REVOC_REG_ENTRY.to_string(), revoc_def_type: rev_def_type.to_string(), - revoc_reg_def_id: revoc_reg_def_id.to_string(), + revoc_reg_def_id: revoc_reg_def_id.clone(), value: value.value } } @@ -34,15 +35,15 @@ impl RevRegEntryOperation { pub struct GetRevRegOperation { #[serde(rename = "type")] pub _type: String, - pub revoc_reg_def_id: String, + pub revoc_reg_def_id: RevocationRegistryId, pub timestamp: i64, } impl GetRevRegOperation { - pub fn new(revoc_reg_def_id: &str, timestamp: i64) -> GetRevRegOperation { + pub fn new(revoc_reg_def_id: &RevocationRegistryId, timestamp: i64) -> GetRevRegOperation { GetRevRegOperation { _type: GET_REVOC_REG.to_string(), - revoc_reg_def_id: revoc_reg_def_id.to_string(), + revoc_reg_def_id: revoc_reg_def_id.clone(), timestamp } } @@ -53,17 +54,17 @@ impl GetRevRegOperation { pub struct GetRevRegDeltaOperation { #[serde(rename = "type")] pub _type: String, - pub revoc_reg_def_id: String, + pub revoc_reg_def_id: RevocationRegistryId, #[serde(skip_serializing_if = "Option::is_none")] pub from: Option, pub to: i64 } impl GetRevRegDeltaOperation { - pub fn new(revoc_reg_def_id: &str, from: Option, to: i64) -> GetRevRegDeltaOperation { + pub fn new(revoc_reg_def_id: &RevocationRegistryId, from: Option, to: i64) -> GetRevRegDeltaOperation { GetRevRegDeltaOperation { _type: GET_REVOC_REG_DELTA.to_string(), - revoc_reg_def_id: revoc_reg_def_id.to_string(), + revoc_reg_def_id: revoc_reg_def_id.clone(), from, to } @@ -87,7 +88,7 @@ impl ReplyType for GetRevocRegReplyResult { #[serde(rename_all = "camelCase")] pub struct GetRevocRegResultV0 { pub seq_no: i32, - pub revoc_reg_def_id: String, + pub revoc_reg_def_id: RevocationRegistryId, pub data: RevocationRegistryV1, pub txn_time: u64 } @@ -95,7 +96,7 @@ pub struct GetRevocRegResultV0 { #[derive(Debug, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct GetRevocRegDataV1 { - pub revoc_reg_def_id: String, + pub revoc_reg_def_id: RevocationRegistryId, pub value: RevocationRegistryV1 } @@ -137,13 +138,13 @@ impl ReplyType for GetRevocRegDeltaReplyResult { #[serde(rename_all = "camelCase")] pub struct GetRevocRegDeltaResultV0 { pub seq_no: i32, - pub revoc_reg_def_id: String, + pub revoc_reg_def_id: RevocationRegistryId, pub data: RevocationRegistryDeltaData } #[derive(Debug, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct GetRevocRegDeltaDataV1 { - pub revoc_reg_def_id: String, + pub revoc_reg_def_id: RevocationRegistryId, pub value: RevocationRegistryDeltaData } diff --git a/libindy/src/domain/ledger/rev_reg_def.rs b/libindy/src/domain/ledger/rev_reg_def.rs index 49d573dcd4..e70eb8602a 100644 --- a/libindy/src/domain/ledger/rev_reg_def.rs +++ b/libindy/src/domain/ledger/rev_reg_def.rs @@ -1,17 +1,18 @@ use super::constants::{REVOC_REG_DEF, GET_REVOC_REG_DEF}; use super::response::{GetReplyResultV1, ReplyType}; -use super::super::anoncreds::revocation_registry_definition::{RevocationRegistryDefinitionV1, RevocationRegistryDefinitionValue}; +use super::super::anoncreds::credential_definition::CredentialDefinitionId; +use super::super::anoncreds::revocation_registry_definition::{RevocationRegistryDefinitionV1, RevocationRegistryDefinitionValue, RevocationRegistryId}; #[derive(Serialize, Debug)] #[serde(rename_all = "camelCase")] pub struct RevRegDefOperation { #[serde(rename = "type")] pub _type: String, - pub id: String, + pub id: RevocationRegistryId, #[serde(rename = "revocDefType")] pub type_: String, pub tag: String, - pub cred_def_id: String, + pub cred_def_id: CredentialDefinitionId, pub value: RevocationRegistryDefinitionValue } @@ -19,10 +20,10 @@ impl RevRegDefOperation { pub fn new(rev_reg_def: RevocationRegistryDefinitionV1) -> RevRegDefOperation { RevRegDefOperation { _type: REVOC_REG_DEF.to_string(), - id: rev_reg_def.id.to_string(), + id: rev_reg_def.id.clone(), type_: rev_reg_def.revoc_def_type.to_str().to_string(), tag: rev_reg_def.tag.to_string(), - cred_def_id: rev_reg_def.cred_def_id.to_string(), + cred_def_id: rev_reg_def.cred_def_id.clone(), value: rev_reg_def.value } } @@ -33,14 +34,14 @@ impl RevRegDefOperation { pub struct GetRevRegDefOperation { #[serde(rename = "type")] pub _type: String, - pub id: String + pub id: RevocationRegistryId } impl GetRevRegDefOperation { - pub fn new(id: &str) -> GetRevRegDefOperation { + pub fn new(id: &RevocationRegistryId) -> GetRevRegDefOperation { GetRevRegDefOperation { _type: GET_REVOC_REG_DEF.to_string(), - id: id.to_string() + id: id.clone() } } } diff --git a/libindy/src/services/anoncreds/prover.rs b/libindy/src/services/anoncreds/prover.rs index 8ec970c76a..d25bfe411d 100644 --- a/libindy/src/services/anoncreds/prover.rs +++ b/libindy/src/services/anoncreds/prover.rs @@ -15,16 +15,16 @@ use ursa::cl::verifier::Verifier as CryptoVerifier; use domain::anoncreds::credential::{AttributeValues, Credential}; use domain::anoncreds::credential_attr_tag_policy::CredentialAttrTagPolicy; -use domain::anoncreds::credential_definition::CredentialDefinitionV1 as CredentialDefinition; +use domain::anoncreds::credential_definition::{CredentialDefinitionV1 as CredentialDefinition, CredentialDefinitionId}; use domain::anoncreds::credential_offer::CredentialOffer; use domain::anoncreds::credential_request::CredentialRequestMetadata; use domain::anoncreds::proof::{Identifier, Proof, RequestedProof, RevealedAttributeInfo, SubProofReferent}; use domain::anoncreds::proof_request::{PredicateInfo, PredicateTypes, ProofRequest, ProofRequestExtraQuery, RequestedAttributeInfo, RequestedPredicateInfo}; use domain::anoncreds::requested_credential::ProvingCredentialKey; use domain::anoncreds::requested_credential::RequestedCredentials; -use domain::anoncreds::revocation_registry_definition::RevocationRegistryDefinitionV1; +use domain::anoncreds::revocation_registry_definition::{RevocationRegistryDefinitionV1, RevocationRegistryId}; use domain::anoncreds::revocation_state::RevocationState; -use domain::anoncreds::schema::SchemaV1; +use domain::anoncreds::schema::{SchemaV1, SchemaId}; use errors::prelude::*; use services::anoncreds::helpers::*; @@ -117,9 +117,9 @@ impl Prover { proof_req: &ProofRequest, requested_credentials: &RequestedCredentials, master_secret: &MasterSecret, - schemas: &HashMap, - cred_defs: &HashMap, - rev_states: &HashMap>) -> IndyResult { + schemas: &HashMap, + cred_defs: &HashMap, + rev_states: &HashMap>) -> IndyResult { trace!("create_proof >>> credentials: {:?}, proof_req: {:?}, requested_credentials: {:?}, master_secret: {:?}, schemas: {:?}, cred_defs: {:?}, rev_states: {:?}", credentials, proof_req, requested_credentials, secret!(&master_secret), schemas, cred_defs, rev_states); @@ -278,7 +278,7 @@ impl Prover { res.insert("schema_version".to_string(), credential.schema_version()); res.insert("issuer_did".to_string(), credential.issuer_did()); res.insert("cred_def_id".to_string(), credential.cred_def_id()); - res.insert("rev_reg_id".to_string(), credential.rev_reg_id.clone().unwrap_or_else(|| "None".to_string())); + res.insert("rev_reg_id".to_string(), credential.rev_reg_id.as_ref().map(|rev_reg_id|rev_reg_id.0.clone()).unwrap_or_else(|| "None".to_string())); credential.values .iter() @@ -389,7 +389,7 @@ impl Prover { req_predicates_for_credential: Vec, proof_req: &ProofRequest, credential: &Credential, - sub_proof_index: i32, + sub_proof_index: u32, requested_proof: &mut RequestedProof) -> IndyResult<()> { trace!("_update_requested_proof >>> req_attrs_for_credential: {:?}, req_predicates_for_credential: {:?}, proof_req: {:?}, credential: {:?}, \ sub_proof_index: {:?}, requested_proof: {:?}", @@ -545,7 +545,7 @@ mod tests { fn build_credential_tags_works_for_rev_reg_id() { let ps = Prover::new(); let mut credential = _credential(); - credential.rev_reg_id = Some(REV_REG_ID.to_string()); + credential.rev_reg_id = Some(RevocationRegistryId(REV_REG_ID.to_string())); let tags = ps.build_credential_tags(&credential, None); let expected_tags: HashMap = hashmap!( diff --git a/libindy/src/services/anoncreds/verifier.rs b/libindy/src/services/anoncreds/verifier.rs index 5f4714130d..373887476a 100644 --- a/libindy/src/services/anoncreds/verifier.rs +++ b/libindy/src/services/anoncreds/verifier.rs @@ -1,11 +1,11 @@ use std::collections::{HashMap, HashSet}; -use domain::anoncreds::credential_definition::{CredentialDefinitionV1, CredentialDefinition}; +use domain::anoncreds::credential_definition::{CredentialDefinitionV1, CredentialDefinitionId}; use domain::anoncreds::proof::{Proof, RequestedProof, Identifier}; use domain::anoncreds::proof_request::{AttributeInfo, PredicateInfo, ProofRequest, NonRevocedInterval}; use domain::anoncreds::revocation_registry::RevocationRegistryV1; -use domain::anoncreds::revocation_registry_definition::RevocationRegistryDefinitionV1; -use domain::anoncreds::schema::{SchemaV1, Schema}; +use domain::anoncreds::revocation_registry_definition::{RevocationRegistryDefinitionV1, RevocationRegistryId}; +use domain::anoncreds::schema::{SchemaV1, SchemaId}; use errors::prelude::*; use services::anoncreds::helpers::*; @@ -33,10 +33,10 @@ impl Verifier { pub fn verify(&self, full_proof: &Proof, proof_req: &ProofRequest, - schemas: &HashMap, - cred_defs: &HashMap, - rev_reg_defs: &HashMap, - rev_regs: &HashMap>) -> IndyResult { + schemas: &HashMap, + cred_defs: &HashMap, + rev_reg_defs: &HashMap, + rev_regs: &HashMap>) -> IndyResult { trace!("verify >>> full_proof: {:?}, proof_req: {:?}, schemas: {:?}, cred_defs: {:?}, rev_reg_defs: {:?} rev_regs: {:?}", full_proof, proof_req, schemas, cred_defs, rev_reg_defs, rev_regs); @@ -121,7 +121,7 @@ impl Verifier { Ok(valid) } - pub fn generate_nonce(&self) -> IndyResult{ + pub fn generate_nonce(&self) -> IndyResult { trace!("generate_nonce >>> "); let nonce = new_nonce()?; @@ -218,8 +218,8 @@ impl Verifier { .iter() .map(|(referent, info)| Verifier::_validate_timestamp(&received_revealed_attrs, referent, &proof_req.non_revoked, &info.non_revoked) - .or_else(|_|Verifier::_validate_timestamp(&received_unrevealed_attrs, referent, &proof_req.non_revoked, &info.non_revoked)) - .or_else(|_|received_self_attested_attrs.get(referent).map(|_| ()).ok_or(IndyError::from(IndyErrorKind::InvalidStructure))) + .or_else(|_| Verifier::_validate_timestamp(&received_unrevealed_attrs, referent, &proof_req.non_revoked, &info.non_revoked)) + .or_else(|_| received_self_attested_attrs.get(referent).map(|_| ()).ok_or(IndyError::from(IndyErrorKind::InvalidStructure))) ) .collect::>>()?; @@ -288,7 +288,7 @@ impl Verifier { .collect() } - fn _get_proof_identifier(proof: &Proof, index: i32) -> IndyResult { + fn _get_proof_identifier(proof: &Proof, index: u32) -> IndyResult { proof.identifiers .get(index as usize) .cloned() @@ -299,8 +299,8 @@ impl Verifier { } fn _verify_requested_restrictions(proof_req: &ProofRequest, - schemas: &HashMap, - cred_defs: &HashMap, + schemas: &HashMap, + cred_defs: &HashMap, received_revealed_attrs: &HashMap, received_unrevealed_attrs: &HashMap, received_predicates: &HashMap, @@ -353,8 +353,8 @@ impl Verifier { fn _gather_filter_info(referent: &str, identifiers: &HashMap, - schemas: &HashMap, - cred_defs: &HashMap) -> IndyResult { + schemas: &HashMap, + cred_defs: &HashMap) -> IndyResult { let identifier = identifiers .get(referent) .ok_or(err_msg( @@ -376,25 +376,25 @@ impl Verifier { format!("CredentialDefinitionV1 not found for id: {:?}", identifier.cred_def_id)) )?; - let schema_issuer_did = Schema::issuer_did(&schema.id) + let schema_issuer_did = cred_def.schema_id.issuer_did() .ok_or(err_msg( IndyErrorKind::InvalidStructure, format!("schema_id has invalid format: {:?}", schema.id)) )?; - let issuer_did = CredentialDefinition::issuer_did(&cred_def.id) + let issuer_did = cred_def.id.issuer_did() .ok_or(err_msg( IndyErrorKind::InvalidStructure, format!("cred_def_id has invalid format: {:?}", cred_def.id)) )?; Ok(Filter { - schema_id: identifier.schema_id.to_string(), + schema_id: identifier.schema_id.0.to_string(), schema_name: schema.name.to_string(), - schema_issuer_did: schema_issuer_did.to_string(), + schema_issuer_did, schema_version: schema.version.to_string(), - cred_def_id: identifier.cred_def_id.to_string(), - issuer_did: issuer_did.to_string() + cred_def_id: identifier.cred_def_id.0.to_string(), + issuer_did }) } @@ -746,8 +746,8 @@ mod tests { fn _received() -> HashMap { let mut res: HashMap = HashMap::new(); - res.insert("referent_1".to_string(), Identifier { timestamp: Some(1234), schema_id: String::new(), cred_def_id: String::new(), rev_reg_id: Some(String::new()) }); - res.insert("referent_2".to_string(), Identifier { timestamp: None, schema_id: String::new(), cred_def_id: String::new(), rev_reg_id: Some(String::new()) }); + res.insert("referent_1".to_string(), Identifier { timestamp: Some(1234), schema_id: SchemaId(String::new()), cred_def_id: CredentialDefinitionId(String::new()), rev_reg_id: Some(RevocationRegistryId(String::new())) }); + res.insert("referent_2".to_string(), Identifier { timestamp: None, schema_id: SchemaId(String::new()), cred_def_id: CredentialDefinitionId(String::new()), rev_reg_id: Some(RevocationRegistryId(String::new())) }); res } diff --git a/libindy/src/services/ledger/mod.rs b/libindy/src/services/ledger/mod.rs index 76807e1d91..0ced6cb24e 100644 --- a/libindy/src/services/ledger/mod.rs +++ b/libindy/src/services/ledger/mod.rs @@ -5,12 +5,12 @@ use serde_json; use serde_json::Value; use log_derive::logfn; -use domain::anoncreds::credential_definition::{CredentialDefinition, CredentialDefinitionV1}; +use domain::anoncreds::credential_definition::{CredentialDefinition, CredentialDefinitionV1, CredentialDefinitionId}; use domain::anoncreds::DELIMITER; use domain::anoncreds::revocation_registry::RevocationRegistry; -use domain::anoncreds::revocation_registry_definition::{RevocationRegistryDefinition, RevocationRegistryDefinitionV1}; +use domain::anoncreds::revocation_registry_definition::{RevocationRegistryDefinition, RevocationRegistryDefinitionV1, RevocationRegistryId}; use domain::anoncreds::revocation_registry_delta::{RevocationRegistryDelta, RevocationRegistryDeltaV1}; -use domain::anoncreds::schema::{Schema, SchemaV1}; +use domain::anoncreds::schema::{Schema, SchemaV1, SchemaId}; use domain::ledger::attrib::{AttribOperation, GetAttribOperation}; use domain::ledger::constants::{GET_VALIDATOR_INFO, NYM, POOL_RESTART, ROLE_REMOVE, STEWARD, ENDORSER, TRUSTEE, NETWORK_MONITOR, ROLES, txn_name_to_code}; use domain::ledger::cred_def::{CredDefOperation, GetCredDefOperation, GetCredDefReplyResult}; @@ -117,17 +117,12 @@ impl LedgerService { } #[logfn(Info)] - pub fn build_get_schema_request(&self, identifier: Option<&str>, id: &str) -> IndyResult { - let parts: Vec<&str> = id.split_terminator(DELIMITER).collect::>(); + pub fn build_get_schema_request(&self, identifier: Option<&str>, id: &SchemaId) -> IndyResult { + let parts: Vec<&str> = id.0.split_terminator(DELIMITER).collect::>(); - let dest = parts.get(0) - .ok_or(err_msg(IndyErrorKind::InvalidStructure, format!("Schema issuer DID not found in: {}", id)))?.to_string(); - - let name = parts.get(2) - .ok_or(err_msg(IndyErrorKind::InvalidStructure, format!("Schema name not found in: {}", id)))?.to_string(); - - let version = parts.get(3) - .ok_or(err_msg(IndyErrorKind::InvalidStructure, format!("Schema version not found in: {}", id)))?.to_string(); + let dest = parts[0].to_string(); + let name = parts[2].to_string(); + let version = parts[3].to_string(); let data = GetSchemaOperationData::new(name, version); @@ -140,21 +135,17 @@ impl LedgerService { } #[logfn(Info)] - pub fn build_get_cred_def_request(&self, identifier: Option<&str>, id: &str) -> IndyResult { - let parts: Vec<&str> = id.split_terminator(DELIMITER).collect::>(); + pub fn build_get_cred_def_request(&self, identifier: Option<&str>, id: &CredentialDefinitionId) -> IndyResult { + let parts: Vec<&str> = id.0.split_terminator(DELIMITER).collect::>(); - let origin = parts.get(0) - .ok_or(err_msg(IndyErrorKind::InvalidStructure, format!("Origin not found in: {}", id)))?.to_string(); + let origin = parts[0].to_string(); + let signature_type = parts[2].to_string(); - let ref_ = parts.get(3) - .ok_or(err_msg(IndyErrorKind::InvalidStructure, format!("Schema ID not found in: {}", id)))? + let ref_ = parts[3] .parse::() - .to_indy(IndyErrorKind::InvalidStructure, format!("Schema ID is invalid number in: {}", id))?; - - let signature_type = parts.get(2) - .ok_or(err_msg(IndyErrorKind::InvalidStructure, format!("Signature type not found in: {}", id)))?.to_string(); + .to_indy(IndyErrorKind::InvalidStructure, format!("Schema ID is invalid number in: {:?}", id))?; - let tag = parts.get(4).map(|tag| tag.to_string()); + let tag = parts.get(4).map(|val| val.to_string()); build_result!(GetCredDefOperation, identifier, ref_, signature_type, origin, tag) } @@ -209,23 +200,23 @@ impl LedgerService { } #[logfn(Info)] - pub fn build_get_revoc_reg_def_request(&self, identifier: Option<&str>, id: &str) -> IndyResult { + pub fn build_get_revoc_reg_def_request(&self, identifier: Option<&str>, id: &RevocationRegistryId) -> IndyResult { build_result!(GetRevRegDefOperation, identifier, id) } #[logfn(Info)] - pub fn build_revoc_reg_entry_request(&self, identifier: &str, revoc_reg_def_id: &str, + pub fn build_revoc_reg_entry_request(&self, identifier: &str, revoc_reg_def_id: &RevocationRegistryId, revoc_def_type: &str, rev_reg_entry: RevocationRegistryDeltaV1) -> IndyResult { build_result!(RevRegEntryOperation, Some(identifier), revoc_def_type, revoc_reg_def_id, rev_reg_entry) } #[logfn(Info)] - pub fn build_get_revoc_reg_request(&self, identifier: Option<&str>, revoc_reg_def_id: &str, timestamp: i64) -> IndyResult { + pub fn build_get_revoc_reg_request(&self, identifier: Option<&str>, revoc_reg_def_id: &RevocationRegistryId, timestamp: i64) -> IndyResult { build_result!(GetRevRegOperation, identifier, revoc_reg_def_id, timestamp) } #[logfn(Info)] - pub fn build_get_revoc_reg_delta_request(&self, identifier: Option<&str>, revoc_reg_def_id: &str, from: Option, to: i64) -> IndyResult { + pub fn build_get_revoc_reg_delta_request(&self, identifier: Option<&str>, revoc_reg_def_id: &RevocationRegistryId, from: Option, to: i64) -> IndyResult { build_result!(GetRevRegDeltaOperation, identifier, revoc_reg_def_id, from, to) } @@ -238,19 +229,21 @@ impl LedgerService { name: res.data.name.clone(), version: res.data.version.clone(), attr_names: res.data.attr_names, - id: Schema::schema_id(&res.dest, &res.data.name, &res.data.version), + id: SchemaId::new(&res.dest, &res.data.name, &res.data.version), seq_no: Some(res.seq_no), }, - GetSchemaReplyResult::GetSchemaReplyResultV1(res) => SchemaV1 { - name: res.txn.data.schema_name, - version: res.txn.data.schema_version, - attr_names: res.txn.data.value.attr_names, - id: res.txn.data.id, - seq_no: Some(res.txn_metadata.seq_no), + GetSchemaReplyResult::GetSchemaReplyResultV1(res) => { + SchemaV1 { + name: res.txn.data.schema_name, + version: res.txn.data.schema_version, + attr_names: res.txn.data.value.attr_names, + id: SchemaId(res.txn.data.id), + seq_no: Some(res.txn_metadata.seq_no), + } } }; - let res = (schema.id.clone(), + let res = (schema.id.0.clone(), serde_json::to_string(&Schema::SchemaV1(schema)) .to_indy(IndyErrorKind::InvalidState, "Cannot serialize Schema")?); @@ -263,26 +256,26 @@ impl LedgerService { let cred_def = match reply.result() { GetCredDefReplyResult::GetCredDefReplyResultV0(res) => CredentialDefinitionV1 { - id: CredentialDefinition::cred_def_id( + id: CredentialDefinitionId::new( &res.origin, - &res.ref_.to_string(), + &SchemaId(res.ref_.to_string()), &res.signature_type.to_str(), &res.tag.clone().unwrap_or_default()), - schema_id: res.ref_.to_string(), + schema_id: SchemaId(res.ref_.to_string()), signature_type: res.signature_type, tag: res.tag.unwrap_or_default(), value: res.data, }, GetCredDefReplyResult::GetCredDefReplyResultV1(res) => CredentialDefinitionV1 { - id: res.txn.data.id, - schema_id: res.txn.data.schema_ref, + id: CredentialDefinitionId(res.txn.data.id), + schema_id:SchemaId(res.txn.data.schema_ref.to_string()), signature_type: res.txn.data.type_, tag: res.txn.data.tag, value: res.txn.data.public_keys, } }; - let res = (cred_def.id.clone(), + let res = (cred_def.id.0.clone(), serde_json::to_string(&CredentialDefinition::CredentialDefinitionV1(cred_def)) .to_indy(IndyErrorKind::InvalidState, "Cannot serialize CredentialDefinition")?); @@ -298,7 +291,7 @@ impl LedgerService { GetRevocRegDefReplyResult::GetRevocRegDefReplyResultV1(res) => res.txn.data, }; - let res = (revoc_reg_def.id.clone(), + let res = (revoc_reg_def.id.0.clone(), serde_json::to_string(&RevocationRegistryDefinition::RevocationRegistryDefinitionV1(revoc_reg_def)) .to_indy(IndyErrorKind::InvalidState, "Cannot serialize RevocationRegistryDefinition")?); @@ -314,7 +307,7 @@ impl LedgerService { GetRevocRegReplyResult::GetRevocRegReplyResultV1(res) => (res.txn.data.revoc_reg_def_id, res.txn.data.value, res.txn_metadata.creation_time), }; - let res = (revoc_reg_def_id, + let res = (revoc_reg_def_id.0.clone(), serde_json::to_string(&RevocationRegistry::RevocationRegistryV1(revoc_reg)) .to_indy(IndyErrorKind::InvalidState, "Cannot serialize RevocationRegistry")?, txn_time); @@ -331,7 +324,7 @@ impl LedgerService { GetRevocRegDeltaReplyResult::GetRevocRegDeltaReplyResultV1(res) => (res.txn.data.revoc_reg_def_id, res.txn.data.value), }; - let res = (revoc_reg_def_id.clone(), + let res = (revoc_reg_def_id.0.clone(), serde_json::to_string(&RevocationRegistryDelta::RevocationRegistryDeltaV1( RevocationRegistryDeltaV1 { value: CryproRevocationRegistryDelta::from_parts(revoc_reg.value.accum_from.map(|accum| accum.value).as_ref(), @@ -476,7 +469,7 @@ impl LedgerService { Ok(acceptance_data) } - fn datetime_to_date_timestamp(time: u64) -> u64{ + fn datetime_to_date_timestamp(time: u64) -> u64 { const SEC_IN_DAY: u64 = 86400; time / SEC_IN_DAY * SEC_IN_DAY } @@ -660,7 +653,7 @@ mod tests { attr_names.insert("male".to_string()); let data = SchemaV1 { - id: Schema::schema_id(IDENTIFIER, "name", "1.0"), + id: SchemaId::new(IDENTIFIER, "name", "1.0"), name: "name".to_string(), version: "1.0".to_string(), attr_names, @@ -684,7 +677,7 @@ mod tests { fn build_get_schema_request_works_for_invalid_id() { let ledger_service = LedgerService::new(); - let res = ledger_service.build_get_schema_request(Some(IDENTIFIER), "wrong_schema_id"); + let res = ledger_service.build_get_schema_request(Some(IDENTIFIER), &SchemaId("wrong_schema_id".to_string())); assert_kind!(IndyErrorKind::InvalidStructure, res); } @@ -692,7 +685,7 @@ mod tests { fn build_get_schema_request_works_for_valid_id() { let ledger_service = LedgerService::new(); - let id = Schema::schema_id(IDENTIFIER, "name", "1.0"); + let id = SchemaId::new(IDENTIFIER, "name", "1.0"); let expected_result = json!({ "type": GET_SCHEMA, @@ -713,7 +706,7 @@ mod tests { let ledger_service = LedgerService::new(); - let id = CredentialDefinition::cred_def_id(IDENTIFIER, "1", "signature_type", "tag"); + let id = CredentialDefinitionId::new(IDENTIFIER, &SchemaId("1".to_string()), "signature_type", "tag"); let expected_result = json!({ "type": GET_CRED_DEF, @@ -1179,7 +1172,7 @@ mod tests { } #[test] - fn datetime_to_date(){ + fn datetime_to_date() { assert_eq!(0, LedgerService::datetime_to_date_timestamp(0)); assert_eq!(0, LedgerService::datetime_to_date_timestamp(20)); assert_eq!(1562284800, LedgerService::datetime_to_date_timestamp(1562367600)); diff --git a/libindy/src/utils/validation.rs b/libindy/src/utils/validation.rs index 5af0edd164..9fe85212b7 100644 --- a/libindy/src/utils/validation.rs +++ b/libindy/src/utils/validation.rs @@ -1,3 +1,5 @@ pub trait Validatable { - fn validate(&self) -> Result<(), String>; + fn validate(&self) -> Result<(), String> { + Ok(()) + } } diff --git a/libindy/tests/anoncreds.rs b/libindy/tests/anoncreds.rs index 1160de170f..900c0847c6 100644 --- a/libindy/tests/anoncreds.rs +++ b/libindy/tests/anoncreds.rs @@ -35,8 +35,6 @@ use indy::ErrorCode; use utils::constants::*; use utils::Setup; -use utils::domain::anoncreds::schema::{Schema}; -use utils::domain::anoncreds::credential_definition::CredentialDefinition; use utils::domain::anoncreds::credential::CredentialInfo; use utils::domain::anoncreds::credential_for_proof_request::{CredentialsForProofRequest, RequestedCredential}; use utils::domain::anoncreds::proof::Proof; @@ -464,6 +462,8 @@ mod high_cases { // {"issuer_did": DID, "schema_id": gvt_schema_id} mod prover_get_credentials_for_proof_req { use super::*; + use utils::domain::anoncreds::schema::SchemaId; + use utils::domain::anoncreds::credential_definition::CredentialDefinitionId; #[test] fn prover_get_credentials_for_proof_req_works_for_empty_req() { @@ -954,7 +954,7 @@ mod high_cases { "requested_attributes": json!({ "attr1_referent": json!({ "name":"name", - "restrictions": [json!({ "schema_id": Schema::schema_id(DID_TRUSTEE, GVT_SCHEMA_NAME, SCHEMA_VERSION) })] + "restrictions": [json!({ "schema_id": SchemaId::new(DID_TRUSTEE, GVT_SCHEMA_NAME, SCHEMA_VERSION) })] }) }), "requested_predicates": json!({ @@ -985,7 +985,7 @@ mod high_cases { "requested_attributes": json!({ "attr1_referent": json!({ "name":"name", - "restrictions": [json!({ "cred_def_id": CredentialDefinition::cred_def_id(DID_TRUSTEE, &anoncreds::gvt_schema_id(), "CL", TAG_1) })] + "restrictions": [json!({ "cred_def_id": CredentialDefinitionId::new(DID_TRUSTEE, &SchemaId(anoncreds::gvt_schema_id()), "CL", TAG_1) })] }) }), "requested_predicates": json!({ @@ -1477,7 +1477,7 @@ mod high_cases { "requested_attributes": json!({ "attr1_referent": json!({ "name":"name", - "restrictions": json!({ "schema_id": Schema::schema_id(DID_TRUSTEE, GVT_SCHEMA_NAME, SCHEMA_VERSION) }) + "restrictions": json!({ "schema_id": SchemaId::new(DID_TRUSTEE, GVT_SCHEMA_NAME, SCHEMA_VERSION) }) }) }), "requested_predicates": json!({ @@ -1508,7 +1508,7 @@ mod high_cases { "requested_attributes": json!({ "attr1_referent": json!({ "name":"name", - "restrictions": json!({ "cred_def_id": CredentialDefinition::cred_def_id(DID_TRUSTEE, &anoncreds::gvt_schema_id(), "CL", TAG_1) }) + "restrictions": json!({ "cred_def_id": CredentialDefinitionId::new(DID_TRUSTEE, &SchemaId(anoncreds::gvt_schema_id()), "CL", TAG_1) }) }) }), "requested_predicates": json!({ @@ -1820,7 +1820,7 @@ mod high_cases { "requested_attributes": json!({}), "requested_predicates": json!({ "predicate1_referent": json!({ "name":"age", "p_type":">=", "p_value":18, - "restrictions": [ json!({ "schema_id": Schema::schema_id(DID_TRUSTEE, "other_schema_name", SCHEMA_VERSION) })] }) + "restrictions": [ json!({ "schema_id": SchemaId::new(DID_TRUSTEE, "other_schema_name", SCHEMA_VERSION) })] }) }), }).to_string(); @@ -2153,7 +2153,7 @@ mod high_cases { "name":"age", "p_type":">=", "p_value":18, - "restrictions": json!({ "schema_id": Schema::schema_id(DID_TRUSTEE, "other_schema_name", SCHEMA_VERSION) }) + "restrictions": json!({ "schema_id": SchemaId::new(DID_TRUSTEE, "other_schema_name", SCHEMA_VERSION) }) }) }), }).to_string(); diff --git a/libindy/tests/cache.rs b/libindy/tests/cache.rs index 10edd3d5c6..0a860b5a90 100644 --- a/libindy/tests/cache.rs +++ b/libindy/tests/cache.rs @@ -39,7 +39,7 @@ mod high_cases { mod schema_cache { use super::*; - use utils::domain::anoncreds::schema::{Schema, SchemaV1}; + use utils::domain::anoncreds::schema::{SchemaV1, SchemaId}; use utils::constants::*; use std::thread::sleep; @@ -71,7 +71,7 @@ mod high_cases { setup.pool_handle, setup.wallet_handle, DID_MY1, - &Schema::schema_id(DID, "other_schema", "1.0"), + &SchemaId::new(DID, "other_schema", "1.0").0, &options_json); assert_code!(ErrorCode::LedgerNotFound, res); diff --git a/libindy/tests/interaction.rs b/libindy/tests/interaction.rs index 8c113ef46b..580224cf0b 100644 --- a/libindy/tests/interaction.rs +++ b/libindy/tests/interaction.rs @@ -322,7 +322,7 @@ impl Prover { // Prover gets CredentialDefinition from Ledger let cred_offer: CredentialOffer = serde_json::from_str(&cred_offer_json).unwrap(); - let (cred_def_id, cred_def_json) = pool.get_cred_def(Some(&self.did), &cred_offer.cred_def_id); + let (cred_def_id, cred_def_json) = pool.get_cred_def(Some(&self.did), &cred_offer.cred_def_id.0); self.cred_def_id = Some(cred_def_id); // Prover creates Credential Request @@ -344,7 +344,7 @@ impl Prover let (_, cred_def_json) = pool.get_cred_def(Some(&self.did), &self.cred_def_id.clone().unwrap()); // Prover gets RevocationRegistryDefinition - let (_, revoc_reg_def_json) = pool.get_revoc_reg_def(None, &credential.rev_reg_id.unwrap()); + let (_, revoc_reg_def_json) = pool.get_revoc_reg_def(None, &credential.rev_reg_id.unwrap().0); // Prover stores received Credential anoncreds::prover_store_credential(self.wallet_handle, @@ -374,22 +374,22 @@ impl Prover let schema_id = cred_info.schema_id; let cred_def_id = cred_info.cred_def_id; - assert_eq!(cred_def_id, self.cred_def_id.clone().unwrap()); + assert_eq!(cred_def_id.0, self.cred_def_id.clone().unwrap()); let cred_rev_id = cred_info.cred_rev_id.clone().unwrap(); let rev_reg_id = cred_info.rev_reg_id.clone().unwrap(); // Prover gets Schema from Ledger - let (_, schema_json) = pool.get_schema(None, &schema_id); + let (_, schema_json) = pool.get_schema(None, &schema_id.0); // Prover gets CredentialDefinition from Ledger - let (_, cred_def_json) = pool.get_cred_def(Some(&self.did), &cred_def_id); + let (_, cred_def_json) = pool.get_cred_def(Some(&self.did), &cred_def_id.0); // Prover gets RevocationRegistryDefinition - let (_, revoc_reg_def_json) = pool.get_revoc_reg_def(None, &rev_reg_id); + let (_, revoc_reg_def_json) = pool.get_revoc_reg_def(None, &rev_reg_id.0); // Prover gets RevocationRegistryDelta from Ledger - let (_, revoc_reg_delta_json, timestamp) = pool.get_revoc_reg_delta(None, &rev_reg_id, from, to); + let (_, revoc_reg_delta_json, timestamp) = pool.get_revoc_reg_delta(None, &rev_reg_id.0, from, to); // Prover creates RevocationState @@ -427,15 +427,15 @@ impl Prover }; let schemas_json = json!({ - schema_id.clone(): serde_json::from_str::(&schema_json).unwrap() + schema_id.0: serde_json::from_str::(&schema_json).unwrap() }).to_string(); let cred_defs_json = json!({ - cred_def_id.clone(): serde_json::from_str::(&cred_def_json).unwrap() + cred_def_id.0: serde_json::from_str::(&cred_def_json).unwrap() }).to_string(); let rev_states_json = json!({ - rev_reg_id.clone(): json!({ + rev_reg_id.0: json!({ timestamp.to_string(): serde_json::from_str::(&rev_state_json).unwrap() }) }).to_string(); @@ -487,17 +487,17 @@ impl Verifier { let identifier = proof.identifiers[0].clone(); // Verifier gets Schema from Ledger - let (schema_id, schema_json) = pool.get_schema(Some(DID_MY1), &identifier.schema_id); + let (schema_id, schema_json) = pool.get_schema(Some(DID_MY1), &identifier.schema_id.0); // Verifier gets CredentialDefinition from Ledger - let (cred_def_id, cred_def_json) = pool.get_cred_def(Some(DID_MY1), &identifier.cred_def_id); + let (cred_def_id, cred_def_json) = pool.get_cred_def(Some(DID_MY1), &identifier.cred_def_id.0); // Verifier gets RevocationRegistryDefinition from Ledger - let (rev_reg_id, revoc_reg_def_json) = pool.get_revoc_reg_def(Some(DID_MY1), &identifier.rev_reg_id.clone().unwrap()); + let (rev_reg_id, revoc_reg_def_json) = pool.get_revoc_reg_def(Some(DID_MY1), &identifier.rev_reg_id.clone().unwrap().0); // Verifier gets RevocationRegistry from Ledger let (_, rev_reg_json, timestamp) = - pool.get_revoc_reg_delta(Some(DID_MY1), &identifier.rev_reg_id.clone().unwrap(), None, identifier.timestamp.unwrap()); + pool.get_revoc_reg_delta(Some(DID_MY1), &identifier.rev_reg_id.clone().unwrap().0, None, identifier.timestamp.unwrap()); let schemas_json = json!({ schema_id.clone(): serde_json::from_str::(&schema_json).unwrap() diff --git a/libindy/tests/ledger.rs b/libindy/tests/ledger.rs index f5cec13525..4d87098413 100644 --- a/libindy/tests/ledger.rs +++ b/libindy/tests/ledger.rs @@ -3090,6 +3090,7 @@ mod medium_cases { mod schemas_requests { use super::*; + use utils::domain::anoncreds::schema::SchemaId; #[test] #[cfg(feature = "local_nodes_pool")] @@ -3180,7 +3181,7 @@ mod medium_cases { fn indy_get_schema_request_works_for_unknown_schema() { let setup = Setup::pool(); - let get_schema_request = ledger::build_get_schema_request(Some(DID_TRUSTEE), &Schema::schema_id(DID, "other_schema", "1.0")).unwrap(); + let get_schema_request = ledger::build_get_schema_request(Some(DID_TRUSTEE), &SchemaId::new(DID, "other_schema", "1.0").0).unwrap(); let get_schema_response = ledger::submit_request(setup.pool_handle, &get_schema_request).unwrap(); let res = ledger::parse_get_schema_response(&get_schema_response); @@ -3206,7 +3207,7 @@ mod medium_cases { fn indy_get_parse_returns_error_for_wrong_type_and_unknown_schema() { let setup = Setup::pool(); - let get_schema_request = ledger::build_get_schema_request(Some(DID_TRUSTEE), &Schema::schema_id(DID, "other_schema", "1.0")).unwrap(); + let get_schema_request = ledger::build_get_schema_request(Some(DID_TRUSTEE), &SchemaId::new(DID, "other_schema", "1.0").0).unwrap(); let get_schema_response = ledger::submit_request(setup.pool_handle, &get_schema_request).unwrap(); let res = ledger::parse_get_cred_def_response(&get_schema_response); diff --git a/libindy/tests/utils/anoncreds.rs b/libindy/tests/utils/anoncreds.rs index 0d7826d627..a0808c0558 100644 --- a/libindy/tests/utils/anoncreds.rs +++ b/libindy/tests/utils/anoncreds.rs @@ -14,8 +14,8 @@ use utils::constants::*; use std::collections::{HashSet, HashMap}; -use utils::domain::anoncreds::schema::{Schema, SchemaV1}; -use utils::domain::anoncreds::credential_definition::{CredentialDefinition, CredentialDefinitionConfig}; +use utils::domain::anoncreds::schema::{Schema, SchemaV1, SchemaId}; +use utils::domain::anoncreds::credential_definition::{CredentialDefinition, CredentialDefinitionConfig, CredentialDefinitionId}; use utils::domain::anoncreds::revocation_registry_definition::{RevocationRegistryConfig, IssuanceType}; use utils::domain::anoncreds::credential::{AttributeValues, CredentialInfo}; use utils::domain::anoncreds::credential_for_proof_request::CredentialsForProofRequest; @@ -193,12 +193,12 @@ pub fn issuance_by_default_rev_reg_config() -> String { } pub fn gvt_schema_id() -> String { - Schema::schema_id(ISSUER_DID, GVT_SCHEMA_NAME, SCHEMA_VERSION) + SchemaId::new(ISSUER_DID, GVT_SCHEMA_NAME, SCHEMA_VERSION).0 } pub fn gvt_schema() -> SchemaV1 { SchemaV1 { - id: gvt_schema_id().to_string(), + id: SchemaId(gvt_schema_id()), version: SCHEMA_VERSION.to_string(), name: GVT_SCHEMA_NAME.to_string(), attr_names: serde_json::from_str::>(GVT_SCHEMA_ATTRIBUTES).unwrap(), @@ -211,12 +211,12 @@ pub fn gvt_schema_json() -> String { } pub fn gvt_schema_id_issuer2() -> String { - Schema::schema_id(ISSUER_DID_2, GVT_SCHEMA_NAME, SCHEMA_VERSION) + SchemaId::new(ISSUER_DID_2, GVT_SCHEMA_NAME, SCHEMA_VERSION).0 } pub fn gvt_schema_issuer2() -> SchemaV1 { SchemaV1 { - id: gvt_schema_id_issuer2().to_string(), + id: SchemaId(gvt_schema_id_issuer2()), version: SCHEMA_VERSION.to_string(), name: GVT_SCHEMA_NAME.to_string(), attr_names: serde_json::from_str::>(GVT_SCHEMA_ATTRIBUTES).unwrap(), @@ -230,12 +230,12 @@ pub fn gvt_schema_issuer2_json() -> String { pub fn xyz_schema_id() -> String { - Schema::schema_id(ISSUER_DID, XYZ_SCHEMA_NAME, SCHEMA_VERSION) + SchemaId::new(ISSUER_DID, XYZ_SCHEMA_NAME, SCHEMA_VERSION).0 } pub fn xyz_schema() -> SchemaV1 { SchemaV1 { - id: xyz_schema_id().to_string(), + id: SchemaId(xyz_schema_id()), version: SCHEMA_VERSION.to_string(), name: XYZ_SCHEMA_NAME.to_string(), attr_names: serde_json::from_str::>(XYZ_SCHEMA_ATTRIBUTES).unwrap(), @@ -248,12 +248,12 @@ pub fn xyz_schema_json() -> String { } pub fn xyz_schema_id_tag2() -> String { - Schema::schema_id(ISSUER_DID, &format!("{}{}", XYZ_SCHEMA_NAME, TAG_2), SCHEMA_VERSION) + SchemaId::new(ISSUER_DID, &format!("{}{}", XYZ_SCHEMA_NAME, TAG_2), SCHEMA_VERSION).0 } pub fn xyz_schema_tag2() -> SchemaV1 { SchemaV1 { - id: xyz_schema_id_tag2().to_string(), + id: SchemaId(xyz_schema_id_tag2()), version: SCHEMA_VERSION.to_string(), name: format!("{}{}", XYZ_SCHEMA_NAME, TAG_2), attr_names: serde_json::from_str::>(XYZ_SCHEMA_ATTRIBUTES).unwrap(), @@ -350,8 +350,8 @@ pub fn gvt3_credential_values_json() -> String { pub fn issuer_1_gvt_credential() -> CredentialInfo { CredentialInfo { - schema_id: gvt_schema_id(), - cred_def_id: issuer_1_gvt_cred_def_id(), + schema_id: SchemaId(gvt_schema_id()), + cred_def_id: CredentialDefinitionId(issuer_1_gvt_cred_def_id()), referent: CREDENTIAL1_ID.to_string(), rev_reg_id: None, cred_rev_id: None, @@ -366,8 +366,8 @@ pub fn issuer_1_gvt_credential() -> CredentialInfo { pub fn issuer_1_xyz_credential() -> CredentialInfo { CredentialInfo { - schema_id: xyz_schema_id(), - cred_def_id: issuer_1_xyz_cred_def_id(), + schema_id: SchemaId(xyz_schema_id()), + cred_def_id: CredentialDefinitionId(issuer_1_xyz_cred_def_id()), referent: CREDENTIAL2_ID.to_string(), rev_reg_id: None, cred_rev_id: None, @@ -380,8 +380,8 @@ pub fn issuer_1_xyz_credential() -> CredentialInfo { pub fn issuer_2_gvt_credential() -> CredentialInfo { CredentialInfo { - schema_id: gvt_schema_id(), - cred_def_id: issuer_2_gvt_cred_def_id(), + schema_id: SchemaId(gvt_schema_id()), + cred_def_id: CredentialDefinitionId(issuer_2_gvt_cred_def_id()), referent: CREDENTIAL3_ID.to_string(), rev_reg_id: None, cred_rev_id: None, @@ -448,7 +448,7 @@ pub fn issuer_1_gvt_cred_def_json() -> String { // This uses gvt schema issued by ISSUER_2 pub fn issuer_2_gvt_cred_def_json() -> String { json!({ - "id":"CnEDk9HrMnmiHXEV1WFgbVCRteYnPqsJwrTdcZaNhFVW:3:CL:CnEDk9HrMnmiHXEV1WFgbVCRteYnPqsJwrTdcZaNhFVW:2:gvt:1.0:TAG_1", + "id":"CAaNhFVW:3:CL:CnEDk9HrMnmiHXEV1WFgbVCRteYnPqsJwrTdcZaNhFVW:2:gvt:1.0:TAG_1", "schemaId":"CnEDk9HrMnmiHXEV1WFgbVCRteYnPqsJwrTdcZaNhFVW:2:gvt:1.0", "tag":"TAG_1", "type":"CL", From 32ec61bb3e0e7a98f546aa078bd2f03b947c6544 Mon Sep 17 00:00:00 2001 From: "artem.ivanov" Date: Mon, 26 Aug 2019 09:56:31 +0300 Subject: [PATCH 249/320] IS-912: UX: Early static validation - use ok_or_else instead of ok_or Signed-off-by: artem.ivanov --- libindy/src/commands/anoncreds/issuer.rs | 2 +- .../src/domain/anoncreds/credential_definition.rs | 12 ++++++------ .../anoncreds/revocation_registry_definition.rs | 6 +++--- libindy/src/domain/anoncreds/schema.rs | 8 ++++---- libindy/src/services/anoncreds/verifier.rs | 10 +++++----- 5 files changed, 19 insertions(+), 19 deletions(-) diff --git a/libindy/src/commands/anoncreds/issuer.rs b/libindy/src/commands/anoncreds/issuer.rs index 28843fe418..ff010ba908 100644 --- a/libindy/src/commands/anoncreds/issuer.rs +++ b/libindy/src/commands/anoncreds/issuer.rs @@ -913,7 +913,7 @@ impl IssuerCommandExecutor { schema_id_record .get_value() .map(|id| SchemaId(id.to_string())) - .ok_or(err_msg(IndyErrorKind::InvalidStructure, format!("SchemaId not found for id: {}", key))) + .ok_or_else(||err_msg(IndyErrorKind::InvalidStructure, format!("SchemaId not found for id: {}", key))) } fn _wallet_get_rev_reg_def(&self, wallet_handle: WalletHandle, key: &RevocationRegistryId) -> IndyResult { diff --git a/libindy/src/domain/anoncreds/credential_definition.rs b/libindy/src/domain/anoncreds/credential_definition.rs index 5cb55172f8..f7bd2ae28a 100644 --- a/libindy/src/domain/anoncreds/credential_definition.rs +++ b/libindy/src/domain/anoncreds/credential_definition.rs @@ -136,20 +136,20 @@ impl Validatable for CredentialDefinitionId { fn validate(&self) -> Result<(), String> { let parts: Vec<&str> = self.0.split_terminator(DELIMITER).collect::>(); - parts.get(0).ok_or(format!("Credential Definition Id validation failed: issuer DID not found in: {}", self.0))?; - parts.get(1).ok_or(format!("Credential Definition Id validation failed: marker not found in: {}", self.0))?; - parts.get(2).ok_or(format!("Credential Definition Id validation failed: signature type not found in: {}", self.0))?; + parts.get(0).ok_or_else(||format!("Credential Definition Id validation failed: issuer DID not found in: {}", self.0))?; + parts.get(1).ok_or_else(||format!("Credential Definition Id validation failed: marker not found in: {}", self.0))?; + parts.get(2).ok_or_else(||format!("Credential Definition Id validation failed: signature type not found in: {}", self.0))?; if parts.len() == 4 { // NcYxiDXkpYi6ov5FcYDi1e:3:CL:1 parts.get(3) - .ok_or(format!("Credential Definition Id validation failed: schema id not found in: {}", self.0))? + .ok_or_else(||format!("Credential Definition Id validation failed: schema id not found in: {}", self.0))? .parse::() .map_err(|_| format!("Credential Definition Id validation failed: schema id is invalid number: {}", self.0))?; } else if parts.len() == 5 { // NcYxiDXkpYi6ov5FcYDi1e:3:CL:1:tag parts.get(7) - .ok_or(format!("Credential Definition Id validation failed: schema id not found in: {}", self.0))? + .ok_or_else(||format!("Credential Definition Id validation failed: schema id not found in: {}", self.0))? .parse::() .map_err(|_| format!("Credential Definition Id validation failed: schema id is invalid number: {}", self.0))?; } else if parts.len() == 7 { @@ -157,7 +157,7 @@ impl Validatable for CredentialDefinitionId { // nothing to do } else if parts.len() == 8 { // NcYxiDXkpYi6ov5FcYDi1e:3:CL:NcYxiDXkpYi6ov5FcYDi1e:2:gvt:1.0:TAG_1 - parts.get(7).ok_or(format!("Credential Definition Id validation failed: tag not found in: {}", self.0))?; + parts.get(7).ok_or_else(||format!("Credential Definition Id validation failed: tag not found in: {}", self.0))?; } else { return Err("Credential Definition Id validation failed: too much parts".to_string()); } diff --git a/libindy/src/domain/anoncreds/revocation_registry_definition.rs b/libindy/src/domain/anoncreds/revocation_registry_definition.rs index 60dc60b815..24718f9d54 100644 --- a/libindy/src/domain/anoncreds/revocation_registry_definition.rs +++ b/libindy/src/domain/anoncreds/revocation_registry_definition.rs @@ -130,9 +130,9 @@ impl Validatable for RevocationRegistryId { fn validate(&self) -> Result<(), String> { let parts: Vec<&str> = self.0.split_terminator(DELIMITER).collect::>(); - parts.get(0).ok_or(format!("Revocation Registry Id validation failed: issuer DID not found in: {}", self.0))?; - parts.get(1).ok_or(format!("Revocation Registry Id validation failed: marker not found in: {}", self.0))?; - parts.get(2).ok_or(format!("Revocation Registry Id validation failed: signature type not found in: {}", self.0))?; + parts.get(0).ok_or_else(||format!("Revocation Registry Id validation failed: issuer DID not found in: {}", self.0))?; + parts.get(1).ok_or_else(||format!("Revocation Registry Id validation failed: marker not found in: {}", self.0))?; + parts.get(2).ok_or_else(||format!("Revocation Registry Id validation failed: signature type not found in: {}", self.0))?; if parts.len() != 8 && parts.len() != 9 && parts.len() != 11 && parts.len() != 12 { return Err("Revocation Registry Id validation failed: invalid number of parts".to_string()); diff --git a/libindy/src/domain/anoncreds/schema.rs b/libindy/src/domain/anoncreds/schema.rs index 15de2c5862..4dbbf046a2 100644 --- a/libindy/src/domain/anoncreds/schema.rs +++ b/libindy/src/domain/anoncreds/schema.rs @@ -87,10 +87,10 @@ impl Validatable for SchemaId { return Err("SchemaId validation failed: too much parts".to_string()); } - parts.get(0).ok_or(format!("Schema Id validation failed: issuer DID not found in: {}", self.0))?; - parts.get(1).ok_or(format!("Schema Id validation failed: marker not found in: {}", self.0))?; - parts.get(2).ok_or(format!("Schema Id validation failed: name not found in: {}", self.0))?; - parts.get(3).ok_or(format!("Schema Id validation failed: version not found in: {}", self.0))?; + parts.get(0).ok_or_else(||format!("Schema Id validation failed: issuer DID not found in: {}", self.0))?; + parts.get(1).ok_or_else(||format!("Schema Id validation failed: marker not found in: {}", self.0))?; + parts.get(2).ok_or_else(||format!("Schema Id validation failed: name not found in: {}", self.0))?; + parts.get(3).ok_or_else(||format!("Schema Id validation failed: version not found in: {}", self.0))?; Ok(()) } diff --git a/libindy/src/services/anoncreds/verifier.rs b/libindy/src/services/anoncreds/verifier.rs index 373887476a..fe1a56c3d8 100644 --- a/libindy/src/services/anoncreds/verifier.rs +++ b/libindy/src/services/anoncreds/verifier.rs @@ -357,33 +357,33 @@ impl Verifier { cred_defs: &HashMap) -> IndyResult { let identifier = identifiers .get(referent) - .ok_or(err_msg( + .ok_or_else(||err_msg( IndyErrorKind::InvalidState, format!("Identifier not found for referent: {}", referent)) )?; let schema: &SchemaV1 = schemas .get(&identifier.schema_id) - .ok_or(err_msg( + .ok_or_else(||err_msg( IndyErrorKind::InvalidStructure, format!("Schema not found for id: {:?}", identifier.schema_id)) )?; let cred_def: &CredentialDefinitionV1 = cred_defs .get(&identifier.cred_def_id) - .ok_or(err_msg( + .ok_or_else(||err_msg( IndyErrorKind::InvalidStructure, format!("CredentialDefinitionV1 not found for id: {:?}", identifier.cred_def_id)) )?; let schema_issuer_did = cred_def.schema_id.issuer_did() - .ok_or(err_msg( + .ok_or_else(||err_msg( IndyErrorKind::InvalidStructure, format!("schema_id has invalid format: {:?}", schema.id)) )?; let issuer_did = cred_def.id.issuer_did() - .ok_or(err_msg( + .ok_or_else(||err_msg( IndyErrorKind::InvalidStructure, format!("cred_def_id has invalid format: {:?}", cred_def.id)) )?; From 0b87445148e5301103a095e0a7bdb46e5d9dd442 Mon Sep 17 00:00:00 2001 From: "artem.ivanov" Date: Mon, 26 Aug 2019 10:29:47 +0300 Subject: [PATCH 250/320] IS-912: UX: Early static validation - corrected did Signed-off-by: artem.ivanov --- libindy/tests/utils/anoncreds.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libindy/tests/utils/anoncreds.rs b/libindy/tests/utils/anoncreds.rs index a0808c0558..0aab12379f 100644 --- a/libindy/tests/utils/anoncreds.rs +++ b/libindy/tests/utils/anoncreds.rs @@ -448,7 +448,7 @@ pub fn issuer_1_gvt_cred_def_json() -> String { // This uses gvt schema issued by ISSUER_2 pub fn issuer_2_gvt_cred_def_json() -> String { json!({ - "id":"CAaNhFVW:3:CL:CnEDk9HrMnmiHXEV1WFgbVCRteYnPqsJwrTdcZaNhFVW:2:gvt:1.0:TAG_1", + "id":"CnEDk9HrMnmiHXEV1WFgbVCRteYnPqsJwrTdcZaNhFVW:3:CL:CnEDk9HrMnmiHXEV1WFgbVCRteYnPqsJwrTdcZaNhFVW:2:gvt:1.0:TAG_1", "schemaId":"CnEDk9HrMnmiHXEV1WFgbVCRteYnPqsJwrTdcZaNhFVW:2:gvt:1.0", "tag":"TAG_1", "type":"CL", From 0c0f6dd9eb565720cfc352849116e35ba18bc206 Mon Sep 17 00:00:00 2001 From: "artem.ivanov" Date: Mon, 26 Aug 2019 10:54:39 +0300 Subject: [PATCH 251/320] IS-912: UX: Early static validation - fixed review clone Signed-off-by: artem.ivanov --- libindy/src/commands/anoncreds/prover.rs | 2 +- libindy/src/domain/ledger/rev_reg_def.rs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libindy/src/commands/anoncreds/prover.rs b/libindy/src/commands/anoncreds/prover.rs index 5595fba259..f8aa183744 100644 --- a/libindy/src/commands/anoncreds/prover.rs +++ b/libindy/src/commands/anoncreds/prover.rs @@ -785,7 +785,7 @@ impl ProverCommandExecutor { attrs: credential_values, schema_id: credential.schema_id, cred_def_id: credential.cred_def_id, - rev_reg_id: credential.rev_reg_id.clone(), + rev_reg_id: credential.rev_reg_id, cred_rev_id: credential.signature.extract_index().map(|idx| idx.to_string()) } } diff --git a/libindy/src/domain/ledger/rev_reg_def.rs b/libindy/src/domain/ledger/rev_reg_def.rs index e70eb8602a..47fff9005e 100644 --- a/libindy/src/domain/ledger/rev_reg_def.rs +++ b/libindy/src/domain/ledger/rev_reg_def.rs @@ -20,10 +20,10 @@ impl RevRegDefOperation { pub fn new(rev_reg_def: RevocationRegistryDefinitionV1) -> RevRegDefOperation { RevRegDefOperation { _type: REVOC_REG_DEF.to_string(), - id: rev_reg_def.id.clone(), + id: rev_reg_def.id, type_: rev_reg_def.revoc_def_type.to_str().to_string(), - tag: rev_reg_def.tag.to_string(), - cred_def_id: rev_reg_def.cred_def_id.clone(), + tag: rev_reg_def.tag, + cred_def_id: rev_reg_def.cred_def_id, value: rev_reg_def.value } } From 1b60fc5507b4babf90307daba85dc1bd63b04154 Mon Sep 17 00:00:00 2001 From: "artem.ivanov" Date: Mon, 26 Aug 2019 12:04:02 +0300 Subject: [PATCH 252/320] IS-912: UX: Early static validation - removed test which isn't valid anymore Signed-off-by: artem.ivanov --- libindy/src/services/ledger/mod.rs | 8 -------- 1 file changed, 8 deletions(-) diff --git a/libindy/src/services/ledger/mod.rs b/libindy/src/services/ledger/mod.rs index 9cf5ffef67..b376d3e8c4 100644 --- a/libindy/src/services/ledger/mod.rs +++ b/libindy/src/services/ledger/mod.rs @@ -673,14 +673,6 @@ mod tests { check_request(&request, expected_result); } - #[test] - fn build_get_schema_request_works_for_invalid_id() { - let ledger_service = LedgerService::new(); - - let res = ledger_service.build_get_schema_request(Some(IDENTIFIER), &SchemaId("wrong_schema_id".to_string())); - assert_kind!(IndyErrorKind::InvalidStructure, res); - } - #[test] fn build_get_schema_request_works_for_valid_id() { let ledger_service = LedgerService::new(); From 5e9a98874f508780683510605e89854360cebb63 Mon Sep 17 00:00:00 2001 From: "artem.ivanov" Date: Mon, 26 Aug 2019 13:57:31 +0300 Subject: [PATCH 253/320] IS-912: UX: Early static validation - corrected deserialization ID structure Signed-off-by: artem.ivanov --- libindy/src/api/anoncreds.rs | 16 ++++----- libindy/src/api/cache.rs | 4 +-- libindy/src/api/ledger.rs | 12 +++---- .../domain/anoncreds/credential_definition.rs | 4 +-- libindy/src/domain/anoncreds/schema.rs | 12 +++---- libindy/src/services/ledger/mod.rs | 4 +++ libindy/src/utils/ctypes.rs | 36 +++++++++++++++++++ libindy/tests/anoncreds.rs | 7 ++-- 8 files changed, 64 insertions(+), 31 deletions(-) diff --git a/libindy/src/api/anoncreds.rs b/libindy/src/api/anoncreds.rs index ae9ca7c554..ac21459b23 100644 --- a/libindy/src/api/anoncreds.rs +++ b/libindy/src/api/anoncreds.rs @@ -267,7 +267,7 @@ pub extern fn indy_issuer_rotate_credential_def_start(command_handle: CommandHan trace!("indy_issuer_rotate_credential_def_start: >>> wallet_handle: {:?}, cred_def_id: {:?}, config_json: {:?}", wallet_handle, cred_def_id, config_json); - check_useful_validatable_json!(cred_def_id, ErrorCode::CommonInvalidParam3, CredentialDefinitionId); + check_useful_validatable_string!(cred_def_id, ErrorCode::CommonInvalidParam3, CredentialDefinitionId); check_useful_opt_validatable_json!(config_json, ErrorCode::CommonInvalidParam4, CredentialDefinitionConfig); check_useful_c_callback!(cb, ErrorCode::CommonInvalidParam5); @@ -320,7 +320,7 @@ pub extern fn indy_issuer_rotate_credential_def_apply(command_handle: CommandHan trace!("indy_issuer_rotate_credential_def_apply: >>> wallet_handle: {:?}, cred_def_id: {:?}", wallet_handle, cred_def_id); - check_useful_validatable_json!(cred_def_id, ErrorCode::CommonInvalidParam3, CredentialDefinitionId); + check_useful_validatable_string!(cred_def_id, ErrorCode::CommonInvalidParam3, CredentialDefinitionId); check_useful_c_callback!(cb, ErrorCode::CommonInvalidParam4); trace!("indy_issuer_rotate_credential_def_apply: entities >>> wallet_handle: {:?}, cred_def_id: {:?}", @@ -441,7 +441,7 @@ pub extern fn indy_issuer_create_and_store_revoc_reg(command_handle: CommandHand check_useful_c_str!(issuer_did, ErrorCode::CommonInvalidParam3); check_useful_opt_c_str!(revoc_def_type, ErrorCode::CommonInvalidParam4); check_useful_c_str!(tag, ErrorCode::CommonInvalidParam5); - check_useful_validatable_json!(cred_def_id, ErrorCode::CommonInvalidParam6, CredentialDefinitionId); + check_useful_validatable_string!(cred_def_id, ErrorCode::CommonInvalidParam6, CredentialDefinitionId); check_useful_validatable_json!(config_json, ErrorCode::CommonInvalidParam7, RevocationRegistryConfig); check_useful_c_callback!(cb, ErrorCode::CommonInvalidParam9); @@ -511,7 +511,7 @@ pub extern fn indy_issuer_create_credential_offer(command_handle: CommandHandle, cred_offer_json: *const c_char)>) -> ErrorCode { trace!("indy_issuer_create_credential_offer: >>> wallet_handle: {:?}, cred_def_id: {:?}", wallet_handle, cred_def_id); - check_useful_validatable_json!(cred_def_id, ErrorCode::CommonInvalidParam3, CredentialDefinitionId); + check_useful_validatable_string!(cred_def_id, ErrorCode::CommonInvalidParam3, CredentialDefinitionId); check_useful_c_callback!(cb, ErrorCode::CommonInvalidParam4); trace!("indy_issuer_create_credential_offer: entities >>> wallet_handle: {:?}, cred_def_id: {:?}", wallet_handle, cred_def_id); @@ -604,7 +604,7 @@ pub extern fn indy_issuer_create_credential(command_handle: CommandHandle, check_useful_validatable_json!(cred_offer_json, ErrorCode::CommonInvalidParam3, CredentialOffer); check_useful_validatable_json!(cred_req_json, ErrorCode::CommonInvalidParam4, CredentialRequest); check_useful_validatable_json!(cred_values_json, ErrorCode::CommonInvalidParam5, CredentialValues); - check_useful_opt_validatable_json!(rev_reg_id, ErrorCode::CommonInvalidParam6, RevocationRegistryId); + check_useful_validatable_opt_string!(rev_reg_id, ErrorCode::CommonInvalidParam6, RevocationRegistryId); check_useful_c_callback!(cb, ErrorCode::CommonInvalidParam8); let blob_storage_reader_handle = if blob_storage_reader_handle != -1 { Some(blob_storage_reader_handle) } else { None }; @@ -684,7 +684,7 @@ pub extern fn indy_issuer_revoke_credential(command_handle: CommandHandle, trace!("indy_issuer_revoke_credential: >>> wallet_handle: {:?}, blob_storage_reader_cfg_handle: {:?}, rev_reg_id: {:?}, cred_revoc_id: {:?}", wallet_handle, blob_storage_reader_cfg_handle, rev_reg_id, cred_revoc_id); - check_useful_validatable_json!(rev_reg_id, ErrorCode::CommonInvalidParam4, RevocationRegistryId); + check_useful_validatable_string!(rev_reg_id, ErrorCode::CommonInvalidParam4, RevocationRegistryId); check_useful_c_str!(cred_revoc_id, ErrorCode::CommonInvalidParam5); check_useful_c_callback!(cb, ErrorCode::CommonInvalidParam6); @@ -1018,7 +1018,7 @@ pub extern fn indy_prover_set_credential_attr_tag_policy(command_handle: Command cb: Option) -> ErrorCode { trace!("indy_prover_set_credential_attr_tag_policy: >>> wallet_handle: {:?}, cred_def_id: {:?}, tag_attrs_json: {:?}, retroactive: {:?}", wallet_handle, cred_def_id, tag_attrs_json, retroactive); - check_useful_validatable_json!(cred_def_id, ErrorCode::CommonInvalidParam3, CredentialDefinitionId); + check_useful_validatable_string!(cred_def_id, ErrorCode::CommonInvalidParam3, CredentialDefinitionId); check_useful_opt_json!(tag_attrs_json, ErrorCode::CommonInvalidParam4, CredentialAttrTagPolicy); check_useful_c_callback!(cb, ErrorCode::CommonInvalidParam6); @@ -1074,7 +1074,7 @@ pub extern fn indy_prover_get_credential_attr_tag_policy(command_handle: Command catpol_json: *const c_char)>) -> ErrorCode { trace!("indy_prover_get_credential_attr_tag_policy: >>> wallet_handle: {:?}, cred_def_id: {:?}", wallet_handle, cred_def_id); - check_useful_validatable_json!(cred_def_id, ErrorCode::CommonInvalidParam3, CredentialDefinitionId); + check_useful_validatable_string!(cred_def_id, ErrorCode::CommonInvalidParam3, CredentialDefinitionId); check_useful_c_callback!(cb, ErrorCode::CommonInvalidParam4); trace!("indy_prover_get_credential_attr_tag_policy: entities >>> wallet_handle: {:?}, cred_def_id: {:?}", wallet_handle, cred_def_id); diff --git a/libindy/src/api/cache.rs b/libindy/src/api/cache.rs index c58c6a8a75..3bf5868191 100644 --- a/libindy/src/api/cache.rs +++ b/libindy/src/api/cache.rs @@ -43,7 +43,7 @@ pub extern fn indy_get_cred_def(command_handle: CommandHandle, pool_handle, wallet_handle, submitter_did, id, options_json); check_useful_c_str!(submitter_did, ErrorCode::CommonInvalidParam4); - check_useful_validatable_json!(id, ErrorCode::CommonInvalidParam5, CredentialDefinitionId); + check_useful_validatable_string!(id, ErrorCode::CommonInvalidParam5, CredentialDefinitionId); check_useful_json!(options_json, ErrorCode::CommonInvalidParam6, GetCacheOptions); check_useful_c_callback!(cb, ErrorCode::CommonInvalidParam7); @@ -101,7 +101,7 @@ pub extern fn indy_get_schema(command_handle: CommandHandle, pool_handle, wallet_handle, submitter_did, id, options_json); check_useful_c_str!(submitter_did, ErrorCode::CommonInvalidParam4); - check_useful_validatable_json!(id, ErrorCode::CommonInvalidParam5, SchemaId); + check_useful_validatable_string!(id, ErrorCode::CommonInvalidParam5, SchemaId); check_useful_json!(options_json, ErrorCode::CommonInvalidParam6, GetCacheOptions); check_useful_c_callback!(cb, ErrorCode::CommonInvalidParam7); diff --git a/libindy/src/api/ledger.rs b/libindy/src/api/ledger.rs index a9ce445936..98dc46c080 100644 --- a/libindy/src/api/ledger.rs +++ b/libindy/src/api/ledger.rs @@ -626,7 +626,7 @@ pub extern fn indy_build_get_schema_request(command_handle: CommandHandle, trace!("indy_build_get_schema_request: >>> submitter_did: {:?}, id: {:?}", submitter_did, id); check_useful_opt_c_str!(submitter_did, ErrorCode::CommonInvalidParam2); - check_useful_validatable_json!(id, ErrorCode::CommonInvalidParam3, SchemaId); + check_useful_validatable_string!(id, ErrorCode::CommonInvalidParam3, SchemaId); check_useful_c_callback!(cb, ErrorCode::CommonInvalidParam4); trace!("indy_build_get_schema_request: entities >>> submitter_did: {:?}, id: {:?}", submitter_did, id); @@ -776,7 +776,7 @@ pub extern fn indy_build_get_cred_def_request(command_handle: CommandHandle, trace!("indy_build_get_cred_def_request: >>> submitter_did: {:?}, id: {:?}", submitter_did, id); check_useful_opt_c_str!(submitter_did, ErrorCode::CommonInvalidParam2); - check_useful_validatable_json!(id, ErrorCode::CommonInvalidParam3, CredentialDefinitionId); + check_useful_validatable_string!(id, ErrorCode::CommonInvalidParam3, CredentialDefinitionId); check_useful_c_callback!(cb, ErrorCode::CommonInvalidParam4); trace!("indy_build_get_cred_def_request: entities >>> submitter_did: {:?}, id: {:?}", submitter_did, id); @@ -1260,7 +1260,7 @@ pub extern fn indy_build_get_revoc_reg_def_request(command_handle: CommandHandle trace!("indy_build_get_revoc_reg_def_request: >>> submitter_did: {:?}, id: {:?}", submitter_did, id); check_useful_opt_c_str!(submitter_did, ErrorCode::CommonInvalidParam2); - check_useful_validatable_json!(id, ErrorCode::CommonInvalidParam3, RevocationRegistryId); + check_useful_validatable_string!(id, ErrorCode::CommonInvalidParam3, RevocationRegistryId); check_useful_c_callback!(cb, ErrorCode::CommonInvalidParam4); trace!("indy_build_get_revoc_reg_def_request: entities>>> submitter_did: {:?}, id: {:?}", submitter_did, id); @@ -1380,7 +1380,7 @@ pub extern fn indy_build_revoc_reg_entry_request(command_handle: CommandHandle, submitter_did, revoc_reg_def_id, rev_def_type, value); check_useful_c_str!(submitter_did, ErrorCode::CommonInvalidParam2); - check_useful_validatable_json!(revoc_reg_def_id, ErrorCode::CommonInvalidParam3, RevocationRegistryId); + check_useful_validatable_string!(revoc_reg_def_id, ErrorCode::CommonInvalidParam3, RevocationRegistryId); check_useful_c_str!(rev_def_type, ErrorCode::CommonInvalidParam4); check_useful_json!(value, ErrorCode::CommonInvalidParam5, RevocationRegistryDelta); check_useful_c_callback!(cb, ErrorCode::CommonInvalidParam6); @@ -1430,7 +1430,7 @@ pub extern fn indy_build_get_revoc_reg_request(command_handle: CommandHandle, trace!("indy_build_get_revoc_reg_request: >>> submitter_did: {:?}, revoc_reg_def_id: {:?}, timestamp: {:?}", submitter_did, revoc_reg_def_id, timestamp); check_useful_opt_c_str!(submitter_did, ErrorCode::CommonInvalidParam2); - check_useful_validatable_json!(revoc_reg_def_id, ErrorCode::CommonInvalidParam3, RevocationRegistryId); + check_useful_validatable_string!(revoc_reg_def_id, ErrorCode::CommonInvalidParam3, RevocationRegistryId); check_useful_c_callback!(cb, ErrorCode::CommonInvalidParam5); trace!("indy_build_get_revoc_reg_request: entities >>> submitter_did: {:?}, revoc_reg_def_id: {:?}, timestamp: {:?}", submitter_did, revoc_reg_def_id, timestamp); @@ -1534,7 +1534,7 @@ pub extern fn indy_build_get_revoc_reg_delta_request(command_handle: CommandHand submitter_did, revoc_reg_def_id, from, to); check_useful_opt_c_str!(submitter_did, ErrorCode::CommonInvalidParam2); - check_useful_validatable_json!(revoc_reg_def_id, ErrorCode::CommonInvalidParam3, RevocationRegistryId); + check_useful_validatable_string!(revoc_reg_def_id, ErrorCode::CommonInvalidParam3, RevocationRegistryId); check_useful_c_callback!(cb, ErrorCode::CommonInvalidParam5); let from = if from != -1 { Some(from) } else { None }; diff --git a/libindy/src/domain/anoncreds/credential_definition.rs b/libindy/src/domain/anoncreds/credential_definition.rs index f7bd2ae28a..73c49471d6 100644 --- a/libindy/src/domain/anoncreds/credential_definition.rs +++ b/libindy/src/domain/anoncreds/credential_definition.rs @@ -148,7 +148,7 @@ impl Validatable for CredentialDefinitionId { .map_err(|_| format!("Credential Definition Id validation failed: schema id is invalid number: {}", self.0))?; } else if parts.len() == 5 { // NcYxiDXkpYi6ov5FcYDi1e:3:CL:1:tag - parts.get(7) + parts.get(3) .ok_or_else(||format!("Credential Definition Id validation failed: schema id not found in: {}", self.0))? .parse::() .map_err(|_| format!("Credential Definition Id validation failed: schema id is invalid number: {}", self.0))?; @@ -157,7 +157,7 @@ impl Validatable for CredentialDefinitionId { // nothing to do } else if parts.len() == 8 { // NcYxiDXkpYi6ov5FcYDi1e:3:CL:NcYxiDXkpYi6ov5FcYDi1e:2:gvt:1.0:TAG_1 - parts.get(7).ok_or_else(||format!("Credential Definition Id validation failed: tag not found in: {}", self.0))?; + // nothing to do } else { return Err("Credential Definition Id validation failed: too much parts".to_string()); } diff --git a/libindy/src/domain/anoncreds/schema.rs b/libindy/src/domain/anoncreds/schema.rs index 4dbbf046a2..3993ebe052 100644 --- a/libindy/src/domain/anoncreds/schema.rs +++ b/libindy/src/domain/anoncreds/schema.rs @@ -71,7 +71,7 @@ impl Validatable for AttributeNames { } impl SchemaId { - pub fn new(did: &str, name: &str, version: &str) -> SchemaId{ + pub fn new(did: &str, name: &str, version: &str) -> SchemaId { SchemaId(format!("{}{}{}{}{}{}{}", did, DELIMITER, SCHEMA_MARKER, DELIMITER, name, DELIMITER, version)) } @@ -83,14 +83,10 @@ impl SchemaId { impl Validatable for SchemaId { fn validate(&self) -> Result<(), String> { let parts: Vec<&str> = self.0.split_terminator(DELIMITER).collect::>(); - if parts.len() > 4 { - return Err("SchemaId validation failed: too much parts".to_string()); - } - parts.get(0).ok_or_else(||format!("Schema Id validation failed: issuer DID not found in: {}", self.0))?; - parts.get(1).ok_or_else(||format!("Schema Id validation failed: marker not found in: {}", self.0))?; - parts.get(2).ok_or_else(||format!("Schema Id validation failed: name not found in: {}", self.0))?; - parts.get(3).ok_or_else(||format!("Schema Id validation failed: version not found in: {}", self.0))?; + if parts.len() != 1 && parts.len() != 4 { + return Err("SchemaId validation failed: invalid number of parts".to_string()); + } Ok(()) } diff --git a/libindy/src/services/ledger/mod.rs b/libindy/src/services/ledger/mod.rs index b376d3e8c4..9f585b3b2c 100644 --- a/libindy/src/services/ledger/mod.rs +++ b/libindy/src/services/ledger/mod.rs @@ -120,6 +120,10 @@ impl LedgerService { pub fn build_get_schema_request(&self, identifier: Option<&str>, id: &SchemaId) -> IndyResult { let parts: Vec<&str> = id.0.split_terminator(DELIMITER).collect::>(); + if parts.len() != 4 { + return Err(IndyError::from_msg(IndyErrorKind::InvalidStructure, format!("Schema ID `{}` cannot be used to build request: invalid number of parts", id.0))); + } + let dest = parts[0].to_string(); let name = parts[2].to_string(); let version = parts[3].to_string(); diff --git a/libindy/src/utils/ctypes.rs b/libindy/src/utils/ctypes.rs index f0a717b05b..cda9be1c81 100644 --- a/libindy/src/utils/ctypes.rs +++ b/libindy/src/utils/ctypes.rs @@ -114,6 +114,42 @@ macro_rules! check_useful_opt_validatable_json { } } +macro_rules! check_useful_validatable_string { + ($x:ident, $e:expr, $t:ident) => { + check_useful_c_str!($x, $e); + + let $x: $t = $t($x.to_string()); + + match $x.validate() { + Ok(ok) => ok, + Err(err) => { + return err_msg(IndyErrorKind::InvalidStructure, err).into() + } + }; + } +} + +macro_rules! check_useful_validatable_opt_string { + ($x:ident, $e:expr, $t:ident) => { + check_useful_opt_c_str!($x, $e); + + let $x: Option<$t> = match $x { + Some(val) => { + let $x: $t = $t(val.to_string()); + + match $x.validate() { + Ok(ok) => ok, + Err(err) => { + return err_msg($e.into(), err).into() + } + }; + Some($x) + }, + None => None + }; + } +} + macro_rules! parse_json { ($x:ident, $e:expr, $t:ty) => { if $x.is_empty() { diff --git a/libindy/tests/anoncreds.rs b/libindy/tests/anoncreds.rs index 900c0847c6..15d8e94f1a 100644 --- a/libindy/tests/anoncreds.rs +++ b/libindy/tests/anoncreds.rs @@ -479,11 +479,8 @@ mod high_cases { "requested_predicates": json!({}), }).to_string(); - let credentials_json = anoncreds::prover_get_credentials_for_proof_req(wallet_handle, &proof_req).unwrap(); - - let credentials: CredentialsForProofRequest = serde_json::from_str(&credentials_json).unwrap(); - assert_eq!(credentials.attrs.len(), 0); - assert_eq!(credentials.predicates.len(), 0); + let res = anoncreds::prover_get_credentials_for_proof_req(wallet_handle, &proof_req); + assert_code!(ErrorCode::CommonInvalidStructure, res); wallet::close_wallet(wallet_handle).unwrap(); } From efbd536055d973eccad86df94a20d778a677ef57 Mon Sep 17 00:00:00 2001 From: "artem.ivanov" Date: Tue, 27 Aug 2019 10:07:42 +0300 Subject: [PATCH 254/320] IS-912: UX: Early static validation - fixed affected tests Signed-off-by: artem.ivanov --- libindy/tests/anoncreds.rs | 2 +- libindy/tests/ledger.rs | 83 +++++++++++-------- libindy/tests/utils/constants.rs | 3 + .../Case Tests/Ledger/LedgerBuildRequest.mm | 28 +++---- .../Test Utils/AnoncredsUtils.h | 4 + .../Test Utils/AnoncredsUtils.m | 8 ++ .../indy/sdk/ledger/CredDefRequestsTest.java | 2 +- .../sdk/ledger/GetRevocRegDefRequestTest.java | 18 ++-- .../sdk/ledger/LedgerIntegrationTest.java | 6 +- .../ledger/RevocGetRegDeltaRequestTest.java | 24 +++--- .../sdk/ledger/RevocGetRegRequestTest.java | 24 +++--- .../sdk/ledger/RevocRegDefRequestTest.java | 8 +- .../sdk/ledger/RevocRegEntryRequestTest.java | 36 ++++---- .../ledger/test_build_cred_def_request.py | 2 +- .../test_build_get_revoc_reg_def_request.py | 2 +- .../test_build_get_revoc_reg_delta_request.py | 2 +- .../test_build_get_revoc_reg_request.py | 2 +- .../test_build_revoc_reg_def_request.py | 4 +- .../test_build_revoc_reg_entry_request.py | 4 +- wrappers/rust/tests/ledger.rs | 4 +- 20 files changed, 153 insertions(+), 113 deletions(-) diff --git a/libindy/tests/anoncreds.rs b/libindy/tests/anoncreds.rs index 15d8e94f1a..b0a319bffd 100644 --- a/libindy/tests/anoncreds.rs +++ b/libindy/tests/anoncreds.rs @@ -3539,7 +3539,7 @@ mod medium_cases { let wallet_handle = wallet::open_wallet(ANONCREDS_WALLET_CONFIG, WALLET_CREDENTIALS).unwrap(); - let res = anoncreds::issuer_create_credential_offer(wallet_handle, "unknown_cred_def_id"); + let res = anoncreds::issuer_create_credential_offer(wallet_handle, "NcYxiDXkpYi6ov5FcYDi1e:3:CL:100"); assert_code!(ErrorCode::WalletItemNotFound, res); wallet::close_wallet(wallet_handle).unwrap(); diff --git a/libindy/tests/ledger.rs b/libindy/tests/ledger.rs index d5c624d875..d7e489fe22 100644 --- a/libindy/tests/ledger.rs +++ b/libindy/tests/ledger.rs @@ -42,7 +42,7 @@ use self::rand::distributions::Alphanumeric; use utils::domain::ledger::constants; use utils::domain::ledger::request::DEFAULT_LIBIDY_DID; -use utils::domain::anoncreds::schema::{SchemaV1}; +use utils::domain::anoncreds::schema::SchemaV1; use utils::domain::anoncreds::credential_definition::CredentialDefinitionV1; use utils::domain::anoncreds::revocation_registry_definition::RevocationRegistryDefinitionV1; use utils::domain::anoncreds::revocation_registry::RevocationRegistryV1; @@ -562,8 +562,8 @@ mod high_cases { let cred_def_json = json!({ "ver":"1.0", - "id":"cred_def_id", - "schemaId":"1", + "id": CRED_DEF_ID, + "schemaId": "1", "type":"CL", "tag":"TAG_1", "value":{ @@ -973,27 +973,44 @@ mod high_cases { fn indy_build_revoc_reg_def_request() { let data = json!({ "ver": "1.0", - "id": "RevocRegID", + "id": REV_REG_ID, "revocDefType": REVOC_REG_TYPE, "tag": TAG_1, - "credDefId": "CredDefID", - "value": json!({ + "credDefId": CRED_DEF_ID, + "value": { "issuanceType":"ISSUANCE_ON_DEMAND", "maxCredNum":5, "tailsHash":"s", "tailsLocation":"http://tails.location.com", - "publicKeys": json!({ - "accumKey": json!({ + "publicKeys": { + "accumKey": { "z": "1 0000000000000000000000000000000000000000000000000000000000001111 1 0000000000000000000000000000000000000000000000000000000000000000 1 0000000000000000000000000000000000000000000000000000000000000000 1 0000000000000000000000000000000000000000000000000000000000000000 1 0000000000000000000000000000000000000000000000000000000000000000 1 0000000000000000000000000000000000000000000000000000000000000000 1 0000000000000000000000000000000000000000000000000000000000000000 1 0000000000000000000000000000000000000000000000000000000000000000 1 0000000000000000000000000000000000000000000000000000000000000000 1 0000000000000000000000000000000000000000000000000000000000000000 1 0000000000000000000000000000000000000000000000000000000000000000 1 0000000000000000000000000000000000000000000000000000000000000000" - }) - }) - }) + } + } + } }).to_string(); - let expected_result = r#""operation":{"type":"113","id":"RevocRegID","revocDefType":"CL_ACCUM","tag":"TAG_1","credDefId":"CredDefID","value":{"issuanceType":"ISSUANCE_ON_DEMAND","maxCredNum":5,"publicKeys":{"accumKey":{"z":"1 0000000000000000000000000000000000000000000000000000000000001111 1 0000000000000000000000000000000000000000000000000000000000000000 1 0000000000000000000000000000000000000000000000000000000000000000 1 0000000000000000000000000000000000000000000000000000000000000000 1 0000000000000000000000000000000000000000000000000000000000000000 1 0000000000000000000000000000000000000000000000000000000000000000 1 0000000000000000000000000000000000000000000000000000000000000000 1 0000000000000000000000000000000000000000000000000000000000000000 1 0000000000000000000000000000000000000000000000000000000000000000 1 0000000000000000000000000000000000000000000000000000000000000000 1 0000000000000000000000000000000000000000000000000000000000000000 1 0000000000000000000000000000000000000000000000000000000000000000"}},"tailsHash":"s","tailsLocation":"http://tails.location.com"}}"#; + let expected_result = json!({ + "id":REV_REG_ID, + "credDefId": CRED_DEF_ID, + "revocDefType":"CL_ACCUM", + "tag":"TAG_1", + "type":"113", + "value": { + "issuanceType":"ISSUANCE_ON_DEMAND", + "maxCredNum":5, + "tailsHash":"s", + "tailsLocation":"http://tails.location.com", + "publicKeys": { + "accumKey": { + "z": "1 0000000000000000000000000000000000000000000000000000000000001111 1 0000000000000000000000000000000000000000000000000000000000000000 1 0000000000000000000000000000000000000000000000000000000000000000 1 0000000000000000000000000000000000000000000000000000000000000000 1 0000000000000000000000000000000000000000000000000000000000000000 1 0000000000000000000000000000000000000000000000000000000000000000 1 0000000000000000000000000000000000000000000000000000000000000000 1 0000000000000000000000000000000000000000000000000000000000000000 1 0000000000000000000000000000000000000000000000000000000000000000 1 0000000000000000000000000000000000000000000000000000000000000000 1 0000000000000000000000000000000000000000000000000000000000000000 1 0000000000000000000000000000000000000000000000000000000000000000" + } + } + } + }); let request = ledger::build_revoc_reg_def_request(DID, &data).unwrap(); - assert!(request.contains(expected_result)); + check_request(&request, expected_result); } #[test] @@ -1001,17 +1018,17 @@ mod high_cases { fn indy_build_get_revoc_reg_def_request() { let expected_result = json!({ "type": constants::GET_REVOC_REG_DEF, - "id": "RevocRegID" + "id": REV_REG_ID }); - let request = ledger::build_get_revoc_reg_def_request(Some(DID), "RevocRegID").unwrap(); + let request = ledger::build_get_revoc_reg_def_request(Some(DID), REV_REG_ID).unwrap(); check_request(&request, expected_result); } #[test] #[cfg(feature = "local_nodes_pool")] fn indy_build_get_revoc_reg_def_request_for_default_submitter_did() { - let request = ledger::build_get_revoc_reg_def_request(None, "RevocRegID").unwrap(); + let request = ledger::build_get_revoc_reg_def_request(None, REV_REG_ID).unwrap(); check_default_identifier(&request); } @@ -1037,7 +1054,7 @@ mod high_cases { fn indy_build_revoc_reg_entry_request() { let expected_result = json!({ "type": constants::REVOC_REG_ENTRY, - "revocRegDefId": "RevocRegID", + "revocRegDefId": REV_REG_ID, "revocDefType": "CL_ACCUM", "value": { "accum": "1 0000000000000000000000000000000000000000000000000000000000000000 1 0000000000000000000000000000000000000000000000000000000000000000 1 0000000000000000000000000000000000000000000000000000000000000000 1 0000000000000000000000000000000000000000000000000000000000000000 1 0000000000000000000000000000000000000000000000000000000000000000 1 0000000000000000000000000000000000000000000000000000000000000000" @@ -1046,7 +1063,7 @@ mod high_cases { let rev_reg_entry_value = r#"{"value":{"accum":"1 0000000000000000000000000000000000000000000000000000000000000000 1 0000000000000000000000000000000000000000000000000000000000000000 1 0000000000000000000000000000000000000000000000000000000000000000 1 0000000000000000000000000000000000000000000000000000000000000000 1 0000000000000000000000000000000000000000000000000000000000000000 1 0000000000000000000000000000000000000000000000000000000000000000"}, "ver":"1.0"}"#; - let request = ledger::build_revoc_reg_entry_request(DID, "RevocRegID", REVOC_REG_TYPE, rev_reg_entry_value).unwrap(); + let request = ledger::build_revoc_reg_entry_request(DID, REV_REG_ID, REVOC_REG_TYPE, rev_reg_entry_value).unwrap(); check_request(&request, expected_result); } @@ -1065,18 +1082,18 @@ mod high_cases { fn indy_build_get_revoc_reg_request() { let expected_result = json!({ "type": constants::GET_REVOC_REG, - "revocRegDefId": "RevRegId", + "revocRegDefId": REV_REG_ID, "timestamp": 100 }); - let request = ledger::build_get_revoc_reg_request(Some(DID), "RevRegId", 100).unwrap(); + let request = ledger::build_get_revoc_reg_request(Some(DID), REV_REG_ID, 100).unwrap(); check_request(&request, expected_result); } #[test] #[cfg(feature = "local_nodes_pool")] fn indy_build_get_revoc_reg_request_for_default_submitter_did() { - let request = ledger::build_get_revoc_reg_request(None, "RevRegId", 100).unwrap(); + let request = ledger::build_get_revoc_reg_request(None, REV_REG_ID, 100).unwrap(); check_default_identifier(&request); } @@ -1105,18 +1122,18 @@ mod high_cases { fn indy_build_get_revoc_reg_delta_request() { let expected_result = json!({ "type": constants::GET_REVOC_REG_DELTA, - "revocRegDefId": "RevRegId", + "revocRegDefId": REV_REG_ID, "to": 100 }); - let request = ledger::build_get_revoc_reg_delta_request(Some(DID), "RevRegId", None, 100).unwrap(); + let request = ledger::build_get_revoc_reg_delta_request(Some(DID), REV_REG_ID, None, 100).unwrap(); check_request(&request, expected_result); } #[test] #[cfg(feature = "local_nodes_pool")] fn indy_build_get_revoc_reg_delta_request_for_default_submitter_did() { - let request = ledger::build_get_revoc_reg_delta_request(None, "RevRegId", None, 100).unwrap(); + let request = ledger::build_get_revoc_reg_delta_request(None, REV_REG_ID, None, 100).unwrap(); check_default_identifier(&request); } @@ -1785,7 +1802,7 @@ mod high_cases { #[test] #[cfg(feature = "local_nodes_pool")] - #[cfg(not(feature="only_high_cases"))] + #[cfg(not(feature = "only_high_cases"))] fn indy_auth_rule_requests_works_for_demote_trustee() { let setup = Setup::trustee(); @@ -1814,7 +1831,7 @@ mod high_cases { #[test] #[cfg(feature = "local_nodes_pool")] - #[cfg(not(feature="only_high_cases"))] + #[cfg(not(feature = "only_high_cases"))] fn indy_auth_rule_requests_works_for_promote_role_to_trustee() { let setup = Setup::trustee(); @@ -1843,7 +1860,7 @@ mod high_cases { #[test] #[cfg(feature = "local_nodes_pool")] - #[cfg(not(feature="only_high_cases"))] + #[cfg(not(feature = "only_high_cases"))] fn indy_auth_rule_requests_works_for_change_trustee_to_steward() { let setup = Setup::trustee(); @@ -2439,7 +2456,7 @@ mod high_cases { } #[test] - #[cfg(not(feature="only_high_cases"))] + #[cfg(not(feature = "only_high_cases"))] fn indy_reset_author_agreement_works() { let setup = Setup::trustee(); @@ -2486,7 +2503,7 @@ mod high_cases { } #[test] - #[cfg(not(feature="only_high_cases"))] + #[cfg(not(feature = "only_high_cases"))] fn indy_author_agreement_works_for_using_invalid_aml() { let setup = Setup::trustee(); @@ -2512,7 +2529,7 @@ mod high_cases { } #[test] - #[cfg(not(feature="only_high_cases"))] + #[cfg(not(feature = "only_high_cases"))] fn indy_author_agreement_works_for_using_not_last_taa() { let setup = Setup::trustee(); @@ -2600,7 +2617,7 @@ mod high_cases { } #[test] - #[cfg(not(feature="only_high_cases"))] + #[cfg(not(feature = "only_high_cases"))] fn indy_send_request_by_endorser_for_both_author_and_endorser_must_sign() { let setup = Setup::endorser(); let my_did = _setup_new_identity(setup.wallet_handle, setup.pool_handle); @@ -2624,12 +2641,12 @@ mod high_cases { } } -#[cfg(not(feature="only_high_cases"))] +#[cfg(not(feature = "only_high_cases"))] mod medium_cases { use super::*; use openssl::hash::{MessageDigest, Hasher}; use sodiumoxide::crypto::secretbox; - use utils::domain::anoncreds::schema::{Schema}; + use utils::domain::anoncreds::schema::Schema; mod requests { use super::*; diff --git a/libindy/tests/utils/constants.rs b/libindy/tests/utils/constants.rs index c35a081464..22cb6b211f 100644 --- a/libindy/tests/utils/constants.rs +++ b/libindy/tests/utils/constants.rs @@ -52,3 +52,6 @@ pub const DEFAULT_WALLET_CONFIG: &'static str = r#"{"id":"default_wallet_1","sto pub const INMEM_WALLET_CONFIG: &'static str = r#"{"id":"inmem_wallet_1","storage_type":"inmem"}"#; // FIXME never use global names pub const UNKNOWN_WALLET_CONFIG: &'static str = r#"{"id":"unknown_wallet_1","storage_type":"unknown"}"#; // FIXME never use global names pub const AGENT_MESSAGE: &'static str = r#"{ "@id": "123456780","@type":"did:sov:BzCbsNYhMrjHiqZDTUASHg;spec/basicmessage/1.0/message","sent_time": "2019-01-15 18:42:01Z","content": "Your hovercraft is full of eels."}"#; +pub const SCHEMA_ID: &'static str = "NcYxiDXkpYi6ov5FcYDi1e:2:gvt:1.0"; +pub const CRED_DEF_ID: &'static str = "NcYxiDXkpYi6ov5FcYDi1e:3:CL:1"; +pub const REV_REG_ID: &'static str = "NcYxiDXkpYi6ov5FcYDi1e:4:NcYxiDXkpYi6ov5FcYDi1e:3:CL:1:CL_ACCUM:TAG_1"; diff --git a/wrappers/ios/libindy-pod/Indy-demoTests/Case Tests/Ledger/LedgerBuildRequest.mm b/wrappers/ios/libindy-pod/Indy-demoTests/Case Tests/Ledger/LedgerBuildRequest.mm index aa45caf164..5c79a2eb9b 100644 --- a/wrappers/ios/libindy-pod/Indy-demoTests/Case Tests/Ledger/LedgerBuildRequest.mm +++ b/wrappers/ios/libindy-pod/Indy-demoTests/Case Tests/Ledger/LedgerBuildRequest.mm @@ -215,7 +215,7 @@ - (void)testBuildGetSchemaRequestsWorks { - (void)testBuildCredDefRequestWorksForCorrectDataJson { NSDictionary *data = @{ @"ver": @"1.0", - @"id": @"id", + @"id": [[AnoncredsUtils sharedInstance] credDefId], @"schemaId": @"1", @"type": @"CL", @"tag": @"TAG1", @@ -255,7 +255,7 @@ - (void)testBuildCredDefRequestWorksForCorrectDataJson { } - (void)testBuildGetCredDefRequestWorks { - NSString *id = @"NcYxiDXkpYi6ov5FcYDi1e:03:CL:1:TAG"; + NSString *id = [[AnoncredsUtils sharedInstance] credDefId]; NSDictionary *expectedResult = @{ @"identifier": [TestUtils issuerDid], @@ -285,10 +285,10 @@ - (void)testBuildGetCredDefRequestWorks { - (void)testBuildRevocRegDefRequestWorks { NSDictionary *data = @{ @"ver": @"1.0", - @"id": @"RevocRegID", + @"id": [[AnoncredsUtils sharedInstance] revRegId], @"revocDefType": @"CL_ACCUM", @"tag": @"TAG_1", - @"credDefId": @"CredDefID", + @"credDefId": [[AnoncredsUtils sharedInstance] credDefId], @"value": @{ @"issuanceType": @"ISSUANCE_ON_DEMAND", @"maxCredNum": @(5), @@ -305,10 +305,10 @@ - (void)testBuildRevocRegDefRequestWorks { NSDictionary *expectedResult = @{ @"operation": @{ @"type": @"113", - @"id": @"RevocRegID", + @"id": [[AnoncredsUtils sharedInstance] revRegId], @"revocDefType": @"CL_ACCUM", @"tag": @"TAG_1", - @"credDefId": @"CredDefID", + @"credDefId": [[AnoncredsUtils sharedInstance] credDefId], @"value": data[@"value"] } }; @@ -328,13 +328,13 @@ - (void)testBuildGetRevocRegDefRequestWorks { NSDictionary *expectedResult = @{ @"operation": @{ @"type": @"115", - @"revocRegDefId": @"RevocRegID" + @"revocRegDefId": [[AnoncredsUtils sharedInstance] revRegId] } }; NSString *requestJson; ret = [[LedgerUtils sharedInstance] buildGetRevocRegDefRequestWithSubmitterDid:[TestUtils issuerDid] - id:@"RevocRegID" + id:[[AnoncredsUtils sharedInstance] revRegId] resultJson:&requestJson]; XCTAssertEqual(ret.code, Success, @"LedgerUtils::buildGetTxnRequestWithSubmitterDid() failed"); @@ -356,7 +356,7 @@ - (void)testBuildRevocRegEntryRequestWorks { NSDictionary *expectedResult = @{ @"operation": @{ @"type": @"114", - @"revocRegDefId": @"RevocRegID", + @"revocRegDefId": [[AnoncredsUtils sharedInstance] revRegId], @"revocDefType": @"CL_ACCUM", @"value": @{ @"accum": @"1 0000000000000000000000000000000000000000000000000000000000000000 1 0000000000000000000000000000000000000000000000000000000000000000 1 0000000000000000000000000000000000000000000000000000000000000000 1 0000000000000000000000000000000000000000000000000000000000000000 1 0000000000000000000000000000000000000000000000000000000000000000 1 0000000000000000000000000000000000000000000000000000000000000000" @@ -367,7 +367,7 @@ - (void)testBuildRevocRegEntryRequestWorks { NSString *requestJson; ret = [[LedgerUtils sharedInstance] buildRevocRegEntryRequestWithSubmitterDid:[TestUtils issuerDid] type:@"CL_ACCUM" - revocRegDefId:@"RevocRegID" + revocRegDefId:[[AnoncredsUtils sharedInstance] revRegId] value:[[AnoncredsUtils sharedInstance] toJson:data] resultJson:&requestJson]; XCTAssertEqual(ret.code, Success, @"LedgerUtils::buildRevocRegEntrtyRequestWithSubmitterDid() failed"); @@ -383,14 +383,14 @@ - (void)testBuildGetRevocRegRequestWorks { NSDictionary *expectedResult = @{ @"operation": @{ @"type": @"116", - @"revocRegDefId": @"RevRegId", + @"revocRegDefId": [[AnoncredsUtils sharedInstance] revRegId], @"timestamp": @(100) } }; NSString *requestJson; ret = [[LedgerUtils sharedInstance] buildGetRevocRegRequestWithSubmitterDid:[TestUtils issuerDid] - revocRegDefId:@"RevRegId" + revocRegDefId:[[AnoncredsUtils sharedInstance] revRegId] timestamp:@(100) resultJson:&requestJson]; XCTAssertEqual(ret.code, Success, @"LedgerUtils::buildGetRevocRegRequestWithSubmitterDid() failed"); @@ -406,7 +406,7 @@ - (void)testBuildGetRevocRegDeltaRequestWorks { NSDictionary *expectedResult = @{ @"operation": @{ @"type": @"117", - @"revocRegDefId": @"RevRegId", + @"revocRegDefId": [[AnoncredsUtils sharedInstance] revRegId], @"from": @(0), @"to": @(100) } @@ -414,7 +414,7 @@ - (void)testBuildGetRevocRegDeltaRequestWorks { NSString *requestJson; ret = [[LedgerUtils sharedInstance] buildGetRevocRegDeltaRequestWithSubmitterDid:[TestUtils issuerDid] - revocRegDefId:@"RevRegId" + revocRegDefId:[[AnoncredsUtils sharedInstance] revRegId] from:@(0) to:@(100) resultJson:&requestJson]; diff --git a/wrappers/ios/libindy-pod/Indy-demoTests/Test Utils/AnoncredsUtils.h b/wrappers/ios/libindy-pod/Indy-demoTests/Test Utils/AnoncredsUtils.h index 12dbb01f52..665254f24f 100644 --- a/wrappers/ios/libindy-pod/Indy-demoTests/Test Utils/AnoncredsUtils.h +++ b/wrappers/ios/libindy-pod/Indy-demoTests/Test Utils/AnoncredsUtils.h @@ -15,6 +15,10 @@ - (NSString *)getGvtSchemaId; +- (NSString *)credDefId; + +- (NSString *)revRegId; + - (NSString *)getGvtSchemaJson; - (NSString *)getIssuer1GvtCredDefId; diff --git a/wrappers/ios/libindy-pod/Indy-demoTests/Test Utils/AnoncredsUtils.m b/wrappers/ios/libindy-pod/Indy-demoTests/Test Utils/AnoncredsUtils.m index c9129bbd01..75e0c12bf6 100644 --- a/wrappers/ios/libindy-pod/Indy-demoTests/Test Utils/AnoncredsUtils.m +++ b/wrappers/ios/libindy-pod/Indy-demoTests/Test Utils/AnoncredsUtils.m @@ -38,6 +38,14 @@ - (NSString *)getGvtSchemaId { return @"NcYxiDXkpYi6ov5FcYDi1e:2:gvt:1.0"; } +- (NSString *)credDefId { + return @"NcYxiDXkpYi6ov5FcYDi1e:2:gvt:1.0"; +} + +- (NSString *)revRegDefId { + return @"NcYxiDXkpYi6ov5FcYDi1e:4:NcYxiDXkpYi6ov5FcYDi1e:3:CL:1:CL_ACCUM:TAG_1"; +} + - (NSString *)getGvtSchemaJson { return [self toJson:@{ @"id": [self getGvtSchemaId], diff --git a/wrappers/java/src/test/java/org/hyperledger/indy/sdk/ledger/CredDefRequestsTest.java b/wrappers/java/src/test/java/org/hyperledger/indy/sdk/ledger/CredDefRequestsTest.java index b08f30725d..bbd12be4cd 100644 --- a/wrappers/java/src/test/java/org/hyperledger/indy/sdk/ledger/CredDefRequestsTest.java +++ b/wrappers/java/src/test/java/org/hyperledger/indy/sdk/ledger/CredDefRequestsTest.java @@ -20,7 +20,7 @@ public class CredDefRequestsTest extends LedgerIntegrationTest { public void testBuildCredDefRequestWorks() throws Exception { String data = "{\n" + " \"ver\": \"1.0\",\n" + - " \"id\": \"cred_def_id\",\n" + + " \"id\": \"NcYxiDXkpYi6ov5FcYDi1e:3:CL:1\",\n" + " \"schemaId\": \"1\",\n" + " \"type\": \"CL\",\n" + " \"tag\": \"TAG_1\",\n" + diff --git a/wrappers/java/src/test/java/org/hyperledger/indy/sdk/ledger/GetRevocRegDefRequestTest.java b/wrappers/java/src/test/java/org/hyperledger/indy/sdk/ledger/GetRevocRegDefRequestTest.java index 16523761f3..231b09b09f 100644 --- a/wrappers/java/src/test/java/org/hyperledger/indy/sdk/ledger/GetRevocRegDefRequestTest.java +++ b/wrappers/java/src/test/java/org/hyperledger/indy/sdk/ledger/GetRevocRegDefRequestTest.java @@ -1,18 +1,22 @@ package org.hyperledger.indy.sdk.ledger; -import org.hyperledger.indy.sdk.IndyIntegrationTestWithPoolAndSingleWallet; +import org.json.JSONObject; import org.junit.Test; -import static org.junit.Assert.assertTrue; - -public class GetRevocRegDefRequestTest extends IndyIntegrationTestWithPoolAndSingleWallet { +public class GetRevocRegDefRequestTest extends LedgerIntegrationTest { @Test public void testBuildGetRevocRegDefRequestWorks() throws Exception { - String expectedResult = "\"operation\":{\"type\":\"115\",\"id\":\"RevocRegID\"}"; + JSONObject expectedResult = new JSONObject() + .put("operation", new JSONObject() + .put("type", "115") + .put("id", revRegDefId) + ); - String request = Ledger.buildGetRevocRegDefRequest(DID, "RevocRegID").get(); + String request = Ledger.buildGetRevocRegDefRequest(DID, revRegDefId).get(); - assertTrue(request.replaceAll("\\s+","").contains(expectedResult.replaceAll("\\s+",""))); + assert (new JSONObject(request).toMap().entrySet() + .containsAll( + expectedResult.toMap().entrySet())); } } diff --git a/wrappers/java/src/test/java/org/hyperledger/indy/sdk/ledger/LedgerIntegrationTest.java b/wrappers/java/src/test/java/org/hyperledger/indy/sdk/ledger/LedgerIntegrationTest.java index 7b24941212..3388e3d5cb 100644 --- a/wrappers/java/src/test/java/org/hyperledger/indy/sdk/ledger/LedgerIntegrationTest.java +++ b/wrappers/java/src/test/java/org/hyperledger/indy/sdk/ledger/LedgerIntegrationTest.java @@ -24,9 +24,9 @@ public class LedgerIntegrationTest extends IndyIntegrationTestWithPoolAndSingleW private static Boolean entitiesPosted = false; - static String schemaId; - static String credDefId; - static String revRegDefId; + static String schemaId = "NcYxiDXkpYi6ov5FcYDi1e:2:gvt:1.0"; + static String credDefId = "NcYxiDXkpYi6ov5FcYDi1e:3:CL:1"; + static String revRegDefId = "NcYxiDXkpYi6ov5FcYDi1e:4:NcYxiDXkpYi6ov5FcYDi1e:3:CL:1:CL_ACCUM:TAG_1"; void postEntities() throws Exception { diff --git a/wrappers/java/src/test/java/org/hyperledger/indy/sdk/ledger/RevocGetRegDeltaRequestTest.java b/wrappers/java/src/test/java/org/hyperledger/indy/sdk/ledger/RevocGetRegDeltaRequestTest.java index 1998973b1d..fa67ec80ea 100644 --- a/wrappers/java/src/test/java/org/hyperledger/indy/sdk/ledger/RevocGetRegDeltaRequestTest.java +++ b/wrappers/java/src/test/java/org/hyperledger/indy/sdk/ledger/RevocGetRegDeltaRequestTest.java @@ -6,22 +6,22 @@ import java.util.Date; -import static org.junit.Assert.assertTrue; - public class RevocGetRegDeltaRequestTest extends LedgerIntegrationTest { @Test public void testBuildGetRevocRegDeltaRequestWorks() throws Exception { - String expectedResult = - "\"operation\": {\n" + - " \"type\": \"117\",\n" + - " \"revocRegDefId\": \"RevocRegID\",\n" + - " \"to\": 100\n" + - " }"; - - String request = Ledger.buildGetRevocRegDeltaRequest(DID, "RevocRegID", - 1, 100).get(); - - assertTrue(request.replaceAll("\\s+", "").contains(expectedResult.replaceAll("\\s+", ""))); + JSONObject expectedResult = new JSONObject() + .put("operation", new JSONObject() + .put("type", "117") + .put("revocRegDefId", revRegDefId) + .put("to", 100) + ); + + String request = Ledger.buildGetRevocRegDeltaRequest(DID, revRegDefId, - 1, 100).get(); + + assert (new JSONObject(request).toMap().entrySet() + .containsAll( + expectedResult.toMap().entrySet())); } @Test diff --git a/wrappers/java/src/test/java/org/hyperledger/indy/sdk/ledger/RevocGetRegRequestTest.java b/wrappers/java/src/test/java/org/hyperledger/indy/sdk/ledger/RevocGetRegRequestTest.java index 688dc08433..c87886b76a 100644 --- a/wrappers/java/src/test/java/org/hyperledger/indy/sdk/ledger/RevocGetRegRequestTest.java +++ b/wrappers/java/src/test/java/org/hyperledger/indy/sdk/ledger/RevocGetRegRequestTest.java @@ -6,22 +6,22 @@ import java.util.Date; -import static org.junit.Assert.assertTrue; - public class RevocGetRegRequestTest extends LedgerIntegrationTest { @Test public void testBuildGetRevocRegRequestWorks() throws Exception { - String expectedResult = - "\"operation\": {\n" + - " \"type\": \"116\",\n" + - " \"revocRegDefId\": \"RevocRegID\",\n" + - " \"timestamp\": 100\n" + - " }"; - - String request = Ledger.buildGetRevocRegRequest(DID, "RevocRegID", 100).get(); - - assertTrue(request.replaceAll("\\s+", "").contains(expectedResult.replaceAll("\\s+", ""))); + JSONObject expectedResult = new JSONObject() + .put("operation", new JSONObject() + .put("type", "116") + .put("revocRegDefId", revRegDefId) + .put("timestamp", 100) + ); + + String request = Ledger.buildGetRevocRegRequest(DID, revRegDefId, 100).get(); + + assert (new JSONObject(request).toMap().entrySet() + .containsAll( + expectedResult.toMap().entrySet())); } @Test diff --git a/wrappers/java/src/test/java/org/hyperledger/indy/sdk/ledger/RevocRegDefRequestTest.java b/wrappers/java/src/test/java/org/hyperledger/indy/sdk/ledger/RevocRegDefRequestTest.java index 57058cc2d6..3b3580242b 100644 --- a/wrappers/java/src/test/java/org/hyperledger/indy/sdk/ledger/RevocRegDefRequestTest.java +++ b/wrappers/java/src/test/java/org/hyperledger/indy/sdk/ledger/RevocRegDefRequestTest.java @@ -13,10 +13,10 @@ public void testBuildRevocRegDefRequestWorks() throws Exception { String expectedResult = "\"operation\":{" + "\"type\":\"113\"," + - "\"id\":\"RevocRegID\"," + + "\"id\":\"NcYxiDXkpYi6ov5FcYDi1e:4:NcYxiDXkpYi6ov5FcYDi1e:3:CL:1:CL_ACCUM:TAG_1\"," + "\"revocDefType\":\"CL_ACCUM\"," + "\"tag\":\"TAG1\"," + - "\"credDefId\":\"CredDefID\"," + + "\"credDefId\":\"NcYxiDXkpYi6ov5FcYDi1e:3:CL:1\"," + "\"value\":{" + " \"issuanceType\":\"ISSUANCE_ON_DEMAND\"," + " \"maxCredNum\":5," + @@ -28,10 +28,10 @@ public void testBuildRevocRegDefRequestWorks() throws Exception { String data = "{\n" + " \"ver\": \"1.0\",\n" + - " \"id\": \"RevocRegID\",\n" + + " \"id\": \"NcYxiDXkpYi6ov5FcYDi1e:4:NcYxiDXkpYi6ov5FcYDi1e:3:CL:1:CL_ACCUM:TAG_1\",\n" + " \"revocDefType\": \"CL_ACCUM\",\n" + " \"tag\": \"TAG1\",\n" + - " \"credDefId\": \"CredDefID\",\n" + + " \"credDefId\": \"NcYxiDXkpYi6ov5FcYDi1e:3:CL:1\",\n" + " \"value\": {\n" + " \"issuanceType\": \"ISSUANCE_ON_DEMAND\",\n" + " \"maxCredNum\": 5,\n" + diff --git a/wrappers/java/src/test/java/org/hyperledger/indy/sdk/ledger/RevocRegEntryRequestTest.java b/wrappers/java/src/test/java/org/hyperledger/indy/sdk/ledger/RevocRegEntryRequestTest.java index 8967fae924..4499c77753 100644 --- a/wrappers/java/src/test/java/org/hyperledger/indy/sdk/ledger/RevocRegEntryRequestTest.java +++ b/wrappers/java/src/test/java/org/hyperledger/indy/sdk/ledger/RevocRegEntryRequestTest.java @@ -1,28 +1,32 @@ package org.hyperledger.indy.sdk.ledger; -import org.hyperledger.indy.sdk.IndyIntegrationTestWithPoolAndSingleWallet; +import org.json.JSONObject; import org.junit.Test; -import static org.junit.Assert.assertTrue; - -public class RevocRegEntryRequestTest extends IndyIntegrationTestWithPoolAndSingleWallet { +public class RevocRegEntryRequestTest extends LedgerIntegrationTest { @Test public void testBuildRevocRegEntryRequestWorks() throws Exception { - String expectedResult ="\"operation\": {\n" + - " \"type\": \"114\",\n" + - " \"revocRegDefId\": \"RevocRegID\",\n" + - " \"revocDefType\": \"CL_ACCUM\",\n" + - " \"value\": {\"accum\": \"1 0000000000000000000000000000000000000000000000000000000000000000 1 0000000000000000000000000000000000000000000000000000000000000000 1 0000000000000000000000000000000000000000000000000000000000000000 1 0000000000000000000000000000000000000000000000000000000000000000 1 0000000000000000000000000000000000000000000000000000000000000000 1 0000000000000000000000000000000000000000000000000000000000000000\"}\n" + - " }"; + JSONObject expectedResult = new JSONObject() + .put("operation", new JSONObject() + .put("type", "114") + .put("revocRegDefId", revRegDefId) + .put("revocDefType", "CL_ACCUM") + .put("value", new JSONObject() + .put("accum", "1 0000000000000000000000000000000000000000000000000000000000000000 1 0000000000000000000000000000000000000000000000000000000000000000 1 0000000000000000000000000000000000000000000000000000000000000000 1 0000000000000000000000000000000000000000000000000000000000000000 1 0000000000000000000000000000000000000000000000000000000000000000 1 0000000000000000000000000000000000000000000000000000000000000000") + ) + ); - String value = "{\"ver\":\"1.0\"," + - " \"value\": {\n" + - " \"accum\": \"1 0000000000000000000000000000000000000000000000000000000000000000 1 0000000000000000000000000000000000000000000000000000000000000000 1 0000000000000000000000000000000000000000000000000000000000000000 1 0000000000000000000000000000000000000000000000000000000000000000 1 0000000000000000000000000000000000000000000000000000000000000000 1 0000000000000000000000000000000000000000000000000000000000000000\"\n" + - " }}"; + String value = new JSONObject() + .put("ver", "1.0") + .put("value", new JSONObject() + .put("accum", "1 0000000000000000000000000000000000000000000000000000000000000000 1 0000000000000000000000000000000000000000000000000000000000000000 1 0000000000000000000000000000000000000000000000000000000000000000 1 0000000000000000000000000000000000000000000000000000000000000000 1 0000000000000000000000000000000000000000000000000000000000000000 1 0000000000000000000000000000000000000000000000000000000000000000") + ).toString(); - String request = Ledger.buildRevocRegEntryRequest(DID, "RevocRegID", "CL_ACCUM", value).get(); + String request = Ledger.buildRevocRegEntryRequest(DID, revRegDefId, "CL_ACCUM", value).get(); - assertTrue(request.replaceAll("\\s+", "").contains(expectedResult.replaceAll("\\s+", ""))); + assert (new JSONObject(request).toMap().entrySet() + .containsAll( + expectedResult.toMap().entrySet())); } } diff --git a/wrappers/python/tests/ledger/test_build_cred_def_request.py b/wrappers/python/tests/ledger/test_build_cred_def_request.py index 600f633a43..ffaedd19a2 100644 --- a/wrappers/python/tests/ledger/test_build_cred_def_request.py +++ b/wrappers/python/tests/ledger/test_build_cred_def_request.py @@ -8,7 +8,7 @@ async def test_build_cred_def_request_works_for_correct_data_json(did_trustee): data = { "ver": "1.0", - "id": "cred_def_id", + "id": "NcYxiDXkpYi6ov5FcYDi1e:3:CL:1", "schemaId": "1", "type": "CL", "tag": "TAG_1", diff --git a/wrappers/python/tests/ledger/test_build_get_revoc_reg_def_request.py b/wrappers/python/tests/ledger/test_build_get_revoc_reg_def_request.py index d968045469..9bdbe816fb 100644 --- a/wrappers/python/tests/ledger/test_build_get_revoc_reg_def_request.py +++ b/wrappers/python/tests/ledger/test_build_get_revoc_reg_def_request.py @@ -8,7 +8,7 @@ async def test_build_get_revoc_reg_def_request_work(): identifier = "Th7MpTaRZVRYnPiabds81Y" - rev_reg_def_id = "RevocRegID" + rev_reg_def_id = "NcYxiDXkpYi6ov5FcYDi1e:4:NcYxiDXkpYi6ov5FcYDi1e:3:CL:1:CL_ACCUM:TAG_1" expected_response = { "operation": { diff --git a/wrappers/python/tests/ledger/test_build_get_revoc_reg_delta_request.py b/wrappers/python/tests/ledger/test_build_get_revoc_reg_delta_request.py index 250002cab4..ad86f5aa3b 100644 --- a/wrappers/python/tests/ledger/test_build_get_revoc_reg_delta_request.py +++ b/wrappers/python/tests/ledger/test_build_get_revoc_reg_delta_request.py @@ -8,7 +8,7 @@ async def test_build_get_revoc_reg_delta_request_work(): identifier = "Th7MpTaRZVRYnPiabds81Y" - rev_reg_def_id = "RevocRegID" + rev_reg_def_id = "NcYxiDXkpYi6ov5FcYDi1e:4:NcYxiDXkpYi6ov5FcYDi1e:3:CL:1:CL_ACCUM:TAG_1" to = 100 expected_response = { diff --git a/wrappers/python/tests/ledger/test_build_get_revoc_reg_request.py b/wrappers/python/tests/ledger/test_build_get_revoc_reg_request.py index 1a664fb473..84b2baf693 100644 --- a/wrappers/python/tests/ledger/test_build_get_revoc_reg_request.py +++ b/wrappers/python/tests/ledger/test_build_get_revoc_reg_request.py @@ -8,7 +8,7 @@ async def test_build_get_revoc_reg_request_work(): identifier = "Th7MpTaRZVRYnPiabds81Y" - rev_reg_def_id = "RevocRegID" + rev_reg_def_id = "NcYxiDXkpYi6ov5FcYDi1e:4:NcYxiDXkpYi6ov5FcYDi1e:3:CL:1:CL_ACCUM:TAG_1" timestamp = 100 expected_response = { diff --git a/wrappers/python/tests/ledger/test_build_revoc_reg_def_request.py b/wrappers/python/tests/ledger/test_build_revoc_reg_def_request.py index 0f2c73753c..2ecda62fc5 100644 --- a/wrappers/python/tests/ledger/test_build_revoc_reg_def_request.py +++ b/wrappers/python/tests/ledger/test_build_revoc_reg_def_request.py @@ -10,10 +10,10 @@ async def test_build_revoc_reg_def_request_work(): data = { "ver": "1.0", - "id": "RevocRegID", + "id": "NcYxiDXkpYi6ov5FcYDi1e:4:NcYxiDXkpYi6ov5FcYDi1e:3:CL:1:CL_ACCUM:TAG_1", "revocDefType": "CL_ACCUM", "tag": "TAG1", - "credDefId": "CredDefID", + "credDefId": "NcYxiDXkpYi6ov5FcYDi1e:3:CL:1", "value": { "issuanceType": "ISSUANCE_ON_DEMAND", "maxCredNum": 5, diff --git a/wrappers/python/tests/ledger/test_build_revoc_reg_entry_request.py b/wrappers/python/tests/ledger/test_build_revoc_reg_entry_request.py index 72abf9ed90..897a9a68d5 100644 --- a/wrappers/python/tests/ledger/test_build_revoc_reg_entry_request.py +++ b/wrappers/python/tests/ledger/test_build_revoc_reg_entry_request.py @@ -14,13 +14,13 @@ async def test_build_revoc_reg_entry_request_work(): "accum": "1 0000000000000000000000000000000000000000000000000000000000000000 1 0000000000000000000000000000000000000000000000000000000000000000 1 0000000000000000000000000000000000000000000000000000000000000000 1 0000000000000000000000000000000000000000000000000000000000000000 1 0000000000000000000000000000000000000000000000000000000000000000 1 0000000000000000000000000000000000000000000000000000000000000000" } } - rev_reg_def_id = "RevocRegID" + rev_reg_def_id = "NcYxiDXkpYi6ov5FcYDi1e:4:NcYxiDXkpYi6ov5FcYDi1e:3:CL:1:CL_ACCUM:TAG_1" rev_reg_type = "CL_ACCUM" expected_response = { "operation": { "type": "114", - "revocRegDefId": "RevocRegID", + "revocRegDefId": rev_reg_def_id, "revocDefType": "CL_ACCUM", "value": {"accum": "1 0000000000000000000000000000000000000000000000000000000000000000 1 0000000000000000000000000000000000000000000000000000000000000000 1 0000000000000000000000000000000000000000000000000000000000000000 1 0000000000000000000000000000000000000000000000000000000000000000 1 0000000000000000000000000000000000000000000000000000000000000000 1 0000000000000000000000000000000000000000000000000000000000000000"} } diff --git a/wrappers/rust/tests/ledger.rs b/wrappers/rust/tests/ledger.rs index 2eb383b8c3..3a28a1d48d 100644 --- a/wrappers/rust/tests/ledger.rs +++ b/wrappers/rust/tests/ledger.rs @@ -410,7 +410,7 @@ mod test_build_get_attrib_request { mod test_build_schema_request { use super::*; - const SCHEMA_DATA: &str = r#"{"id":"id","attrNames": ["name", "male"],"name":"gvt2","version":"3.1","ver":"1.0"}"#; + const SCHEMA_DATA: &str = r#"{"id":"NcYxiDXkpYi6ov5FcYDi1e:2:gvt:1.0","attrNames": ["name", "male"],"name":"gvt2","version":"3.1","ver":"1.0"}"#; #[test] pub fn build_schema_request_success() { @@ -454,7 +454,7 @@ mod test_parse_get_schema_response { use super::*; const SCHEMA_NAME: &str = "schema_1234"; - const SCHEMA_DATA: &str = r#"{"id":"schema_id1234","attrNames": ["name", "male"],"name":"schema_1234","version":"1.0","ver":"1.0"}"#; + const SCHEMA_DATA: &str = r#"{"id":"NcYxiDXkpYi6ov5FcYDi1e:2:gvt:1.0","attrNames": ["name", "male"],"name":"schema_1234","version":"1.0","ver":"1.0"}"#; fn create_build_schema_request(did: &String) -> String { From c7ba6cff779ff8d8de38361b2c9310db8b1572f4 Mon Sep 17 00:00:00 2001 From: "artem.ivanov" Date: Sat, 17 Aug 2019 20:12:21 +0300 Subject: [PATCH 255/320] Fixed affected iOS tests Signed-off-by: artem.ivanov --- .../libindy-pod/Indy-demoTests/Test Utils/AnoncredsUtils.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wrappers/ios/libindy-pod/Indy-demoTests/Test Utils/AnoncredsUtils.m b/wrappers/ios/libindy-pod/Indy-demoTests/Test Utils/AnoncredsUtils.m index 75e0c12bf6..b4e6a49565 100644 --- a/wrappers/ios/libindy-pod/Indy-demoTests/Test Utils/AnoncredsUtils.m +++ b/wrappers/ios/libindy-pod/Indy-demoTests/Test Utils/AnoncredsUtils.m @@ -39,10 +39,10 @@ - (NSString *)getGvtSchemaId { } - (NSString *)credDefId { - return @"NcYxiDXkpYi6ov5FcYDi1e:2:gvt:1.0"; + return @"NcYxiDXkpYi6ov5FcYDi1e:3:CL:1"; } -- (NSString *)revRegDefId { +- (NSString *)revRegId { return @"NcYxiDXkpYi6ov5FcYDi1e:4:NcYxiDXkpYi6ov5FcYDi1e:3:CL:1:CL_ACCUM:TAG_1"; } From b9ee8adc595e79d029f1b2d1ef1cbe561642798c Mon Sep 17 00:00:00 2001 From: Axel Nennker Date: Sat, 17 Aug 2019 21:43:37 +0200 Subject: [PATCH 256/320] dyn Signed-off-by: Axel Nennker --- wrappers/rust/src/anoncreds.rs | 58 ++++++++++---------- wrappers/rust/src/blob_storage.rs | 4 +- wrappers/rust/src/cache.rs | 8 +-- wrappers/rust/src/crypto.rs | 22 ++++---- wrappers/rust/src/did.rs | 26 ++++----- wrappers/rust/src/ledger.rs | 80 ++++++++++++++-------------- wrappers/rust/src/lib.rs | 2 +- wrappers/rust/src/logger.rs | 4 +- wrappers/rust/src/pairwise.rs | 10 ++-- wrappers/rust/src/payments.rs | 40 +++++++------- wrappers/rust/src/pool.rs | 14 ++--- wrappers/rust/src/utils/callbacks.rs | 2 +- wrappers/rust/src/wallet.rs | 36 ++++++------- 13 files changed, 153 insertions(+), 153 deletions(-) diff --git a/wrappers/rust/src/anoncreds.rs b/wrappers/rust/src/anoncreds.rs index 98b4cbea67..b1f25f95d8 100644 --- a/wrappers/rust/src/anoncreds.rs +++ b/wrappers/rust/src/anoncreds.rs @@ -47,7 +47,7 @@ https://github.com/hyperledger/indy-hipe/blob/c761c583b1e01c1e9d3ceda2b03b35336f /// # Returns /// * `schema_id`: identifier of created schema /// * `schema_json`: schema as json -pub fn issuer_create_schema(issuer_did: &str, name: &str, version: &str, attrs: &str) -> Box> { +pub fn issuer_create_schema(issuer_did: &str, name: &str, version: &str, attrs: &str) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec_string_string(); let err = _issuer_create_schema(command_handle, issuer_did, name, version, attrs, cb); @@ -110,7 +110,7 @@ fn _issuer_create_schema(command_handle: CommandHandle, issuer_did: &str, name: /// Note: `primary` and `revocation` fields of credential definition are complex opaque types that contain data structures internal to Ursa. /// They should not be parsed and are likely to change in future versions. /// -pub fn issuer_create_and_store_credential_def(wallet_handle: WalletHandle, issuer_did: &str, schema_json: &str, tag: &str, signature_type: Option<&str>, config_json: &str) -> Box> { +pub fn issuer_create_and_store_credential_def(wallet_handle: WalletHandle, issuer_did: &str, schema_json: &str, tag: &str, signature_type: Option<&str>, config_json: &str) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec_string_string(); let err = _issuer_create_and_store_credential_def(command_handle, wallet_handle, issuer_did, schema_json, tag, signature_type, config_json, cb); @@ -152,7 +152,7 @@ fn _issuer_create_and_store_credential_def(command_handle: CommandHandle, wallet /// /// # Returns /// * `cred_def_json`: public part of temporary created credential definition -pub fn issuer_rotate_credential_def_start(wallet_handle: WalletHandle, cred_def_id: &str, config_json: Option<&str>) -> Box> { +pub fn issuer_rotate_credential_def_start(wallet_handle: WalletHandle, cred_def_id: &str, config_json: Option<&str>) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec_string(); let err = _issuer_rotate_credential_def_start(command_handle, wallet_handle, cred_def_id, config_json, cb); @@ -182,7 +182,7 @@ fn _issuer_rotate_credential_def_start(command_handle: CommandHandle, wallet_han /// * `cred_def_id`: an identifier of created credential definition stored in the wallet /// /// # Returns -pub fn issuer_rotate_credential_def_apply(wallet_handle: WalletHandle, cred_def_id: &str) -> Box> { +pub fn issuer_rotate_credential_def_apply(wallet_handle: WalletHandle, cred_def_id: &str) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec(); let err = _issuer_rotate_credential_def_apply(command_handle, wallet_handle, cred_def_id, cb); @@ -277,7 +277,7 @@ pub fn issuer_create_and_store_revoc_reg(wallet_handle: WalletHandle, tag: &str, cred_def_id: &str, config_json: &str, - tails_writer_handle: TailsWriterHandle) -> Box> { + tails_writer_handle: TailsWriterHandle) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec_string_string_string(); let err = _issuer_create_and_store_revoc_reg(command_handle, wallet_handle, issuer_did, revoc_def_type, tag, cred_def_id, config_json, tails_writer_handle, cb); @@ -315,7 +315,7 @@ fn _issuer_create_and_store_revoc_reg(command_handle: CommandHandle, wallet_hand /// (opaque type that contains data structures internal to Ursa. /// It should not be parsed and are likely to change in future versions). /// } -pub fn issuer_create_credential_offer(wallet_handle: WalletHandle, cred_def_id: &str) -> Box> { +pub fn issuer_create_credential_offer(wallet_handle: WalletHandle, cred_def_id: &str) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec_string(); let err = _issuer_create_credential_offer(command_handle, wallet_handle, cred_def_id, cb); @@ -377,7 +377,7 @@ pub fn issuer_create_credential(wallet_handle: WalletHandle, cred_req_json: &str, cred_values_json: &str, rev_reg_id: Option<&str>, - blob_storage_reader_handle: BlobStorageReaderHandle) -> Box, Option), Error=IndyError>> { + blob_storage_reader_handle: BlobStorageReaderHandle) -> Box, Option), Error=IndyError>> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec_string_opt_string_opt_string(); let err = _issuer_create_credential(command_handle, wallet_handle, cred_offer_json, cred_req_json, cred_values_json, rev_reg_id, blob_storage_reader_handle, cb); @@ -421,7 +421,7 @@ fn _issuer_create_credential( /// /// # Returns /// * `revoc_reg_delta_json`: Revocation registry delta json with a revoked credential -pub fn issuer_revoke_credential(wallet_handle: WalletHandle, blob_storage_reader_cfg_handle: BlobStorageReaderCfgHandle, rev_reg_id: &str, cred_revoc_id: &str) -> Box> { +pub fn issuer_revoke_credential(wallet_handle: WalletHandle, blob_storage_reader_cfg_handle: BlobStorageReaderCfgHandle, rev_reg_id: &str, cred_revoc_id: &str) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec_string(); let err = _issuer_revoke_credential(command_handle, wallet_handle, blob_storage_reader_cfg_handle, rev_reg_id, cred_revoc_id, cb); @@ -452,7 +452,7 @@ fn _issuer_revoke_credential(command_handle: CommandHandle, /// /// # Returns /// * `merged_rev_reg_delta` - Merged revocation registry delta -pub fn issuer_merge_revocation_registry_deltas(rev_reg_delta_json: &str, other_rev_reg_delta_json: &str) -> Box> { +pub fn issuer_merge_revocation_registry_deltas(rev_reg_delta_json: &str, other_rev_reg_delta_json: &str) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec_string(); let err = _issuer_merge_revocation_registry_deltas(command_handle, rev_reg_delta_json, other_rev_reg_delta_json, cb); @@ -479,7 +479,7 @@ fn _issuer_merge_revocation_registry_deltas(command_handle: CommandHandle, rev_r /// /// # Returns /// * `out_master_secret_id` - Id of generated master secret -pub fn prover_create_master_secret(wallet_handle: WalletHandle, master_secret_id: Option<&str>) -> Box> { +pub fn prover_create_master_secret(wallet_handle: WalletHandle, master_secret_id: Option<&str>) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec_string(); let err = _prover_create_master_secret(command_handle, wallet_handle, master_secret_id, cb); @@ -510,7 +510,7 @@ fn _prover_create_master_secret(command_handle: CommandHandle, wallet_handle: Wa /// "rev_reg_id": Optional, /// "cred_rev_id": Optional /// } -pub fn prover_get_credential(wallet_handle: WalletHandle, cred_id: &str) -> Box> { +pub fn prover_get_credential(wallet_handle: WalletHandle, cred_id: &str) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec_string(); let err = _prover_get_credential(command_handle, wallet_handle, cred_id, cb); @@ -531,7 +531,7 @@ fn _prover_get_credential(command_handle: CommandHandle, wallet_handle: WalletHa /// # Arguments /// * `wallet_handle`: wallet handle (created by Wallet::open_wallet). /// * `cred_id`: Identifier by which requested credential is stored in the wallet -pub fn prover_delete_credential(wallet_handle: WalletHandle, cred_id: &str) -> Box> { +pub fn prover_delete_credential(wallet_handle: WalletHandle, cred_id: &str) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec(); let err = _prover_delete_credential(command_handle, wallet_handle, cred_id, cb); @@ -576,7 +576,7 @@ fn _prover_delete_credential(command_handle: CommandHandle, wallet_handle: Walle /// } /// * `cred_req_metadata_json`: Credential request metadata json for further processing of received form Issuer credential. /// Note: cred_req_metadata_json mustn't be shared with Issuer. -pub fn prover_create_credential_req(wallet_handle: WalletHandle, prover_did: &str, cred_offer_json: &str, cred_def_json: &str, master_secret_id: &str) -> Box> { +pub fn prover_create_credential_req(wallet_handle: WalletHandle, prover_did: &str, cred_offer_json: &str, cred_def_json: &str, master_secret_id: &str) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec_string_string(); let err = _prover_create_credential_req(command_handle, wallet_handle, prover_did, cred_offer_json, cred_def_json, master_secret_id, cb); @@ -623,7 +623,7 @@ fn _prover_create_credential_req(command_handle: CommandHandle, wallet_handle: W /// cred_def_id: credential definition id /// tag_attrs_json: JSON array with names of attributes to tag by policy, or null for all /// retroactive: boolean, whether to apply policy to existing credentials on credential definition identifier -pub fn prover_set_credential_attr_tag_policy(wallet_handle: WalletHandle, cred_def_id: &str, tag_attrs_json: Option<&str>, retroactive: bool) -> Box> { +pub fn prover_set_credential_attr_tag_policy(wallet_handle: WalletHandle, cred_def_id: &str, tag_attrs_json: Option<&str>, retroactive: bool) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec(); let err = _prover_set_credential_attr_tag_policy(command_handle, wallet_handle, cred_def_id, tag_attrs_json, retroactive, cb); @@ -649,7 +649,7 @@ fn _prover_set_credential_attr_tag_policy(command_handle: CommandHandle, wallet_ /// # Returns /// JSON array with all attributes that current policy marks taggable; /// null for default policy (tag all credential attributes). -pub fn prover_get_credential_attr_tag_policy(wallet_handle: WalletHandle, cred_id: &str) -> Box> { +pub fn prover_get_credential_attr_tag_policy(wallet_handle: WalletHandle, cred_id: &str) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec_string(); let err = _prover_get_credential_attr_tag_policy(command_handle, wallet_handle, cred_id, cb); @@ -692,7 +692,7 @@ fn _prover_get_credential_attr_tag_policy(command_handle: CommandHandle, wallet_ /// /// # Returns /// * `out_cred_id` - identifier by which credential is stored in the wallet -pub fn prover_store_credential(wallet_handle: WalletHandle, cred_id: Option<&str>, cred_req_metadata_json: &str, cred_json: &str, cred_def_json: &str, rev_reg_def_json: Option<&str>) -> Box> { +pub fn prover_store_credential(wallet_handle: WalletHandle, cred_id: Option<&str>, cred_req_metadata_json: &str, cred_json: &str, cred_def_json: &str, rev_reg_def_json: Option<&str>) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec_string(); let err = _prover_store_credential(command_handle, wallet_handle, cred_id, cred_req_metadata_json, cred_json, cred_def_json, rev_reg_def_json, cb); @@ -736,7 +736,7 @@ fn _prover_store_credential(command_handle: CommandHandle, wallet_handle: Wallet /// "rev_reg_id": Optional, /// "cred_rev_id": Optional /// }] -pub fn prover_get_credentials(wallet_handle: WalletHandle, filter_json: Option<&str>) -> Box> { +pub fn prover_get_credentials(wallet_handle: WalletHandle, filter_json: Option<&str>) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec_string(); let err = _prover_get_credentials(command_handle, wallet_handle, filter_json, cb); @@ -767,7 +767,7 @@ fn _prover_get_credentials(command_handle: CommandHandle, wallet_handle: WalletH /// # Returns /// * `search_handle`: Search handle that can be used later to fetch records by small batches (with fetch_credentials) /// * `total_count`: Total count of records -pub fn prover_search_credentials(wallet_handle: WalletHandle, query_json: Option<&str>) -> Box> { +pub fn prover_search_credentials(wallet_handle: WalletHandle, query_json: Option<&str>) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec_handle_usize(); let err = _prover_search_credentials(command_handle, wallet_handle, query_json, cb); @@ -799,7 +799,7 @@ fn _prover_search_credentials(command_handle: CommandHandle, wallet_handle: Wall /// "rev_reg_id": Optional, /// "cred_rev_id": Optional /// }] -pub fn prover_fetch_credentials(search_handle: SearchHandle, count: usize) -> Box> { +pub fn prover_fetch_credentials(search_handle: SearchHandle, count: usize) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec_string(); let err = _prover_fetch_credentials(command_handle, search_handle, count, cb); @@ -817,7 +817,7 @@ fn _prover_fetch_credentials(command_handle: CommandHandle, search_handle: Searc /// /// # Arguments /// * `search_handle`: Search handle (created by search_credentials) -pub fn prover_close_credentials_search(search_handle: SearchHandle) -> Box> { +pub fn prover_close_credentials_search(search_handle: SearchHandle) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec(); let err = _prover_close_credentials_search(command_handle, search_handle, cb); @@ -906,7 +906,7 @@ fn _prover_close_credentials_search(command_handle: CommandHandle, search_handle /// "rev_reg_id": Optional, /// "cred_rev_id": Optional, /// } -pub fn prover_get_credentials_for_proof_req(wallet_handle: WalletHandle, proof_request_json: &str) -> Box> { +pub fn prover_get_credentials_for_proof_req(wallet_handle: WalletHandle, proof_request_json: &str) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec_string(); let err = _prover_get_credentials_for_proof_req(command_handle, wallet_handle, proof_request_json, cb); @@ -988,7 +988,7 @@ fn _prover_get_credentials_for_proof_req(command_handle: CommandHandle, wallet_h /// * `search_handle`: Search handle that can be used later to fetch records by small batches (with fetch_credentials_for_proof_req) pub fn prover_search_credentials_for_proof_req(wallet_handle: WalletHandle, proof_request_json: &str, - extra_query_json: Option<&str>) -> Box> { + extra_query_json: Option<&str>) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec_handle(); let err = _prover_search_credentials_for_proof_req(command_handle, wallet_handle, proof_request_json, extra_query_json, cb); @@ -1039,7 +1039,7 @@ fn _prover_search_credentials_for_proof_req(command_handle: CommandHandle, /// } /// NOTE: The list of length less than the requested count means that search iterator /// correspondent to the requested is completed. -pub fn prover_fetch_credentials_for_proof_req(search_handle: SearchHandle, item_referent: &str, count: usize) -> Box> { +pub fn prover_fetch_credentials_for_proof_req(search_handle: SearchHandle, item_referent: &str, count: usize) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec_string(); let err = _prover_fetch_credentials_for_proof_req(command_handle, search_handle, item_referent, count, cb); @@ -1059,7 +1059,7 @@ fn _prover_fetch_credentials_for_proof_req(command_handle: CommandHandle, search /// /// # Arguments /// * `search_handle`: Search handle (created by search_credentials_for_proof_req) -pub fn prover_close_credentials_search_for_proof_req(search_handle: SearchHandle) -> Box> { +pub fn prover_close_credentials_search_for_proof_req(search_handle: SearchHandle) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec(); let err = _prover_close_credentials_search_for_proof_req(command_handle, search_handle, cb); @@ -1201,7 +1201,7 @@ fn _prover_close_credentials_search_for_proof_req(command_handle: CommandHandle, /// It should not be parsed and are likely to change in future versions). /// "identifiers": [{schema_id, cred_def_id, Optional, Optional}] /// } -pub fn prover_create_proof(wallet_handle: WalletHandle, proof_req_json: &str, requested_credentials_json: &str, master_secret_id: &str, schemas_json: &str, credential_defs_json: &str, rev_states_json: &str) -> Box> { +pub fn prover_create_proof(wallet_handle: WalletHandle, proof_req_json: &str, requested_credentials_json: &str, master_secret_id: &str, schemas_json: &str, credential_defs_json: &str, rev_states_json: &str) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec_string(); let err = _prover_create_proof(command_handle, wallet_handle, proof_req_json, requested_credentials_json, master_secret_id, schemas_json, credential_defs_json, rev_states_json, cb); @@ -1304,7 +1304,7 @@ fn _prover_create_proof(command_handle: CommandHandle, wallet_handle: WalletHand /// /// # Returns /// * `valid`: true - if signature is valid, false - otherwise -pub fn verifier_verify_proof(proof_request_json: &str, proof_json: &str, schemas_json: &str, credential_defs_json: &str, rev_reg_defs_json: &str, rev_regs_json: &str) -> Box> { +pub fn verifier_verify_proof(proof_request_json: &str, proof_json: &str, schemas_json: &str, credential_defs_json: &str, rev_reg_defs_json: &str, rev_regs_json: &str) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec_bool(); let err = _verifier_verify_proof(command_handle, proof_request_json, proof_json, schemas_json, credential_defs_json, rev_reg_defs_json, rev_regs_json, cb); @@ -1343,7 +1343,7 @@ fn _verifier_verify_proof(command_handle: CommandHandle, proof_request_json: &st /// It should not be parsed and are likely to change in future versions). /// "timestamp" : integer /// } -pub fn create_revocation_state(blob_storage_reader_handle: BlobStorageReaderHandle, rev_reg_def_json: &str, rev_reg_delta_json: &str, timestamp: u64, cred_rev_id: &str) -> Box> { +pub fn create_revocation_state(blob_storage_reader_handle: BlobStorageReaderHandle, rev_reg_def_json: &str, rev_reg_delta_json: &str, timestamp: u64, cred_rev_id: &str) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec_string(); let err = _create_revocation_state(command_handle, blob_storage_reader_handle, rev_reg_def_json, rev_reg_delta_json, timestamp, cred_rev_id, cb); @@ -1380,7 +1380,7 @@ fn _create_revocation_state(command_handle: CommandHandle, blob_storage_reader_h /// It should not be parsed and are likely to change in future versions). /// "timestamp" : integer /// } -pub fn update_revocation_state(blob_storage_reader_handle: BlobStorageReaderHandle, rev_state_json: &str, rev_reg_def_json: &str, rev_reg_delta_json: &str, timestamp: u64, cred_rev_id: &str) -> Box> { +pub fn update_revocation_state(blob_storage_reader_handle: BlobStorageReaderHandle, rev_state_json: &str, rev_reg_def_json: &str, rev_reg_delta_json: &str, timestamp: u64, cred_rev_id: &str) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec_string(); let err = _update_revocation_state(command_handle, blob_storage_reader_handle, rev_state_json, rev_reg_def_json, rev_reg_delta_json, timestamp, cred_rev_id, cb); @@ -1411,7 +1411,7 @@ fn _update_revocation_state(command_handle: CommandHandle, blob_storage_reader_h /// /// # Returns /// * `nonce`: generated number as a string -pub fn generate_nonce() -> Box> { +pub fn generate_nonce() -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec_string(); let err = _generate_nonce(command_handle, cb); diff --git a/wrappers/rust/src/blob_storage.rs b/wrappers/rust/src/blob_storage.rs index 14f52035d2..e1cee553b7 100644 --- a/wrappers/rust/src/blob_storage.rs +++ b/wrappers/rust/src/blob_storage.rs @@ -10,7 +10,7 @@ use ffi::ResponseI32CB; use utils::callbacks::{ClosureHandler, ResultHandler}; use {IndyHandle, CommandHandle}; -pub fn open_reader(xtype: &str, config_json: &str) -> Box> { +pub fn open_reader(xtype: &str, config_json: &str) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec_handle(); let err = _open_reader(command_handle, xtype, config_json, cb); @@ -25,7 +25,7 @@ fn _open_reader(command_handle: CommandHandle, xtype: &str, config_json: &str, c ErrorCode::from(unsafe { blob_storage::indy_open_blob_storage_reader(command_handle, xtype.as_ptr(), config_json.as_ptr(), cb) }) } -pub fn open_writer(xtype: &str, config_json: &str) -> Box> { +pub fn open_writer(xtype: &str, config_json: &str) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec_handle(); let err = _open_writer(command_handle, xtype, config_json, cb); diff --git a/wrappers/rust/src/cache.rs b/wrappers/rust/src/cache.rs index 97b8bf16e3..5f4f019896 100644 --- a/wrappers/rust/src/cache.rs +++ b/wrappers/rust/src/cache.rs @@ -41,7 +41,7 @@ pub fn get_schema(pool_handle: PoolHandle, wallet_handle: WalletHandle, submitter_did: &str, id: &str, - options_json: &str) -> Box> { + options_json: &str) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec_string(); let err = _get_schema(command_handle, pool_handle, wallet_handle, submitter_did, id, options_json, cb); @@ -102,7 +102,7 @@ pub fn get_cred_def(pool_handle: PoolHandle, wallet_handle: WalletHandle, submitter_did: &str, id: &str, - options_json: &str) -> Box> { + options_json: &str) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec_string(); let err = _get_cred_def(command_handle, pool_handle, wallet_handle, submitter_did, id, options_json, cb); @@ -139,7 +139,7 @@ pub fn _get_cred_def(command_handle: CommandHandle, /// { /// maxAge: (int, optional, -1 by default) Purge cached data if older than this many seconds. -1 means purge all. /// } -pub fn purge_schema_cache(wallet_handle: WalletHandle, options_json: &str) -> Box> { +pub fn purge_schema_cache(wallet_handle: WalletHandle, options_json: &str) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec(); let err = _purge_schema_cache(command_handle, wallet_handle, options_json, cb); @@ -164,7 +164,7 @@ fn _purge_schema_cache(command_handle: CommandHandle, wallet_handle: WalletHandl /// { /// maxAge: (int, optional, -1 by default) Purge cached data if older than this many seconds. -1 means purge all. /// } -pub fn purge_cred_def_cache(wallet_handle: WalletHandle, options_json: &str) -> Box> { +pub fn purge_cred_def_cache(wallet_handle: WalletHandle, options_json: &str) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec(); let err = _purge_cred_def_cache(command_handle, wallet_handle, options_json, cb); diff --git a/wrappers/rust/src/crypto.rs b/wrappers/rust/src/crypto.rs index dc164c9c5d..1fb9901bb2 100644 --- a/wrappers/rust/src/crypto.rs +++ b/wrappers/rust/src/crypto.rs @@ -28,7 +28,7 @@ use {WalletHandle, CommandHandle}; /// } /// # Returns /// verkey of generated key pair, also used as key identifier -pub fn create_key(wallet_handle: WalletHandle, my_key_json: Option<&str>) -> Box> { +pub fn create_key(wallet_handle: WalletHandle, my_key_json: Option<&str>) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec_string(); let err = _create_key(command_handle, wallet_handle, my_key_json, cb); @@ -47,7 +47,7 @@ fn _create_key(command_handle: CommandHandle, wallet_handle: WalletHandle, my_ke /// * `wallet_handle` - wallet handle (created by Wallet::open) /// * `verkey` - the public key or key id where to store the metadata /// * `metadata` - the metadata that will be stored with the key, can be empty string -pub fn set_key_metadata(wallet_handle: WalletHandle, verkey: &str, metadata: &str) -> Box> { +pub fn set_key_metadata(wallet_handle: WalletHandle, verkey: &str, metadata: &str) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec(); let err = _set_key_metadata(command_handle, wallet_handle, verkey, metadata, cb); @@ -68,7 +68,7 @@ fn _set_key_metadata(command_handle: CommandHandle, wallet_handle: WalletHandle, /// * `verkey` - the public key or key id to retrieve metadata /// # Returns /// metadata currently stored with the key; Can be empty if no metadata was saved for this key -pub fn get_key_metadata(wallet_handle: WalletHandle, verkey: &str) -> Box> { +pub fn get_key_metadata(wallet_handle: WalletHandle, verkey: &str) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec_string(); let err = _get_key_metadata(command_handle, wallet_handle, verkey, cb); @@ -89,7 +89,7 @@ fn _get_key_metadata(command_handle: CommandHandle, wallet_handle: WalletHandle, /// * `message` - the data to be signed /// # Returns /// the signature -pub fn sign(wallet_handle: WalletHandle, signer_vk: &str, message: &[u8]) -> Box, Error=IndyError>> { +pub fn sign(wallet_handle: WalletHandle, signer_vk: &str, message: &[u8]) -> Box, Error=IndyError>> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec_slice(); let err = _sign(command_handle, wallet_handle, signer_vk, message, cb); @@ -115,7 +115,7 @@ fn _sign(command_handle: CommandHandle, wallet_handle: WalletHandle, signer_vk: /// * `signature` - the signature to verify /// # Returns /// true if signature is valid, false otherwise -pub fn verify(signer_vk: &str, message: &[u8], signature: &[u8]) -> Box> { +pub fn verify(signer_vk: &str, message: &[u8], signature: &[u8]) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec_bool(); let err = _verify(command_handle, signer_vk, message, signature, cb); @@ -151,7 +151,7 @@ fn _verify(command_handle: CommandHandle, signer_vk: &str, message: &[u8], signa /// * `message` - the data to be encrypted /// # Returns /// the encrypted message -pub fn auth_crypt(wallet_handle: WalletHandle, sender_vk: &str, recipient_vk: &str, message: &[u8]) -> Box, Error=IndyError>> { +pub fn auth_crypt(wallet_handle: WalletHandle, sender_vk: &str, recipient_vk: &str, message: &[u8]) -> Box, Error=IndyError>> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec_slice(); let err = _auth_crypt(command_handle, wallet_handle, sender_vk, recipient_vk, message, cb); @@ -189,7 +189,7 @@ fn _auth_crypt(command_handle: CommandHandle, wallet_handle: WalletHandle, sende /// * `encrypted_message`: the message to be decrypted /// # Returns /// sender's verkey and decrypted message -pub fn auth_decrypt(wallet_handle: WalletHandle, recipient_vk: &str, encrypted_message: &[u8]) -> Box), Error=IndyError>> { +pub fn auth_decrypt(wallet_handle: WalletHandle, recipient_vk: &str, encrypted_message: &[u8]) -> Box), Error=IndyError>> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec_string_slice(); let err = _auth_decrypt(command_handle, wallet_handle, recipient_vk, encrypted_message, cb); @@ -226,7 +226,7 @@ fn _auth_decrypt(command_handle: CommandHandle, wallet_handle: WalletHandle, rec /// /// # Returns /// the encrypted message -pub fn anon_crypt(recipient_vk: &str, message: &[u8]) -> Box, Error=IndyError>> { +pub fn anon_crypt(recipient_vk: &str, message: &[u8]) -> Box, Error=IndyError>> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec_slice(); let err = _anon_crypt(command_handle, recipient_vk, message, cb); @@ -263,7 +263,7 @@ fn _anon_crypt(command_handle: CommandHandle, recipient_vk: &str, message: &[u8] /// /// # Returns /// decrypted message -pub fn anon_decrypt(wallet_handle: WalletHandle, recipient_vk: &str, encrypted_message: &[u8]) -> Box, Error=IndyError>> { +pub fn anon_decrypt(wallet_handle: WalletHandle, recipient_vk: &str, encrypted_message: &[u8]) -> Box, Error=IndyError>> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec_slice(); let err = _anon_decrypt(command_handle, wallet_handle, recipient_vk, encrypted_message, cb); @@ -293,7 +293,7 @@ fn _anon_decrypt(command_handle: CommandHandle, wallet_handle: WalletHandle, rec /// * `sender` : a string of the sender's verkey When None is used in this parameter, anoncrypt is used /// # Returns /// a json structure in the form of a JWE that contains the encrypted message and associated metadata -pub fn pack_message(wallet_handle: WalletHandle, message: &[u8], receiver_keys: &str, sender: Option<&str>) -> Box, Error=IndyError>> { +pub fn pack_message(wallet_handle: WalletHandle, message: &[u8], receiver_keys: &str, sender: Option<&str>) -> Box, Error=IndyError>> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec_slice(); let err= _pack_message(command_handle, wallet_handle, message, receiver_keys, sender, cb); @@ -326,7 +326,7 @@ fn _pack_message(command_handle: CommandHandle, wallet_handle: WalletHandle, mes /// * `jwe`: a pointer to the first byte of the JWE string /// # Returns /// a json structure that contains a decrypted message and a sender_verkey if packed with authcrypt -pub fn unpack_message(wallet_handle: WalletHandle, jwe: &[u8]) -> Box, Error=IndyError>> { +pub fn unpack_message(wallet_handle: WalletHandle, jwe: &[u8]) -> Box, Error=IndyError>> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec_slice(); let err= _unpack_message(command_handle, wallet_handle, jwe, cb); diff --git a/wrappers/rust/src/did.rs b/wrappers/rust/src/did.rs index 992c5c20f8..b8ba8800d9 100644 --- a/wrappers/rust/src/did.rs +++ b/wrappers/rust/src/did.rs @@ -39,7 +39,7 @@ use {CommandHandle, WalletHandle, PoolHandle}; /// # Returns /// * `did` - DID generated and stored in the wallet /// * `verkey` - The DIDs verification key -pub fn create_and_store_my_did(wallet_handle: WalletHandle, did_json: &str) -> Box> { +pub fn create_and_store_my_did(wallet_handle: WalletHandle, did_json: &str) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec_string_string(); let err = _create_and_store_my_did(command_handle, wallet_handle, did_json, cb); @@ -71,7 +71,7 @@ fn _create_and_store_my_did(command_handle: CommandHandle, wallet_handle: Wallet /// /// # Returns /// * `verkey` - The DIDs verification key -pub fn replace_keys_start(wallet_handle: WalletHandle, tgt_did: &str, identity_json: &str) -> Box> { +pub fn replace_keys_start(wallet_handle: WalletHandle, tgt_did: &str, identity_json: &str) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec_string(); let err = _replace_keys_start(command_handle, wallet_handle, tgt_did, identity_json, cb); @@ -91,7 +91,7 @@ fn _replace_keys_start(command_handle: CommandHandle, wallet_handle: WalletHandl /// # Arguments /// * `wallet_handle` - wallet handler (created by Wallet::open). /// * `tgt_did` - DID stored in the wallet -pub fn replace_keys_apply(wallet_handle: WalletHandle, tgt_did: &str) -> Box> { +pub fn replace_keys_apply(wallet_handle: WalletHandle, tgt_did: &str) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec(); let err = _replace_keys_apply(command_handle, wallet_handle, tgt_did, cb); @@ -117,7 +117,7 @@ fn _replace_keys_apply(command_handle: CommandHandle, wallet_handle: WalletHandl /// "did": string, (required) /// "verkey": string (optional, can be avoided if did is cryptonym: did == verkey), /// } -pub fn store_their_did(wallet_handle: WalletHandle, identity_json: &str) -> Box> { +pub fn store_their_did(wallet_handle: WalletHandle, identity_json: &str) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec(); let err = _store_their_did(command_handle, wallet_handle, identity_json, cb); @@ -151,7 +151,7 @@ fn _store_their_did(command_handle: CommandHandle, wallet_handle: WalletHandle, /// /// # Returns /// * `key` - The DIDs ver key (key id). -pub fn key_for_did(pool_handle: PoolHandle, wallet_handle: WalletHandle, did: &str) -> Box> { +pub fn key_for_did(pool_handle: PoolHandle, wallet_handle: WalletHandle, did: &str) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec_string(); let err = _key_for_did(command_handle, pool_handle, wallet_handle, did, cb); @@ -182,7 +182,7 @@ fn _key_for_did(command_handle: CommandHandle, pool_handle: PoolHandle, wallet_h /// /// # Returns /// * `key` - The DIDs ver key (key id). -pub fn key_for_local_did(wallet_handle: WalletHandle, did: &str) -> Box> { +pub fn key_for_local_did(wallet_handle: WalletHandle, did: &str) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec_string(); let err = _key_for_local_did(command_handle, wallet_handle, did, cb); @@ -203,7 +203,7 @@ fn _key_for_local_did(command_handle: CommandHandle, wallet_handle: WalletHandle /// * `did` - The DID to resolve endpoint. /// * `address` - The DIDs endpoint address. /// * `transport_key` - The DIDs transport key (ver key, key id). -pub fn set_endpoint_for_did(wallet_handle: WalletHandle, did: &str, address: &str, transport_key: &str) -> Box> { +pub fn set_endpoint_for_did(wallet_handle: WalletHandle, did: &str, address: &str, transport_key: &str) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec(); let err = _set_endpoint_for_did(command_handle, wallet_handle, did, address, transport_key, cb); @@ -228,7 +228,7 @@ fn _set_endpoint_for_did(command_handle: CommandHandle, wallet_handle: WalletHan /// # Returns /// * `endpoint` - The DIDs endpoint. /// * `transport_vk` - The DIDs transport key (ver key, key id). -pub fn get_endpoint_for_did(wallet_handle: WalletHandle, pool_handle: PoolHandle, did: &str) -> Box), Error=IndyError>> { +pub fn get_endpoint_for_did(wallet_handle: WalletHandle, pool_handle: PoolHandle, did: &str) -> Box), Error=IndyError>> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec_string_opt_string(); let err = _get_endpoint_for_did(command_handle, wallet_handle, pool_handle, did, cb); @@ -248,7 +248,7 @@ fn _get_endpoint_for_did(command_handle: CommandHandle, wallet_handle: WalletHan /// * `wallet_handle` - Wallet handle (created by Wallet::open). /// * `did` - the DID to store metadata. /// * `metadata` - the meta information that will be store with the DID. -pub fn set_did_metadata(wallet_handle: WalletHandle, tgt_did: &str, metadata: &str) -> Box> { +pub fn set_did_metadata(wallet_handle: WalletHandle, tgt_did: &str, metadata: &str) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec(); let err = _set_did_metadata(command_handle, wallet_handle, tgt_did, metadata, cb); @@ -271,7 +271,7 @@ fn _set_did_metadata(command_handle: CommandHandle, wallet_handle: WalletHandle, /// /// #Returns /// * `metadata` - The meta information stored with the DID; Can be null if no metadata was saved for this DID. -pub fn get_did_metadata(wallet_handle: WalletHandle, tgt_did: &str) -> Box> { +pub fn get_did_metadata(wallet_handle: WalletHandle, tgt_did: &str) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec_string(); let err = _get_did_metadata(command_handle, wallet_handle, tgt_did, cb); @@ -297,7 +297,7 @@ fn _get_did_metadata(command_handle: CommandHandle, wallet_handle: WalletHandle, /// "verkey": string - The DIDs transport key (ver key, key id), /// "metadata": string - The meta information stored with the DID /// } -pub fn get_my_did_with_metadata(wallet_handle: WalletHandle, my_did: &str) -> Box> { +pub fn get_my_did_with_metadata(wallet_handle: WalletHandle, my_did: &str) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec_string(); let err = _get_my_did_with_metadata(command_handle, wallet_handle, my_did, cb); @@ -323,7 +323,7 @@ fn _get_my_did_with_metadata(command_handle: CommandHandle, wallet_handle: Walle /// "tempVerkey": string - Temporary DIDs transport key (will be active after key rotation). /// "metadata": string - The meta information stored with the DID /// }] -pub fn list_my_dids_with_metadata(wallet_handle: WalletHandle) -> Box> { +pub fn list_my_dids_with_metadata(wallet_handle: WalletHandle) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec_string(); let err = _list_my_dids_with_metadata(command_handle, wallet_handle, cb); @@ -343,7 +343,7 @@ fn _list_my_dids_with_metadata(command_handle: CommandHandle, wallet_handle: Wal /// /// #Returns /// * `verkey` - The DIDs verification key in either abbreviated or full form -pub fn abbreviate_verkey(tgt_did: &str, verkey: &str) -> Box> { +pub fn abbreviate_verkey(tgt_did: &str, verkey: &str) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec_string(); let err = _abbreviate_verkey(command_handle, tgt_did, verkey, cb); diff --git a/wrappers/rust/src/ledger.rs b/wrappers/rust/src/ledger.rs index 0f08958bf2..99761575bb 100644 --- a/wrappers/rust/src/ledger.rs +++ b/wrappers/rust/src/ledger.rs @@ -27,7 +27,7 @@ use {WalletHandle, CommandHandle, PoolHandle}; /// /// # Returns /// Request result as json. -pub fn sign_and_submit_request(pool_handle: PoolHandle, wallet_handle: WalletHandle, submitter_did: &str, request_json: &str) -> Box> { +pub fn sign_and_submit_request(pool_handle: PoolHandle, wallet_handle: WalletHandle, submitter_did: &str, request_json: &str) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec_string(); let err = _sign_and_submit_request(command_handle, pool_handle, wallet_handle, submitter_did, request_json, cb); @@ -59,7 +59,7 @@ fn _sign_and_submit_request(command_handle: CommandHandle, pool_handle: PoolHand /// /// # Returns /// Request result as json. -pub fn submit_request(pool_handle: PoolHandle, request_json: &str) -> Box> { +pub fn submit_request(pool_handle: PoolHandle, request_json: &str) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec_string(); let err = _submit_request(command_handle, pool_handle, request_json, cb); @@ -73,7 +73,7 @@ fn _submit_request(command_handle: CommandHandle, pool_handle: PoolHandle, reque ErrorCode::from(unsafe { ledger::indy_submit_request(command_handle, pool_handle, request_json.as_ptr(), cb) }) } -pub fn submit_action(pool_handle: PoolHandle, request_json: &str, nodes: Option<&str>, wait_timeout: Option) -> Box> { +pub fn submit_action(pool_handle: PoolHandle, request_json: &str, nodes: Option<&str>, wait_timeout: Option) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec_string(); let err = _submit_action(command_handle, pool_handle, request_json, nodes, wait_timeout, cb); @@ -102,7 +102,7 @@ fn _submit_action(command_handle: CommandHandle, pool_handle: PoolHandle, reques /// /// # Returns /// Signed request json. -pub fn sign_request(wallet_handle: WalletHandle, submitter_did: &str, request_json: &str) -> Box> { +pub fn sign_request(wallet_handle: WalletHandle, submitter_did: &str, request_json: &str) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec_string(); let err = _sign_request(command_handle, wallet_handle, submitter_did, request_json, cb); @@ -129,7 +129,7 @@ fn _sign_request(command_handle: CommandHandle, wallet_handle: WalletHandle, sub /// /// # Returns /// Signed request json. -pub fn multi_sign_request(wallet_handle: WalletHandle, submitter_did: &str, request_json: &str) -> Box> { +pub fn multi_sign_request(wallet_handle: WalletHandle, submitter_did: &str, request_json: &str) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec_string(); let err = _multi_sign_request(command_handle, wallet_handle, submitter_did, request_json, cb); @@ -152,7 +152,7 @@ fn _multi_sign_request(command_handle: CommandHandle, wallet_handle: WalletHandl /// /// # Returns /// Request result as json. -pub fn build_get_ddo_request(submitter_did: Option<&str>, target_did: &str) -> Box> { +pub fn build_get_ddo_request(submitter_did: Option<&str>, target_did: &str) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec_string(); let err = _build_get_ddo_request(command_handle, submitter_did, target_did, cb); @@ -186,7 +186,7 @@ fn _build_get_ddo_request(command_handle: CommandHandle, submitter_did: Option<& /// /// # Returns /// Request result as json. -pub fn build_nym_request(submitter_did: &str, target_did: &str, verkey: Option<&str>, data: Option<&str>, role: Option<&str>) -> Box> { +pub fn build_nym_request(submitter_did: &str, target_did: &str, verkey: Option<&str>, data: Option<&str>, role: Option<&str>) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec_string(); let err = _build_nym_request(command_handle, submitter_did, target_did, verkey, data, role, cb); @@ -227,7 +227,7 @@ fn _build_nym_request(command_handle: CommandHandle, /// /// # Returns /// Request result as json. -pub fn build_get_nym_request(submitter_did: Option<&str>, target_did: &str) -> Box> { +pub fn build_get_nym_request(submitter_did: Option<&str>, target_did: &str) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec_string(); let err = _build_get_nym_request(command_handle, submitter_did, target_did, cb); @@ -254,7 +254,7 @@ fn _build_get_nym_request(command_handle: CommandHandle, submitter_did: Option<& /// /// # Returns /// Request result as json. -pub fn build_get_txn_request(submitter_did: Option<&str>, ledger_type: Option<&str>, seq_no: i32) -> Box> { +pub fn build_get_txn_request(submitter_did: Option<&str>, ledger_type: Option<&str>, seq_no: i32) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec_string(); let err = _build_get_txn_request(command_handle, submitter_did, ledger_type, seq_no, cb); @@ -281,7 +281,7 @@ fn _build_get_txn_request(command_handle: CommandHandle, submitter_did: Option<& /// /// # Returns /// Request result as json. -pub fn build_attrib_request(submitter_did: &str, target_did: &str, hash: Option<&str>, raw: Option<&str>, enc: Option<&str>) -> Box> { +pub fn build_attrib_request(submitter_did: &str, target_did: &str, hash: Option<&str>, raw: Option<&str>, enc: Option<&str>) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec_string(); let err = _build_attrib_request(command_handle, submitter_did, target_did, hash, raw, enc, cb); @@ -319,7 +319,7 @@ fn _build_attrib_request(command_handle: CommandHandle, submitter_did: &str, tar /// /// # Returns /// Request result as json. -pub fn build_get_attrib_request(submitter_did: Option<&str>, target_did: &str, raw: Option<&str>, hash: Option<&str>, enc: Option<&str>) -> Box> { +pub fn build_get_attrib_request(submitter_did: Option<&str>, target_did: &str, raw: Option<&str>, hash: Option<&str>, enc: Option<&str>) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec_string(); let err = _build_get_attrib_request(command_handle, submitter_did, target_did, raw, hash, enc, cb); @@ -362,7 +362,7 @@ fn _build_get_attrib_request(command_handle: CommandHandle, submitter_did: Optio /// /// # Returns /// Request result as json. -pub fn build_schema_request(submitter_did: &str, data: &str) -> Box> { +pub fn build_schema_request(submitter_did: &str, data: &str) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec_string(); let err = _build_schema_request(command_handle, submitter_did, data, cb); @@ -385,7 +385,7 @@ fn _build_schema_request(command_handle: CommandHandle, submitter_did: &str, dat /// /// # Returns /// Request result as json. -pub fn build_get_schema_request(submitter_did: Option<&str>, id: &str) -> Box> { +pub fn build_get_schema_request(submitter_did: Option<&str>, id: &str) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec_string(); let err = _build_get_schema_request(command_handle, submitter_did, id, cb); @@ -414,7 +414,7 @@ fn _build_get_schema_request(command_handle: CommandHandle, submitter_did: Optio /// version: Schema's version string /// ver: Version of the Schema json /// } -pub fn parse_get_schema_response(get_schema_response: &str) -> Box> { +pub fn parse_get_schema_response(get_schema_response: &str) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec_string_string(); let err = _parse_get_schema_response(command_handle, get_schema_response, cb); @@ -449,7 +449,7 @@ fn _parse_get_schema_response(command_handle: CommandHandle, get_schema_response /// /// # Returns /// Request result as json. -pub fn build_cred_def_request(submitter_did: &str, data: &str) -> Box> { +pub fn build_cred_def_request(submitter_did: &str, data: &str) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec_string(); let err = _build_cred_def_request(command_handle, submitter_did, data, cb); @@ -473,7 +473,7 @@ fn _build_cred_def_request(command_handle: CommandHandle, submitter_did: &str, d /// /// # Returns /// Request result as json. -pub fn build_get_cred_def_request(submitter_did: Option<&str>, id: &str) -> Box> { +pub fn build_get_cred_def_request(submitter_did: Option<&str>, id: &str) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec_string(); let err = _build_get_cred_def_request(command_handle, submitter_did, id, cb); @@ -506,7 +506,7 @@ fn _build_get_cred_def_request(command_handle: CommandHandle, submitter_did: Opt /// }, /// ver: Version of the Credential Definition json /// } -pub fn parse_get_cred_def_response(get_cred_def_response: &str) -> Box> { +pub fn parse_get_cred_def_response(get_cred_def_response: &str) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec_string_string(); let err = _parse_get_cred_def_response(command_handle, get_cred_def_response, cb); @@ -538,7 +538,7 @@ fn _parse_get_cred_def_response(command_handle: CommandHandle, get_cred_def_resp /// /// # Returns /// Request result as json. -pub fn build_node_request(submitter_did: &str, target_did: &str, data: &str) -> Box> { +pub fn build_node_request(submitter_did: &str, target_did: &str, data: &str) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec_string(); let err = _build_node_request(command_handle, submitter_did, target_did, data, cb); @@ -561,7 +561,7 @@ fn _build_node_request(command_handle: CommandHandle, submitter_did: &str, targe /// /// # Returns /// Request result as json. -pub fn build_get_validator_info_request(submitter_did: &str) -> Box> { +pub fn build_get_validator_info_request(submitter_did: &str) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec_string(); let err = _build_get_validator_info_request(command_handle, submitter_did, cb); @@ -589,7 +589,7 @@ fn _build_get_validator_info_request(command_handle: CommandHandle, submitter_di /// /// # Returns /// Request result as json. -pub fn build_pool_config_request(submitter_did: &str, writes: bool, force: bool) -> Box> { +pub fn build_pool_config_request(submitter_did: &str, writes: bool, force: bool) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec_string(); let err = _build_pool_config_request(command_handle, submitter_did, writes, force, cb); @@ -613,7 +613,7 @@ fn _build_pool_config_request(command_handle: CommandHandle, submitter_did: &str /// /// # Returns /// Request result as json. -pub fn build_pool_restart_request(submitter_did: &str, action: &str, datetime: Option<&str>) -> Box> { +pub fn build_pool_restart_request(submitter_did: &str, action: &str, datetime: Option<&str>) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec_string(); let err = _build_pool_restart_request(command_handle, submitter_did, action, datetime, cb); @@ -665,7 +665,7 @@ pub fn build_pool_upgrade_request(submitter_did: &str, justification: Option<&str>, reinstall: bool, force: bool, - package: Option<&str>) -> Box> { + package: Option<&str>) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec_string(); let err = _build_pool_upgrade_request(command_handle, submitter_did, name, version, action, sha256, upgrade_timeout, schedule, justification, reinstall, force, package, cb); @@ -738,7 +738,7 @@ fn _build_pool_upgrade_request(command_handle: CommandHandle, /// /// # Returns /// Request result as json. -pub fn build_revoc_reg_def_request(submitter_did: &str, data: &str) -> Box> { +pub fn build_revoc_reg_def_request(submitter_did: &str, data: &str) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec_string(); let err = _build_revoc_reg_def_request(command_handle, submitter_did, data, cb); @@ -762,7 +762,7 @@ fn _build_revoc_reg_def_request(command_handle: CommandHandle, submitter_did: &s /// /// # Returns /// Request result as json. -pub fn build_get_revoc_reg_def_request(submitter_did: Option<&str>, id: &str) -> Box> { +pub fn build_get_revoc_reg_def_request(submitter_did: Option<&str>, id: &str) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec_string(); let err = _build_get_revoc_reg_def_request(command_handle, submitter_did, id, cb); @@ -799,7 +799,7 @@ fn _build_get_revoc_reg_def_request(command_handle: CommandHandle, submitter_did /// }, /// "ver": string - version of revocation registry definition json. /// } -pub fn parse_get_revoc_reg_def_response(get_revoc_reg_def_response: &str) -> Box> { +pub fn parse_get_revoc_reg_def_response(get_revoc_reg_def_response: &str) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec_string_string(); let err = _parse_get_revoc_reg_def_response(command_handle, get_revoc_reg_def_response, cb); @@ -836,7 +836,7 @@ fn _parse_get_revoc_reg_def_response(command_handle: CommandHandle, get_revoc_re /// /// # Returns /// Request result as json. -pub fn build_revoc_reg_entry_request(submitter_did: &str, revoc_reg_def_id: &str, rev_def_type: &str, value: &str) -> Box> { +pub fn build_revoc_reg_entry_request(submitter_did: &str, revoc_reg_def_id: &str, rev_def_type: &str, value: &str) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec_string(); let err = _build_revoc_reg_entry_request(command_handle, submitter_did, revoc_reg_def_id, rev_def_type, value, cb); @@ -863,7 +863,7 @@ fn _build_revoc_reg_entry_request(command_handle: CommandHandle, submitter_did: /// /// # Returns /// Request result as json. -pub fn build_get_revoc_reg_request(submitter_did: Option<&str>, revoc_reg_def_id: &str, timestamp: i64) -> Box> { +pub fn build_get_revoc_reg_request(submitter_did: Option<&str>, revoc_reg_def_id: &str, timestamp: i64) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec_string(); let err = _build_get_revoc_reg_request(command_handle, submitter_did, revoc_reg_def_id, timestamp, cb); @@ -891,7 +891,7 @@ fn _build_get_revoc_reg_request(command_handle: CommandHandle, submitter_did: Op /// }, /// "ver": string - version revocation registry json /// } -pub fn parse_get_revoc_reg_response(get_revoc_reg_response: &str) -> Box> { +pub fn parse_get_revoc_reg_response(get_revoc_reg_response: &str) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec_string_string_u64(); let err = _parse_get_revoc_reg_response(command_handle, get_revoc_reg_response, cb); @@ -917,7 +917,7 @@ fn _parse_get_revoc_reg_response(command_handle: CommandHandle, get_revoc_reg_re /// /// # Returns /// Request result as json. -pub fn build_get_revoc_reg_delta_request(submitter_did: Option<&str>, revoc_reg_def_id: &str, from: i64, to: i64) -> Box> { +pub fn build_get_revoc_reg_delta_request(submitter_did: Option<&str>, revoc_reg_def_id: &str, from: i64, to: i64) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec_string(); let err = _build_get_revoc_reg_delta_request(command_handle, submitter_did, revoc_reg_def_id, from, to, cb); @@ -948,7 +948,7 @@ fn _build_get_revoc_reg_delta_request(command_handle: CommandHandle, submitter_d /// }, /// "ver": string - version revocation registry delta json /// } -pub fn parse_get_revoc_reg_delta_response(get_revoc_reg_delta_response: &str) -> Box> { +pub fn parse_get_revoc_reg_delta_response(get_revoc_reg_delta_response: &str) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec_string_string_u64(); let err = _parse_get_revoc_reg_delta_response(command_handle, get_revoc_reg_delta_response, cb); @@ -992,7 +992,7 @@ fn _parse_get_revoc_reg_delta_response(command_handle: CommandHandle, get_revoc_ /// "lastSeqNo": Option - the latest transaction seqNo for particular Node, /// "lastTxnTime": Option - the latest transaction ordering time for particular Node /// } -pub fn get_response_metadata(response: &str) -> Box> { +pub fn get_response_metadata(response: &str) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec_string(); let err = _get_response_metadata(command_handle, response, cb); @@ -1036,7 +1036,7 @@ fn _get_response_metadata(command_handle: CommandHandle, response: &str, cb: Opt /// # Returns /// Request result as json. pub fn build_auth_rule_request(submitter_did: &str, txn_type: &str, action: &str, field: &str, - old_value: Option<&str>, new_value: Option<&str>, constraint: &str) -> Box> { + old_value: Option<&str>, new_value: Option<&str>, constraint: &str) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec_string(); let err = _build_auth_rule_request(command_handle, submitter_did, txn_type, action, field, old_value, new_value, constraint, cb); @@ -1093,7 +1093,7 @@ fn _build_auth_rule_request(command_handle: CommandHandle, /// /// # Returns /// Request result as json. -pub fn build_auth_rules_request(submitter_did: &str, data: &str) -> Box> { +pub fn build_auth_rules_request(submitter_did: &str, data: &str) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec_string(); let err = _build_auth_rules_request(command_handle, submitter_did, data, cb); @@ -1133,7 +1133,7 @@ fn _build_auth_rules_request(command_handle: CommandHandle, /// # Returns /// Request result as json. pub fn build_get_auth_rule_request(submitter_did: Option<&str>, txn_type: Option<&str>, action: Option<&str>, field: Option<&str>, - old_value: Option<&str>, new_value: Option<&str>) -> Box> { + old_value: Option<&str>, new_value: Option<&str>) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec_string(); let err = _build_get_auth_rule_request(command_handle, submitter_did, txn_type, action, field, old_value, new_value, cb); @@ -1180,7 +1180,7 @@ fn _build_get_auth_rule_request(command_handle: CommandHandle, /// /// # Returns /// Request result as json. -pub fn build_txn_author_agreement_request(submitter_did: &str, text: &str, version: &str) -> Box> { +pub fn build_txn_author_agreement_request(submitter_did: &str, text: &str, version: &str) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec_string(); let err = _build_txn_author_agreement_request(command_handle, submitter_did, text, version, cb); @@ -1221,7 +1221,7 @@ fn _build_txn_author_agreement_request(command_handle: CommandHandle, /// /// # Returns /// Request result as json. -pub fn build_get_txn_author_agreement_request(submitter_did: Option<&str>, data: Option<&str>) -> Box> { +pub fn build_get_txn_author_agreement_request(submitter_did: Option<&str>, data: Option<&str>) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec_string(); let err = _build_get_txn_author_agreement_request(command_handle, submitter_did, data, cb); @@ -1261,7 +1261,7 @@ fn _build_get_txn_author_agreement_request(command_handle: CommandHandle, /// /// # Returns /// Request result as json. -pub fn build_acceptance_mechanisms_request(submitter_did: &str, aml: &str, version: &str, aml_context: Option<&str>) -> Box> { +pub fn build_acceptance_mechanisms_request(submitter_did: &str, aml: &str, version: &str, aml_context: Option<&str>) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec_string(); let err = _build_acceptance_mechanisms_request(command_handle, submitter_did, aml, version, aml_context, cb); @@ -1302,7 +1302,7 @@ fn _build_acceptance_mechanisms_request(command_handle: CommandHandle, /// /// # Returns /// Request result as json. -pub fn build_get_acceptance_mechanisms_request(submitter_did: Option<&str>, timestamp: Option, version: Option<&str>) -> Box> { +pub fn build_get_acceptance_mechanisms_request(submitter_did: Option<&str>, timestamp: Option, version: Option<&str>) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec_string(); let err = _build_get_acceptance_mechanisms_request(command_handle, submitter_did, timestamp, version, cb); @@ -1351,7 +1351,7 @@ pub fn append_txn_author_agreement_acceptance_to_request(request_json: &str, version: Option<&str>, taa_digest: Option<&str>, mechanism: &str, - time: u64) -> Box> { + time: u64) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec_string(); let err = _append_txn_author_agreement_acceptance_to_request(command_handle, request_json, text, version, taa_digest, mechanism, time, cb); @@ -1402,7 +1402,7 @@ fn _append_txn_author_agreement_acceptance_to_request(command_handle: CommandHan /// # Returns /// Updated request result as json. pub fn append_request_endorser(request_json: &str, - endorser_did: &str) -> Box> { + endorser_did: &str) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec_string(); let err = _append_request_endorser(command_handle, request_json, endorser_did, cb); diff --git a/wrappers/rust/src/lib.rs b/wrappers/rust/src/lib.rs index 6f782ec484..1deed3166a 100644 --- a/wrappers/rust/src/lib.rs +++ b/wrappers/rust/src/lib.rs @@ -338,7 +338,7 @@ pub struct IndyError { } impl Fail for IndyError { - fn cause(&self) -> Option<&Fail> { + fn cause(&self) -> Option<&dyn Fail> { self.error_code.cause() } diff --git a/wrappers/rust/src/logger.rs b/wrappers/rust/src/logger.rs index 323fc8ac22..c589510aaa 100644 --- a/wrappers/rust/src/logger.rs +++ b/wrappers/rust/src/logger.rs @@ -10,7 +10,7 @@ use std::ptr::null; use utils::ctypes::c_str_to_string; -static mut LOGGER: Option> = None; +static mut LOGGER: Option> = None; /// Set default logger implementation. /// @@ -36,7 +36,7 @@ pub fn set_default_logger(pattern: Option<&str>) -> Result<(), IndyError> { /// /// # Arguments /// * `logger` - reference to logger used by application. -pub fn set_logger(logger: &'static Log) -> Result<(), IndyError> { +pub fn set_logger(logger: &'static dyn Log) -> Result<(), IndyError> { { unsafe { if LOGGER.is_some() { diff --git a/wrappers/rust/src/pairwise.rs b/wrappers/rust/src/pairwise.rs index 4744811fcd..49a24f4790 100644 --- a/wrappers/rust/src/pairwise.rs +++ b/wrappers/rust/src/pairwise.rs @@ -13,7 +13,7 @@ use ffi::{ResponseEmptyCB, ResponseBoolCB}; use {WalletHandle, CommandHandle}; -pub fn is_pairwise_exists(wallet_handle: WalletHandle, their_did: &str) -> Box> { +pub fn is_pairwise_exists(wallet_handle: WalletHandle, their_did: &str) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec_bool(); let err = _is_pairwise_exists(command_handle, wallet_handle, their_did, cb); @@ -29,7 +29,7 @@ fn _is_pairwise_exists(command_handle: CommandHandle, wallet_handle: WalletHandl }) } -pub fn create_pairwise(wallet_handle: WalletHandle, their_did: &str, my_did: &str, metadata: Option<&str>) -> Box> { +pub fn create_pairwise(wallet_handle: WalletHandle, their_did: &str, my_did: &str, metadata: Option<&str>) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec(); let err = _create_pairwise(command_handle, wallet_handle, their_did, my_did, metadata, cb); @@ -47,7 +47,7 @@ fn _create_pairwise(command_handle: CommandHandle, wallet_handle: WalletHandle, }) } -pub fn list_pairwise(wallet_handle: WalletHandle) -> Box> { +pub fn list_pairwise(wallet_handle: WalletHandle) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec_string(); let err = _list_pairwise(command_handle, wallet_handle, cb); @@ -61,7 +61,7 @@ fn _list_pairwise(command_handle: CommandHandle, wallet_handle: WalletHandle, cb }) } -pub fn get_pairwise(wallet_handle: WalletHandle, their_did: &str) -> Box> { +pub fn get_pairwise(wallet_handle: WalletHandle, their_did: &str) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec_string(); let err = _get_pairwise(command_handle, wallet_handle, their_did, cb); @@ -77,7 +77,7 @@ fn _get_pairwise(command_handle: CommandHandle, wallet_handle: WalletHandle, the }) } -pub fn set_pairwise_metadata(wallet_handle: WalletHandle, their_did: &str, metadata: Option<&str>) -> Box> { +pub fn set_pairwise_metadata(wallet_handle: WalletHandle, their_did: &str, metadata: Option<&str>) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec(); let err = _set_pairwise_metadata(command_handle, wallet_handle, their_did, metadata, cb); diff --git a/wrappers/rust/src/payments.rs b/wrappers/rust/src/payments.rs index 9709b6248e..721ea29f9e 100644 --- a/wrappers/rust/src/payments.rs +++ b/wrappers/rust/src/payments.rs @@ -38,7 +38,7 @@ use futures::IntoFuture; /// /// # Returns /// * `payment_address` - public identifier of payment address in fully resolvable payment address format -pub fn create_payment_address(wallet_handle: WalletHandle, payment_method: &str, config: &str) -> Box> { +pub fn create_payment_address(wallet_handle: WalletHandle, payment_method: &str, config: &str) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec_string(); let err = _create_payment_address(command_handle, wallet_handle, payment_method, config, cb); @@ -60,7 +60,7 @@ fn _create_payment_address(command_handle: CommandHandle, wallet_handle: WalletH /// /// # Returns /// * `payment_addresses_json` - json array of string with json addresses -pub fn list_payment_addresses(wallet_handle: WalletHandle) -> Box> { +pub fn list_payment_addresses(wallet_handle: WalletHandle) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec_string(); let err = _list_payment_addresses(command_handle, wallet_handle, cb); @@ -112,7 +112,7 @@ pub fn add_request_fees(wallet_handle: WalletHandle, req_json: &str, inputs_json: &str, outputs_json: &str, - extra: Option<&str>) -> Box> { + extra: Option<&str>) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec_string_string(); let err = _add_request_fees(command_handle, wallet_handle, submitter_did, req_json, inputs_json, outputs_json, extra, cb); @@ -163,7 +163,7 @@ fn _add_request_fees(command_handle: CommandHandle, /// amount: , // amount of tokens in this input /// extra: , // optional data from payment transaction /// }] -pub fn parse_response_with_fees(payment_method: &str, resp_json: &str) -> Box> { +pub fn parse_response_with_fees(payment_method: &str, resp_json: &str) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec_string(); let err = _parse_response_with_fees(command_handle, payment_method, resp_json, cb); @@ -191,7 +191,7 @@ fn _parse_response_with_fees(command_handle: CommandHandle, payment_method: &str /// * `get_utxo_txn_json` - Indy request for getting UTXO list for payment address /// * `payment_method` #[deprecated(since="2.0.0", note="please use `parse_get_payment_sources_with_from_response` instead")] -pub fn build_get_payment_sources_request(wallet_handle: WalletHandle, submitter_did: Option<&str>, payment_address: &str) -> Box> { +pub fn build_get_payment_sources_request(wallet_handle: WalletHandle, submitter_did: Option<&str>, payment_address: &str) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec_string_string(); @@ -219,7 +219,7 @@ fn _build_get_payment_sources_request(command_handle: CommandHandle, wallet_hand /// # Returns /// * `get_utxo_txn_json` - Indy request for getting UTXO list for payment address /// * `payment_method` -pub fn build_get_payment_sources_with_from_request(wallet_handle: WalletHandle, submitter_did: Option<&str>, payment_address: &str, from: Option) -> Box> { +pub fn build_get_payment_sources_with_from_request(wallet_handle: WalletHandle, submitter_did: Option<&str>, payment_address: &str, from: Option) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec_string_string(); @@ -252,7 +252,7 @@ fn _build_get_payment_sources_with_from_request(command_handle: CommandHandle, w /// extra: , // optional data from payment transaction /// }] #[deprecated(since="2.0.0", note="please use `parse_get_payment_sources_with_from_response` instead")] -pub fn parse_get_payment_sources_response(payment_method: &str, resp_json: &str) -> Box> { +pub fn parse_get_payment_sources_response(payment_method: &str, resp_json: &str) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec_string(); let err = _parse_get_payment_sources_response(command_handle, payment_method, resp_json, cb); @@ -283,7 +283,7 @@ fn _parse_get_payment_sources_response(command_handle: CommandHandle, payment_me /// extra: , // optional data from payment transaction /// }] /// next -- pointer to the next slice of payment sources -pub fn parse_get_payment_sources_with_from_response(payment_method: &str, resp_json: &str) -> Box), Error=IndyError>> { +pub fn parse_get_payment_sources_with_from_response(payment_method: &str, resp_json: &str) -> Box), Error=IndyError>> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec_string_i64(); let err = _parse_get_payment_sources_with_from_response(command_handle, payment_method, resp_json, cb); @@ -322,7 +322,7 @@ fn _parse_get_payment_sources_with_from_response(command_handle: CommandHandle, /// # Returns /// * `payment_req_json` - Indy request for doing tokens payment /// * `payment_method` -pub fn build_payment_req(wallet_handle: WalletHandle, submitter_did: Option<&str>, inputs: &str, outputs: &str, extra: Option<&str>) -> Box> { +pub fn build_payment_req(wallet_handle: WalletHandle, submitter_did: Option<&str>, inputs: &str, outputs: &str, extra: Option<&str>) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec_string_string(); let err = _build_payment_req(command_handle, wallet_handle, submitter_did, inputs, outputs, extra, cb); @@ -362,7 +362,7 @@ fn _build_payment_req(command_handle: CommandHandle, wallet_handle: WalletHandle /// amount: , // amount of tokens in this input /// extra: , // optional data from payment transaction /// }] -pub fn parse_payment_response(payment_method: &str, resp_json: &str) -> Box> { +pub fn parse_payment_response(payment_method: &str, resp_json: &str) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec_string(); let err = _parse_payment_response(command_handle, payment_method, resp_json, cb); @@ -399,7 +399,7 @@ pub fn prepare_extra_with_acceptance_data(extra_json: Option<&str>, version: Option<&str>, taa_digest: Option<&str>, mechanism: &str, - time: u64) -> Box> { + time: u64) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec_string(); let err = _prepare_extra_with_acceptance_data(command_handle, extra_json, text, version, taa_digest, mechanism, time, cb); @@ -449,7 +449,7 @@ fn _prepare_extra_with_acceptance_data(command_handle: CommandHandle, /// # Returns /// * `mint_req_json` - Indy request for doing tokens minting /// * `payment_method` -pub fn build_mint_req(wallet_handle: WalletHandle, submitter_did: Option<&str>, outputs_json: &str, extra: Option<&str>) -> Box> { +pub fn build_mint_req(wallet_handle: WalletHandle, submitter_did: Option<&str>, outputs_json: &str, extra: Option<&str>) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec_string_string(); let err = _build_mint_req(command_handle, wallet_handle, submitter_did, outputs_json, extra, cb); @@ -480,7 +480,7 @@ fn _build_mint_req(command_handle: CommandHandle, wallet_handle: WalletHandle, s /// /// # Returns /// * `set_txn_fees_json` - Indy request for setting fees for transactions in the ledger -pub fn build_set_txn_fees_req(wallet_handle: WalletHandle, submitter_did: Option<&str>, payment_method: &str, fees_json: &str) -> Box> { +pub fn build_set_txn_fees_req(wallet_handle: WalletHandle, submitter_did: Option<&str>, payment_method: &str, fees_json: &str) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec_string(); let err = _build_set_txn_fees_req(command_handle, wallet_handle, submitter_did, payment_method, fees_json, cb); @@ -506,7 +506,7 @@ fn _build_set_txn_fees_req(command_handle: CommandHandle, wallet_handle: WalletH /// /// # Returns /// * `get_txn_fees_json` - Indy request for getting fees for transactions in the ledger -pub fn build_get_txn_fees_req(wallet_handle: WalletHandle, submitter_did: Option<&str>, payment_method: &str) -> Box> { +pub fn build_get_txn_fees_req(wallet_handle: WalletHandle, submitter_did: Option<&str>, payment_method: &str) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec_string(); let err = _build_get_txn_fees_req(command_handle, wallet_handle, submitter_did, payment_method, cb); @@ -535,7 +535,7 @@ fn _build_get_txn_fees_req(command_handle: CommandHandle, wallet_handle: WalletH /// ................. /// txnTypeN: amountN, /// } -pub fn parse_get_txn_fees_response(payment_method: &str, resp_json: &str) -> Box> { +pub fn parse_get_txn_fees_response(payment_method: &str, resp_json: &str) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec_string(); let err = _parse_get_txn_fees_response(command_handle, payment_method, resp_json, cb); @@ -550,7 +550,7 @@ fn _parse_get_txn_fees_response(command_handle: CommandHandle, payment_method: & ErrorCode::from(unsafe { payments::indy_parse_get_txn_fees_response(command_handle, payment_method.as_ptr(), resp_json.as_ptr(), cb) }) } -pub fn build_verify_payment_req(wallet_handle: WalletHandle, submitter_did: Option<&str>, receipt: &str) -> Box> { +pub fn build_verify_payment_req(wallet_handle: WalletHandle, submitter_did: Option<&str>, receipt: &str) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec_string_string(); let err = _build_verify_req(command_handle, wallet_handle, submitter_did, receipt, cb); @@ -567,7 +567,7 @@ fn _build_verify_req(command_handle: CommandHandle, wallet_handle: WalletHandle, }) } -pub fn parse_verify_payment_response(payment_method: &str, resp_json: &str) -> Box> { +pub fn parse_verify_payment_response(payment_method: &str, resp_json: &str) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec_string(); let err = _parse_verify_response(command_handle, payment_method, resp_json, cb); @@ -613,7 +613,7 @@ fn _parse_verify_response(command_handle: CommandHandle, payment_method: &str, r /// }] /// } /// -pub fn get_request_info(get_auth_rule_resp_json: &str, requester_info_json: &str, fees_json: &str) -> Box> { +pub fn get_request_info(get_auth_rule_resp_json: &str, requester_info_json: &str, fees_json: &str) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec_string(); let err = _get_request_info(command_handle, get_auth_rule_resp_json, requester_info_json, fees_json, cb); @@ -631,7 +631,7 @@ fn _get_request_info(command_handle: CommandHandle, get_auth_rule_resp_json: &st }) } -pub fn sign_with_address(wallet_handle: i32, address: &str, message: &[u8]) -> Box, Error=IndyError>> { +pub fn sign_with_address(wallet_handle: i32, address: &str, message: &[u8]) -> Box, Error=IndyError>> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec_slice(); let err = _sign_with_address(command_handle, wallet_handle, address, message, cb); @@ -649,7 +649,7 @@ fn _sign_with_address(command_handle: CommandHandle, wallet_handle: WalletHandle }) } -pub fn verify_with_address(address: &str, message: &[u8], signature: &[u8]) -> Box> { +pub fn verify_with_address(address: &str, message: &[u8], signature: &[u8]) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec_bool(); let err = _verify_with_address(command_handle, address, message, signature, cb); diff --git a/wrappers/rust/src/pool.rs b/wrappers/rust/src/pool.rs index f451424536..3e72dc5dea 100644 --- a/wrappers/rust/src/pool.rs +++ b/wrappers/rust/src/pool.rs @@ -21,7 +21,7 @@ use {CommandHandle, PoolHandle}; /// { /// "genesis_txn": string (required), A path to genesis transaction file. /// } -pub fn create_pool_ledger_config(pool_name: &str, pool_config: Option<&str>) -> Box> { +pub fn create_pool_ledger_config(pool_name: &str, pool_config: Option<&str>) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec(); let err = _create_pool_ledger_config(command_handle, pool_name, pool_config, cb); @@ -57,7 +57,7 @@ fn _create_pool_ledger_config(command_handle: CommandHandle, pool_name: &str, po /// /// # Returns /// Handle to opened pool to use in methods that require pool connection. -pub fn open_pool_ledger(pool_name: &str, config: Option<&str>) -> Box> { +pub fn open_pool_ledger(pool_name: &str, config: Option<&str>) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec_handle(); let err = _open_pool_ledger(command_handle, pool_name, config, cb); @@ -76,7 +76,7 @@ fn _open_pool_ledger(command_handle: CommandHandle, pool_name: &str, config: Opt /// /// # Arguments /// * `handle` - pool handle returned by open_ledger -pub fn refresh_pool_ledger(pool_handle: PoolHandle) -> Box> { +pub fn refresh_pool_ledger(pool_handle: PoolHandle) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec(); let err = _refresh_pool_ledger(command_handle, pool_handle, cb); @@ -89,7 +89,7 @@ fn _refresh_pool_ledger(command_handle: CommandHandle, pool_handle: PoolHandle, } /// Lists names of created pool ledgers -pub fn list_pools() -> Box> { +pub fn list_pools() -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec_string(); let err = _list_pools(command_handle, cb); @@ -105,7 +105,7 @@ fn _list_pools(command_handle: CommandHandle, cb: Option) -> E /// /// # Arguments /// * `handle` - pool handle returned by open_ledger. -pub fn close_pool_ledger(pool_handle: PoolHandle) -> Box> { +pub fn close_pool_ledger(pool_handle: PoolHandle) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec(); let err = _close_pool_ledger(command_handle, pool_handle, cb); @@ -121,7 +121,7 @@ fn _close_pool_ledger(command_handle: CommandHandle, pool_handle: PoolHandle, cb /// /// # Arguments /// * `config_name` - Name of the pool ledger configuration to delete. -pub fn delete_pool_ledger(pool_name: &str) -> Box> { +pub fn delete_pool_ledger(pool_name: &str) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec(); let err = _delete_pool_ledger(command_handle, pool_name, cb); @@ -146,7 +146,7 @@ fn _delete_pool_ledger(command_handle: CommandHandle, pool_name: &str, cb: Optio /// * `protocol_version` - Protocol version will be used: /// 1 - for Indy Node 1.3 /// 2 - for Indy Node 1.4 -pub fn set_protocol_version(protocol_version: usize) -> Box> { +pub fn set_protocol_version(protocol_version: usize) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec(); let err = _set_protocol_version(command_handle, protocol_version, cb); diff --git a/wrappers/rust/src/utils/callbacks.rs b/wrappers/rust/src/utils/callbacks.rs index 60adecd9b6..66cb10d952 100644 --- a/wrappers/rust/src/utils/callbacks.rs +++ b/wrappers/rust/src/utils/callbacks.rs @@ -110,7 +110,7 @@ macro_rules! result_handler { ($name:ident($res_type:ty), $map:ident) => ( pub fn $name(command_handle: CommandHandle, err: ErrorCode, - rx: sync::oneshot::Receiver>) -> Box> { + rx: sync::oneshot::Receiver>) -> Box> { if err != ErrorCode::Success { let mut callbacks = $map.lock().unwrap(); callbacks.remove(&command_handle).unwrap(); diff --git a/wrappers/rust/src/wallet.rs b/wrappers/rust/src/wallet.rs index 9064b53ee2..57f8aeeeba 100644 --- a/wrappers/rust/src/wallet.rs +++ b/wrappers/rust/src/wallet.rs @@ -53,7 +53,7 @@ pub fn register_wallet_storage(xtype: &str, search_all_records: Option, get_search_total_count: Option, fetch_search_next_record: Option, - free_search: Option) -> Box> { + free_search: Option) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec(); let err = _register_storage(command_handle, @@ -154,7 +154,7 @@ fn _register_storage(command_handle: CommandHandle, /// if NULL, then default config will be used. /// * `credentials` - Wallet credentials json. List of supported keys are defined by wallet type. /// if NULL, then default config will be used. -pub fn create_wallet(config: &str, credentials: &str) -> Box> { +pub fn create_wallet(config: &str, credentials: &str) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec(); let err = _create_wallet(command_handle, config, credentials, cb); @@ -187,7 +187,7 @@ fn _create_wallet(command_handle: CommandHandle, config: &str, credentials: &str /// /// # Returns /// Handle to opened wallet to use in methods that require wallet access. -pub fn open_wallet(config: &str, credentials: &str) -> Box> { +pub fn open_wallet(config: &str, credentials: &str) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec_handle(); let err = _open_wallet(command_handle, config, credentials, cb); @@ -216,7 +216,7 @@ fn _open_wallet(command_handle: CommandHandle, config: &str, credentials: &str, /// "path": path of the file that contains exported wallet content /// "key": passphrase used to derive export key /// } -pub fn export_wallet(wallet_handle: WalletHandle, export_config: &str) -> Box> { +pub fn export_wallet(wallet_handle: WalletHandle, export_config: &str) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec(); let err = _export_wallet(command_handle, wallet_handle, export_config, cb); @@ -255,7 +255,7 @@ fn _export_wallet(command_handle: CommandHandle, wallet_handle: WalletHandle, ex /// "path": path of the file that contains exported wallet content /// "key": passphrase used to derive export key /// } -pub fn import_wallet(config: &str, credentials: &str, import_config: &str) -> Box> { +pub fn import_wallet(config: &str, credentials: &str, import_config: &str) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec(); let err = _import_wallet(command_handle, config, credentials, import_config, cb); @@ -274,7 +274,7 @@ fn _import_wallet(command_handle: CommandHandle, config: &str, credentials: &str } /// Deletes created wallet. -pub fn delete_wallet(config: &str, credentials: &str) -> Box> { +pub fn delete_wallet(config: &str, credentials: &str) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec(); let err = _delete_wallet(command_handle, config, credentials, cb); @@ -295,7 +295,7 @@ fn _delete_wallet(command_handle: CommandHandle, config: &str, credentials: &str /// /// # Arguments /// * `handle` - wallet handle returned by open. -pub fn close_wallet(wallet_handle: WalletHandle) -> Box> { +pub fn close_wallet(wallet_handle: WalletHandle) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec(); let err = _close_wallet(command_handle, wallet_handle, cb); @@ -325,7 +325,7 @@ fn _close_wallet(command_handle: CommandHandle, wallet_handle: WalletHandle, cb: /// If tag name starts with "~" the tag will be stored un-encrypted that will allow /// usage of this tag in complex search queries (comparison, predicates) /// Encrypted tags can be searched only for exact matching -pub fn add_wallet_record(wallet_handle: WalletHandle, xtype: &str, id: &str, value: &str, tags_json: Option<&str>) -> Box> { +pub fn add_wallet_record(wallet_handle: WalletHandle, xtype: &str, id: &str, value: &str, tags_json: Option<&str>) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec(); let err = _add_wallet_record(command_handle, wallet_handle, xtype, id, value, tags_json, cb); @@ -356,7 +356,7 @@ fn _add_wallet_record(command_handle: CommandHandle, wallet_handle: WalletHandle /// * `xtype` - allows to separate different record types collections /// * `id` - the id of record /// * `value` - the new value of record -pub fn update_wallet_record_value(wallet_handle: WalletHandle, xtype: &str, id: &str, value: &str) -> Box> { +pub fn update_wallet_record_value(wallet_handle: WalletHandle, xtype: &str, id: &str, value: &str) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec(); let err = _update_wallet_record_value(command_handle, wallet_handle, xtype, id, value, cb); @@ -395,7 +395,7 @@ fn _update_wallet_record_value(command_handle: CommandHandle, wallet_handle: Wal /// If tag name starts with "~" the tag will be stored un-encrypted that will allow /// usage of this tag in complex search queries (comparison, predicates) /// Encrypted tags can be searched only for exact matching -pub fn update_wallet_record_tags(wallet_handle: WalletHandle, xtype: &str, id: &str, tags_json: &str) -> Box> { +pub fn update_wallet_record_tags(wallet_handle: WalletHandle, xtype: &str, id: &str, tags_json: &str) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec(); let err = _update_wallet_record_tags(command_handle, wallet_handle, xtype, id, tags_json, cb); @@ -431,7 +431,7 @@ fn _update_wallet_record_tags(command_handle: CommandHandle, wallet_handle: Wall /// Encrypted tags can be searched only for exact matching /// Note if some from provided tags already assigned to the record than /// corresponding tags values will be replaced -pub fn add_wallet_record_tags(wallet_handle: WalletHandle, xtype: &str, id: &str, tags_json: &str) -> Box> { +pub fn add_wallet_record_tags(wallet_handle: WalletHandle, xtype: &str, id: &str, tags_json: &str) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec(); let err = _add_wallet_record_tags(command_handle, wallet_handle, xtype, id, tags_json, cb); @@ -457,7 +457,7 @@ fn _add_wallet_record_tags(command_handle: CommandHandle, wallet_handle: WalletH /// * `id` - the id of record /// * `tag_names_json` - the list of tag names to remove from the record as json array: /// ["tagName1", "tagName2", ...] -pub fn delete_wallet_record_tags(wallet_handle: WalletHandle, xtype: &str, id: &str, tag_names_json: &str) -> Box> { +pub fn delete_wallet_record_tags(wallet_handle: WalletHandle, xtype: &str, id: &str, tag_names_json: &str) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec(); let err = _delete_wallet_record_tags(command_handle, wallet_handle, xtype, id, tag_names_json, cb); @@ -481,7 +481,7 @@ fn _delete_wallet_record_tags(command_handle: CommandHandle, wallet_handle: Wall /// * `wallet_handle` - wallet handle (created by open_wallet) /// * `xtype` - record type /// * `id` - the id of record -pub fn delete_wallet_record(wallet_handle: WalletHandle, xtype: &str, id: &str) -> Box> { +pub fn delete_wallet_record(wallet_handle: WalletHandle, xtype: &str, id: &str) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec(); let err = _delete_wallet_record(command_handle, wallet_handle, xtype, id, cb); @@ -518,7 +518,7 @@ fn _delete_wallet_record(command_handle: CommandHandle, wallet_handle: WalletHan /// value: "Some value", // present only if retrieveValue set to true /// tags: , // present only if retrieveTags set to true /// } -pub fn get_wallet_record(wallet_handle: WalletHandle, xtype: &str, id: &str, options_json: &str) -> Box> { +pub fn get_wallet_record(wallet_handle: WalletHandle, xtype: &str, id: &str, options_json: &str) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec_string(); let err = _get_wallet_record(command_handle, wallet_handle, xtype, id, options_json, cb); @@ -564,7 +564,7 @@ fn _get_wallet_record(command_handle: CommandHandle, wallet_handle: WalletHandle /// # Returns /// * `search_handle` - Wallet search handle that can be used later /// to fetch records by small batches (with indy_fetch_wallet_search_next_records) -pub fn open_wallet_search(wallet_handle: WalletHandle, xtype: &str, query_json: &str, options_json: &str) -> Box> { +pub fn open_wallet_search(wallet_handle: WalletHandle, xtype: &str, query_json: &str, options_json: &str) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec_handle(); let err = _open_wallet_search(command_handle, wallet_handle, xtype, query_json, options_json, cb); @@ -602,7 +602,7 @@ fn _open_wallet_search(command_handle: CommandHandle, wallet_handle: WalletHandl /// tags: , // present only if retrieveTags set to true /// }], /// } -pub fn fetch_wallet_search_next_records(wallet_handle: WalletHandle, wallet_search_handle: SearchHandle, count: usize) -> Box> { +pub fn fetch_wallet_search_next_records(wallet_handle: WalletHandle, wallet_search_handle: SearchHandle, count: usize) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec_string(); let err = _fetch_wallet_search_next_records(command_handle, wallet_handle, wallet_search_handle, count, cb); @@ -620,7 +620,7 @@ fn _fetch_wallet_search_next_records(command_handle: CommandHandle, wallet_handl /// /// # Arguments /// * `wallet_search_handle` - wallet search handle -pub fn close_wallet_search(wallet_search_handle: SearchHandle) -> Box> { +pub fn close_wallet_search(wallet_search_handle: SearchHandle) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec(); let err = _close_wallet_search(command_handle, wallet_search_handle, cb); @@ -654,7 +654,7 @@ fn _default_credentials(credentials: Option<&str>) -> CString { /// /// # Returns /// wallet key can be used with RAW derivation type -pub fn generate_wallet_key(config: Option<&str>) -> Box> { +pub fn generate_wallet_key(config: Option<&str>) -> Box> { let (receiver, command_handle, cb) = ClosureHandler::cb_ec_string(); let err = _generate_wallet_key(command_handle, config, cb); From 4ea2814b635db51a87908202dddbcc531ff7cab2 Mon Sep 17 00:00:00 2001 From: Axel Nennker Date: Sat, 17 Aug 2019 21:48:35 +0200 Subject: [PATCH 257/320] cargo update Signed-off-by: Axel Nennker --- cli/Cargo.lock | 636 ++++++++++++++++++++++++--------------------- libindy/Cargo.lock | 410 ++++++++++++++++------------- 2 files changed, 572 insertions(+), 474 deletions(-) diff --git a/cli/Cargo.lock b/cli/Cargo.lock index f2894356a3..215ed61ddb 100644 --- a/cli/Cargo.lock +++ b/cli/Cargo.lock @@ -7,10 +7,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "aho-corasick" -version = "0.6.9" +version = "0.6.10" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "memchr 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "aho-corasick" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -18,7 +26,7 @@ name = "ansi_term" version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -27,17 +35,18 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] -name = "argon2rs" -version = "0.2.5" +name = "arc-swap" +version = "0.3.11" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "arrayref" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", - "scoped_threadpool 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", -] [[package]] name = "arrayvec" -version = "0.4.9" +version = "0.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "nodrop 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", @@ -45,35 +54,46 @@ dependencies = [ [[package]] name = "atty" -version = "0.2.11" +version = "0.2.13" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", - "termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "autocfg" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "backtrace" -version = "0.3.11" +version = "0.3.34" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "backtrace-sys 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", - "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "backtrace-sys 0.1.31 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-demangle 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-demangle 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "backtrace-sys" -version = "0.1.26" +version = "0.1.31" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cc 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "base64" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "bitflags" version = "0.4.0" @@ -81,97 +101,98 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "bitflags" -version = "1.0.4" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] -name = "blake2-rfc" -version = "0.2.18" +name = "blake2b_simd" +version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "arrayvec 0.4.9 (registry+https://github.com/rust-lang/crates.io-index)", + "arrayref 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", + "arrayvec 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", "constant_time_eq 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "build_const" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "byteorder" -version = "1.2.7" +version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "cc" -version = "1.0.27" +version = "1.0.40" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "cfg-if" -version = "0.1.6" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "chrono" -version = "0.4.6" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "num-integer 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", + "num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "constant_time_eq" -version = "0.1.3" +name = "cloudabi" +version = "0.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", +] [[package]] -name = "crc" -version = "1.8.1" +name = "constant_time_eq" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "build_const 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", -] [[package]] name = "crc32fast" -version = "1.1.2" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "crossbeam" -version = "0.3.2" +name = "crossbeam-utils" +version = "0.6.6" source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", +] [[package]] name = "csv" version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "memchr 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "dirs" -version = "1.0.4" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_users 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_users 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "dtoa" -version = "0.4.3" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -181,33 +202,33 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "failure" -version = "0.1.3" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "backtrace 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)", - "failure_derive 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "backtrace 0.3.34 (registry+https://github.com/rust-lang/crates.io-index)", + "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "failure_derive" -version = "0.1.3" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.23 (registry+https://github.com/rust-lang/crates.io-index)", - "synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)", + "synstructure 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "flate2" -version = "1.0.6" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "crc32fast 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "crc32fast 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", - "miniz-sys 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", - "miniz_oxide_c_api 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "miniz-sys 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", + "miniz_oxide 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -216,22 +237,13 @@ version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] -name = "fuchsia-zircon" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "fuchsia-zircon-sys" -version = "0.3.3" +name = "fuchsia-cprng" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "futures" -version = "0.1.25" +version = "0.1.28" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -246,16 +258,16 @@ dependencies = [ name = "indy" version = "1.11.0" dependencies = [ - "failure 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", + "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", "indy-sys 1.11.0", "lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "num-derive 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.97 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.97 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "num-derive 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -264,21 +276,21 @@ name = "indy-cli" version = "1.11.0" dependencies = [ "ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", - "atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", - "chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "dirs 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "atty 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)", + "chrono 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", + "dirs 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", "indy 1.11.0", "lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", - "libloading 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libloading 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", "linefeed 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "log4rs 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "log4rs 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)", "prettytable-rs 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", "regex 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "rpassword 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.97 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.97 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", "term 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "unescape 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -289,14 +301,14 @@ name = "indy-sys" version = "1.11.0" dependencies = [ "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", - "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "vcpkg 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "vcpkg 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "itoa" -version = "0.4.3" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -315,7 +327,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "lazy_static" -version = "1.2.0" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -325,11 +337,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "libloading" -version = "0.5.0" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cc 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -342,23 +354,23 @@ dependencies = [ "nix 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "ole32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "shell32-sys 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-normalization 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-normalization 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "linked-hash-map" -version = "0.5.1" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "log" -version = "0.4.6" +version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.97 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -368,26 +380,26 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "log4rs" -version = "0.8.1" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "antidote 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "flate2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "arc-swap 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)", + "chrono 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", + "flate2 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "humantime 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "log-mdc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.97 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", "serde-value 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.97 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_yaml 0.8.8 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_yaml 0.8.9 (registry+https://github.com/rust-lang/crates.io-index)", "thread-id 3.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "typemap 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -400,49 +412,33 @@ dependencies = [ [[package]] name = "memchr" -version = "2.1.2" +version = "2.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", - "version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", -] [[package]] name = "miniz-sys" -version = "0.1.11" +version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cc 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "miniz_oxide" -version = "0.2.0" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "adler32 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "miniz_oxide_c_api" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "cc 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)", - "crc 1.8.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", - "miniz_oxide 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "nix" version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_version 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", "semver 0.1.20 (registry+https://github.com/rust-lang/crates.io-index)", @@ -456,27 +452,30 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "num-derive" -version = "0.2.3" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.23 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "num-integer" -version = "0.1.39" +version = "0.1.41" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "num-traits" -version = "0.2.6" +version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "autocfg 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", +] [[package]] name = "ole32-sys" @@ -489,15 +488,15 @@ dependencies = [ [[package]] name = "ordered-float" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "pkg-config" -version = "0.3.14" +version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -505,7 +504,7 @@ name = "prettytable-rs" version = "0.6.7" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", + "atty 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)", "csv 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)", "encode_unicode 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", @@ -515,12 +514,20 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "0.4.24" +version = "0.4.30" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "proc-macro2" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "quick-error" version = "1.2.2" @@ -528,44 +535,68 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "quote" -version = "0.6.10" +version = "0.6.13" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "rand" -version = "0.4.3" +name = "quote" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "redox_syscall" -version = "0.1.44" +name = "rand_core" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", +] [[package]] -name = "redox_termios" -version = "0.1.1" +name = "rand_core" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "rand_os" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "redox_syscall 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)", + "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "rdrand" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "redox_syscall" +version = "0.1.56" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "redox_users" -version = "0.2.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "argon2rs 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", - "failure 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)", + "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_os 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)", + "rust-argon2 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -573,23 +604,22 @@ name = "regex" version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "aho-corasick 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", - "memchr 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "aho-corasick 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "regex-syntax 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", "thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", - "utf8-ranges 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "utf8-ranges 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "regex" -version = "1.1.0" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "aho-corasick 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", - "memchr 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-syntax 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", + "aho-corasick 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "regex-syntax 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", "thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", - "utf8-ranges 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -597,16 +627,13 @@ name = "regex-syntax" version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "ucd-util 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "ucd-util 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "regex-syntax" -version = "0.6.4" +version = "0.6.11" source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "ucd-util 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", -] [[package]] name = "rpassword" @@ -624,9 +651,19 @@ name = "rprompt" version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "rust-argon2" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", + "blake2b_simd 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "rustc-demangle" -version = "0.1.11" +version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -647,11 +684,6 @@ name = "ryu" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "scoped_threadpool" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "semver" version = "0.1.20" @@ -659,7 +691,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "serde" -version = "1.0.97" +version = "1.0.99" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -667,18 +699,18 @@ name = "serde-value" version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "ordered-float 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.97 (registry+https://github.com/rust-lang/crates.io-index)", + "ordered-float 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "serde_derive" -version = "1.0.97" +version = "1.0.99" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.23 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -686,20 +718,20 @@ name = "serde_json" version = "1.0.40" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", + "itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", "ryu 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.97 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "serde_yaml" -version = "0.8.8" +version = "0.8.9" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "dtoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", - "linked-hash-map 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.97 (registry+https://github.com/rust-lang/crates.io-index)", - "yaml-rust 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "dtoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", + "linked-hash-map 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", + "yaml-rust 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -711,24 +743,39 @@ dependencies = [ "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "smallvec" +version = "0.6.10" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "syn" -version = "0.15.23" +version = "0.15.44" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "syn" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "synstructure" -version = "0.10.1" +version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.23 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -741,24 +788,14 @@ dependencies = [ "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "termion" -version = "1.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "thread-id" version = "3.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -766,17 +803,17 @@ name = "thread_local" version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "time" -version = "0.1.41" +version = "0.1.42" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -794,7 +831,7 @@ dependencies = [ [[package]] name = "ucd-util" -version = "0.1.3" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -804,8 +841,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "unicode-normalization" -version = "0.1.7" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "smallvec 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", +] [[package]] name = "unicode-width" @@ -817,6 +857,11 @@ name = "unicode-xid" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "unicode-xid" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "unsafe-any" version = "0.4.2" @@ -827,17 +872,12 @@ dependencies = [ [[package]] name = "utf8-ranges" -version = "1.0.2" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "vcpkg" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "version_check" -version = "0.1.5" +version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -852,7 +892,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "winapi" -version = "0.3.6" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -876,118 +916,124 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "yaml-rust" -version = "0.4.2" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "linked-hash-map 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "linked-hash-map 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [metadata] "checksum adler32 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "7e522997b529f05601e05166c07ed17789691f562762c7f3b987263d2dedee5c" -"checksum aho-corasick 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)" = "1e9a933f4e58658d7b12defcf96dc5c720f20832deebe3e0a19efd3b6aaeeb9e" +"checksum aho-corasick 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)" = "81ce3d38065e618af2d7b77e10c5ad9a069859b4be3c2250f674af3840d9c8a5" +"checksum aho-corasick 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)" = "58fb5e95d83b38284460a5fda7d6470aa0b8844d283a0b614b8535e880800d2d" "checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" "checksum antidote 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "34fde25430d87a9388dadbe6e34d7f72a462c8b43ac8d309b42b0a8505d7e2a5" -"checksum argon2rs 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "3f67b0b6a86dae6e67ff4ca2b6201396074996379fba2b92ff649126f37cb392" -"checksum arrayvec 0.4.9 (registry+https://github.com/rust-lang/crates.io-index)" = "d18513977c2d8261c448511c5c53dc66b26dfccbc3d4446672dea1e71a7d8a26" -"checksum atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "9a7d5b8723950951411ee34d271d99dddcc2035a16ab25310ea2c8cfd4369652" -"checksum backtrace 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)" = "18b65ea1161bfb2dd6da6fade5edd4dbd08fba85012123dd333d2fd1b90b2782" -"checksum backtrace-sys 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)" = "3fcce89e5ad5c8949caa9434501f7b55415b3e7ad5270cb88c75a8d35e8f1279" +"checksum arc-swap 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)" = "bc4662175ead9cd84451d5c35070517777949a2ed84551764129cedb88384841" +"checksum arrayref 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "0d382e583f07208808f6b1249e60848879ba3543f57c32277bf52d69c2f0f0ee" +"checksum arrayvec 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)" = "b8d73f9beda665eaa98ab9e4f7442bd4e7de6652587de55b2525e52e29c1b0ba" +"checksum atty 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)" = "1803c647a3ec87095e7ae7acfca019e98de5ec9a7d01343f611cf3152ed71a90" +"checksum autocfg 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "22130e92352b948e7e82a49cdb0aa94f2211761117f29e052dd397c1ac33542b" +"checksum backtrace 0.3.34 (registry+https://github.com/rust-lang/crates.io-index)" = "b5164d292487f037ece34ec0de2fcede2faa162f085dd96d2385ab81b12765ba" +"checksum backtrace-sys 0.1.31 (registry+https://github.com/rust-lang/crates.io-index)" = "82a830b4ef2d1124a711c71d263c5abdc710ef8e907bd508c88be475cebc422b" +"checksum base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0b25d992356d2eb0ed82172f5248873db5560c4721f564b13cb5193bda5e668e" "checksum bitflags 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8dead7461c1127cf637931a1e50934eb6eee8bff2f74433ac7909e9afcee04a3" -"checksum bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "228047a76f468627ca71776ecdebd732a3423081fcf5125585bcd7c49886ce12" -"checksum blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)" = "5d6d530bdd2d52966a6d03b7a964add7ae1a288d25214066fd4b600f0f796400" -"checksum build_const 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "39092a32794787acd8525ee150305ff051b0aa6cc2abaf193924f5ab05425f39" -"checksum byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "94f88df23a25417badc922ab0f5716cc1330e87f71ddd9203b3a3ccd9cedf75d" -"checksum cc 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)" = "155ed195f7bd722d1dfeb30365b9d0c1f6a078fa7ca4014497e5935d90993d6f" -"checksum cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "082bb9b28e00d3c9d39cc03e64ce4cea0f1bb9b3fde493f0cbc008472d22bdf4" -"checksum chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "45912881121cb26fad7c38c17ba7daa18764771836b34fab7d3fbd93ed633878" +"checksum bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3d155346769a6855b86399e9bc3814ab343cd3d62c7e985113d46a0ec3c281fd" +"checksum blake2b_simd 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "461f4b879a8eb70c1debf7d0788a9a5ff15f1ea9d25925fea264ef4258bed6b2" +"checksum byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a7c3dd8985a7111efc5c80b44e23ecdd8c007de8ade3b96595387e812b957cf5" +"checksum cc 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)" = "b548a4ee81fccb95919d4e22cfea83c7693ebfd78f0495493178db20b3139da7" +"checksum cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "b486ce3ccf7ffd79fdeb678eac06a9e6c09fc88d33836340becb8fffe87c5e33" +"checksum chrono 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)" = "77d81f58b7301084de3b958691458a53c3f7e0b1d702f77e550b6a88e3a88abe" +"checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" "checksum constant_time_eq 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8ff012e225ce166d4422e0e78419d901719760f62ae2b7969ca6b564d1b54a9e" -"checksum crc 1.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d663548de7f5cca343f1e0a48d14dcfb0e9eb4e079ec58883b7251539fa10aeb" -"checksum crc32fast 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e91d5240c6975ef33aeb5f148f35275c25eda8e8a5f95abe421978b05b8bf192" -"checksum crossbeam 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "24ce9782d4d5c53674646a6a4c1863a21a8fc0cb649b3c94dfc16e45071dea19" +"checksum crc32fast 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ba125de2af0df55319f41944744ad91c71113bf74a4646efff39afe1f6842db1" +"checksum crossbeam-utils 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)" = "04973fa96e96579258a5091af6003abde64af786b860f18622b82e026cca60e6" "checksum csv 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7ef22b37c7a51c564a365892c012dc0271221fdcc64c69b19ba4d6fa8bd96d9c" -"checksum dirs 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "88972de891f6118092b643d85a0b28e0678e0f948d7f879aa32f2d5aafe97d2a" -"checksum dtoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "6d301140eb411af13d3115f9a562c85cc6b541ade9dfa314132244aaee7489dd" +"checksum dirs 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "3fd78930633bd1c6e35c4b42b1df7b0cbc6bc191146e512bb3bedf243fcc3901" +"checksum dtoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "ea57b42383d091c85abcc2706240b94ab2a8fa1fc81c10ff23c4de06e2a90b5e" "checksum encode_unicode 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "90b2c9496c001e8cb61827acdefad780795c42264c137744cae6f7d9e3450abd" -"checksum failure 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "6dd377bcc1b1b7ce911967e3ec24fa19c3224394ec05b54aa7b083d498341ac7" -"checksum failure_derive 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "64c2d913fe8ed3b6c6518eedf4538255b989945c14c2a7d5cbff62a5e2120596" -"checksum flate2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "2291c165c8e703ee54ef3055ad6188e3d51108e2ded18e9f2476e774fc5ad3d4" +"checksum failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "795bd83d3abeb9220f257e597aa0080a508b27533824adf336529648f6abf7e2" +"checksum failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "ea1063915fd7ef4309e222a5a07cf9c319fb9c7836b1f89b85458672dbb127e1" +"checksum flate2 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)" = "2adaffba6388640136149e18ed080b77a78611c1e1d6de75aedcdf78df5d4682" "checksum fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "2fad85553e09a6f881f739c29f0b00b0f01357c743266d478b68951ce23285f3" -"checksum fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" -"checksum fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" -"checksum futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)" = "49e7653e374fe0d0c12de4250f0bdb60680b8c80eed558c5c7538eec9c89e21b" +"checksum fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" +"checksum futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)" = "45dc39533a6cae6da2b56da48edae506bb767ec07370f86f70fc062e9d435869" "checksum humantime 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3ca7e5f2e110db35f93b837c81797f3714500b81d517bf20c431b16d3ca4f114" -"checksum itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "1306f3464951f30e30d12373d31c79fbd52d236e5e896fd92f96ec7babbbe60b" +"checksum itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "501266b7edd0174f8530248f87f99c88fbe60ca4ef3dd486835b8d8d53136f7f" "checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" "checksum lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "76f033c7ad61445c5b347c7382dd1237847eb1bce590fe50365dcb33d546be73" -"checksum lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a374c89b9db55895453a74c1e38861d9deec0b01b405a82516e9d5de4820dea1" +"checksum lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bc5729f27f159ddd61f4df6228e827e86643d4d3e7c32183cb30a1c08f604a14" "checksum libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)" = "d44e80633f007889c7eff624b709ab43c92d708caad982295768a7b13ca3b5eb" -"checksum libloading 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9c3ad660d7cb8c5822cd83d10897b0f1f1526792737a179e73896152f85b88c2" +"checksum libloading 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f2b111a074963af1d37a139918ac6d49ad1d0d5e47f72fd55388619691a7d753" "checksum linefeed 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "67deb656cfb06a63e4cb31e49609174db253fabaf019476ad505fc52a3302226" -"checksum linked-hash-map 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "70fb39025bc7cdd76305867c4eccf2f2dcf6e9a57f5b21a93e1c2d86cd03ec9e" -"checksum log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c84ec4b527950aa83a329754b01dbe3f58361d1c5efacd1f6d68c494d08a17c6" +"checksum linked-hash-map 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "ae91b68aebc4ddb91978b11a1b02ddd8602a05ec19002801c5666000e05e0f83" +"checksum log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)" = "14b6052be84e6b71ab17edffc2eeabf5c2c3ae1fdb464aae35ac50c67a44e1f7" "checksum log-mdc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a94d21414c1f4a51209ad204c1776a3d0765002c76c6abcb602a6f09f1e881c7" -"checksum log4rs 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "25e0fc8737a634116a2deb38d821e4400ed16ce9dcb0d628a978d399260f5902" +"checksum log4rs 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)" = "100052474df98158c0738a7d3f4249c99978490178b5f9f68cd835ac57adbd1b" "checksum memchr 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "148fab2e51b4f1cfc66da2a7c32981d1d3c083a803978268bb11fe4b86925e7a" -"checksum memchr 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "db4c41318937f6e76648f42826b1d9ade5c09cafb5aef7e351240a70f39206e9" -"checksum miniz-sys 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "0300eafb20369952951699b68243ab4334f4b10a88f411c221d444b36c40e649" -"checksum miniz_oxide 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5ad30a47319c16cde58d0314f5d98202a80c9083b5f61178457403dfb14e509c" -"checksum miniz_oxide_c_api 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "28edaef377517fd9fe3e085c37d892ce7acd1fbeab9239c5a36eec352d8a8b7e" +"checksum memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "88579771288728879b57485cc7d6b07d648c9f0141eb955f8ab7f9d45394468e" +"checksum miniz-sys 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)" = "1e9e3ae51cea1576ceba0dde3d484d30e6e5b86dee0b2d412fe3a16a15c98202" +"checksum miniz_oxide 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7108aff85b876d06f22503dcce091e29f76733b2bfdd91eebce81f5e68203a10" "checksum nix 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a0d95c5fa8b641c10ad0b8887454ebaafa3c92b5cd5350f8fc693adafd178e7b" "checksum nodrop 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "2f9667ddcc6cc8a43afc9b7917599d7216aa09c463919ea32c59ed6cac8bc945" -"checksum num-derive 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8af1847c907c2f04d7bfd572fb25bbb4385c637fe5be163cf2f8c5d778fe1e7d" -"checksum num-integer 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)" = "e83d528d2677f0518c570baf2b7abdcf0cd2d248860b68507bdcb3e91d4c0cea" -"checksum num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0b3a5d7cc97d6d30d8b9bc8fa19bf45349ffe46241e8816f50f62f6d6aaabee1" +"checksum num-derive 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "eafd0b45c5537c3ba526f79d3e75120036502bebacbb3f3220914067ce39dbf2" +"checksum num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)" = "b85e541ef8255f6cf42bbfe4ef361305c6c135d10919ecc26126c4e5ae94bc09" +"checksum num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "6ba9a427cfca2be13aa6f6403b0b7e7368fe982bfa16fccc450ce74c46cd9b32" "checksum ole32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5d2c49021782e5233cd243168edfa8037574afed4eba4bbaf538b3d8d1789d8c" -"checksum ordered-float 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2f0015e9e8e28ee20c581cfbfe47c650cedeb9ed0721090e0b7ebb10b9cdbcc2" -"checksum pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)" = "676e8eb2b1b4c9043511a9b7bea0915320d7e502b0a079fb03f9635a5252b18c" +"checksum ordered-float 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "18869315e81473c951eb56ad5558bbc56978562d3ecfb87abb7a1e944cea4518" +"checksum pkg-config 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "a7c1d2cfa5a714db3b5f24f0915e74fcdf91d09d496ba61329705dda7774d2af" "checksum prettytable-rs 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)" = "34dc1f4f6dddab3bf008ecfd4fd2a631b585fbf0af123f34c1324f51a034ff5f" -"checksum proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)" = "77619697826f31a02ae974457af0b29b723e5619e113e9397b8b82c6bd253f09" +"checksum proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)" = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759" +"checksum proc-macro2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4c5c2380ae88876faae57698be9e9775e3544decad214599c3a6266cca6ac802" "checksum quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9274b940887ce9addde99c4eee6b5c44cc494b182b97e73dc8ffdcb3397fd3f0" -"checksum quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)" = "53fa22a1994bd0f9372d7a816207d8a2677ad0325b073f5c5332760f0fb62b5c" -"checksum rand 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8356f47b32624fef5b3301c1be97e5944ecdd595409cc5da11d05f211db6cfbd" -"checksum redox_syscall 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)" = "a84bcd297b87a545980a2d25a0beb72a1f490c31f0a9fde52fca35bfbb1ceb70" -"checksum redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76" -"checksum redox_users 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "214a97e49be64fd2c86f568dd0cb2c757d2cc53de95b273b6ad0a1c908482f26" +"checksum quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)" = "6ce23b6b870e8f94f81fb0a363d65d86675884b34a09043c81e5562f11c1f8e1" +"checksum quote 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "49d77c41ca8767f2f41394c11a4eebccab83da25e7cc035387a3125f02be90a3" +"checksum rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b" +"checksum rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc" +"checksum rand_os 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "7b75f676a1e053fc562eafbb47838d67c84801e38fc1ba459e8f180deabd5071" +"checksum rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2" +"checksum redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)" = "2439c63f3f6139d1b57529d16bc3b8bb855230c8efcc5d3a896c8bea7c3b1e84" +"checksum redox_users 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4ecedbca3bf205f8d8f5c2b44d83cd0690e39ee84b951ed649e9f1841132b66d" "checksum regex 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "9329abc99e39129fcceabd24cf5d85b4671ef7c29c50e972bc5afe32438ec384" -"checksum regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "37e7cbbd370869ce2e8dff25c7018702d10b21a20ef7135316f8daecd6c25b7f" +"checksum regex 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "88c3d9193984285d544df4a30c23a4e62ead42edf70a4452ceb76dac1ce05c26" "checksum regex-syntax 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "7d707a4fa2637f2dca2ef9fd02225ec7661fe01a53623c1e6515b6916511f7a7" -"checksum regex-syntax 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "4e47a2ed29da7a9e1960e1639e7a982e6edc6d49be308a3b02daf511504a16d1" +"checksum regex-syntax 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)" = "b143cceb2ca5e56d5671988ef8b15615733e7ee16cd348e064333b251b89343f" "checksum rpassword 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b273c91bd242ca03ad6d71c143b6f17a48790e61f21a6c78568fa2b6774a24a4" "checksum rprompt 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "1601f32bc5858aae3cbfa1c645c96c4d820cc5c16be0194f089560c00b6eb625" -"checksum rustc-demangle 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "01b90379b8664dd83460d59bdc5dd1fd3172b8913788db483ed1325171eab2f7" +"checksum rust-argon2 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4ca4eaef519b494d1f2848fc602d18816fed808a981aedf4f1f00ceb7c9d32cf" +"checksum rustc-demangle 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "4c691c0e608126e00913e33f0ccf3727d5fc84573623b8d65b2df340b5201783" "checksum rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)" = "dcf128d1287d2ea9d80910b5f1120d0b8eede3fbf1abe91c40d39ea7d51e6fda" "checksum rustc_version 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "c5f5376ea5e30ce23c03eb77cbe4962b988deead10910c372b226388b594c084" "checksum ryu 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c92464b447c0ee8c4fb3824ecc8383b81717b9f1e74ba2e72540aef7b9f82997" -"checksum scoped_threadpool 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "1d51f5df5af43ab3f1360b429fa5e0152ac5ce8c0bd6485cae490332e96846a8" "checksum semver 0.1.20 (registry+https://github.com/rust-lang/crates.io-index)" = "d4f410fedcf71af0345d7607d246e7ad15faaadd49d240ee3b24e5dc21a820ac" -"checksum serde 1.0.97 (registry+https://github.com/rust-lang/crates.io-index)" = "d46b3dfedb19360a74316866cef04687cd4d6a70df8e6a506c63512790769b72" +"checksum serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)" = "fec2851eb56d010dc9a21b89ca53ee75e6528bab60c11e89d38390904982da9f" "checksum serde-value 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "7a663f873dedc4eac1a559d4c6bc0d0b2c34dc5ac4702e105014b8281489e44f" -"checksum serde_derive 1.0.97 (registry+https://github.com/rust-lang/crates.io-index)" = "c22a0820adfe2f257b098714323563dd06426502abbbce4f51b72ef544c5027f" +"checksum serde_derive 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)" = "cb4dc18c61206b08dc98216c98faa0232f4337e1e1b8574551d5bad29ea1b425" "checksum serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)" = "051c49229f282f7c6f3813f8286cc1e3323e8051823fce42c7ea80fe13521704" -"checksum serde_yaml 0.8.8 (registry+https://github.com/rust-lang/crates.io-index)" = "0887a8e097a69559b56aa2526bf7aff7c3048cf627dff781f0b56a6001534593" +"checksum serde_yaml 0.8.9 (registry+https://github.com/rust-lang/crates.io-index)" = "38b08a9a90e5260fe01c6480ec7c811606df6d3a660415808c3c3fa8ed95b582" "checksum shell32-sys 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9ee04b46101f57121c9da2b151988283b6beb79b34f5bb29a58ee48cb695122c" -"checksum syn 0.15.23 (registry+https://github.com/rust-lang/crates.io-index)" = "9545a6a093a3f0bd59adb472700acc08cad3776f860f16a897dfce8c88721cbc" -"checksum synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "73687139bf99285483c96ac0add482c3776528beac1d97d444f6e91f203a2015" +"checksum smallvec 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)" = "ab606a9c5e214920bb66c458cd7be8ef094f813f20fe77a54cc7dbfff220d4b7" +"checksum syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)" = "9ca4b3b69a77cbe1ffc9e198781b7acb0c7365a883670e8f1c1bc66fba79a5c5" +"checksum syn 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "2ae5cd13590144ea968ba5d5520da7a4c08415861014399b5b349f74591c375f" +"checksum synstructure 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)" = "02353edf96d6e4dc81aea2d8490a7e9db177bf8acb0e951c24940bf866cb313f" "checksum term 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "fa63644f74ce96fbeb9b794f66aff2a52d601cbd5e80f4b97123e3899f4570f1" -"checksum termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "689a3bdfaab439fd92bc87df5c4c78417d3cbe537487274e9b0b2dce76e92096" "checksum thread-id 3.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c7fbf4c9d56b320106cd64fd024dadfa0be7cb4706725fc44a7d7ce952d820c1" "checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b" -"checksum time 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)" = "847da467bf0db05882a9e2375934a8a55cffdc9db0d128af1518200260ba1f6c" +"checksum time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f" "checksum traitobject 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "efd1f82c56340fdf16f2a953d7bda4f8fdffba13d93b00844c25572110b26079" "checksum typemap 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "653be63c80a3296da5551e1bfd2cca35227e13cdd08c6668903ae2f4f77aa1f6" -"checksum ucd-util 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "535c204ee4d8434478593480b8f86ab45ec9aae0e83c568ca81abf0fd0e88f86" +"checksum ucd-util 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "fa9b3b49edd3468c0e6565d85783f51af95212b6fa3986a5500954f00b460874" "checksum unescape 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ccb97dac3243214f8d8507998906ca3e2e0b900bf9bf4870477f125b82e68f6e" -"checksum unicode-normalization 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "6a0180bc61fc5a987082bfa111f4cc95c4caff7f9799f3e46df09163a937aa25" +"checksum unicode-normalization 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "141339a08b982d942be2ca06ff8b076563cbe223d1befd5450716790d44e2426" "checksum unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "882386231c45df4700b275c7ff55b6f3698780a650026380e72dabe76fa46526" "checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" +"checksum unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c" "checksum unsafe-any 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f30360d7979f5e9c6e6cea48af192ea8fab4afb3cf72597154b8f08935bc9c7f" -"checksum utf8-ranges 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "796f7e48bef87609f7ade7e06495a87d5cd06c7866e6a5cbfceffc558a243737" -"checksum vcpkg 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "def296d3eb3b12371b2c7d0e83bfe1403e4db2d7a0bba324a12b21c4ee13143d" -"checksum version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "914b1a6776c4c929a602fafd8bc742e06365d4bcbe48c30f9cca5824f70dc9dd" +"checksum utf8-ranges 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "b4ae116fef2b7fea257ed6440d3cfcff7f190865f170cdad00bb6465bf18ecba" +"checksum vcpkg 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "33dd455d0f96e90a75803cfeb7f948768c08d70a6de9a8d2362461935698bf95" "checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" "checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" -"checksum winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "92c1eb33641e276cfa214a0522acad57be5c56b10cb348b3c5117db75f3ac4b0" +"checksum winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)" = "f10e386af2b13e47c89e7236a7a14a086791a2b88ebad6df9bf42040195cf770" "checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" "checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" "checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" -"checksum yaml-rust 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "95acf0db5515d07da9965ec0e0ba6cc2d825e2caeb7303b66ca441729801254e" +"checksum yaml-rust 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "65923dd1784f44da1d2c3dbbc5e822045628c590ba72123e1c73d3c230c4434d" diff --git a/libindy/Cargo.lock b/libindy/Cargo.lock index f77e68fc01..546e0d512f 100644 --- a/libindy/Cargo.lock +++ b/libindy/Cargo.lock @@ -2,7 +2,7 @@ # It is not intended for manual editing. [[package]] name = "aho-corasick" -version = "0.7.4" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -25,16 +25,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "android_log-sys 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "argon2rs" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", - "scoped_threadpool 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -72,7 +63,7 @@ dependencies = [ "backtrace-sys 0.1.30 (registry+https://github.com/rust-lang/crates.io-index)", "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-demangle 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-demangle 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -94,6 +85,14 @@ dependencies = [ "safemem 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "base64" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "bitflags" version = "1.1.0" @@ -107,14 +106,15 @@ dependencies = [ "byte-tools 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "crypto-mac 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "digest 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", - "opaque-debug 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "opaque-debug 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "blake2-rfc" -version = "0.2.18" +name = "blake2b_simd" +version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ + "arrayref 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", "arrayvec 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", "constant_time_eq 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -140,13 +140,13 @@ dependencies = [ [[package]] name = "bstr" -version = "0.2.2" +version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-automata 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.97 (registry+https://github.com/rust-lang/crates.io-index)", + "regex-automata 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -229,11 +229,11 @@ dependencies = [ "rand_xoshiro 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "rayon 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "rayon-core 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.97 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.97 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", "tinytemplate 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "walkdir 2.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "walkdir 2.2.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -251,21 +251,21 @@ name = "crossbeam-deque" version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "crossbeam-epoch 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-epoch 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "crossbeam-epoch" -version = "0.7.1" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "arrayvec 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "memoffset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "memoffset 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "scopeguard 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -273,12 +273,12 @@ name = "crossbeam-queue" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "crossbeam-utils" -version = "0.6.5" +version = "0.6.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", @@ -299,11 +299,11 @@ name = "csv" version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "bstr 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "bstr 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)", "csv-core 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", "ryu 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.97 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -316,14 +316,14 @@ dependencies = [ [[package]] name = "curve25519-dalek" -version = "1.2.1" +version = "1.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "clear_on_drop 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "digest 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "subtle 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "subtle 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -345,7 +345,7 @@ dependencies = [ "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", "strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.39 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -355,7 +355,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "darling_core 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.39 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -365,7 +365,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.39 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -382,7 +382,7 @@ version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_users 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_users 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -392,7 +392,7 @@ version = "1.0.0-pre.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "clear_on_drop 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "curve25519-dalek 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "curve25519-dalek 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", "sha2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -415,8 +415,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "atty 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)", "humantime 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "termcolor 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -476,7 +476,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.39 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)", "synstructure 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -563,11 +563,11 @@ dependencies = [ "indy-sys 1.11.0", "lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "num-derive 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.97 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.97 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -576,8 +576,8 @@ name = "indy-sys" version = "1.11.0" dependencies = [ "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", - "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "vcpkg 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -641,7 +641,7 @@ dependencies = [ "int_traits 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "log-derive 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "log-panics 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "named_type 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -652,8 +652,8 @@ dependencies = [ "rmp-serde 0.13.7 (registry+https://github.com/rust-lang/crates.io-index)", "rusqlite 0.19.0 (registry+https://github.com/rust-lang/crates.io-index)", "rust-base58 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.97 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.97 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", "sha2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "sha3 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -662,7 +662,7 @@ dependencies = [ "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", "ursa 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "uuid 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "zeroize 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)", + "zeroize 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)", "zmq 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -672,7 +672,7 @@ version = "0.0.16" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", - "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -681,7 +681,7 @@ version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cc 1.0.26 (registry+https://github.com/rust-lang/crates.io-index)", - "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", "vcpkg 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -692,7 +692,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "log" -version = "0.4.7" +version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", @@ -704,10 +704,10 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "darling 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.39 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -715,7 +715,7 @@ name = "log-panics" version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -736,8 +736,11 @@ dependencies = [ [[package]] name = "memoffset" -version = "0.2.1" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", +] [[package]] name = "metadeps" @@ -745,7 +748,7 @@ version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "error-chain 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", - "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", "toml 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -807,7 +810,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.39 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -866,7 +869,7 @@ dependencies = [ [[package]] name = "opaque-debug" -version = "0.2.2" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -879,18 +882,18 @@ dependencies = [ "foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl-sys 0.9.48 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl-sys 0.9.49 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "openssl-sys" -version = "0.9.48" +version = "0.9.49" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "autocfg 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "cc 1.0.26 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", - "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", "vcpkg 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -904,7 +907,7 @@ dependencies = [ [[package]] name = "pkg-config" -version = "0.3.14" +version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -915,6 +918,14 @@ dependencies = [ "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "proc-macro2" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "quick-error" version = "1.2.2" @@ -933,6 +944,14 @@ dependencies = [ "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "quote" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "rand" version = "0.3.23" @@ -962,7 +981,7 @@ dependencies = [ "autocfg 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", "rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "rand_hc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand_isaac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "rand_jitter 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", @@ -986,12 +1005,12 @@ name = "rand_core" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rand_core" -version = "0.4.0" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -1016,7 +1035,7 @@ version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1028,9 +1047,9 @@ dependencies = [ "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen 0.2.49 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1040,7 +1059,7 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "autocfg 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1077,7 +1096,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "crossbeam-deque 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", "crossbeam-queue 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "num_cpus 1.10.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1097,30 +1116,29 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "redox_users" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "argon2rs 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "rand_os 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)", + "rust-argon2 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "regex" -version = "1.1.9" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "aho-corasick 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)", + "aho-corasick 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)", "memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-syntax 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)", + "regex-syntax 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", "thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", - "utf8-ranges 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "regex-automata" -version = "0.1.7" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1128,11 +1146,8 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.6.8" +version = "0.6.11" source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "ucd-util 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", -] [[package]] name = "rmp" @@ -1150,7 +1165,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "rmp 0.8.7 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.97 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1167,6 +1182,16 @@ dependencies = [ "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "rust-argon2" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", + "blake2b_simd 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "rust-base58" version = "0.0.4" @@ -1177,9 +1202,17 @@ dependencies = [ [[package]] name = "rustc-demangle" -version = "0.1.15" +version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "rustc_version" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "ryu" version = "1.0.0" @@ -1198,14 +1231,9 @@ dependencies = [ "winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "scoped_threadpool" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "scopeguard" -version = "0.3.3" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -1215,22 +1243,35 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cc 1.0.26 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.97 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "semver" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "semver-parser" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "serde" -version = "1.0.97" +version = "1.0.99" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "serde_derive" -version = "1.0.97" +version = "1.0.99" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.39 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1240,7 +1281,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", "ryu 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.97 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1251,7 +1292,7 @@ dependencies = [ "block-buffer 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", "digest 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "fake-simd 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "opaque-debug 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "opaque-debug 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1263,7 +1304,7 @@ dependencies = [ "byte-tools 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "digest 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "keccak 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "opaque-debug 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "opaque-debug 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1273,7 +1314,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", "libsodium-sys 0.0.16 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.97 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1293,7 +1334,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "subtle" -version = "2.1.0" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -1308,7 +1349,7 @@ dependencies = [ [[package]] name = "syn" -version = "0.15.39" +version = "0.15.44" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1316,6 +1357,16 @@ dependencies = [ "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "syn" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "synom" version = "0.11.3" @@ -1331,7 +1382,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.39 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1340,7 +1391,7 @@ name = "termcolor" version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "wincolor 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "wincolor 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1382,7 +1433,7 @@ name = "tinytemplate" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "serde 1.0.97 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1396,11 +1447,6 @@ name = "typenum" version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "ucd-util" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "unicode-width" version = "0.1.5" @@ -1416,6 +1462,11 @@ name = "unicode-xid" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "unicode-xid" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "ursa" version = "0.1.1" @@ -1430,13 +1481,13 @@ dependencies = [ "generic-array 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)", "int_traits 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "openssl 0.10.24 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", "rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "secp256k1 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.97 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.97 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", "sha2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "sha3 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1444,11 +1495,6 @@ dependencies = [ "zeroize 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "utf8-ranges" -version = "1.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "uuid" version = "0.5.1" @@ -1464,7 +1510,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "walkdir" -version = "2.2.8" +version = "2.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "same-file 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1474,50 +1520,51 @@ dependencies = [ [[package]] name = "wasm-bindgen" -version = "0.2.48" +version = "0.2.49" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "wasm-bindgen-macro 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-macro 0.2.49 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "wasm-bindgen-backend" -version = "0.2.48" +version = "0.2.49" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bumpalo 2.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.39 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-shared 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-shared 0.2.49 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "wasm-bindgen-macro" -version = "0.2.48" +version = "0.2.49" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-macro-support 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-macro-support 0.2.49 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.48" +version = "0.2.49" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.39 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-backend 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-shared 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-backend 0.2.49 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-shared 0.2.49 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.48" +version = "0.2.49" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -1549,7 +1596,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "wincolor" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1563,20 +1610,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "zeroize" -version = "0.9.2" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "zeroize_derive 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "zeroize_derive 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "zeroize_derive" -version = "0.9.0" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.39 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)", "synstructure 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1586,7 +1633,7 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "zmq-sys 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1600,24 +1647,24 @@ dependencies = [ ] [metadata] -"checksum aho-corasick 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)" = "36b7aa1ccb7d7ea3f437cf025a2ab1c47cc6c1bc9fc84918ff449def12f5e282" +"checksum aho-corasick 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)" = "58fb5e95d83b38284460a5fda7d6470aa0b8844d283a0b614b8535e880800d2d" "checksum amcl 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee5cca1ddc8b9dceb55b7f1272a9d1e643d73006f350a20ab4926d24e33f0f0d" "checksum android_log-sys 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b8052e2d8aabbb8d556d6abbcce2a22b9590996c5f849b9c7ce4544a2e3b984e" "checksum android_logger 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "86983875e7c3a202e31471cc6d60fcc18f30e194f1729cfff3bfb43d646ffced" -"checksum argon2rs 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "3f67b0b6a86dae6e67ff4ca2b6201396074996379fba2b92ff649126f37cb392" "checksum arrayref 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "0d382e583f07208808f6b1249e60848879ba3543f57c32277bf52d69c2f0f0ee" "checksum arrayvec 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)" = "b8d73f9beda665eaa98ab9e4f7442bd4e7de6652587de55b2525e52e29c1b0ba" "checksum atty 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)" = "1803c647a3ec87095e7ae7acfca019e98de5ec9a7d01343f611cf3152ed71a90" "checksum autocfg 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "22130e92352b948e7e82a49cdb0aa94f2211761117f29e052dd397c1ac33542b" "checksum backtrace 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)" = "18b65ea1161bfb2dd6da6fade5edd4dbd08fba85012123dd333d2fd1b90b2782" "checksum backtrace-sys 0.1.30 (registry+https://github.com/rust-lang/crates.io-index)" = "5b3a000b9c543553af61bc01cbfc403b04b5caa9e421033866f2e98061eb3e61" +"checksum base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0b25d992356d2eb0ed82172f5248873db5560c4721f564b13cb5193bda5e668e" "checksum base64 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "96434f987501f0ed4eb336a411e0631ecd1afa11574fe148587adc4ff96143c9" "checksum bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3d155346769a6855b86399e9bc3814ab343cd3d62c7e985113d46a0ec3c281fd" "checksum blake2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "91721a6330935673395a0607df4d49a9cb90ae12d259f1b3e0a3f6e1d486872e" -"checksum blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)" = "5d6d530bdd2d52966a6d03b7a964add7ae1a288d25214066fd4b600f0f796400" +"checksum blake2b_simd 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "461f4b879a8eb70c1debf7d0788a9a5ff15f1ea9d25925fea264ef4258bed6b2" "checksum block-buffer 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c0940dc441f31689269e10ac70eb1002a3a1d3ad1390e030043662eb7fe4688b" "checksum block-padding 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "6d4dc3af3ee2e12f3e5d224e5e1e3d73668abbeb69e566d361f7d5563a4fdf09" -"checksum bstr 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "fc0662252f9bba48c251a16d16a768b9fcd959593bde07544710bce6efe60b7a" +"checksum bstr 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "94cdf78eb7e94c566c1f5dbe2abf8fc70a548fc902942a48c4b3a98b48ca9ade" "checksum bumpalo 2.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2cd43d82f27d68911e6ee11ee791fb248f138f5d69424dc02e098d4f152b0b05" "checksum byte-tools 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7" "checksum byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a7c3dd8985a7111efc5c80b44e23ecdd8c007de8ade3b96595387e812b957cf5" @@ -1631,13 +1678,13 @@ dependencies = [ "checksum criterion 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "0363053954f3e679645fc443321ca128b7b950a6fe288cf5f9335cc22ee58394" "checksum criterion-plot 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "76f9212ddf2f4a9eb2d401635190600656a1f88a932ef53d06e7fa4c7e02fb8e" "checksum crossbeam-deque 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "05e44b8cf3e1a625844d1750e1f7820da46044ff6d28f4d43e455ba3e5bb2c13" -"checksum crossbeam-epoch 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "04c9e3102cc2d69cd681412141b390abd55a362afc1540965dad0ad4d34280b4" +"checksum crossbeam-epoch 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "fedcd6772e37f3da2a9af9bf12ebe046c0dfe657992377b4df982a2b54cd37a9" "checksum crossbeam-queue 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7c979cd6cfe72335896575c6b5688da489e420d36a27a0b9eb0c73db574b4a4b" -"checksum crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "f8306fcef4a7b563b76b7dd949ca48f52bc1141aa067d2ea09565f3e2652aa5c" +"checksum crossbeam-utils 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)" = "04973fa96e96579258a5091af6003abde64af786b860f18622b82e026cca60e6" "checksum crypto-mac 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4434400df11d95d556bac068ddfedd482915eb18fe8bea89bc80b6e4b1c179e5" "checksum csv 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "37519ccdfd73a75821cac9319d4fce15a81b9fcf75f951df5b9988aa3a0af87d" "checksum csv-core 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "9b5cadb6b25c77aeff80ba701712494213f4a8418fcda2ee11b6560c3ad0bf4c" -"checksum curve25519-dalek 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "5d4b820e8711c211745880150f5fac78ab07d6e3851d8ce9f5a02cedc199174c" +"checksum curve25519-dalek 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8b7dcd30ba50cdf88b55b033456138b7c0ac4afdc436d82e1b79f370f24cc66d" "checksum darling 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fcfbcb0c5961907597a7d1148e3af036268f2b773886b8bb3eeb1e1281d3d3d6" "checksum darling_core 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6afc018370c3bff3eb51f89256a6bdb18b4fdcda72d577982a14954a7a0b402c" "checksum darling_macro 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c6d8dac1c6f1d29a41c4712b4400f878cb4fcc4c7628f298dd75038e024998d1" @@ -1678,12 +1725,12 @@ dependencies = [ "checksum libsodium-sys 0.0.16 (registry+https://github.com/rust-lang/crates.io-index)" = "fcbd1beeed8d44caa8a669ebaa697c313976e242c03cc9fb23d88bf1656f5542" "checksum libsqlite3-sys 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)" = "72b1e07fcc60484f42e246f0cf1f133940c98117c81b2cefcdf71be288069680" "checksum linked-hash-map 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "ae91b68aebc4ddb91978b11a1b02ddd8602a05ec19002801c5666000e05e0f83" -"checksum log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)" = "c275b6ad54070ac2d665eef9197db647b32239c9d244bfb6f041a766d00da5b3" +"checksum log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)" = "14b6052be84e6b71ab17edffc2eeabf5c2c3ae1fdb464aae35ac50c67a44e1f7" "checksum log-derive 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "90b7e153f2d4bf69d46a9e640e2c96573940fca671d275bf6f7687f6bab803fc" "checksum log-panics 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ae0136257df209261daa18d6c16394757c63e032e27aafd8b07788b051082bef" "checksum lru-cache 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "31e24f1ad8321ca0e8a1e0ac13f23cb668e6f5466c2c57319f6a5cf1cc8e3b1c" "checksum memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "88579771288728879b57485cc7d6b07d648c9f0141eb955f8ab7f9d45394468e" -"checksum memoffset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0f9dc261e2b62d7a622bf416ea3c5245cdd5d9a7fcc428c0d06804dfce1775b3" +"checksum memoffset 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ce6075db033bbbb7ee5a0bbd3a3186bbae616f57fb001c485c7ff77955f8177f" "checksum metadeps 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "73b122901b3a675fac8cecf68dcb2f0d3036193bc861d1ac0e1c337f7d5254c2" "checksum named_type 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c39ac6c5ee13bf558879a82198b0afe84989cf3f7fb7592b56d73eb1a50c9e66" "checksum named_type_derive 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "651d7e408d728ded66748986dc046156dbc7bd25add9ea334bcf762c7a83e14a" @@ -1698,21 +1745,23 @@ dependencies = [ "checksum num-traits 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)" = "92e5113e9fd4cc14ded8e499429f396a20f98c772a47cc8622a736e1ec843c31" "checksum num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "6ba9a427cfca2be13aa6f6403b0b7e7368fe982bfa16fccc450ce74c46cd9b32" "checksum num_cpus 1.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "bcef43580c035376c0705c42792c294b66974abbfd2789b511784023f71f3273" -"checksum opaque-debug 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "93f5bb2e8e8dec81642920ccff6b61f1eb94fa3020c5a325c9851ff604152409" +"checksum opaque-debug 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c" "checksum openssl 0.10.24 (registry+https://github.com/rust-lang/crates.io-index)" = "8152bb5a9b5b721538462336e3bef9a539f892715e5037fda0f984577311af15" -"checksum openssl-sys 0.9.48 (registry+https://github.com/rust-lang/crates.io-index)" = "b5ba300217253bcc5dc68bed23d782affa45000193866e025329aa8a7a9f05b8" +"checksum openssl-sys 0.9.49 (registry+https://github.com/rust-lang/crates.io-index)" = "f4fad9e54bd23bd4cbbe48fdc08a1b8091707ac869ef8508edea2fec77dcc884" "checksum owning_ref 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "49a4b8ea2179e6a2e27411d3bca09ca6dd630821cf6894c6c7c8467a8ee7ef13" -"checksum pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)" = "676e8eb2b1b4c9043511a9b7bea0915320d7e502b0a079fb03f9635a5252b18c" +"checksum pkg-config 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "a7c1d2cfa5a714db3b5f24f0915e74fcdf91d09d496ba61329705dda7774d2af" "checksum proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)" = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759" +"checksum proc-macro2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4c5c2380ae88876faae57698be9e9775e3544decad214599c3a6266cca6ac802" "checksum quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9274b940887ce9addde99c4eee6b5c44cc494b182b97e73dc8ffdcb3397fd3f0" "checksum quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a" "checksum quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)" = "6ce23b6b870e8f94f81fb0a363d65d86675884b34a09043c81e5562f11c1f8e1" +"checksum quote 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "49d77c41ca8767f2f41394c11a4eebccab83da25e7cc035387a3125f02be90a3" "checksum rand 0.3.23 (registry+https://github.com/rust-lang/crates.io-index)" = "64ac302d8f83c0c1974bf758f6b041c6c8ada916fbb44a609158ca8b064cc76c" "checksum rand 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "552840b97013b1a26992c11eac34bdd778e464601a4c2054b5f0bff7c6761293" "checksum rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "6d71dacdc3c88c1fde3885a3be3fbab9f35724e6ce99467f7d9c5026132184ca" "checksum rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "556d3a1ca6600bfcbab7c7c91ccb085ac7fbbcd70e008a98742e7847f4f7bcef" "checksum rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b" -"checksum rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d0e7a549d590831370895ab7ba4ea0c1b6b011d106b5ff2da6eee112615e6dc0" +"checksum rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc" "checksum rand_hc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7b40677c7be09ae76218dc623efbf7b18e34bced3f38883af07bb75630a21bc4" "checksum rand_isaac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ded997c9d5f13925be2a6fd7e66bf1872597f759fd9dd93513dd7e92e5a5ee08" "checksum rand_jitter 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "1166d5c91dc97b88d1decc3285bb0a99ed84b05cfd0bc2341bdf2d43fc41e39b" @@ -1724,23 +1773,26 @@ dependencies = [ "checksum rayon-core 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ebbe0df8435ac0c397d467b6cad6d25543d06e8a019ef3f6af3c384597515bd2" "checksum rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2" "checksum redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)" = "2439c63f3f6139d1b57529d16bc3b8bb855230c8efcc5d3a896c8bea7c3b1e84" -"checksum redox_users 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3fe5204c3a17e97dde73f285d49be585df59ed84b50a872baf416e73b62c3828" -"checksum regex 1.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "d9d8297cc20bbb6184f8b45ff61c8ee6a9ac56c156cec8e38c3e5084773c44ad" -"checksum regex-automata 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "3ed09217220c272b29ef237a974ad58515bde75f194e3ffa7e6d0bf0f3b01f86" -"checksum regex-syntax 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)" = "9b01330cce219c1c6b2e209e5ed64ccd587ae5c67bed91c0b49eecf02ae40e21" +"checksum redox_users 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4ecedbca3bf205f8d8f5c2b44d83cd0690e39ee84b951ed649e9f1841132b66d" +"checksum regex 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "88c3d9193984285d544df4a30c23a4e62ead42edf70a4452ceb76dac1ce05c26" +"checksum regex-automata 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "92b73c2a1770c255c240eaa4ee600df1704a38dc3feaa6e949e7fcd4f8dc09f9" +"checksum regex-syntax 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)" = "b143cceb2ca5e56d5671988ef8b15615733e7ee16cd348e064333b251b89343f" "checksum rmp 0.8.7 (registry+https://github.com/rust-lang/crates.io-index)" = "a3d45d7afc9b132b34a2479648863aa95c5c88e98b32285326a6ebadc80ec5c9" "checksum rmp-serde 0.13.7 (registry+https://github.com/rust-lang/crates.io-index)" = "011e1d58446e9fa3af7cdc1fb91295b10621d3ac4cb3a85cc86385ee9ca50cd3" "checksum rusqlite 0.19.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6ebca2e7e3deb7241b7fa5929c088548c590728b1b740c479594c23f813eb8a7" +"checksum rust-argon2 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4ca4eaef519b494d1f2848fc602d18816fed808a981aedf4f1f00ceb7c9d32cf" "checksum rust-base58 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "b313b91fcdc6719ad41fa2dad2b7e810b03833fae4bf911950e15529a5f04439" -"checksum rustc-demangle 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)" = "a7f4dccf6f4891ebcc0c39f9b6eb1a83b9bf5d747cb439ec6fba4f3b977038af" +"checksum rustc-demangle 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "4c691c0e608126e00913e33f0ccf3727d5fc84573623b8d65b2df340b5201783" +"checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" "checksum ryu 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c92464b447c0ee8c4fb3824ecc8383b81717b9f1e74ba2e72540aef7b9f82997" "checksum safemem 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e27a8b19b835f7aea908818e871f5cc3a5a186550c30773be987e155e8163d8f" "checksum same-file 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "585e8ddcedc187886a30fa705c47985c3fa88d06624095856b36ca0b82ff4421" -"checksum scoped_threadpool 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "1d51f5df5af43ab3f1360b429fa5e0152ac5ce8c0bd6485cae490332e96846a8" -"checksum scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "94258f53601af11e6a49f722422f6e3425c52b06245a5cf9bc09908b174f5e27" +"checksum scopeguard 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b42e15e59b18a828bbf5c58ea01debb36b9b096346de35d941dcb89009f24a0d" "checksum secp256k1 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)" = "bfaccd3a23619349e0878d9a241f34b1982343cdf67367058cd7d078d326b63e" -"checksum serde 1.0.97 (registry+https://github.com/rust-lang/crates.io-index)" = "d46b3dfedb19360a74316866cef04687cd4d6a70df8e6a506c63512790769b72" -"checksum serde_derive 1.0.97 (registry+https://github.com/rust-lang/crates.io-index)" = "c22a0820adfe2f257b098714323563dd06426502abbbce4f51b72ef544c5027f" +"checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" +"checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" +"checksum serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)" = "fec2851eb56d010dc9a21b89ca53ee75e6528bab60c11e89d38390904982da9f" +"checksum serde_derive 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)" = "cb4dc18c61206b08dc98216c98faa0232f4337e1e1b8574551d5bad29ea1b425" "checksum serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)" = "051c49229f282f7c6f3813f8286cc1e3323e8051823fce42c7ea80fe13521704" "checksum sha2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7b4d8bfd0e469f417657573d8451fb33d16cfe0989359b93baf3a1ffc639543d" "checksum sha3 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dd26bc0e7a2e3a7c959bc494caf58b72ee0c71d67704e9520f736ca7e4853ecf" @@ -1748,9 +1800,10 @@ dependencies = [ "checksum stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dba1a27d3efae4351c8051072d619e3ade2820635c3958d826bfea39d59b54c8" "checksum strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bb4f380125926a99e52bc279241539c018323fab05ad6368b56f93d9369ff550" "checksum subtle 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2d67a5a62ba6e01cb2192ff309324cb4875d0c451d55fe2319433abe7a05a8ee" -"checksum subtle 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "01dca13cf6c3b179864ab3292bd794e757618d35a7766b7c46050c614ba00829" +"checksum subtle 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "01f40907d9ffc762709e4ff3eb4a6f6b41b650375a3f09ac92b641942b7fb082" "checksum syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)" = "d3b891b9015c88c576343b9b3e41c2c11a51c219ef067b264bd9c8aa9b441dad" -"checksum syn 0.15.39 (registry+https://github.com/rust-lang/crates.io-index)" = "b4d960b829a55e56db167e861ddb43602c003c7be0bee1d345021703fac2fb7c" +"checksum syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)" = "9ca4b3b69a77cbe1ffc9e198781b7acb0c7365a883670e8f1c1bc66fba79a5c5" +"checksum syn 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "2ae5cd13590144ea968ba5d5520da7a4c08415861014399b5b349f74591c375f" "checksum synom 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a393066ed9010ebaed60b9eafa373d4b1baac186dd7e008555b0f702b51945b6" "checksum synstructure 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)" = "02353edf96d6e4dc81aea2d8490a7e9db177bf8acb0e951c24940bf866cb313f" "checksum termcolor 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "96d6098003bde162e4277c70665bd87c326f5a0c3f3fbfb285787fa482d54e6e" @@ -1761,27 +1814,26 @@ dependencies = [ "checksum tinytemplate 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4574b75faccaacddb9b284faecdf0b544b80b6b294f3d062d325c5726a209c20" "checksum toml 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "736b60249cb25337bc196faa43ee12c705e426f3d55c214d73a4e7be06f92cb4" "checksum typenum 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "612d636f949607bdf9b123b4a6f6d966dedf3ff669f7f045890d3a4a73948169" -"checksum ucd-util 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "535c204ee4d8434478593480b8f86ab45ec9aae0e83c568ca81abf0fd0e88f86" "checksum unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "882386231c45df4700b275c7ff55b6f3698780a650026380e72dabe76fa46526" "checksum unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f860d7d29cf02cb2f3f359fd35991af3d30bac52c57d265a3c461074cb4dc" "checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" +"checksum unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c" "checksum ursa 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9081683a6861bee60c4005c280dafd50c6ee9c2ffd14935865f72658e5f2d9f8" -"checksum utf8-ranges 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "9d50aa7650df78abf942826607c62468ce18d9019673d4a2ebe1865dbb96ffde" "checksum uuid 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "bcc7e3b898aa6f6c08e5295b6c89258d1331e9ac578cc992fb818759951bdc22" "checksum vcpkg 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "33dd455d0f96e90a75803cfeb7f948768c08d70a6de9a8d2362461935698bf95" -"checksum walkdir 2.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "c7904a7e2bb3cdf0cf5e783f44204a85a37a93151738fa349f06680f59a98b45" -"checksum wasm-bindgen 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)" = "4de97fa1806bb1a99904216f6ac5e0c050dc4f8c676dc98775047c38e5c01b55" -"checksum wasm-bindgen-backend 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)" = "5d82c170ef9f5b2c63ad4460dfcee93f3ec04a9a36a4cc20bc973c39e59ab8e3" -"checksum wasm-bindgen-macro 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)" = "f07d50f74bf7a738304f6b8157f4a581e1512cd9e9cdb5baad8c31bbe8ffd81d" -"checksum wasm-bindgen-macro-support 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)" = "95cf8fe77e45ba5f91bc8f3da0c3aa5d464b3d8ed85d84f4d4c7cc106436b1d7" -"checksum wasm-bindgen-shared 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)" = "d9c2d4d4756b2e46d3a5422e06277d02e4d3e1d62d138b76a4c681e925743623" +"checksum walkdir 2.2.9 (registry+https://github.com/rust-lang/crates.io-index)" = "9658c94fa8b940eab2250bd5a457f9c48b748420d71293b165c8cdbe2f55f71e" +"checksum wasm-bindgen 0.2.49 (registry+https://github.com/rust-lang/crates.io-index)" = "220f01bcb6b306c063e3283f97dd974bcab4e5affed2b654bae1a22d0d99c3aa" +"checksum wasm-bindgen-backend 0.2.49 (registry+https://github.com/rust-lang/crates.io-index)" = "8894c95e23cc5082786192ebbd2ac0e31e9f77a022132ba03e8b8de32a2323c6" +"checksum wasm-bindgen-macro 0.2.49 (registry+https://github.com/rust-lang/crates.io-index)" = "ec031a3190c51dda28c9f3623e2674e58c79f6d88c020c2157417fcf62298a3f" +"checksum wasm-bindgen-macro-support 0.2.49 (registry+https://github.com/rust-lang/crates.io-index)" = "3b7cad0ab0bb5fefbb770279f522dcebb6433585174d93ea648390f61db57401" +"checksum wasm-bindgen-shared 0.2.49 (registry+https://github.com/rust-lang/crates.io-index)" = "9142625bbb0d70710b3f2a6b20924c80fa182b05888b6bd21600ab9075673563" "checksum winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)" = "f10e386af2b13e47c89e7236a7a14a086791a2b88ebad6df9bf42040195cf770" "checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" "checksum winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7168bab6e1daee33b4557efd0e95d5ca70a03706d39fa5f3fe7a236f584b03c9" "checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" -"checksum wincolor 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "561ed901ae465d6185fa7864d63fbd5720d0ef718366c9a4dc83cf6170d7e9ba" +"checksum wincolor 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "96f5016b18804d24db43cebf3c77269e7569b8954a8464501c216cc5e070eaa9" "checksum zeroize 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "8ddfeb6eee2fb3b262ef6e0898a52b7563bb8e0d5955a313b3cf2f808246ea14" -"checksum zeroize 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4177936c03b5a349c1b8e4509c46add268e66bc66fe92663729fa0570fe4f213" -"checksum zeroize_derive 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "afd1469e4bbca3b96606d26ba6e9bd6d3aed3b1299c82b92ec94377d22d78dbc" +"checksum zeroize 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)" = "45af6a010d13e4cf5b54c94ba5a2b2eba5596b9e46bf5875612d332a1f2b3f86" +"checksum zeroize_derive 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)" = "080616bd0e31f36095288bb0acdf1f78ef02c2fa15527d7e993f2a6c7591643e" "checksum zmq 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8ff1c5e9ff4ac9c2847b2e72ada1c1eb3e188adb49fe3f1dd3bbcdc47f414d17" "checksum zmq-sys 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)" = "4b770cf495ad41e920ab25c465f35b7eec09d0ce8d7c892a7c8334a5e0de037c" From cda1fe7998ebae69e027f899b62b44d73aaace10 Mon Sep 17 00:00:00 2001 From: "artem.ivanov" Date: Mon, 19 Aug 2019 09:07:44 +0300 Subject: [PATCH 258/320] Fixed broken test Signed-off-by: artem.ivanov --- libindy/tests/wallet.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/libindy/tests/wallet.rs b/libindy/tests/wallet.rs index e2a90a6539..e75cba13ef 100644 --- a/libindy/tests/wallet.rs +++ b/libindy/tests/wallet.rs @@ -584,8 +584,6 @@ mod medium_cases { Setup::empty(); let config = r#"{"field":"value"}"#; - - wallet::create_wallet(&config, WALLET_CREDENTIALS).unwrap(); let res = wallet::open_wallet(config, WALLET_CREDENTIALS); assert_code!(ErrorCode::CommonInvalidStructure, res); } From 12a4db6a0eed8e2c61c34e898fa8f3e7d08123a1 Mon Sep 17 00:00:00 2001 From: "artem.ivanov" Date: Mon, 19 Aug 2019 09:08:16 +0300 Subject: [PATCH 259/320] Removed part of Medium Cases tests from ObjectiveC wrapper Signed-off-by: artem.ivanov --- .../Case Tests/Anoncreds/AnoncredsHighCases.m | 351 ------------------ .../Anoncreds/AnoncredsMediumCasesDemos.m | 263 ------------- .../Case Tests/Crypto/CryptoHighCases.mm | 20 - .../Case Tests/Did/DidHighCases.m | 53 --- .../Case Tests/Ledger/LedgerSendRequests.mm | 113 ------ .../Case Tests/Pairwise/PairwiseHighCases.m | 17 - .../Case Tests/Payment/PaymentHighCases.mm | 12 - .../Case Tests/Wallet/PluggedWallet.m | 170 --------- .../Case Tests/Wallet/PluggedWallet.mm | 19 - 9 files changed, 1018 deletions(-) delete mode 100644 wrappers/ios/libindy-pod/Indy-demoTests/Case Tests/Wallet/PluggedWallet.m delete mode 100644 wrappers/ios/libindy-pod/Indy-demoTests/Case Tests/Wallet/PluggedWallet.mm diff --git a/wrappers/ios/libindy-pod/Indy-demoTests/Case Tests/Anoncreds/AnoncredsHighCases.m b/wrappers/ios/libindy-pod/Indy-demoTests/Case Tests/Anoncreds/AnoncredsHighCases.m index 48a0b95ddc..20e8e0fa71 100644 --- a/wrappers/ios/libindy-pod/Indy-demoTests/Case Tests/Anoncreds/AnoncredsHighCases.m +++ b/wrappers/ios/libindy-pod/Indy-demoTests/Case Tests/Anoncreds/AnoncredsHighCases.m @@ -40,32 +40,6 @@ - (void)testIssuerCreateAndStoreCredentialDefWorks { XCTAssertEqual(ret.code, Success, @"AnoncredsUtils::initializeCommonWalletAndReturnHandle failed"); } -- (void)testIssuerCreateAndStoreCredentialDefWorksForInvalidWallet { - // 1. init commmon wallet - IndyHandle walletHandle = 0; - ret = [[AnoncredsUtils sharedInstance] initializeCommonWalletAndReturnHandle:&walletHandle - credentialDefJson:nil - credentialOfferJson:nil - credentialReqJson:nil - credentialJson:nil]; - XCTAssertEqual(ret.code, Success, @"AnoncredsUtils::initializeCommonWalletAndReturnHandle failed"); - - // 2. Create credential definition - IndyHandle invalidWalletHandle = walletHandle + 100; - - NSString *credentialDefId; - NSString *credentialDefJSON; - ret = [[AnoncredsUtils sharedInstance] issuerCreateAndStoreCredentialDefForSchema:[[AnoncredsUtils sharedInstance] getGvtSchemaJson] - issuerDID:[TestUtils issuerDid] - tag:[TestUtils tag] - type:nil - configJSON:[[AnoncredsUtils sharedInstance] defaultCredentialDefConfig] - walletHandle:invalidWalletHandle - credDefId:&credentialDefId - credDefJson:&credentialDefJSON]; - XCTAssertEqual(ret.code, WalletInvalidHandle, @"AnoncredsUtils::issuerCreateCredentialDefinifionWithWalletHandle failed: returned wrong error code"); -} - // MARK: - Prover create master secret - (void)testProverCreateMasterSecretWorks { @@ -78,26 +52,6 @@ - (void)testProverCreateMasterSecretWorks { XCTAssertEqual(ret.code, Success, @"AnoncredsUtils::initializeCommonWalletAndReturnHandle failed with code:%ld", (long) ret.code); } -- (void)testProverCreateMasterSecretWorksInvalidWalletHandle { - IndyHandle walletHandle = 0; - - // 1. get wallet handle - ret = [[AnoncredsUtils sharedInstance] initializeCommonWalletAndReturnHandle:&walletHandle - credentialDefJson:nil - credentialOfferJson:nil - credentialReqJson:nil - credentialJson:nil]; - XCTAssertEqual(ret.code, Success, @"AnoncredsUtils::initializeCommonWalletAndReturnHandle failed with code:%ld", (long) ret.code); - - // 2. create master secret - IndyHandle invalidWalletHandle = walletHandle + 1; - ret = [[AnoncredsUtils sharedInstance] proverCreateMasterSecret:nil - walletHandle:invalidWalletHandle - outMasterSecretId:nil]; - XCTAssertEqual(ret.code, WalletInvalidHandle, @"AnoncredsUtils::proverCreateMasterSecret returned not WalletInvalidHandle code:%ld", (long) ret.code); - -} - // MARK: - Prover create credential request - (void)testProverCreateCredentialRequestWorks { // 1. init commmon wallet @@ -109,34 +63,6 @@ - (void)testProverCreateCredentialRequestWorks { XCTAssertEqual(ret.code, Success, @"AnoncredsUtils::initializeCommonWalletAndReturnHandle failed with code:%ld", (long) ret.code); } -- (void)testProverCreateCredentialReqWorksForInvalidWallet { - IndyHandle walletHandle = 0; - NSString *credentialDef; - NSString *credentialOffer; - - // 1. get wallet handle - ret = [[AnoncredsUtils sharedInstance] initializeCommonWalletAndReturnHandle:&walletHandle - credentialDefJson:&credentialDef - credentialOfferJson:&credentialOffer - credentialReqJson:nil - credentialJson:nil]; - XCTAssertEqual(ret.code, Success, @"AnoncredsUtils::initializeCommonWalletAndReturnHandle failed"); - - // 2. create and store credential requets - IndyHandle invalidWalletHandle = walletHandle + 1; - NSString *credentialRequestJson; - NSString *credentialRequestMetadataJson; - ret = [[AnoncredsUtils sharedInstance] proverCreateCredentialReqForCredentialOffer:credentialOffer - credentialDefJSON:credentialDef - proverDID:[TestUtils proverDid] - masterSecretID:[TestUtils commonMasterSecretName] - walletHandle:invalidWalletHandle - credReqJson:&credentialRequestJson - credReqMetadataJson:&credentialRequestMetadataJson]; - XCTAssertEqual(ret.code, WalletInvalidHandle, @"AnoncredsUtils::proverCreateAndStoreCredentialReq failed"); - -} - // MARK: - Issuer create credential - (void)testIssuerCreateCredentialWorks { @@ -149,62 +75,6 @@ - (void)testIssuerCreateCredentialWorks { XCTAssertEqual(ret.code, Success, @"AnoncredsUtils::initializeCommonWalletAndReturnHandle failed"); } -- (void)testIssuerCreateCredentialWorksForCredentialDoesNotCorrespondToCredentialValues { - IndyHandle walletHandle = 0; - - // 1. get wallet handle - NSString *credentialRequest; - NSString *credentialOffer; - ret = [[AnoncredsUtils sharedInstance] initializeCommonWalletAndReturnHandle:&walletHandle - credentialDefJson:nil - credentialOfferJson:&credentialOffer - credentialReqJson:&credentialRequest - credentialJson:nil]; - XCTAssertEqual(ret.code, Success, @"AnoncredsUtils::initializeCommonWalletAndReturnHandle failed"); - - // 2. create credential - NSString *credentialJson; - ret = [[AnoncredsUtils sharedInstance] issuerCreateCredentialForCredentialRequest:credentialRequest - credOfferJSON:credentialOffer - credValuesJSON:[[AnoncredsUtils sharedInstance] getXyzCredentialValuesJson] - revRegId:nil - blobStorageReaderHandle:nil - walletHandle:walletHandle - credJson:&credentialJson - credRevocId:nil - revocRegDeltaJSON:nil]; - XCTAssertEqual(ret.code, CommonInvalidStructure, @"AnoncredsUtils::issuerCreateCredentialWithWalletHandle returned wrong code"); -} - -- (void)testIssuerCreateCredentialWorksForInvalidWalletHandle { - IndyHandle walletHandle = 0; - - // 1. get wallet handle - NSString *credentialRequest; - NSString *credentialOffer; - ret = [[AnoncredsUtils sharedInstance] initializeCommonWalletAndReturnHandle:&walletHandle - credentialDefJson:nil - credentialOfferJson:&credentialOffer - credentialReqJson:&credentialRequest - credentialJson:nil]; - XCTAssertEqual(ret.code, Success, @"AnoncredsUtils::initializeCommonWalletAndReturnHandle failed"); - - // 2. create credential - IndyHandle invalidWalletHandle = walletHandle + 1; - - NSString *credentialJson; - ret = [[AnoncredsUtils sharedInstance] issuerCreateCredentialForCredentialRequest:credentialRequest - credOfferJSON:credentialOffer - credValuesJSON:[[AnoncredsUtils sharedInstance] getGvtCredentialValuesJson] - revRegId:nil - blobStorageReaderHandle:nil - walletHandle:invalidWalletHandle - credJson:&credentialJson - credRevocId:nil - revocRegDeltaJSON:nil]; - XCTAssertEqual(ret.code, WalletInvalidHandle, @"AnoncredsUtils::issuerCreateCredentialWithWalletHandle returned wrong error code."); -} - // MARK: - Prover store credential - (void)testProverStoreCredentialWorks { @@ -217,56 +87,6 @@ - (void)testProverStoreCredentialWorks { XCTAssertEqual(ret.code, Success, @"AnoncredsUtils::initializeCommonWalletAndReturnHandle failed"); } -- (void)testProverStoreCredentialWorksForInvalidWalletHandle { - IndyHandle walletHandle = 0; - NSString *credentialDefJson; - NSString *credentialOfferJson; - NSString *credentialJson; - - // 1. get wallet handle - ret = [[AnoncredsUtils sharedInstance] initializeCommonWalletAndReturnHandle:&walletHandle - credentialDefJson:&credentialDefJson - credentialOfferJson:&credentialOfferJson - credentialReqJson:nil - credentialJson:nil]; - XCTAssertEqual(ret.code, Success, @"AnoncredsUtils::initializeCommonWalletAndReturnHandle failed"); - - // 2. get credential request - NSString *credentialRequest; - NSString *credentialRequestMetadata; - ret = [[AnoncredsUtils sharedInstance] proverCreateCredentialReqForCredentialOffer:credentialOfferJson - credentialDefJSON:credentialDefJson - proverDID:[TestUtils proverDid] - masterSecretID:[TestUtils commonMasterSecretName] - walletHandle:walletHandle - credReqJson:&credentialRequest - credReqMetadataJson:&credentialRequestMetadata]; - XCTAssertEqual(ret.code, Success, @"AnoncredsUtils::proverCreateAndStoreCredentialReq failed"); - - // 4. create credential - ret = [[AnoncredsUtils sharedInstance] issuerCreateCredentialForCredentialRequest:credentialRequest - credOfferJSON:credentialOfferJson - credValuesJSON:[[AnoncredsUtils sharedInstance] getGvtCredentialValuesJson] - revRegId:nil - blobStorageReaderHandle:nil - walletHandle:walletHandle - credJson:&credentialJson - credRevocId:nil - revocRegDeltaJSON:nil]; - XCTAssertEqual(ret.code, Success, @"AnoncredsUtils::issuerCreateCredentialWithWalletHandle failed"); - - // 5. store credential - IndyHandle invalidWalletHandle = walletHandle + 1; - ret = [[AnoncredsUtils sharedInstance] proverStoreCredential:credentialJson - credID:[[AnoncredsUtils sharedInstance] credentialId1] - credReqMetadataJSON:credentialRequestMetadata - credDefJSON:credentialDefJson - revRegDefJSON:nil - walletHandle:invalidWalletHandle - outCredId:nil]; - XCTAssertEqual(ret.code, WalletInvalidHandle, @"AnoncredsUtils::proverStoreCredentialWithWalletHandle failed"); -} - // MARK: - Prover get credential - (void)testProverGetCredentialWorks { @@ -343,31 +163,6 @@ - (void)testProverGetCredentialsWorksForFilterByIssuerDid { XCTAssertEqual([credentials count], 1, @"credentials count != 1"); } -- (void)testProverGetCredentialsWorksForFilterByCredentialDefId { - IndyHandle walletHandle = 0; - - // 1. get wallet handle - ret = [[AnoncredsUtils sharedInstance] initializeCommonWalletAndReturnHandle:&walletHandle - credentialDefJson:nil - credentialOfferJson:nil - credentialReqJson:nil - credentialJson:nil]; - XCTAssertEqual(ret.code, Success, @"AnoncredsUtils::initializeCommonWalletAndReturnHandle failed"); - - // 2. get credentials - NSString *credentialsJson; - NSString *filter = [NSString stringWithFormat:@"{\"cred_def_id\":\"%@\"}", [[AnoncredsUtils sharedInstance] getIssuer1GvtCredDefId]]; - ret = [[AnoncredsUtils sharedInstance] proverGetCredentialsForFilter:filter - walletHandle:walletHandle - credentilsJson:&credentialsJson]; - XCTAssertEqual(ret.code, Success, @"AnoncredsUtils::proverGetCredentialsForWalletHandle failed"); - - NSDictionary *credentialsDict = [NSDictionary fromString:credentialsJson]; - NSArray *credentials = (NSArray *) credentialsDict; - - XCTAssertEqual([credentials count], 1, @"credentials count != 1"); -} - - (void)testProverGetCredentialsWorksForEmptyResult { IndyHandle walletHandle = 0; @@ -392,26 +187,6 @@ - (void)testProverGetCredentialsWorksForEmptyResult { XCTAssertEqual([credentials count], 0, @"credentials count != 0"); } -- (void)testProverGetCredentialsWorksForInvalidWalletHandle { - IndyHandle walletHandle = 0; - - // 1. get wallet handle - ret = [[AnoncredsUtils sharedInstance] initializeCommonWalletAndReturnHandle:&walletHandle - credentialDefJson:nil - credentialOfferJson:nil - credentialReqJson:nil - credentialJson:nil]; - XCTAssertEqual(ret.code, Success, @"AnoncredsUtils::initializeCommonWalletAndReturnHandle failed"); - - // 2. get credentials - NSString *credentialsJson; - IndyHandle invalidWalletHandle = walletHandle + 1; - ret = [[AnoncredsUtils sharedInstance] proverGetCredentialsForFilter:@"{}" - walletHandle:invalidWalletHandle - credentilsJson:&credentialsJson]; - XCTAssertEqual(ret.code, WalletInvalidHandle, @"AnoncredsUtils::proverGetCredentialsForWalletHandle returned wrong code"); -} - // MARK: - Prover credentials search - (void)testProverCredentialSearchWorks { @@ -490,43 +265,6 @@ - (void)testProverGetCredentialsForProofReqWorksForRevealedAttr { XCTAssertEqual([credentials[@"attrs"][@"attr1_referent"] count], 2, @"attr1_referent length != 2"); } -- (void)testProverGetCredentialsForProofReqWorksForNotFoundAttribute { - IndyHandle walletHandle = 0; - - // 1. get wallet handle - ret = [[AnoncredsUtils sharedInstance] initializeCommonWalletAndReturnHandle:&walletHandle - credentialDefJson:nil - credentialOfferJson:nil - credentialReqJson:nil - credentialJson:nil]; - XCTAssertEqual(ret.code, Success, @"AnoncredsUtils::initializeCommonWalletAndReturnHandle failed"); - - // 2. get credentials - NSString *proofRequest = [[AnoncredsUtils sharedInstance] toJson:@{ - @"nonce": @"123432421212", - @"name": @"proof_req_1", - @"version": @"0.1", - @"requested_attributes": @{ - @"attr1_referent": @{ - @"name": @"some_attr" - } - }, - @"requested_predicates": @{} - }]; - - NSString *credentialsJson; - ret = [[AnoncredsUtils sharedInstance] proverGetCredentialsForProofReq:proofRequest - walletHandle:walletHandle - credentialsJson:&credentialsJson]; - XCTAssertEqual(ret.code, Success, @"AnoncredsUtils::proverGetCredentialsForProofReqWithWalletHandle returned wrong code"); - - // 3. check credentials - NSDictionary *credentials = [NSDictionary fromString:credentialsJson]; - XCTAssertEqual([[credentials[@"attrs"] allValues] count], 1, @"attrs length != 1"); - XCTAssertEqual([[credentials[@"predicates"] allValues] count], 0, @"predicates length != 0"); - XCTAssertEqual([credentials[@"attrs"][@"attr1_referent"] count], 0, @"attr1_referent length != 1"); -} - - (void)testProverGetCredentialsForProofReqWorksForSatisfyPredicate { IndyHandle walletHandle = 0; @@ -566,44 +304,6 @@ - (void)testProverGetCredentialsForProofReqWorksForSatisfyPredicate { XCTAssertEqual([credentials[@"predicates"][@"predicate1_referent"] count], 2, @"predicate1_referent length != 2"); } -- (void)testProverGetCredentialsForProofReqWorksForNotSatisfyPredicate { - IndyHandle walletHandle = 0; - - // 1. get wallet handle - ret = [[AnoncredsUtils sharedInstance] initializeCommonWalletAndReturnHandle:&walletHandle - credentialDefJson:nil - credentialOfferJson:nil - credentialReqJson:nil - credentialJson:nil]; - XCTAssertEqual(ret.code, Success, @"AnoncredsUtils::initializeCommonWalletAndReturnHandle failed"); - - // 2. get credentials - NSString *proofRequest = [[AnoncredsUtils sharedInstance] toJson:@{ - @"nonce": @"123432421212", - @"name": @"proof_req_1", - @"version": @"0.1", - @"requested_attributes": @{}, - @"requested_predicates": @{ - @"predicate1_referent": @{ - @"name": @"age", - @"p_type": @">=", - @"p_value": @(58) - } - } - }]; - NSString *credentialsJson; - ret = [[AnoncredsUtils sharedInstance] proverGetCredentialsForProofReq:proofRequest - walletHandle:walletHandle - credentialsJson:&credentialsJson]; - XCTAssertEqual(ret.code, Success, @"AnoncredsUtils::proverGetCredentialsForProofReqWithWalletHandle returned wrong code"); - - // 3. check credentials - NSDictionary *credentials = [NSDictionary fromString:credentialsJson]; - XCTAssertEqual([[credentials[@"attrs"] allValues] count], 0, @"attrs length != 1"); - XCTAssertEqual([[credentials[@"predicates"] allValues] count], 1, @"predicates length != 0"); - XCTAssertEqual([credentials[@"predicates"][@"predicate1_referent"] count], 0, @"predicate1_referent length != 0"); -} - - (void)testProverGetCredentialsForProofReqWorksForMultiplyAttributeAndPredicates { IndyHandle walletHandle = 0; @@ -779,57 +479,6 @@ - (void)testProverCreateProofWorks { XCTAssertTrue([proofJson isValid], @"invalid proofJson: %@", proofJson); } -- (void)testProverCreateProofWorksForUsingNotSatisfyCredential { - IndyHandle walletHandle = 0; - NSString *credentialDefJson; - - // 1. get wallet handle - ret = [[AnoncredsUtils sharedInstance] initializeCommonWalletAndReturnHandle:&walletHandle - credentialDefJson:&credentialDefJson - credentialOfferJson:nil - credentialReqJson:nil - credentialJson:nil]; - XCTAssertEqual(ret.code, Success, @"AnoncredsUtils::initializeCommonWalletAndReturnHandle failed"); - - NSString *proofRequest = [[AnoncredsUtils sharedInstance] toJson:@{ - @"nonce": @"123432421212", - @"name": @"proof_req_1", - @"version": @"0.1", - @"requested_attributes": @{ - @"attr1_referent": @{ - @"name": @"status" - } - }, - @"requested_predicates": @{} - }]; - - NSString *requestedCredentialsJson = [[AnoncredsUtils sharedInstance] toJson:@{ - @"self_attested_attributes": @{}, - @"requested_attributes": @{ - @"attr1_referent": @{ - @"cred_id": [[AnoncredsUtils sharedInstance] credentialId1], - @"revealed": @(YES) - } - }, - @"requested_predicates": @{} - }]; - - NSString *schemasJson = [NSString stringWithFormat:@"{\"%@\":%@}", [[AnoncredsUtils sharedInstance] getGvtSchemaId], [[AnoncredsUtils sharedInstance] getGvtSchemaJson]]; - NSString *credentialDefsJson = [NSString stringWithFormat:@"{\"%@\":%@}", [[AnoncredsUtils sharedInstance] getIssuer1GvtCredDefId], credentialDefJson]; - NSString *revocStatesJson = @"{}"; - - NSString *proofJson; - ret = [[AnoncredsUtils sharedInstance] proverCreateProofForRequest:proofRequest - requestedCredentialsJSON:requestedCredentialsJson - masterSecretID:[TestUtils commonMasterSecretName] - schemasJSON:schemasJson - credentialDefsJSON:credentialDefsJson - revocStatesJSON:revocStatesJson - walletHandle:walletHandle - proofJson:&proofJson]; - XCTAssertEqual(ret.code, CommonInvalidStructure, @"AnoncredsUtils::proverCreateProofWithWalletHandle returned wrong code"); -} - // MARK: - Verifier verify proof - (void)testVerifierVerifyProofWorksForCorrectProof { // 2. verify proof diff --git a/wrappers/ios/libindy-pod/Indy-demoTests/Case Tests/Anoncreds/AnoncredsMediumCasesDemos.m b/wrappers/ios/libindy-pod/Indy-demoTests/Case Tests/Anoncreds/AnoncredsMediumCasesDemos.m index 4fa1abbf94..d9fa00ce21 100644 --- a/wrappers/ios/libindy-pod/Indy-demoTests/Case Tests/Anoncreds/AnoncredsMediumCasesDemos.m +++ b/wrappers/ios/libindy-pod/Indy-demoTests/Case Tests/Anoncreds/AnoncredsMediumCasesDemos.m @@ -470,267 +470,4 @@ - (void)testAnoncredsWorksForMultiplyIssuerSingleProver { XCTAssertTrue(isValidJson, @"proof is not verified!"); } - -- (void)testAnoncredsWorksForSingleIssuerMultipleCredentialsSingleProver { - //1. Issuer create wallet, get wallet handles - IndyHandle issuerWalletHandle = 0; - ret = [[WalletUtils sharedInstance] createAndOpenWalletWithHandle:&issuerWalletHandle]; - XCTAssertEqual(ret.code, Success, @"WalletUtils::createAndOpenWallet() failed"); - - //2. Prover create wallet, get wallet handles - IndyHandle proverWalletHandle = 0; - ret = [[WalletUtils sharedInstance] createAndOpenWalletWithHandle:&proverWalletHandle]; - XCTAssertEqual(ret.code, Success, @"WalletUtils::createAndOpenWallet() failed"); - - //4. Issuer create GVT Schema - NSString *gvtSchemaId; - NSString *gvtSchemaJson; - ret = [[AnoncredsUtils sharedInstance] issuerCreateSchemaWithName:[TestUtils gvtSchemaName] - version:[TestUtils schemaVersion] - attrs:[TestUtils gvtSchemaAttrs] - issuerDID:[TestUtils issuerDid] - schemaId:&gvtSchemaId - schemaJson:&gvtSchemaJson]; - XCTAssertEqual(ret.code, Success, @"issuerCreateSchemaForIssuerDID failed"); - - //4. Issuer create XYZ Schema - NSString *xyzSchemaId; - NSString *xyzSchemaJson; - ret = [[AnoncredsUtils sharedInstance] issuerCreateSchemaWithName:[TestUtils xyzSchemaName] - version:[TestUtils schemaVersion] - attrs:[TestUtils xyzSchemaAttrs] - issuerDID:[TestUtils issuerDid] - schemaId:&xyzSchemaId - schemaJson:&xyzSchemaJson]; - XCTAssertEqual(ret.code, Success, @"issuerCreateSchemaForIssuerDID failed"); - - //4. Issuer create credential definition by GVT Schema - NSString *gvtCredentialDefId; - NSString *gvtCredentialDefJson; - ret = [[AnoncredsUtils sharedInstance] issuerCreateAndStoreCredentialDefForSchema:gvtSchemaJson - issuerDID:[TestUtils issuerDid] - tag:[TestUtils tag] - type:nil - configJSON:[[AnoncredsUtils sharedInstance] defaultCredentialDefConfig] - walletHandle:issuerWalletHandle - credDefId:&gvtCredentialDefId - credDefJson:&gvtCredentialDefJson]; - XCTAssertEqual(ret.code, Success, @"issuerCreateCredentialDefinifionWithWalletHandle failed"); - - //5. Issuer create credential definition by XYZ Schema - NSString *xyzCredentialDefId; - NSString *xyzCredentialDefJson; - ret = [[AnoncredsUtils sharedInstance] issuerCreateAndStoreCredentialDefForSchema:xyzSchemaJson - issuerDID:[TestUtils issuerDid] - tag:[TestUtils tag] - type:nil - configJSON:[[AnoncredsUtils sharedInstance] defaultCredentialDefConfig] - walletHandle:issuerWalletHandle - credDefId:&xyzCredentialDefId - credDefJson:&xyzCredentialDefJson]; - XCTAssertEqual(ret.code, Success, @"issuerCreateCredentialDefinifionWithWalletHandle failed"); - - //6. Prover create Master Secret - ret = [[AnoncredsUtils sharedInstance] proverCreateMasterSecret:[TestUtils commonMasterSecretName] - walletHandle:proverWalletHandle - outMasterSecretId:nil]; - XCTAssertEqual(ret.code, Success, @"AnoncredsUtils::proverCreateMasterSecret() failed for issuer 1"); - - // 7. Issuer create Credential Offer - NSString *gvtCredentialOfferJson = nil; - ret = [[AnoncredsUtils sharedInstance] issuerCreateCredentialOfferForCredDefId:gvtCredentialDefId - walletHandle:issuerWalletHandle - credOfferJson:&gvtCredentialOfferJson]; - XCTAssertEqual(ret.code, Success, @"AnoncredsUtils::issuerCreateAndStoreCredentialDef() failed!"); - - //8. Issuer create Credential Offer - NSString *xyzCredentialOfferJson = nil; - ret = [[AnoncredsUtils sharedInstance] issuerCreateCredentialOfferForCredDefId:xyzCredentialDefId - walletHandle:issuerWalletHandle - credOfferJson:&xyzCredentialOfferJson]; - XCTAssertEqual(ret.code, Success, @"AnoncredsUtils::issuerCreateAndStoreCredentialDef() failed!"); - - //9. Prover create Credential Request for Issuer GVT credential offer - NSString *gvtCredentialReq; - NSString *gvtCredentialReqMetadata; - ret = [[AnoncredsUtils sharedInstance] proverCreateCredentialReqForCredentialOffer:gvtCredentialOfferJson - credentialDefJSON:gvtCredentialDefJson - proverDID:[TestUtils proverDid] - masterSecretID:[TestUtils commonMasterSecretName] - walletHandle:proverWalletHandle - credReqJson:&gvtCredentialReq - credReqMetadataJson:&gvtCredentialReqMetadata]; - XCTAssertEqual(ret.code, Success, @"AnoncredsUtils::proverCreateAndStoreCredentialReq() failed"); - - //10. Issuer create GVT Credential - NSString *gvtCredential; - ret = [[AnoncredsUtils sharedInstance] issuerCreateCredentialForCredentialRequest:gvtCredentialReq - credOfferJSON:gvtCredentialOfferJson - credValuesJSON:[[AnoncredsUtils sharedInstance] getGvtCredentialValuesJson] - revRegId:nil - blobStorageReaderHandle:nil - walletHandle:issuerWalletHandle - credJson:&gvtCredential - credRevocId:nil - revocRegDeltaJSON:nil]; - XCTAssertEqual(ret.code, Success, @"AnoncredsUtils::issuerCreateCredential() failed for issuerGvtWalletHandle"); - - //11. Prover store received GVT Credential - ret = [[AnoncredsUtils sharedInstance] proverStoreCredential:gvtCredential - credID:[[AnoncredsUtils sharedInstance] credentialId1] - credReqMetadataJSON:gvtCredentialReqMetadata - credDefJSON:gvtCredentialDefJson - revRegDefJSON:nil - walletHandle:proverWalletHandle - outCredId:nil]; - XCTAssertEqual(ret.code, Success, @"AnoncredsUtils::proverStoreCredential() failed"); - - //12. Prover create Credential Request for xyz credential offer - NSString *xyzCredentialReq; - NSString *xyzCredentialReqMetadata; - ret = [[AnoncredsUtils sharedInstance] proverCreateCredentialReqForCredentialOffer:xyzCredentialOfferJson - credentialDefJSON:xyzCredentialDefJson - proverDID:[TestUtils proverDid] - masterSecretID:[TestUtils commonMasterSecretName] - walletHandle:proverWalletHandle - credReqJson:&xyzCredentialReq - credReqMetadataJson:&xyzCredentialReqMetadata]; - XCTAssertEqual(ret.code, Success, @"AnoncredsUtils::proverCreateAndStoreCredentialReq() failed"); - - //13. Issuer create XYZ Credential - NSString *xyzCredential; - ret = [[AnoncredsUtils sharedInstance] issuerCreateCredentialForCredentialRequest:xyzCredentialReq - credOfferJSON:xyzCredentialOfferJson - credValuesJSON:[[AnoncredsUtils sharedInstance] getXyzCredentialValuesJson] - revRegId:nil - blobStorageReaderHandle:nil - walletHandle:issuerWalletHandle - credJson:&xyzCredential - credRevocId:nil - revocRegDeltaJSON:nil]; - XCTAssertEqual(ret.code, Success, @"AnoncredsUtils::issuerCreateCredential() failed for issuerXyzWalletHandle"); - - // 14. Prover store received XYZ Credential - ret = [[AnoncredsUtils sharedInstance] proverStoreCredential:xyzCredential - credID:[[AnoncredsUtils sharedInstance] credentialId2] - credReqMetadataJSON:xyzCredentialReqMetadata - credDefJSON:xyzCredentialDefJson - revRegDefJSON:nil - walletHandle:proverWalletHandle - outCredId:nil]; - XCTAssertEqual(ret.code, Success, @"AnoncredsUtils::proverStoreCredential() failed on step 16"); - - // 15. Prover gets Credentials for Proof Request - NSString *proofReqJson = [[AnoncredsUtils sharedInstance] toJson:@{ - @"nonce": @"123432421212", - @"name": @"proof_req_1", - @"version": @"0.1", - @"requested_attributes": @{ - @"attr1_referent": @{ - @"name": @"name" - }, - @"attr2_referent": @{ - @"name": @"status" - } - }, - @"requested_predicates": @{ - @"predicate1_referent": @{ - @"name": @"age", - @"p_type": @">=", - @"p_value": @(18) - }, - @"predicate2_referent": @{ - @"name": @"period", - @"p_type": @">=", - @"p_value": @(5) - } - } - }]; - - NSString *credentialsJson; - ret = [[AnoncredsUtils sharedInstance] proverGetCredentialsForProofReq:proofReqJson - walletHandle:proverWalletHandle - credentialsJson:&credentialsJson]; - XCTAssertEqual(ret.code, Success, @"AnoncredsUtils::proverGetCredentialsForProofReq() failed"); - - NSDictionary *credentials = [NSDictionary fromString:credentialsJson]; - - NSDictionary *credentialForAttr1 = credentials[@"attrs"][@"attr1_referent"][0]; - NSDictionary *credentialForAttr2 = credentials[@"attrs"][@"attr2_referent"][0]; - - NSDictionary *credentialForPredicate1 = credentials[@"predicates"][@"predicate1_referent"][0]; - NSDictionary *credentialForPredicate2 = credentials[@"predicates"][@"predicate2_referent"][0]; - - // 16. Prover create Proof - NSString *credential_attr_1_UUID = credentialForAttr1[@"cred_info"][@"referent"]; - NSString *credential_attr_2_UUID = credentialForAttr2[@"cred_info"][@"referent"]; - NSString *credential_predicate_1_UUID = credentialForPredicate1[@"cred_info"][@"referent"]; - NSString *credential_predicate_2_UUID = credentialForPredicate2[@"cred_info"][@"referent"]; - - NSString *requestedCredentialsJson = [[AnoncredsUtils sharedInstance] toJson:@{ - @"self_attested_attributes": @{}, - @"requested_attributes": @{ - @"attr1_referent": @{ - @"cred_id": credential_attr_1_UUID, - @"revealed": @(YES) - }, - @"attr2_referent": @{ - @"cred_id": credential_attr_2_UUID, - @"revealed": @(YES) - } - }, - @"requested_predicates": @{ - @"predicate1_referent": @{ - @"cred_id": credential_predicate_1_UUID - }, - @"predicate2_referent": @{ - @"cred_id": credential_predicate_2_UUID - } - } - }]; - - NSString *schemasJson = [[AnoncredsUtils sharedInstance] toJson:@{ - gvtSchemaId: [NSDictionary fromString:gvtSchemaJson], - xyzSchemaId: [NSDictionary fromString:xyzSchemaJson]}]; - NSString *credentialDefsJson = [[AnoncredsUtils sharedInstance] toJson:@{ - gvtCredentialDefId: [NSDictionary fromString:gvtCredentialDefJson], - xyzCredentialDefId: [NSDictionary fromString:xyzCredentialDefJson]}]; - NSString *revocStatesJson = @"{}"; - - NSString *proofJson; - ret = [[AnoncredsUtils sharedInstance] proverCreateProofForRequest:proofReqJson - requestedCredentialsJSON:requestedCredentialsJson - masterSecretID:[TestUtils commonMasterSecretName] - schemasJSON:schemasJson - credentialDefsJSON:credentialDefsJson - revocStatesJSON:revocStatesJson - walletHandle:proverWalletHandle - proofJson:&proofJson]; - XCTAssertEqual(ret.code, Success, @"AnoncredsUtils::proverCreateProof() failed on step 18"); - - // 17. Verifier verify proof - NSDictionary *proof = [NSDictionary fromString:proofJson]; - XCTAssertTrue(proof, @"serialization failed"); - - NSDictionary *revealedAttr1 = proof[@"requested_proof"][@"revealed_attrs"][@"attr1_referent"]; - XCTAssertTrue([@"Alex" isEqualToString:revealedAttr1[@"raw"]]); - - NSDictionary *revealedAttr2 = proof[@"requested_proof"][@"revealed_attrs"][@"attr2_referent"]; - XCTAssertTrue([@"partial" isEqualToString:revealedAttr2[@"raw"]]); - - NSString *revocRegDefsJson = @"{}"; - NSString *revocRegsJson = @"{}"; - - BOOL isValidJson = NO; - ret = [[AnoncredsUtils sharedInstance] verifierVerifyProofRequest:proofReqJson - proofJSON:proofJson - schemasJSON:schemasJson - credentialDefsJSON:credentialDefsJson - revocRegDefsJSON:revocRegDefsJson - revocRegsJSON:revocRegsJson - isValid:&isValidJson]; - XCTAssertEqual(ret.code, Success, @"AnoncredsUtils::verifierVerifyProof() failed"); - XCTAssertTrue(isValidJson, @"proof is not verified!"); -} - @end diff --git a/wrappers/ios/libindy-pod/Indy-demoTests/Case Tests/Crypto/CryptoHighCases.mm b/wrappers/ios/libindy-pod/Indy-demoTests/Case Tests/Crypto/CryptoHighCases.mm index e751c7deca..38c0ae5a33 100644 --- a/wrappers/ios/libindy-pod/Indy-demoTests/Case Tests/Crypto/CryptoHighCases.mm +++ b/wrappers/ios/libindy-pod/Indy-demoTests/Case Tests/Crypto/CryptoHighCases.mm @@ -131,26 +131,6 @@ - (void)testGetKeyMetadataWorks { XCTAssertEqualObjects(outMetadata, [TestUtils someMetadata]); } -- (void)testGetKeyMetadataWorksForEmptyString { - NSString *verkey = nil; - ret = [[CryptoUtils sharedInstance] createKeyWithWalletHandle:walletHandle - keyJson:@"{}" - outVerkey:&verkey]; - XCTAssertEqual(ret.code, Success, @"CryptoUtils:createKeyWithWalletHandle failed"); - - ret = [[CryptoUtils sharedInstance] setMetadata:@"" - forKey:verkey - walletHandle:walletHandle]; - XCTAssertEqual(ret.code, Success, @"CryptoUtils:setMetadata failed"); - - NSString *outMetadata = nil; - ret = [[CryptoUtils sharedInstance] getMetadataForKey:verkey - walletHandle:walletHandle - outMetadata:&outMetadata]; - XCTAssertEqual(ret.code, Success, @"CryptoUtils:getMetadata failed"); - XCTAssertEqualObjects(outMetadata, @""); -} - - (void)testGetKeyMetadataWorksForNoMetadata { NSString *outMetadata = nil; ret = [[CryptoUtils sharedInstance] getMetadataForKey:[TestUtils myVerkey1] diff --git a/wrappers/ios/libindy-pod/Indy-demoTests/Case Tests/Did/DidHighCases.m b/wrappers/ios/libindy-pod/Indy-demoTests/Case Tests/Did/DidHighCases.m index 7dd4f5822c..15b982ea8c 100644 --- a/wrappers/ios/libindy-pod/Indy-demoTests/Case Tests/Did/DidHighCases.m +++ b/wrappers/ios/libindy-pod/Indy-demoTests/Case Tests/Did/DidHighCases.m @@ -60,21 +60,6 @@ - (void)testCreateMyDidWorksWithSeed { XCTAssertTrue([myVerKey isEqualToString:[TestUtils myVerkey1]], @"wrong myVerKey!"); } -- (void)testCreateMyDidWorksWithPassedDid { - // 1. Obtain my did - NSString *myDid; - NSString *myVerKey; - NSString *myDidJson = [NSString stringWithFormat:@"{\"did\":\"%@\", \"seed\":\"%@\"}", [TestUtils myDid1], [TestUtils mySeed1]]; - - ret = [[DidUtils sharedInstance] createMyDidWithWalletHandle:walletHandle - myDidJson:myDidJson - outMyDid:&myDid - outMyVerkey:&myVerKey]; - XCTAssertEqual(ret.code, Success, @"DidUtils::createMyDidWithWalletHandle() failed"); - XCTAssertTrue([myDid isEqualToString:[TestUtils myDid1]], @"wrong myDid!"); - XCTAssertTrue([myVerKey isEqualToString:[TestUtils myVerkey1]], @"wrong myVerKey!"); -} - // MARK: - Replace keys Start - (void)testReplaceKeysStartWorks { @@ -96,27 +81,6 @@ - (void)testReplaceKeysStartWorks { XCTAssertFalse([myVerkey isEqualToString:newVerkey], @"verkey is the same!"); } -- (void)testReplaceKeysStartWorksForSeed { - // 1. create my did - NSString *myDid; - NSString *myVerkey; - ret = [[DidUtils sharedInstance] createMyDidWithWalletHandle:walletHandle - myDidJson:@"{}" - outMyDid:&myDid - outMyVerkey:&myVerkey]; - XCTAssertEqual(ret.code, Success, @"DidUtils::createMyDidWithWalletHandle() returned wrong error code"); - - // 2. replace keys - NSString *newVerkey; - ret = [[DidUtils sharedInstance] replaceKeysStartForDid:myDid - identityJson:[NSString stringWithFormat:@"{\"seed\":\"%@\"}", [TestUtils mySeed1]] - walletHandle:walletHandle - outMyVerKey:&newVerkey]; - - XCTAssertEqual(ret.code, Success, @"DidUtils:replaceKeysStartForDid failed"); - XCTAssertTrue([newVerkey isEqualToString:[TestUtils myVerkey1]], @"wrong newVerkey"); -} - - (void)testReplaceKeysStartWorksForNotExistingDid { // 1. replace keys start ret = [[DidUtils sharedInstance] replaceKeysStartForDid:[TestUtils trusteeDid] @@ -255,23 +219,6 @@ - (void)testStoreTheidDidWorks { XCTAssertEqual(ret.code, Success, @"DidUtils:storeTheirDid failed"); } -- (void)testStoreTheirDidWorksWithVerkey { - // 1. Store their did - NSString *identityJson = [NSString stringWithFormat:@"{\"did\":\"%@\", \"verkey\":\"%@\"}", [TestUtils trusteeDid], [TestUtils trusteeVerkey]]; - ret = [[DidUtils sharedInstance] storeTheirDidWithWalletHandle:walletHandle - identityJson:identityJson]; - XCTAssertEqual(ret.code, Success, @"DidUtils:storeTheirDid() failed"); -} - -- (void)testStoretheirDidWorksWithoutDid { - // 1. Store their did - NSString *identityJson = [NSString stringWithFormat:@"{\"verkey\":\"%@\"}", [TestUtils trusteeVerkey]]; - ret = [[DidUtils sharedInstance] storeTheirDidWithWalletHandle:walletHandle - identityJson:identityJson]; - XCTAssertEqual(ret.code, CommonInvalidStructure, @"DidUtils:storeTheirDidWithWalletHandle() returned wrong code"); - -} - // MARK: - Key for Did - (void)testKeyForDidWorksForMyDid { diff --git a/wrappers/ios/libindy-pod/Indy-demoTests/Case Tests/Ledger/LedgerSendRequests.mm b/wrappers/ios/libindy-pod/Indy-demoTests/Case Tests/Ledger/LedgerSendRequests.mm index 4342289de9..626a864dfc 100644 --- a/wrappers/ios/libindy-pod/Indy-demoTests/Case Tests/Ledger/LedgerSendRequests.mm +++ b/wrappers/ios/libindy-pod/Indy-demoTests/Case Tests/Ledger/LedgerSendRequests.mm @@ -222,69 +222,8 @@ - (void)testSignWorksForUnknownSigner { XCTAssertEqual(ret.code, WalletItemNotFound, @"LedgerUtils::signRequestWithWalletHandle() returned wrong code!"); } -- (void)testSignRequestWorksFowInvalidMessageFormat { - // 1. create my did - NSString *myDid; - ret = [[DidUtils sharedInstance] createMyDidWithWalletHandle:walletHandle - myDidJson:@"{}" - outMyDid:&myDid - outMyVerkey:nil]; - XCTAssertEqual(ret.code, Success, @"DidUtils::createMyDidWithWalletHandle() failed!"); - - NSString *message = @"1495034346617224651"; - - ret = [[LedgerUtils sharedInstance] signRequestWithWalletHandle:walletHandle - submitterdid:myDid - requestJson:message - resultJson:nil]; - XCTAssertEqual(ret.code, CommonInvalidStructure, @"LedgerUtils::signRequestWithWalletHandle() returned wrong code!"); -} - // MARK: - NYM Requests -- (void)testNymRequestWorksWithoutSignature { - // 1. Build NYM Request - NSString *nymRequest; - ret = [[LedgerUtils sharedInstance] buildNymRequestWithSubmitterDid:[TestUtils trusteeDid] - targetDid:[TestUtils myDid1] - verkey:nil - alias:nil - role:nil - outRequest:&nymRequest]; - XCTAssertEqual(ret.code, Success, @"LedgerUtils::buildGetNymRequestWithSubmitterDid() failed"); - - // 2. Send request - NSString *nymResponse; - ret = [[PoolUtils sharedInstance] sendRequestWithPoolHandle:poolHandle - request:nymRequest - response:&nymResponse]; - XCTAssertEqual(ret.code, Success, @"LedgerUtils::sendRequestWithPoolHandle() returned not Success"); - XCTAssertNotNil(nymResponse, @"nymResponse is nil!"); - - NSDictionary *response = [NSDictionary fromString:nymResponse]; - XCTAssertTrue([response[@"op"] isEqualToString:@"REQNACK"], @"wrong response type"); -} - -- (void)testSendGetNymRequestWorks { - // 1. Build get NYM Request - NSString *getNymRequest; - ret = [[LedgerUtils sharedInstance] buildGetNymRequestWithSubmitterDid:[TestUtils trusteeDid] - targetDid:[TestUtils trusteeDid] - outRequest:&getNymRequest]; - XCTAssertEqual(ret.code, Success, @"LedgerUtils::buildGetNymRequestWithSubmitterDid() failed"); - - // 2. Send request - NSString *getNymResponseJson; - ret = [[PoolUtils sharedInstance] sendRequestWithPoolHandle:poolHandle - request:getNymRequest - response:&getNymResponseJson]; - XCTAssertEqual(ret.code, Success, @"PoolUtils::sendRequestWithPoolHandle() failed"); - - NSDictionary *getNymResponse = [NSDictionary fromString:getNymResponseJson]; - XCTAssertNotNil(getNymResponse[@"result"][@"seqNo"], @"getNymResponse seqNo is empty"); -} - - - (void)testNymRequestsWorks { // 1. Obtain trustee did NSString *trusteeDid = nil; @@ -337,58 +276,6 @@ - (void)testNymRequestsWorks { XCTAssertNotNil(getNymResponse[@"result"][@"seqNo"], @"getNymResponse seqNo is empty"); } -- (void)testSendNymRequestWorksWithOptionFields { - // 1. Obtain trustee did - NSString *trusteeDid = nil; - ret = [[DidUtils sharedInstance] createAndStoreMyDidWithWalletHandle:walletHandle - seed:[TestUtils trusteeSeed] - outMyDid:&trusteeDid - outMyVerkey:nil]; - XCTAssertEqual(ret.code, Success, @"DidUtils::createAndStoreMyDid() failed for trustee"); - - // 2. Obtain my did - NSString *myDid = nil; - NSString *myVerKey = nil; - ret = [[DidUtils sharedInstance] createAndStoreMyDidWithWalletHandle:walletHandle - seed:nil - outMyDid:&myDid - outMyVerkey:&myVerKey]; - XCTAssertEqual(ret.code, Success, @"DidUtils::createAndStoreMyDid() failed for myDid"); - - // 3. Build nym request; - NSString *nymRequest; - ret = [[LedgerUtils sharedInstance] buildNymRequestWithSubmitterDid:trusteeDid - targetDid:myDid - verkey:myVerKey - alias:@"some_alias" - role:@"STEWARD" - outRequest:&nymRequest]; - XCTAssertEqual(ret.code, Success, @"LedgerUtils::buildNymRequestWithSubmitterDid() failed"); - - // 4. Send and submit nym request - NSString *nymResponse; - ret = [[LedgerUtils sharedInstance] signAndSubmitRequestWithPoolHandle:poolHandle - walletHandle:walletHandle - submitterDid:trusteeDid - requestJson:nymRequest - outResponseJson:&nymResponse]; - XCTAssertEqual(ret.code, Success, @"LedgerUtils::signAndSubmitRequestWithPoolHandle() failed"); - - // 5. Build get nym request - NSString *getNymRequest = nil; - ret = [[LedgerUtils sharedInstance] buildGetNymRequestWithSubmitterDid:myDid - targetDid:myDid - outRequest:&getNymRequest]; - XCTAssertEqual(ret.code, Success, @"LedgerUtils::buildGetNymRequestWithSubmitterDid() failed"); - - // 6. Send getNymRequest - NSString *getNymResponseJson = [[LedgerUtils sharedInstance] submitRetry:getNymRequest - poolHandle:poolHandle]; - - NSDictionary *getNymResponse = [NSDictionary fromString:getNymResponseJson]; - XCTAssertNotNil(getNymResponse[@"result"][@"seqNo"], @"getNymResponse seqNo is empty"); -} - // MARK: - Attribute requests - (void)testAttributeRequestsWorks { diff --git a/wrappers/ios/libindy-pod/Indy-demoTests/Case Tests/Pairwise/PairwiseHighCases.m b/wrappers/ios/libindy-pod/Indy-demoTests/Case Tests/Pairwise/PairwiseHighCases.m index e544d2e0ac..50ced1c79c 100644 --- a/wrappers/ios/libindy-pod/Indy-demoTests/Case Tests/Pairwise/PairwiseHighCases.m +++ b/wrappers/ios/libindy-pod/Indy-demoTests/Case Tests/Pairwise/PairwiseHighCases.m @@ -73,23 +73,6 @@ - (void)testCreatePairwiseWorksForNotFoundMyDid { XCTAssertEqual(ret.code, WalletItemNotFound, @"PairwiseUtils::createPairwiseForTheirDid() returned wrong eror code!"); } -- (void)testCreatePairwiseWorksForNotFoundTheirDid { - // 1. create and store my did - NSString *myDid; - ret = [[DidUtils sharedInstance] createAndStoreMyDidWithWalletHandle:walletHandle - seed:[TestUtils mySeed1] - outMyDid:&myDid - outMyVerkey:nil]; - XCTAssertEqual(ret.code, Success, @"DidUtils::createAndStoreMyDidWithWalletHandle() failed to create myDid!"); - - // 2. create pairwise - ret = [[PairwiseUtils sharedInstance] createPairwiseForTheirDid:[TestUtils unknownDid] - withMyDid:myDid - metadata:[TestUtils someMetadata] - walletHandle:walletHandle]; - XCTAssertEqual(ret.code, WalletItemNotFound, @"PairwiseUtils::createPairwiseForTheirDid() failed!"); -} - // MARK: - List pairwise - (void)testListPairwiseWorks { diff --git a/wrappers/ios/libindy-pod/Indy-demoTests/Case Tests/Payment/PaymentHighCases.mm b/wrappers/ios/libindy-pod/Indy-demoTests/Case Tests/Payment/PaymentHighCases.mm index 09a91b828e..5364e7ad8b 100644 --- a/wrappers/ios/libindy-pod/Indy-demoTests/Case Tests/Payment/PaymentHighCases.mm +++ b/wrappers/ios/libindy-pod/Indy-demoTests/Case Tests/Payment/PaymentHighCases.mm @@ -75,18 +75,6 @@ - (void)testAddRequestFeesWorks { XCTAssertEqual(ret.code, PaymentUnknownMethodError); } -- (void)testAddRequestFeesWorksForExtra { - ret = [[PaymentUtils sharedInstance] addFeesToRequest:@"{}" - walletHandle:walletHandle - submitterDid:[TestUtils trusteeDid] - inputsJson:inputs - outputsJson:outputs - extra:@"Extra data" - requestWithFeesJson:nil - paymentMethod:nil]; - XCTAssertEqual(ret.code, PaymentUnknownMethodError); -} - - (void)testAddRequestFeesWorksForSeveralMethods { ret = [[PaymentUtils sharedInstance] addFeesToRequest:@"{}" walletHandle:walletHandle diff --git a/wrappers/ios/libindy-pod/Indy-demoTests/Case Tests/Wallet/PluggedWallet.m b/wrappers/ios/libindy-pod/Indy-demoTests/Case Tests/Wallet/PluggedWallet.m deleted file mode 100644 index b60cf8ffe0..0000000000 --- a/wrappers/ios/libindy-pod/Indy-demoTests/Case Tests/Wallet/PluggedWallet.m +++ /dev/null @@ -1,170 +0,0 @@ -// -// WalletHighCases.m -// Indy-demo -// - - -#import -#import "PoolUtils.h" -#import "TestUtils.h" -#import -#import "WalletUtils.h" -#import "DidUtils.h" -#import "LedgerUtils.h" -#import "AnoncredsUtils.h" -#import "NSDictionary+JSON.h" - -@interface DefaultWallet : XCTestCase - -@end - -@implementation DefaultWallet - -- (void)setUp { - [super setUp]; - [TestUtils cleanupStorage]; - // Put setup code here. This method is called before the invocation of each test method in the class. -} - -- (void)tearDown { - // Put teardown code here. This method is called after the invocation of each test method in the class. - [TestUtils cleanupStorage]; - [super tearDown]; -} - -// MARK: - Create wallet - -- (void)testCreateWalletWorks { - NSError *ret = [[WalletUtils sharedInstance] createWalletWithPoolName:[TestUtils pool] - walletName:[TestUtils wallet] - xtype:nil - config:nil]; - XCTAssertEqual(ret.code, Success, @"WalletUtils:createWalletWithPoolName() failed"); -} - -- (void)testCreateWalletWorksForUnknownType { - NSError *ret = [[WalletUtils sharedInstance] createWalletWithPoolName:[TestUtils pool] - walletName:[TestUtils wallet] - xtype:@"type" - config:nil]; - XCTAssertEqual(ret.code, WalletUnknownTypeError, @"WalletUtils:createWalletWithPoolName() returned wrong error"); -} - -// MARK: - Delete wallet - -- (void)testDeleteWalletWorks { - // 1. Create wallet - NSError *ret = [[WalletUtils sharedInstance] createWalletWithPoolName:[TestUtils pool] - walletName:[TestUtils wallet] - xtype:nil - config:nil]; - XCTAssertEqual(ret.code, Success, @"WalletUtils:createWalletWithPoolName failed"); - - // 2. Delete wallet - ret = [[WalletUtils sharedInstance] deleteWalletWithName:[TestUtils wallet]]; - XCTAssertEqual(ret.code, Success, @"WalletUtils:deleteWalletWithName failed"); - - // 3. Create wallet - ret = [[WalletUtils sharedInstance] createWalletWithPoolName:[TestUtils pool] - walletName:[TestUtils wallet] - xtype:nil - config:nil]; - XCTAssertEqual(ret.code, Success, @"WalletUtils:createWalletWithPoolName failed"); -} - -- (void)testDeleteWalletWorksForClosed { - // 1. create wallet - NSError *ret = [[WalletUtils sharedInstance] createWalletWithPoolName:[TestUtils pool] - walletName:[TestUtils wallet] - xtype:nil - config:nil]; - XCTAssertEqual(ret.code, Success, @"WalletUtils:createWalletWithPoolName failed"); - - // 2. open wallet - IndyHandle walletHandle = 0; - ret = [[WalletUtils sharedInstance] openWalletWithName:[TestUtils wallet] - config:nil - outHandle:&walletHandle]; - XCTAssertEqual(ret.code, Success, @"WalletUtils:openWalletWithName failed"); - - // 3. close wallet - ret = [[WalletUtils sharedInstance] closeWalletWithHandle:walletHandle]; - XCTAssertEqual(ret.code, Success, @"WalletUtils:closeWalletWithHandle failed"); - - // 4. delete wallet - ret = [[WalletUtils sharedInstance] deleteWalletWithName:[TestUtils wallet]]; - XCTAssertEqual(ret.code, Success, @"WalletUtils:deleteWalletWithName failed"); - - // 5. create wallet - ret = [[WalletUtils sharedInstance] createWalletWithPoolName:[TestUtils pool] - walletName:[TestUtils wallet] - xtype:nil - config:nil]; - XCTAssertEqual(ret.code, Success, @"WalletUtils:createWalletWithPoolName failed"); -} - -- (void)testDeleteWalletWorksForUnknown { - NSError *ret = [[WalletUtils sharedInstance] deleteWalletWithName:@"testDeleteWalletWorksForUnknown"]; - XCTAssertEqual(ret.code, CommonIOError, @"WalletUtils:deleteWalletWithName() returned wrong error"); -} - -// MARK: - Open wallet - -- (void)testOpenWalletWorks { - NSString *walletName = @"indy_open_wallet_works"; - - // 1. Create wallet - NSError *ret = [[WalletUtils sharedInstance] createWalletWithPoolName:[TestUtils pool] - walletName:walletName - xtype:nil - config:nil]; - XCTAssertEqual(ret.code, Success, @"WalletUtils:createWalletWithPoolName failed"); - - // 2. Open wallet - IndyHandle walletHandle = 0; - ret = [[WalletUtils sharedInstance] openWalletWithName:walletName - config:nil - outHandle:&walletHandle]; - XCTAssertEqual(ret.code, Success, @"WalletUtils:openWalletWithName failed"); -} - -- (void)testOpenWalletWorksForNotCreatedWallet { - NSError *ret = [[WalletUtils sharedInstance] openWalletWithName:[TestUtils wallet] - config:nil - outHandle:nil]; - XCTAssertEqual(ret.code, CommonIOError, @"WalletUtils:openWalletWithName() failed"); -} - -// MARK: - Close wallet - -- (void)testCloseWalletWorks { - // 1. create wallet - NSError *ret = [[WalletUtils sharedInstance] createWalletWithPoolName:[TestUtils pool] - walletName:[TestUtils wallet] - xtype:nil - config:nil]; - XCTAssertEqual(ret.code, Success, @"WalletUtils:createWalletWithPoolName failed"); - - // 2. open wallet - IndyHandle walletHandle; - ret = [[WalletUtils sharedInstance] openWalletWithName:[TestUtils wallet] - config:nil - outHandle:&walletHandle]; - XCTAssertEqual(ret.code, Success, @"WalletUtils:openWalletWithName failed"); - - // 3. close wallet - ret = [[WalletUtils sharedInstance] closeWalletWithHandle:walletHandle]; - XCTAssertEqual(ret.code, Success, @"WalletUtils:closeWalletWithHandle failed"); - - // 4. open wallet - ret = [[WalletUtils sharedInstance] openWalletWithName:[TestUtils wallet] - config:nil - outHandle:&walletHandle]; - XCTAssertEqual(ret.code, Success, @"WalletUtils:openWalletWithName failed"); - - // 5. close wallet - ret = [[WalletUtils sharedInstance] closeWalletWithHandle:walletHandle]; - XCTAssertEqual(ret.code, Success, @"WalletUtils:closeWalletWithHandle failed"); -} - -@end diff --git a/wrappers/ios/libindy-pod/Indy-demoTests/Case Tests/Wallet/PluggedWallet.mm b/wrappers/ios/libindy-pod/Indy-demoTests/Case Tests/Wallet/PluggedWallet.mm deleted file mode 100644 index f297fa97b6..0000000000 --- a/wrappers/ios/libindy-pod/Indy-demoTests/Case Tests/Wallet/PluggedWallet.mm +++ /dev/null @@ -1,19 +0,0 @@ -// -// WalletHighCases.m -// Indy-demo -// - - -#import -#import "PoolUtils.h" -#import "TestUtils.h" -#import -#import "WalletUtils.h" -#import "DidUtils.h" -#import "LedgerUtils.h" -#import "AnoncredsUtils.h" -#import "NSDictionary+JSON.h" - -@interface DefaultWallet : XCTestCase - -@end \ No newline at end of file From da3f2f7df5495b31f84acf66c27a1229cf8d01fa Mon Sep 17 00:00:00 2001 From: "artem.ivanov" Date: Mon, 19 Aug 2019 10:08:35 +0300 Subject: [PATCH 260/320] Removed part of Medium Cases tests from Java wrapper Signed-off-by: artem.ivanov --- ...reateAndStoreCredentialDefinitionTest.java | 21 - .../anoncreds/IssuerCreateCredentialTest.java | 9 - .../IssuerRotateCredentialDefinitionTest.java | 3 - .../ProverCreateCredentialRequestTest.java | 9 - .../ProverCreateMasterSecretTest.java | 5 - .../sdk/anoncreds/ProverCreateProofTest.java | 53 --- ...overGetCredentialsForProofRequestTest.java | 382 ------------------ .../anoncreds/ProverGetCredentialsTest.java | 37 -- .../ProverSearchCredentialsTest.java | 17 - .../anoncreds/ProverStoreCredentialTest.java | 18 - .../anoncreds/VerifierVerifyProofTest.java | 42 -- .../indy/sdk/crypto/CryptoAnonCryptTest.java | 12 - .../sdk/crypto/CryptoAnonDecryptTest.java | 13 - .../indy/sdk/crypto/CryptoAuthCryptTest.java | 18 - .../sdk/crypto/CryptoAuthDecryptTest.java | 20 - .../indy/sdk/crypto/CryptoVerifyTest.java | 26 -- .../indy/sdk/crypto/GetKeyMetadataTest.java | 15 - .../sdk/crypto/PackUnpackMessageTest.java | 28 -- .../indy/sdk/crypto/SetKeyMetadataTest.java | 19 - .../indy/sdk/did/CreateMyDidTest.java | 50 --- .../indy/sdk/did/GetDidMetadataTest.java | 15 - .../indy/sdk/did/GetEndpointForDidTest.java | 26 -- .../indy/sdk/did/KeyForDidTest.java | 22 - .../indy/sdk/did/KeyForLocalDidTest.java | 8 - .../indy/sdk/did/SetDidMetadataTest.java | 23 -- .../indy/sdk/did/SetEndpointForDidTest.java | 23 -- .../indy/sdk/did/StoreTheirDidTest.java | 13 - ...uthorAgreementAcceptanceToRequestTest.java | 6 - .../indy/sdk/ledger/AttribRequestsTest.java | 58 --- .../indy/sdk/ledger/CredDefRequestsTest.java | 13 - .../indy/sdk/ledger/GetTxnRequestTest.java | 17 - .../indy/sdk/ledger/NodeRequestsTest.java | 52 --- .../indy/sdk/ledger/NymRequestsTest.java | 93 ----- .../sdk/non_secrets/AddRecordTagsTest.java | 18 - .../indy/sdk/non_secrets/AddRecordTest.java | 6 - .../sdk/non_secrets/DeleteRecordTagsTest.java | 11 - .../sdk/non_secrets/DeleteRecordTest.java | 12 - .../sdk/non_secrets/UpdateRecordTagsTest.java | 15 - .../indy/sdk/pairwise/CreatePairwiseTest.java | 13 - .../sdk/pairwise/SetPairwiseMetadataTest.java | 13 - .../indy/sdk/payment/AddRequestFeesTest.java | 8 - ...dGetPaymentSourcesWithFromRequestTest.java | 8 - .../sdk/payment/BuildPaymentRequestTest.java | 16 - .../indy/sdk/pool/ClosePoolTest.java | 26 -- .../indy/sdk/pool/CreatePoolTest.java | 11 - .../indy/sdk/pool/OpenPoolTest.java | 21 - .../indy/sdk/wallet/CloseWalletTest.java | 12 - .../indy/sdk/wallet/DeleteWalletTest.java | 28 -- .../indy/sdk/wallet/OpenWalletTest.java | 11 - 49 files changed, 1395 deletions(-) diff --git a/wrappers/java/src/test/java/org/hyperledger/indy/sdk/anoncreds/IssuerCreateAndStoreCredentialDefinitionTest.java b/wrappers/java/src/test/java/org/hyperledger/indy/sdk/anoncreds/IssuerCreateAndStoreCredentialDefinitionTest.java index e511450066..4bc855515d 100644 --- a/wrappers/java/src/test/java/org/hyperledger/indy/sdk/anoncreds/IssuerCreateAndStoreCredentialDefinitionTest.java +++ b/wrappers/java/src/test/java/org/hyperledger/indy/sdk/anoncreds/IssuerCreateAndStoreCredentialDefinitionTest.java @@ -29,25 +29,4 @@ public void testIssuerCreateAndStoreCredentialDefWorksForInvalidSchemaJson() thr Anoncreds.issuerCreateAndStoreCredentialDef(wallet, issuerDid, schema, "InvalidSchema", null, defaultCredentialDefinitionConfig).get(); } - - @Test - public void testIssuerCreateAndStoreCredentialDefWorksForEmptyKeys() throws Exception { - - thrown.expect(ExecutionException.class); - thrown.expectCause(isA(InvalidStructureException.class)); - - String schema = "{\n" + - " \"id\":\"1\",\n" + - " \"name\":\"gvt\",\n" + - " \"version\":\"1.0\",\n" + - " \"attr_names\":[]\n" + - " }"; - - Anoncreds.issuerCreateAndStoreCredentialDef(wallet, issuerDid, schema, "EmptyKeys", null, defaultCredentialDefinitionConfig).get(); - } - - @Test - public void testIssuerCreateAndStoreCredentialDefWorksForDuplicate() throws Exception { - Anoncreds.issuerCreateAndStoreCredentialDef(wallet, issuerDid, gvtSchema, tag, null, defaultCredentialDefinitionConfig).get(); - } } diff --git a/wrappers/java/src/test/java/org/hyperledger/indy/sdk/anoncreds/IssuerCreateCredentialTest.java b/wrappers/java/src/test/java/org/hyperledger/indy/sdk/anoncreds/IssuerCreateCredentialTest.java index 341ce7374d..df4e813893 100644 --- a/wrappers/java/src/test/java/org/hyperledger/indy/sdk/anoncreds/IssuerCreateCredentialTest.java +++ b/wrappers/java/src/test/java/org/hyperledger/indy/sdk/anoncreds/IssuerCreateCredentialTest.java @@ -12,15 +12,6 @@ public class IssuerCreateCredentialTest extends AnoncredsIntegrationTest { @Test public void testIssuerCreateCredentialWorks() throws Exception {} - @Test - public void testIssuerCreateCredentialWorksForCredentialValuesDoesNotCorrespondToCredentialRequest() throws Exception { - - thrown.expect(ExecutionException.class); - thrown.expectCause(isA(InvalidStructureException.class)); - - Anoncreds.issuerCreateCredential(wallet, issuer1GvtCredOffer, issuer1GvtCredReq, xyzCredentialValuesJson, null, - 1).get(); - } - @Test public void testIssuerCreateCredentialWorksForInvalidCredentialValues() throws Exception { diff --git a/wrappers/java/src/test/java/org/hyperledger/indy/sdk/anoncreds/IssuerRotateCredentialDefinitionTest.java b/wrappers/java/src/test/java/org/hyperledger/indy/sdk/anoncreds/IssuerRotateCredentialDefinitionTest.java index f92e3c8f7e..2de8ac6149 100644 --- a/wrappers/java/src/test/java/org/hyperledger/indy/sdk/anoncreds/IssuerRotateCredentialDefinitionTest.java +++ b/wrappers/java/src/test/java/org/hyperledger/indy/sdk/anoncreds/IssuerRotateCredentialDefinitionTest.java @@ -27,9 +27,6 @@ public void testIssuerRotateCredentialDefinitionWorks() throws Exception { String tempCredDef = Anoncreds.issuerRotateCredentialDefStart(localWallet, credDefId, null).get(); - System.out.println(credDef); - System.out.println(tempCredDef); - assertFalse(JsonObjectSimilar.similar(new JSONObject(credDef), new JSONObject(tempCredDef))); Anoncreds.issuerRotateCredentialDefApply(localWallet, credDefId).get(); diff --git a/wrappers/java/src/test/java/org/hyperledger/indy/sdk/anoncreds/ProverCreateCredentialRequestTest.java b/wrappers/java/src/test/java/org/hyperledger/indy/sdk/anoncreds/ProverCreateCredentialRequestTest.java index df91b7fa46..fa5829e303 100644 --- a/wrappers/java/src/test/java/org/hyperledger/indy/sdk/anoncreds/ProverCreateCredentialRequestTest.java +++ b/wrappers/java/src/test/java/org/hyperledger/indy/sdk/anoncreds/ProverCreateCredentialRequestTest.java @@ -14,15 +14,6 @@ public class ProverCreateCredentialRequestTest extends AnoncredsIntegrationTest public void testProverCreateAndStoreCredentialReqWorks() throws Exception { } - @Test - public void testProverCreateAndStoreCredentialReqWorksForCredentialDefDoesNotCorrespondToCredentialOfferDifferentIssuer() throws Exception { - - thrown.expect(ExecutionException.class); - thrown.expectCause(isA(InvalidStructureException.class)); - - Anoncreds.proverCreateCredentialReq(wallet, proverDid, issuer2GvtCredOffer, issuer1gvtCredDef, masterSecretId).get(); - } - @Test public void testProverCreateAndStoreCredentialReqWorksForInvalidCredentialOffer() throws Exception { diff --git a/wrappers/java/src/test/java/org/hyperledger/indy/sdk/anoncreds/ProverCreateMasterSecretTest.java b/wrappers/java/src/test/java/org/hyperledger/indy/sdk/anoncreds/ProverCreateMasterSecretTest.java index ea5c6f4e72..d00aa35890 100644 --- a/wrappers/java/src/test/java/org/hyperledger/indy/sdk/anoncreds/ProverCreateMasterSecretTest.java +++ b/wrappers/java/src/test/java/org/hyperledger/indy/sdk/anoncreds/ProverCreateMasterSecretTest.java @@ -20,9 +20,4 @@ public void testProverCreateMasterSecretWorksForDuplicate() throws Exception { Anoncreds.proverCreateMasterSecret(wallet, masterSecretId).get(); } - - @Test - public void testProverCreateMasterSecretWorksForEmptyName() throws Exception { - Anoncreds.proverCreateMasterSecret(wallet, null).get(); - } } diff --git a/wrappers/java/src/test/java/org/hyperledger/indy/sdk/anoncreds/ProverCreateProofTest.java b/wrappers/java/src/test/java/org/hyperledger/indy/sdk/anoncreds/ProverCreateProofTest.java index ab5f177024..c3b505ee91 100644 --- a/wrappers/java/src/test/java/org/hyperledger/indy/sdk/anoncreds/ProverCreateProofTest.java +++ b/wrappers/java/src/test/java/org/hyperledger/indy/sdk/anoncreds/ProverCreateProofTest.java @@ -29,25 +29,6 @@ public void testProverCreateProofWorks() throws Exception { assertNotNull(proofJson); } - @Test - public void testProverCreateProofWorksForUsingNotSatisfyCredential() throws Exception { - - thrown.expect(ExecutionException.class); - thrown.expectCause(isA(InvalidStructureException.class)); - - String requestedCredentialsJson = String.format("{\"self_attested_attributes\":{},\n" + - " \"requested_attributes\":{\"attr1_referent\":{\"cred_id\":\"%s\", \"revealed\":true}},\n" + - " \"requested_predicates\":{}\n" + - " }", credentialId2); - - String schemasJson = new JSONObject().put(xyzSchemaId, xyzSchema).toString(); - String credentialDefsJson = new JSONObject().put(issuer1xyzCredDef, issuer1xyzCredDef).toString(); - String revocStatesJson = new JSONObject().toString(); - - Anoncreds.proverCreateProof(wallet, proofRequest, new JSONObject(requestedCredentialsJson).toString(), - masterSecretId, schemasJson, credentialDefsJson, revocStatesJson).get(); - } - @Test public void testProverCreateProofWorksForInvalidMasterSecret() throws Exception { @@ -61,38 +42,4 @@ public void testProverCreateProofWorksForInvalidMasterSecret() throws Exception Anoncreds.proverCreateProof(wallet, proofRequest, new JSONObject(requestedCredentialsJson).toString(), "wrong_master_secret", schemasJson, credentialDefsJson, revocStatesJson).get(); } - - @Test - public void testProverCreateProofWorksForInvalidSchemas() throws Exception { - - thrown.expect(ExecutionException.class); - thrown.expectCause(isA(InvalidStructureException.class)); - - String schemasJson = new JSONObject().toString(); - String credentialDefsJson = new JSONObject().put(issuer1gvtCredDefId, issuer1gvtCredDef).toString(); - String revocStatesJson = new JSONObject().toString(); - - Anoncreds.proverCreateProof(wallet, proofRequest, new JSONObject(requestedCredentialsJson).toString(), - masterSecretId, schemasJson, credentialDefsJson, revocStatesJson).get(); - } - - @Test - public void testProverCreateProofWorksForInvalidRequestedCredentialsJson() throws Exception { - - thrown.expect(ExecutionException.class); - thrown.expectCause(isA(InvalidStructureException.class)); - - String schemasJson = new JSONObject().put(gvtSchemaId, gvtSchema).toString(); - String credentialDefsJson = new JSONObject().put(issuer1gvtCredDefId, issuer1gvtCredDef).toString(); - String revocStatesJson = new JSONObject().toString(); - String requestedCredentialsJson = new JSONObject().put("self_attested_attributes", new JSONObject()). - put("requested_predicates", new JSONObject()).toString(); - - - /*String requestedCredentialsJson = "{\"self_attested_attributes\":{},\n" + - " \"requested_predicates\":{}\n" + - " }";*/ - - Anoncreds.proverCreateProof(wallet, proofRequest, requestedCredentialsJson, masterSecretId, schemasJson, credentialDefsJson, revocStatesJson).get(); - } } diff --git a/wrappers/java/src/test/java/org/hyperledger/indy/sdk/anoncreds/ProverGetCredentialsForProofRequestTest.java b/wrappers/java/src/test/java/org/hyperledger/indy/sdk/anoncreds/ProverGetCredentialsForProofRequestTest.java index 97a8965b76..7dd7bf579c 100644 --- a/wrappers/java/src/test/java/org/hyperledger/indy/sdk/anoncreds/ProverGetCredentialsForProofRequestTest.java +++ b/wrappers/java/src/test/java/org/hyperledger/indy/sdk/anoncreds/ProverGetCredentialsForProofRequestTest.java @@ -33,48 +33,6 @@ public void testProverGetCredentialsForProofRequestWorksForRevealedAttribute() t assertEquals(2, credentialsForAttribute1.length()); } - @Test - public void testProverGetCredentialsForProofRequestWorksForRevealedAttributeInUpperCase() throws Exception { - - String proofRequest = "{" + - " \"nonce\":\"123432421212\"," + - " \"name\":\"proof_req_1\"," + - " \"version\":\"0.1\"," + - " \"requested_attributes\":{" + - " \"attr1_referent\":{\"name\":\"NAME\"}" + - " }," + - " \"requested_predicates\":{}" + - " }"; - - String credentialsJson = Anoncreds.proverGetCredentialsForProofReq(wallet, new JSONObject(proofRequest).toString()).get(); - - JSONObject credentials = new JSONObject(credentialsJson); - - JSONArray credentialsForAttribute1 = credentials.getJSONObject("attrs").getJSONArray("attr1_referent"); - assertEquals(2, credentialsForAttribute1.length()); - } - - @Test - public void testProverGetCredentialsForProofRequestWorksForRevealedAttributeContainsSpaces() throws Exception { - - String proofRequest = "{" + - " \"nonce\":\"123432421212\"," + - " \"name\":\"proof_req_1\"," + - " \"version\":\"0.1\"," + - " \"requested_attributes\":{" + - " \"attr1_referent\":{\"name\":\" name \"}" + - " }," + - " \"requested_predicates\":{}" + - " }"; - - String credentialsJson = Anoncreds.proverGetCredentialsForProofReq(wallet, new JSONObject(proofRequest).toString()).get(); - - JSONObject credentials = new JSONObject(credentialsJson); - - JSONArray credentialsForAttribute1 = credentials.getJSONObject("attrs").getJSONArray("attr1_referent"); - assertEquals(2, credentialsForAttribute1.length()); - } - @Test public void testProverGetCredentialsForProofRequestWorksForNotFoundAttribute() throws Exception { @@ -119,52 +77,6 @@ public void testProverGetCredentialsForProofRequestWorksForPredicate() throws Ex assertEquals(2, credentialsForPredicate.length()); } - @Test - public void testProverGetCredentialsForProofRequestWorksForPredicateAttrInUpperCase() throws Exception { - - String proofRequest = "{" + - " \"nonce\":\"123432421212\"," + - " \"name\":\"proof_req_1\"," + - " \"version\":\"0.1\"," + - " \"requested_attributes\":{}," + - " \"requested_predicates\":{" + - " \"predicate1_referent\":{" + - " \"name\":\"AGE\",\"p_type\":\">=\",\"p_value\":18" + - " }" + - " }" + - " }"; - - String credentialsJson = Anoncreds.proverGetCredentialsForProofReq(wallet, new JSONObject(proofRequest).toString()).get(); - - JSONObject credentials = new JSONObject(credentialsJson); - - JSONArray credentialsForPredicate = credentials.getJSONObject("predicates").getJSONArray("predicate1_referent"); - assertEquals(2, credentialsForPredicate.length()); - } - - @Test - public void testProverGetCredentialsForProofRequestWorksForPredicateAttrContainsSpaces() throws Exception { - - String proofRequest = "{" + - " \"nonce\":\"123432421212\"," + - " \"name\":\"proof_req_1\"," + - " \"version\":\"0.1\"," + - " \"requested_attributes\":{}," + - " \"requested_predicates\":{" + - " \"predicate1_referent\":{" + - " \"name\":\" age \",\"p_type\":\">=\",\"p_value\":18" + - " }" + - " }" + - " }"; - - String credentialsJson = Anoncreds.proverGetCredentialsForProofReq(wallet, new JSONObject(proofRequest).toString()).get(); - - JSONObject credentials = new JSONObject(credentialsJson); - - JSONArray credentialsForPredicate = credentials.getJSONObject("predicates").getJSONArray("predicate1_referent"); - assertEquals(2, credentialsForPredicate.length()); - } - @Test public void testProverGetCredentialsForProofRequestWorksForNotSatisfiedPredicate() throws Exception { @@ -222,25 +134,6 @@ public void testProverGetCredentialsForProofRequestWorksForMultiplyAttributesAnd assertEquals(2, credentialsForPredicate2.length()); } - @Test - public void testProverGetCredentialsForProofRequestWorksForEmptyRequest() throws Exception { - - String proofRequest = "{" + - " \"nonce\":\"123432421212\"," + - " \"name\":\"proof_req_1\"," + - " \"version\":\"0.1\"," + - " \"requested_attributes\":{}," + - " \"requested_predicates\":{}" + - " }"; - - String credentialsJson = Anoncreds.proverGetCredentialsForProofReq(wallet, new JSONObject(proofRequest).toString()).get(); - - JSONObject credentials = new JSONObject(credentialsJson); - - assertEquals(0, credentials.getJSONObject("attrs").length()); - assertEquals(0, credentials.getJSONObject("predicates").length()); - } - @Test public void testProverGetCredentialsForProofRequestWorksForRevealedAttributeBySpecificIssuer() throws Exception { @@ -264,279 +157,4 @@ public void testProverGetCredentialsForProofRequestWorksForRevealedAttributeBySp JSONArray credentialsForAttribute1 = credentials.getJSONObject("attrs").getJSONArray("attr1_referent"); assertEquals(1, credentialsForAttribute1.length()); } - - @Test - public void testProverGetCredentialsForProofRequestWorksForRevealedAttributeBySchemaId() throws Exception { - - String proofRequest = String.format("{" + - " \"nonce\":\"123432421212\"," + - " \"name\":\"proof_req_1\"," + - " \"version\":\"0.1\"," + - " \"requested_attributes\":{" + - " \"attr1_referent\":{" + - " \"name\":\"name\"," + - " \"restrictions\":[{\"schema_id\":\"%s\"}]" + - " }" + - " }," + - " \"requested_predicates\":{}" + - " }", gvtSchemaId); - - String credentialsJson = Anoncreds.proverGetCredentialsForProofReq(wallet, new JSONObject(proofRequest).toString()).get(); - - JSONObject credentials = new JSONObject(credentialsJson); - - JSONArray credentialsForAttribute1 = credentials.getJSONObject("attrs").getJSONArray("attr1_referent"); - assertEquals(2, credentialsForAttribute1.length()); - } - - @Test - public void testProverGetCredentialsForProofRequestWorksForRevealedAttributeBySchemaName() throws Exception { - - String proofRequest = "{" + - " \"nonce\":\"123432421212\"," + - " \"name\":\"proof_req_1\"," + - " \"version\":\"0.1\"," + - " \"requested_attributes\":{" + - " \"attr1_referent\":{" + - " \"name\":\"name\"," + - " \"restrictions\":[{\"schema_name\":\"gvt\"}]" + - " }" + - " }," + - " \"requested_predicates\":{}" + - " }"; - - String credentialsJson = Anoncreds.proverGetCredentialsForProofReq(wallet, new JSONObject(proofRequest).toString()).get(); - - JSONObject credentials = new JSONObject(credentialsJson); - - JSONArray credentialsForAttribute1 = credentials.getJSONObject("attrs").getJSONArray("attr1_referent"); - assertEquals(2, credentialsForAttribute1.length()); - } - - @Test - public void testProverGetCredentialsForProofRequestWorksForRevealedAttributeByMultipleSchemas() throws Exception { - - String proofRequest = String.format("{" + - " \"nonce\":\"123432421212\"," + - " \"name\":\"proof_req_1\"," + - " \"version\":\"0.1\"," + - " \"requested_attributes\":{" + - " \"attr1_referent\":{" + - " \"name\":\"name\"," + - " \"restrictions\":[{\"schema_id\":\"%s\"}, {\"schema_id\":\"%s\"}]" + - " }" + - " }," + - " \"requested_predicates\":{}" + - " }", gvtSchemaId, xyzSchemaId); - - String credentialsJson = Anoncreds.proverGetCredentialsForProofReq(wallet, new JSONObject(proofRequest).toString()).get(); - - JSONObject credentials = new JSONObject(credentialsJson); - - JSONArray credentialsForAttribute1 = credentials.getJSONObject("attrs").getJSONArray("attr1_referent"); - assertEquals(2, credentialsForAttribute1.length()); - } - - @Test - public void testProverGetCredentialsForProofRequestWorksForRevealedAttributeByCredDefId() throws Exception { - - String proofRequest = String.format("{" + - " \"nonce\":\"123432421212\"," + - " \"name\":\"proof_req_1\"," + - " \"version\":\"0.1\"," + - " \"requested_attributes\":{" + - " \"attr1_referent\":{" + - " \"name\":\"name\"," + - " \"restrictions\":[{\"cred_def_id\":\"%s\"}]" + - " }" + - " }," + - " \"requested_predicates\":{}" + - " }", issuer1gvtCredDefId); - - String credentialsJson = Anoncreds.proverGetCredentialsForProofReq(wallet, new JSONObject(proofRequest).toString()).get(); - - JSONObject credentials = new JSONObject(credentialsJson); - - JSONArray credentialsForAttribute1 = credentials.getJSONObject("attrs").getJSONArray("attr1_referent"); - assertEquals(1, credentialsForAttribute1.length()); - } - - @Test - public void testProverGetCredentialsForProofRequestWorksForRevealedAttributeBySpecificSchemaOrSpecificIssuer() throws Exception { - - String proofRequest = String.format("{" + - " \"nonce\":\"123432421212\"," + - " \"name\":\"proof_req_1\"," + - " \"version\":\"0.1\"," + - " \"requested_attributes\":{" + - " \"attr1_referent\":{" + - " \"name\":\"name\"," + - " \"restrictions\":[{\"schema_id\":\"%s\"}, {\"issuer_did\":\"%s\"}]" + - " }" + - " }," + - " \"requested_predicates\":{}" + - " }", gvtSchemaId, issuerDid); - - String credentialsJson = Anoncreds.proverGetCredentialsForProofReq(wallet, new JSONObject(proofRequest).toString()).get(); - - JSONObject credentials = new JSONObject(credentialsJson); - - JSONArray credentialsForAttribute1 = credentials.getJSONObject("attrs").getJSONArray("attr1_referent"); - assertEquals(2, credentialsForAttribute1.length()); - } - - @Test - public void testProverGetCredentialsForProofRequestWorksForPredicateBySpecificIssuer() throws Exception { - - String proofRequest = String.format("{" + - " \"nonce\":\"123432421212\"," + - " \"name\":\"proof_req_1\"," + - " \"version\":\"0.1\"," + - " \"requested_attributes\":{}," + - " \"requested_predicates\":{" + - " \"predicate1_referent\":{" + - " \"name\":\"age\",\"p_type\":\">=\",\"p_value\":18," + - " \"restrictions\":[{\"issuer_did\":\"%s\"}]" + - " }" + - " }" + - " }", issuerDid); - - String credentialsJson = Anoncreds.proverGetCredentialsForProofReq(wallet, new JSONObject(proofRequest).toString()).get(); - - JSONObject credentials = new JSONObject(credentialsJson); - - JSONArray credentialsForPredicate = credentials.getJSONObject("predicates").getJSONArray("predicate1_referent"); - assertEquals(1, credentialsForPredicate.length()); - } - - @Test - public void testProverGetCredentialsForProofRequestWorksForPredicateBySchemaId() throws Exception { - - String proofRequest = String.format("{" + - " \"nonce\":\"123432421212\"," + - " \"name\":\"proof_req_1\"," + - " \"version\":\"0.1\"," + - " \"requested_attributes\":{}," + - " \"requested_predicates\":{" + - " \"predicate1_referent\":{" + - " \"name\":\"age\",\"p_type\":\">=\",\"p_value\":18," + - " \"restrictions\":[{\"schema_id\":\"%s\"}]" + - " }" + - " }" + - " }", gvtSchemaId); - - String credentialsJson = Anoncreds.proverGetCredentialsForProofReq(wallet, new JSONObject(proofRequest).toString()).get(); - - JSONObject credentials = new JSONObject(credentialsJson); - - JSONArray credentialsForPredicate = credentials.getJSONObject("predicates").getJSONArray("predicate1_referent"); - assertEquals(2, credentialsForPredicate.length()); - } - - @Test - public void testProverGetCredentialsForProofRequestWorksForPredicateByMultipleSchemas() throws Exception { - - String proofRequest = String.format("{" + - " \"nonce\":\"123432421212\"," + - " \"name\":\"proof_req_1\"," + - " \"version\":\"0.1\"," + - " \"requested_attributes\":{}," + - " \"requested_predicates\":{" + - " \"predicate1_referent\":{" + - " \"name\":\"age\",\"p_type\":\">=\",\"p_value\":18," + - " \"restrictions\":[{\"schema_id\":\"%s\"}, {\"schema_id\":\"%s\"}]" + - " }" + - " }" + - " }", gvtSchemaId, xyzSchemaId); - - String credentialsJson = Anoncreds.proverGetCredentialsForProofReq(wallet, new JSONObject(proofRequest).toString()).get(); - - JSONObject credentials = new JSONObject(credentialsJson); - - JSONArray credentialsForPredicate = credentials.getJSONObject("predicates").getJSONArray("predicate1_referent"); - assertEquals(2, credentialsForPredicate.length()); - } - - @Test - public void testProverGetCredentialsForProofRequestWorksForPredicateBySpecificCredDefId() throws Exception { - - String proofRequest = String.format("{" + - " \"nonce\":\"123432421212\"," + - " \"name\":\"proof_req_1\"," + - " \"version\":\"0.1\"," + - " \"requested_attributes\":{}," + - " \"requested_predicates\":{" + - " \"predicate1_referent\":{" + - " \"name\":\"age\",\"p_type\":\">=\",\"p_value\":18," + - " \"restrictions\":[{\"cred_def_id\":\"%s\"}]" + - " }" + - " }" + - " }", issuer1gvtCredDefId); - - String credentialsJson = Anoncreds.proverGetCredentialsForProofReq(wallet, new JSONObject(proofRequest).toString()).get(); - - JSONObject credentials = new JSONObject(credentialsJson); - - JSONArray credentialsForPredicate = credentials.getJSONObject("predicates").getJSONArray("predicate1_referent"); - assertEquals(1, credentialsForPredicate.length()); - } - - @Test - public void testProverGetCredentialsForProofRequestWorksForPredicateBySpecificIssuerOrSpecificSchema() throws Exception { - - String proofRequest = String.format("{" + - " \"nonce\":\"123432421212\"," + - " \"name\":\"proof_req_1\"," + - " \"version\":\"0.1\"," + - " \"requested_attributes\":{}," + - " \"requested_predicates\":{" + - " \"predicate1_referent\":{" + - " \"name\":\"age\",\"p_type\":\">=\",\"p_value\":18," + - " \"restrictions\":[{\"schema_id\":\"%s\"}, {\"issuer_did\":\"%s\"}]" + - " }" + - " }" + - " }", gvtSchemaId, issuerDid); - - String credentialsJson = Anoncreds.proverGetCredentialsForProofReq(wallet, new JSONObject(proofRequest).toString()).get(); - - JSONObject credentials = new JSONObject(credentialsJson); - - JSONArray credentialsForPredicate = credentials.getJSONObject("predicates").getJSONArray("predicate1_referent"); - assertEquals(2, credentialsForPredicate.length()); - } - - @Test - public void testProverGetCredentialsForProofRequestWorksForInvalidProofRequest() throws Exception { - - thrown.expect(ExecutionException.class); - thrown.expectCause(isA(InvalidStructureException.class)); - - String proofRequest = "{" + - " \"nonce\":\"123432421212\"," + - " \"name\":\"proof_req_1\"," + - " \"version\":\"0.1\"," + - " \"requested_predicates\":{}" + - " }"; - - Anoncreds.proverGetCredentialsForProofReq(wallet, new JSONObject(proofRequest).toString()).get(); - } - - @Test - public void testProverGetCredentialsForProofRequestWorksForInvalidPredicateType() throws Exception { - - thrown.expect(ExecutionException.class); - thrown.expectCause(isA(InvalidStructureException.class)); - - String proofRequest = "{" + - " \"nonce\":\"123432421212\"," + - " \"name\":\"proof_req_1\"," + - " \"version\":\"0.1\"," + - " \"requested_attributes\":{}," + - " \"requested_predicates\":{" + - " \"predicate1_referent\":{\"name\":\"age\",\"p_type\":\"LE\",\"p_value\":18}" + - " }" + - " }"; - - Anoncreds.proverGetCredentialsForProofReq(wallet, new JSONObject(proofRequest).toString()).get(); - } } diff --git a/wrappers/java/src/test/java/org/hyperledger/indy/sdk/anoncreds/ProverGetCredentialsTest.java b/wrappers/java/src/test/java/org/hyperledger/indy/sdk/anoncreds/ProverGetCredentialsTest.java index b3133642e2..faf84bde96 100644 --- a/wrappers/java/src/test/java/org/hyperledger/indy/sdk/anoncreds/ProverGetCredentialsTest.java +++ b/wrappers/java/src/test/java/org/hyperledger/indy/sdk/anoncreds/ProverGetCredentialsTest.java @@ -39,43 +39,6 @@ public void testProverGetCredentialsWorksForFilterByIssuer() throws Exception { assertEquals(2, credentialsArray.length()); } - @Test - public void testProverGetCredentialsWorksForFilterBySchema() throws Exception { - - JSONObject json = new JSONObject(); - String filter = json.put("schema_id", gvtSchemaId).toString(); - - String credentials = Anoncreds.proverGetCredentials(wallet, filter).get(); - - JSONArray credentialsArray = new JSONArray(credentials); - - assertEquals(2, credentialsArray.length()); - } - - @Test - public void testProverGetCredentialsWorksForFilterBySchemaName() throws Exception { - - JSONObject json = new JSONObject(); - String filter = json.put("schema_name", "gvt").toString(); - - String credentials = Anoncreds.proverGetCredentials(wallet, filter).get(); - - JSONArray credentialsArray = new JSONArray(credentials); - - assertEquals(2, credentialsArray.length()); - } - - @Test - public void testProverGetCredentialsWorksForFilterByCredDefId() throws Exception { - JSONObject json = new JSONObject(); - String filter = json.put("cred_def_id", issuer1gvtCredDefId).toString(); - String credentials = Anoncreds.proverGetCredentials(wallet, filter).get(); - - JSONArray credentialsArray = new JSONArray(credentials); - - assertEquals(1, credentialsArray.length()); - } - @Test public void testProverGetCredentialsWorksForEmptyResult() throws Exception { diff --git a/wrappers/java/src/test/java/org/hyperledger/indy/sdk/anoncreds/ProverSearchCredentialsTest.java b/wrappers/java/src/test/java/org/hyperledger/indy/sdk/anoncreds/ProverSearchCredentialsTest.java index ff2850b93b..404e3e82f8 100644 --- a/wrappers/java/src/test/java/org/hyperledger/indy/sdk/anoncreds/ProverSearchCredentialsTest.java +++ b/wrappers/java/src/test/java/org/hyperledger/indy/sdk/anoncreds/ProverSearchCredentialsTest.java @@ -1,14 +1,10 @@ package org.hyperledger.indy.sdk.anoncreds; -import org.hyperledger.indy.sdk.wallet.WalletInvalidQueryException; import org.json.JSONArray; import org.json.JSONObject; import org.junit.Test; -import java.util.concurrent.ExecutionException; - -import static org.hamcrest.CoreMatchers.isA; import static org.junit.Assert.assertEquals; public class ProverSearchCredentialsTest extends AnoncredsIntegrationTest { @@ -26,17 +22,4 @@ public void testProverSearchCredentialsWorksForEmptyFilter() throws Exception { assertEquals(3, credentialsArray.length()); } - - - @Test - public void testProverSearchCredentialsWorksForInvalidFilterJson() throws Exception { - - thrown.expect(ExecutionException.class); - thrown.expectCause(isA(WalletInvalidQueryException.class)); - - JSONObject json = new JSONObject(); - String filter = json.put("issuer_did", 1).toString(); - - Anoncreds.proverGetCredentials(wallet, filter).get(); - } } diff --git a/wrappers/java/src/test/java/org/hyperledger/indy/sdk/anoncreds/ProverStoreCredentialTest.java b/wrappers/java/src/test/java/org/hyperledger/indy/sdk/anoncreds/ProverStoreCredentialTest.java index 61db33e0b5..a29dd7c43b 100644 --- a/wrappers/java/src/test/java/org/hyperledger/indy/sdk/anoncreds/ProverStoreCredentialTest.java +++ b/wrappers/java/src/test/java/org/hyperledger/indy/sdk/anoncreds/ProverStoreCredentialTest.java @@ -1,29 +1,11 @@ package org.hyperledger.indy.sdk.anoncreds; -import org.hyperledger.indy.sdk.InvalidStructureException; import org.junit.*; -import static org.hamcrest.CoreMatchers.isA; - -import java.util.concurrent.ExecutionException; public class ProverStoreCredentialTest extends AnoncredsIntegrationTest { @Test public void testProverStoreCredentialWorks() throws Exception { } - - @Test - public void testProverStoreCredentialWorksForInvalidCredentialJson() throws Exception { - - Anoncreds.proverCreateCredentialReq(wallet, proverDid, issuer1GvtCredOffer, issuer1gvtCredDef, masterSecretId).get(); - - String credentialJson = "{\"issuer1GvtCredential\":{\"sex\":[\"male\",\"1\"],\"age\":[\"28\",\"28\"],\"name\":[\"Alex\",\"1\"],\"height\":[\"175\",\"175\"]},\n" + - " \"issuer_did\":1}"; - - thrown.expect(ExecutionException.class); - thrown.expectCause(isA(InvalidStructureException.class)); - - Anoncreds.proverStoreCredential(wallet, credentialId1, issuer1GvtCredReqMetadata, credentialJson, issuer1gvtCredDef, null).get(); - } } diff --git a/wrappers/java/src/test/java/org/hyperledger/indy/sdk/anoncreds/VerifierVerifyProofTest.java b/wrappers/java/src/test/java/org/hyperledger/indy/sdk/anoncreds/VerifierVerifyProofTest.java index 2213556cdb..33824358fc 100644 --- a/wrappers/java/src/test/java/org/hyperledger/indy/sdk/anoncreds/VerifierVerifyProofTest.java +++ b/wrappers/java/src/test/java/org/hyperledger/indy/sdk/anoncreds/VerifierVerifyProofTest.java @@ -1,12 +1,8 @@ package org.hyperledger.indy.sdk.anoncreds; -import org.hyperledger.indy.sdk.InvalidStructureException; import org.json.JSONObject; import org.junit.Test; -import java.util.concurrent.ExecutionException; - -import static org.hamcrest.CoreMatchers.isA; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; @@ -85,29 +81,6 @@ public void testVerifierVerifyProofWorksForCorrectProof() throws Exception { assertTrue(valid); } - @Test - public void testVerifierVerifyProofWorksForProofDoesNotCorrespondToProofRequest() throws Exception { - thrown.expect(ExecutionException.class); - thrown.expectCause(isA(InvalidStructureException.class)); - - String schemasJson = new JSONObject().put(gvtSchemaId, new JSONObject(gvtSchema)).toString(); - String credentialDefsJson = new JSONObject().put(issuer1gvtCredDefId, new JSONObject(credentialDef)).toString(); - String revocRegDefsJson = new JSONObject().toString(); - String revocRegsJson = new JSONObject().toString(); - - proofJson = proofJson.replace("\"schema_id\": \"\"", String.format("\"schema_id\": \"%s\"", gvtSchemaId)); - proofJson = proofJson.replace("\"cred_def_id\": \"\"", String.format("\"cred_def_id\": \"%s\"", issuer1gvtCredDefId)); - - String proofRequest = new JSONObject("{\"nonce\":\"123432421212\",\n" + - " \"name\":\"proof_req_1\",\n" + - " \"version\":\"0.1\",\n" + - " \"requested_attributes\":{\"attr1_referent\":{\"name\":\"sex\"}},\n" + - " \"requested_predicates\":{\"predicate1_referent\":{\"name\":\"height\",\"p_type\":\">=\",\"p_value\":180}}\n" + - " }").toString(); - - Anoncreds.verifierVerifyProof(proofRequest, new JSONObject(proofJson).toString(), schemasJson, credentialDefsJson, revocRegDefsJson, revocRegsJson).get(); - } - @Test public void testVerifierVerifyProofWorksForWrongProof() throws Exception { @@ -123,19 +96,4 @@ public void testVerifierVerifyProofWorksForWrongProof() throws Exception { Boolean valid = Anoncreds.verifierVerifyProof(verifierProofRequest, new JSONObject(proofJson).toString(), schemasJson, credentialDefsJson, revocRegDefsJson, revocRegsJson).get(); assertFalse(valid); } - - @Test - public void testVerifierVerifyProofWorksForInvalidProofJson() throws Exception { - thrown.expect(ExecutionException.class); - thrown.expectCause(isA(InvalidStructureException.class)); - - String schemasJson = new JSONObject().put(gvtSchemaId, new JSONObject(gvtSchema)).toString(); - String credentialDefsJson = new JSONObject().put(issuer1gvtCredDefId, new JSONObject(credentialDef)).toString(); - String revocRegDefsJson = new JSONObject().toString(); - String revocRegsJson = new JSONObject().toString(); - - String proofJson = String.format("{\"proofs\":{\"issuer1GvtCredential::277478db-bf57-42c3-8530-b1b13cfe0bfd\":{\"primary_proof\":{\"eq_proof\":{\"revealed_attrs\":{\"name\":\"1139481716457488690172217916278103335\"},\"a_prime\":\"80401564260558483983794628158664845806393125691167675024527906210615204776868092566789307767601325086260531777605457298059939671624755239928848057947875953445797869574854365751051663611984607735255307096920094357120779812375573500489773454634756645206823074153240319316758529163584251907107473703779754778699279153037094140428648169418133281187947677937472972061954089873405836249023133445286756991574802740614183730141450546881449500189789970102133738133443822618072337620343825908790734460412932921199267304555521397418007577171242880211812703320270140386219809818196744216958369397014610013338422295772654405475023\",\"e\":\"31151798717381512709903464053695613005379725796031086912986270617392167764097422442809244590980303622977555221812111085160553241592792901\",\"v\":\"524407431684833626723631303096063196973911986967748096669183384949467719053669910411426601230736351335262754473490498825342793551112426427823428399937548938048089615644972537564428344526295733169691240937176356626523864731701111189536269488496019586818879697981955044502664124964896796783428945944075084807859935155837238670987272778459356531608865162828109489758902085206073584532002909678902616210042778963974064479140826712481297584040209095459963718975102750913306565864485279810056629704077428898739021040190774575868853629858297299392839284660771662690107106553362040805152261505268111067408422298806905178826507224233050991301274817252924123120887017757639206512015559321675322509820081151404696713509158685022511201565062671933414307463988209696457343022378430051265752251403461414881325357657438328740471164157220698425309006894962942640219890219594168419276308074677144722217081026358892787770650248878952483621\",\"m\":{\"age\":\"10477979077744818183854012231360633424177093192344587159214818537659704987539982653663361680650769087122324965941845552897155693994859927792964720675888893623940580527766661802170\",\"sex\":\"15368219775809326116045200104269422566086585069798988383076685221700842794654771075432385446820819836777771517356551059931242867733879324915651894894695726945279462946826404864068\",\"height\":\"268172143999991481637372321419290603042446269013750825098514042757459298040087626745653681785038933035820421862976371452111736537699176931068992453946771945552540798204580069806\"},\"m1\":\"119095745403940293668103184388411799541118279558928018597628509118163496000813590825371995586347826189221837428823000332905316924389185590810015031744029496470545254805993327676570037596326743185389101389800942263689809725968264069601565478411709555274081560719927118853299543998608664701485475703881376151770\",\"m2\":\"3166313665375815600922385342096456465402430622944571045536207479553790085339726549928012930073803465171492637049498407367742103524723152099973753540483894420905314750248333232361\"},\"ge_proofs\":[{\"u\":{\"2\":\"6494171529848192644197417834173236605253723188808961394289041396341136802965710957759175642924978223517091081898946519122412445399638640485278379079647638538597635045303985779767\",\"0\":\"7739508859260491061487569748588091139318989278758566530899756574128579312557203413565436003310787878172471425996601979342157451689172171025305431595131816910273398879776841751855\",\"3\":\"9424758820140378077609053635383940574362083113571024891496206162696034958494400871955445981458978146571146602763357500412840538526390475379772903513687358736287298159312524034159\",\"1\":\"9011979414559555265454106061917684716953356440811838475257096756618761731111646531136628099710567973381801256908067529269805992222342928842825929421929485785888403149296320711642\"},\"r\":{\"DELTA\":\"2119857977629302693157808821351328058251440215802746362450951329352726877165815663955490999790457576333458830301801261754696823614762123890412904169206391143688952648566814660498520188221060505840151491403269696751525874990487604723445355651918681212361562384420233903265612599812725766212744963540390806334870022328290970137051148373040320927100063898502086531019924715927190306801273252711777648467224661735618842887006436195147540705753550974655689586750013569294343535843195025962867299786380033532422131203367401906988124836294104501525520053613392691214421562815044433237816093079784307397782961917892254668290115653012265908717124278607660504580036193346698672079435538219972121355893074219968755049500875222141\",\"2\":\"879097501989202140886939888802566536179834329508897124489020677433754766947767937608431979796722207676629625451150104784909666168153917345813160237337412296010679353735699663083287427507870244565918756969618964144516025526404618052053542009438548457492400344119561349471929199757453154204191407620539220514897529346602664135146454509169680801061111878075145734123580343470361019624175036825631373890661124315134340427076598351080893567995392248394683875116715114577054906406649006122102488431184007790011073389768061904597267545895265921673106871142463561948479668876241841045522543174660428236658891636170119227855493059358614089146415798861053408542832475696099851160385105386001523305465829676723036394820593263477\",\"0\":\"1724016272047416140958096373304304971004826284109046259544344355102178044512441391364907122486655755929044720001281832600729467778103556397960700809066582436321515744527550472324028227472294258045699756170293405547851344921626775854114063087070898499913846456795761213291925373770081490280103876827479351849800210782799381740073719081199000612284788683993320623339686128531187019125095700122135094060470612862911102824801065698176788174959069186600426519872015152034176356923049531650418553748519941342115963599848111324793380438600664408464987023646615003553912544410140730587797458882329021327455905737414352355326238028222782957735440607899424838572541602600159016542488644761584240884783618700311735467659132540546\",\"3\":\"2317535203964314926167241523636020444600002667629517624482931328850422196008281300859516069440995466415138723103558631951648519232327284208990029010060986032518946759289078833125920310350676484457972303378558158127406345804560689086460633931717939234025886786468170219981598030245042011840614339386724945679531091642132820284896626191109974537171662283750959028046143650291367908660204201563611944187723824430780626387525165408619587771059635528553832034409311888615502905143628507219523591091412192645348525327725381323865648645828460581593542176351568614465903523790649219812666979685223535464526901006270478687017672202058914176692964406859722580270696925877498058525086810338471380117323227744481903228027847825795\",\"1\":\"1119193929864813751243160041764170298897380522230946444206167281178657213260394833843687899872857393015947283159245092452814155776571829885921814072299525859857844030379558685168895306445277750249341844789101670896570226707650318347992386244538723699686941887792682779028216548922683313576597384354842537728667739985216662699631842296096507821667149950956179957306177525178260912379909156360834120816956949271530622510333943914411903103069247646327625753995178999023427645468623522280255892736633780185163496867644317005801241786702434621502492159672660131289312665511793827552317714835658019088880972220344126692027952749318018900669839090109361161616086319604439015851316798257015063653414161203599184730094765941653\"},\"mj\":\"10477979077744818183854012231360633424177093192344587159214818537659704987539982653663361680650769087122324965941845552897155693994859927792964720675888893623940580527766661802170\",\"alpha\":\"46280660038407959140964701167450659223532556136388451390393713283900546119670373626221864441898929302821705811144923685080534692512705456699843367809872982836890616398604933641265111106644805368974824737276965928297120628041257593166650593538539384316563258781595629888673792430276007730792093088812056156937735120078929629310611907731935101448992312370312134173482115524436767558802102266208152808607480693236511858269018733175523724309089010048330044458187371675333889670055578652283806685440133357512406700879353713629795062705271430695988191782837658895477702634883214188598350625843489120361660836956958750828038278027538830855628653513539929730230905015331221220017847248793929813230252015802389329428995718799619565984669228143200627972926117282688854152516298117476837960100343260648687249027349308513966440386556698667484082658689\",\"t\":{\"DELTA\":\"46814992964714978733007076702016837564951956529003697497847838781899848384824991374342901164708655443686022921583406187082133141084994843502230809550055933825660668160300304112671478218513259983054489597176651737200716259733573469298437873515151377206364940530308167934399245072298875358347931404742292788785586833114480704138718996633638362933821933388459210678374952072108333767698704767907612549860590824123780096225591372365712106060039646448181221691765233478768574198237963457485496438076793333937013217675591500849193742006533651525421426481898699626618796271544860105422331629265388419155909716261466161258430\",\"2\":\"59423006413504086085782234600502410213751379553855471973440165009200961757474676407242673622935614782362911290590560535490636029324125251850583605745046201217673654522625983661578962623803698461459190578519097656221453474955879823750445359506290522280566225253310030053812918275525607874059407284653434046369835156477189219911810464401689041140506062300317020407969423270374033482533711564673658146930272487464489365713112043565257807490520178903336328210031106311280471651300486164966423437275272281777742004535722142265580037959473078313965482591454009972765788975683031385823798895914265841131145707278751512534120\",\"0\":\"56510878078818710798555570103060159621941668074271797077206591818472978018558098567975838757566260370093327989369045722406190165972775356924844244889146946158949660988214890388299203816110339909687790860564719380865809705044646711632599987968183128514431910561478715003212633874423067294596323864121737000450543142072142652163818450299889830999149821558252183477517484127000480272695698860647674027831262149565273068850774090998356019534296579838685977022988536930596918054160990243868372150609770079720240227817149126735182138479851227052696211125454858584118346950878092387488482897777914362341820607560926173967363\",\"3\":\"63511079416489489495396586813126304469185174450150717746314545118902972011091412254834718868134635251731510764117528579641756327883640004345178347120290107941107152421856942264968771810665927914509411385404403747487862696526824127219640807008235054362138760656969613951620938020257273816713908815343872804442748694361381399025862438391456307852482826748664499083370705834755863016895566228300904018909174673301643617543662527772400085378252706897979609427451977654028887889811453690146157824251379525221390697200211891556653698308665831075787991412401737090471273439878635073797691350863566834141222438011402987450926\",\"1\":\"30348838247529448929141877305241172943867610065951047292188826263950046630912426030349276970628525991007036685038199133783991618544554063310358191845473212966131475853690378885426974792306638181168558731807811629973716711132134244797541560013139884391800841941607502149630914097258613821336239993125960064136287579351403225717114920758719152701696123905042695943045383536065833292374624566478931465135875411483860059753175449604448434619593495399051968638830805689355610877075130302742512428461286121237297212174164897833936610857614962734658136750299346971377383141235020438750748045568800723867413392427848651081274\"},\"predicate\":{\"attr_name\":\"age\",\"p_type\":\"GE\",\"value\":18}}]},\"non_revoc_proof\":null}},\"aggregated_proof\":{\"c_hash\":\"81135772044295974649282368084258333955993271555081206390568996949836231116301\",\"c_list\":[[2,124,231,47,189,36,247,160,61,220,165,35,97,165,203,185,133,253,81,239,67,127,156,49,189,16,140,30,177,161,221,54,154,0,127,143,98,212,114,193,188,85,206,171,198,140,9,192,10,254,218,120,201,182,40,141,80,35,81,148,204,192,41,5,186,33,50,77,211,163,124,130,32,219,193,167,79,43,181,76,19,249,53,79,70,221,205,36,180,50,120,255,161,227,196,204,71,106,221,131,220,7,73,86,128,208,48,58,123,63,82,24,170,141,143,56,221,96,151,108,105,38,185,243,224,112,177,101,195,87,208,201,39,123,165,125,92,104,234,188,54,92,31,158,178,152,52,205,26,156,237,241,23,15,76,220,168,32,175,230,157,197,225,70,57,237,8,81,13,17,95,70,143,56,162,223,203,8,48,153,51,51,118,116,32,139,187,222,146,86,165,111,125,107,203,18,212,28,168,22,62,69,204,207,122,148,25,30,92,120,83,214,116,221,204,120,230,70,128,139,181,110,69,93,253,240,69,16,113,224,246,41,142,0,83,237,186,4,50,156,206,199,89,74,96,168,249,240,101,16,103,234,162,219,52,218,207],[1,191,167,2,151,36,61,136,184,172,120,86,127,88,109,119,56,21,167,171,217,221,24,64,246,237,255,152,81,183,201,191,59,234,213,101,254,91,33,205,120,71,215,144,160,243,145,109,19,151,241,46,135,132,50,143,219,207,197,35,89,103,83,212,96,83,222,101,55,57,220,161,252,115,39,62,46,160,30,138,221,89,125,66,114,150,5,95,63,10,55,107,102,73,40,69,41,6,57,0,64,226,152,66,181,149,251,50,28,53,18,26,221,5,188,67,125,184,190,200,56,92,132,201,242,211,37,2,43,6,146,88,228,120,204,190,4,118,134,106,118,110,249,145,175,165,116,197,200,183,207,215,197,79,207,203,29,182,231,151,248,233,107,41,79,234,250,27,33,33,107,102,240,47,37,230,243,185,93,192,52,31,73,211,11,173,150,92,194,154,172,247,221,206,129,85,193,105,172,140,201,40,240,200,28,94,1,96,204,175,113,170,46,134,229,111,215,208,237,252,84,50,249,41,214,79,38,194,23,212,7,164,153,217,23,252,32,114,145,58,189,118,104,131,84,184,115,175,199,227,219,117,23,113,113,180,3],[240,104,187,71,84,144,129,123,12,181,215,233,27,55,56,54,94,57,17,42,111,42,112,234,192,23,226,103,118,198,189,175,175,1,102,64,128,100,221,201,134,106,83,239,69,43,150,172,95,206,145,224,207,239,39,193,30,200,90,125,175,125,59,47,250,224,193,21,64,112,101,131,128,249,96,165,73,33,174,64,69,252,209,158,130,53,23,158,217,173,69,51,12,145,70,174,15,206,13,181,50,246,50,110,223,65,250,44,39,33,8,47,169,242,147,3,190,164,110,20,68,5,142,133,38,198,151,161,167,0,219,128,126,120,190,23,153,22,250,78,114,241,252,181,74,142,65,123,225,153,75,159,78,84,28,110,203,105,231,238,75,138,121,233,75,163,221,69,106,143,1,217,251,43,147,252,189,122,19,124,189,180,206,91,165,199,41,172,233,102,14,91,162,254,16,142,60,230,39,200,208,236,101,69,101,152,233,217,100,206,31,120,211,191,90,56,205,40,180,120,47,210,224,86,153,34,86,237,204,11,183,227,0,224,15,201,32,228,4,210,43,156,68,246,137,150,103,197,191,150,155,181,78,5,134,58],[1,214,184,139,205,251,132,131,8,186,140,58,211,242,134,120,121,253,128,192,10,252,172,101,44,26,119,56,212,8,248,71,19,96,59,12,233,191,63,187,217,35,191,160,127,247,189,247,229,111,252,101,126,10,142,252,238,215,211,137,137,164,114,186,255,199,183,50,103,9,158,63,134,140,162,154,188,109,52,31,92,78,38,228,0,60,225,100,239,88,114,95,48,71,7,117,168,45,45,177,178,62,87,197,98,174,123,249,26,237,179,12,63,182,46,218,183,148,163,222,179,159,146,56,142,190,122,100,211,6,86,237,10,7,111,186,27,66,95,252,108,247,203,1,111,60,13,218,104,63,128,125,197,11,201,138,33,122,37,31,163,123,120,132,65,122,208,60,80,87,113,183,28,31,74,106,18,79,52,245,113,184,94,202,72,223,8,128,209,43,77,237,119,208,255,144,26,76,223,77,177,131,237,49,150,251,53,150,115,33,254,237,185,15,140,234,205,99,248,252,171,245,192,104,151,194,190,186,249,180,246,9,169,165,0,221,7,107,39,67,58,178,176,99,212,40,247,49,127,7,94,5,170,65,154,28,104],[1,247,26,202,244,120,131,95,151,52,56,38,141,232,178,50,61,45,235,61,12,68,11,180,174,222,110,211,141,253,198,204,248,192,40,99,237,1,45,170,79,208,3,13,135,89,195,65,3,228,224,146,181,198,14,79,78,237,168,81,108,151,68,12,88,242,120,200,120,193,253,51,167,140,43,175,59,18,160,190,233,21,213,135,162,76,38,48,163,110,155,197,97,93,211,183,95,42,172,249,98,59,161,136,70,39,142,48,242,44,154,103,186,161,214,215,0,254,166,150,111,71,242,102,209,125,25,65,144,223,211,137,223,239,50,96,185,171,120,155,171,98,204,23,102,253,68,141,91,240,127,170,199,249,217,165,164,37,174,212,159,232,140,196,216,140,205,102,84,104,220,223,9,249,75,245,78,157,245,203,235,154,73,34,77,12,227,138,93,105,178,114,255,210,88,216,202,64,69,128,220,211,113,51,15,185,103,236,52,187,49,29,162,20,35,21,65,188,33,46,11,172,59,15,221,36,33,213,14,121,36,218,76,80,97,197,83,64,145,73,194,43,233,144,251,86,112,209,230,67,234,116,172,219,123,50,46],[1,114,216,159,37,214,198,117,230,153,15,176,95,20,29,134,179,207,209,35,101,193,47,54,130,141,78,213,54,167,31,73,105,177,129,135,6,135,45,107,103,16,133,187,74,217,42,40,1,214,60,70,78,245,86,82,150,75,91,235,181,249,129,147,202,15,86,250,222,240,203,236,102,39,53,147,79,178,124,184,97,73,65,136,74,29,219,182,83,167,221,203,32,200,243,130,65,234,133,181,203,35,86,21,123,170,74,174,5,132,1,149,77,141,158,193,249,130,37,53,253,234,228,144,66,152,232,246,26,193,6,53,139,45,231,173,115,87,89,61,197,9,96,73,229,189,49,44,203,214,156,139,58,153,77,13,90,35,157,130,184,150,161,69,145,157,4,206,52,216,227,233,113,202,54,154,153,100,83,97,135,88,197,227,42,52,28,221,91,117,56,183,198,102,231,37,232,226,136,142,115,218,175,45,221,143,130,215,184,39,102,172,126,253,152,108,254,241,17,98,70,223,191,138,251,227,243,32,180,190,223,69,135,0,97,105,115,189,221,134,26,159,32,210,172,233,7,65,238,77,203,159,181,188,203,159,190]]}},\"requested_proof\":{\"revealed_attrs\":{\"attr1_referent\":[\"issuer1GvtCredential::277478db-bf57-42c3-8530-b1b13cfe0bfd\",\"Alex\",\"1139481716457488690172217916278103335\"]},\"unrevealed_attrs\":{},\"self_attested_attrs\":{},\"predicates\":{\"predicate1_referent\":\"issuer1GvtCredential::277478db-bf57-42c3-8530-b1b13cfe0bfd\"},\"identifiers\":{\"issuer1GvtCredential::277478db-bf57-42c3-8530-b1b13cfe0bfd\":{\"issuer_did\":\"NcYxiDXkpYi6ov5FcYDi1e\",\"schema_key\":%s}}}", gvtSchemaId); - - Anoncreds.verifierVerifyProof(verifierProofRequest, new JSONObject(proofJson).toString(), schemasJson, credentialDefsJson, revocRegDefsJson, revocRegsJson).get(); - } } diff --git a/wrappers/java/src/test/java/org/hyperledger/indy/sdk/crypto/CryptoAnonCryptTest.java b/wrappers/java/src/test/java/org/hyperledger/indy/sdk/crypto/CryptoAnonCryptTest.java index 86f452924e..6bd5586486 100644 --- a/wrappers/java/src/test/java/org/hyperledger/indy/sdk/crypto/CryptoAnonCryptTest.java +++ b/wrappers/java/src/test/java/org/hyperledger/indy/sdk/crypto/CryptoAnonCryptTest.java @@ -1,12 +1,8 @@ package org.hyperledger.indy.sdk.crypto; import org.hyperledger.indy.sdk.IndyIntegrationTest; -import org.hyperledger.indy.sdk.InvalidStructureException; import org.junit.Test; -import java.util.concurrent.ExecutionException; - -import static org.hamcrest.CoreMatchers.isA; import static org.junit.Assert.assertNotNull; public class CryptoAnonCryptTest extends IndyIntegrationTest { @@ -16,12 +12,4 @@ public void testPrepAnonymousMsgWorks() throws Exception { byte[] encryptedMsg = Crypto.anonCrypt(VERKEY_MY1, MESSAGE).get(); assertNotNull(encryptedMsg); } - - @Test - public void testPrepAnonymousMsgWorksForInvalidRecipientVk() throws Exception { - thrown.expect(ExecutionException.class); - thrown.expectCause(isA(InvalidStructureException.class)); - - Crypto.anonCrypt(INVALID_VERKEY, MESSAGE).get(); - } } \ No newline at end of file diff --git a/wrappers/java/src/test/java/org/hyperledger/indy/sdk/crypto/CryptoAnonDecryptTest.java b/wrappers/java/src/test/java/org/hyperledger/indy/sdk/crypto/CryptoAnonDecryptTest.java index f4ab7d5b85..a6355ba4ab 100644 --- a/wrappers/java/src/test/java/org/hyperledger/indy/sdk/crypto/CryptoAnonDecryptTest.java +++ b/wrappers/java/src/test/java/org/hyperledger/indy/sdk/crypto/CryptoAnonDecryptTest.java @@ -1,7 +1,6 @@ package org.hyperledger.indy.sdk.crypto; import org.hyperledger.indy.sdk.IndyIntegrationTestWithSingleWallet; -import org.hyperledger.indy.sdk.InvalidStructureException; import org.hyperledger.indy.sdk.wallet.WalletItemNotFoundException; import org.junit.Test; @@ -24,18 +23,6 @@ public void testAnonDecryptWorks() throws Exception { assertTrue(Arrays.equals(MESSAGE, decryptedMsg)); } - @Test - public void testAnonDecryptWorksForInvalidMessage() throws Exception { - String myVk = Crypto.createKey(wallet, "{}").get(); - - String msg = "unencrypted message"; - - thrown.expect(ExecutionException.class); - thrown.expectCause(isA(InvalidStructureException.class)); - - Crypto.anonDecrypt(wallet, myVk, msg.getBytes()).get(); - } - @Test public void testParseMsgWorksForUnknownRecipientVk() throws Exception { byte[] encryptedMsg = Crypto.anonCrypt(VERKEY, MESSAGE).get(); diff --git a/wrappers/java/src/test/java/org/hyperledger/indy/sdk/crypto/CryptoAuthCryptTest.java b/wrappers/java/src/test/java/org/hyperledger/indy/sdk/crypto/CryptoAuthCryptTest.java index 55590e6f9c..2face96735 100644 --- a/wrappers/java/src/test/java/org/hyperledger/indy/sdk/crypto/CryptoAuthCryptTest.java +++ b/wrappers/java/src/test/java/org/hyperledger/indy/sdk/crypto/CryptoAuthCryptTest.java @@ -23,24 +23,6 @@ public void testAuthCryptWorksForCreatedKey() throws Exception { assertNotNull(encryptedMsg); } - @Test - public void testAuthCryptWorksForCreatedDid() throws Exception { - DidResults.CreateAndStoreMyDidResult result = Did.createAndStoreMyDid(wallet, MY1_IDENTITY_JSON).get(); - String myVk = result.getVerkey(); - - byte[] encryptedMsg = Crypto.authCrypt(wallet, myVk, VERKEY_MY2, MESSAGE).get(); - assertNotNull(encryptedMsg); - } - - @Test - public void testAuthCryptWorksForCreatedDidAsCid() throws Exception { - DidResults.CreateAndStoreMyDidResult result = Did.createAndStoreMyDid(wallet, MY1_IDENTITY_JSON).get(); - String myVk = result.getVerkey(); - - byte[] encryptedMsg = Crypto.authCrypt(wallet, myVk, VERKEY_MY2, MESSAGE).get(); - assertNotNull(encryptedMsg); - } - @Test public void testAuthCryptWorksForUnknownSenderVerkey() throws Exception { thrown.expect(ExecutionException.class); diff --git a/wrappers/java/src/test/java/org/hyperledger/indy/sdk/crypto/CryptoAuthDecryptTest.java b/wrappers/java/src/test/java/org/hyperledger/indy/sdk/crypto/CryptoAuthDecryptTest.java index 5e7bc3b3af..4170329344 100644 --- a/wrappers/java/src/test/java/org/hyperledger/indy/sdk/crypto/CryptoAuthDecryptTest.java +++ b/wrappers/java/src/test/java/org/hyperledger/indy/sdk/crypto/CryptoAuthDecryptTest.java @@ -1,9 +1,6 @@ package org.hyperledger.indy.sdk.crypto; import org.hyperledger.indy.sdk.IndyIntegrationTestWithSingleWallet; -import org.hyperledger.indy.sdk.InvalidStructureException; -import org.hyperledger.indy.sdk.did.Did; -import org.hyperledger.indy.sdk.did.DidResults; import org.hyperledger.indy.sdk.wallet.WalletItemNotFoundException; import org.junit.Test; @@ -32,23 +29,6 @@ public void testAuthDecryptWorks() throws Exception { assertTrue(Arrays.equals(MESSAGE, decryptResult.getDecryptedMessage())); } - @Test - public void testAuthDecryptWorksForInvalidMessage() throws Exception { - DidResults.CreateAndStoreMyDidResult result = Did.createAndStoreMyDid(wallet, "{}").get(); - String recipientDid = result.getDid(); - String myVk = result.getVerkey(); - - String identityJson = String.format(IDENTITY_JSON_TEMPLATE, recipientDid, myVk); - Did.storeTheirDid(wallet, identityJson).get(); - - String msg = String.format("{\"auth\":true,\"nonсe\":\"Th7MpTaRZVRYnPiabds81Y12\",\"sender\":\"%s\",\"msg\":%s}", VERKEY, Arrays.toString(ENCRYPTED_MESSAGE)); - - thrown.expect(ExecutionException.class); - thrown.expectCause(isA(InvalidStructureException.class)); - - Crypto.authDecrypt(wallet, myVk, msg.getBytes()).get(); - } - @Test public void testAuthDecryptWorksForUnknownTheirVk() throws Exception { String theirVk = Crypto.createKey(wallet, MY1_IDENTITY_KEY_JSON).get(); diff --git a/wrappers/java/src/test/java/org/hyperledger/indy/sdk/crypto/CryptoVerifyTest.java b/wrappers/java/src/test/java/org/hyperledger/indy/sdk/crypto/CryptoVerifyTest.java index a85c9f0b4e..ad3a5499f4 100644 --- a/wrappers/java/src/test/java/org/hyperledger/indy/sdk/crypto/CryptoVerifyTest.java +++ b/wrappers/java/src/test/java/org/hyperledger/indy/sdk/crypto/CryptoVerifyTest.java @@ -3,10 +3,6 @@ import org.hyperledger.indy.sdk.IndyIntegrationTest; import org.junit.Test; -import java.util.concurrent.ExecutionException; - -import static junit.framework.TestCase.assertFalse; -import static org.hamcrest.CoreMatchers.isA; import static org.junit.Assert.assertTrue; public class CryptoVerifyTest extends IndyIntegrationTest { @@ -16,26 +12,4 @@ public void testCryptoVerifyWorks() throws Exception { Boolean valid = Crypto.cryptoVerify(VERKEY_TRUSTEE, MESSAGE, SIGNATURE).get(); assertTrue(valid); } - - @Test - public void testCryptoVerifyWorksForVerkeyWithCorrectCryptoType() throws Exception { - String verkey = VERKEY_TRUSTEE + ":ed25519"; - Boolean valid = Crypto.cryptoVerify(verkey, MESSAGE, SIGNATURE).get(); - assertTrue(valid); - } - - @Test - public void testCryptoVerifyWorksForVerkeyWithInvalidCryptoType() throws Exception { - thrown.expect(ExecutionException.class); - thrown.expectCause(isA(UnknownCryptoException.class)); - - String verkey = VERKEY_TRUSTEE + ":unknown_crypto"; - Crypto.cryptoVerify(verkey, MESSAGE, SIGNATURE).get(); - } - - @Test - public void testCryptoVerifyWorksForOtherSigner() throws Exception { - Boolean valid = Crypto.cryptoVerify(VERKEY_MY2, MESSAGE, SIGNATURE).get(); - assertFalse(valid); - } } diff --git a/wrappers/java/src/test/java/org/hyperledger/indy/sdk/crypto/GetKeyMetadataTest.java b/wrappers/java/src/test/java/org/hyperledger/indy/sdk/crypto/GetKeyMetadataTest.java index 724f4b2e26..e9b507e088 100644 --- a/wrappers/java/src/test/java/org/hyperledger/indy/sdk/crypto/GetKeyMetadataTest.java +++ b/wrappers/java/src/test/java/org/hyperledger/indy/sdk/crypto/GetKeyMetadataTest.java @@ -27,13 +27,6 @@ public void testGetKeyMetadataWorks() throws Exception { assertEquals(METADATA, receivedMetadata); } - @Test - public void testGetKeyMetadataWorksForEmptyString() throws Exception { - Crypto.setKeyMetadata(wallet, key, "").get(); - String receivedMetadata = Crypto.getKeyMetadata(wallet, key).get(); - assertEquals("", receivedMetadata); - } - @Test public void testGetKeyMetadataWorksForNoKey() throws Exception { thrown.expect(ExecutionException.class); @@ -41,12 +34,4 @@ public void testGetKeyMetadataWorksForNoKey() throws Exception { Crypto.getKeyMetadata(wallet, VERKEY).get(); } - - @Test - public void testGetKeyMetadataWorksForNoMetadata() throws Exception { - thrown.expect(ExecutionException.class); - thrown.expectCause(isA(WalletItemNotFoundException.class)); - - Crypto.getKeyMetadata(wallet, key).get(); - } } \ No newline at end of file diff --git a/wrappers/java/src/test/java/org/hyperledger/indy/sdk/crypto/PackUnpackMessageTest.java b/wrappers/java/src/test/java/org/hyperledger/indy/sdk/crypto/PackUnpackMessageTest.java index 8e56689890..9663efc34b 100644 --- a/wrappers/java/src/test/java/org/hyperledger/indy/sdk/crypto/PackUnpackMessageTest.java +++ b/wrappers/java/src/test/java/org/hyperledger/indy/sdk/crypto/PackUnpackMessageTest.java @@ -3,13 +3,11 @@ import org.hyperledger.indy.sdk.IndyIntegrationTest; import org.hyperledger.indy.sdk.IndyIntegrationTestWithSingleWallet; import org.hyperledger.indy.sdk.InvalidParameterException; -import org.hyperledger.indy.sdk.InvalidStructureException; import org.hyperledger.indy.sdk.wallet.WalletItemNotFoundException; import org.json.JSONObject; import org.junit.Test; import org.json.JSONArray; -import java.util.concurrent.CompletableFuture; import java.util.concurrent.ExecutionException; import static org.hamcrest.CoreMatchers.isA; @@ -64,32 +62,6 @@ public void testPackMessageErrorsWithNoReceivers() throws Exception { assertTrue(false); } - @Test - public void testPackMessageErrorsInvalidReceivers() throws Exception { - JSONArray receivers = new JSONArray(new String[]{"IndyIntegrationTest.VERKEY_MY1"}); - - thrown.expect(ExecutionException.class); - thrown.expectCause(isA(InvalidStructureException.class)); - - Crypto.packMessage(wallet, receivers.toString(), null, message.getBytes()).get(); - - // this assert should never trigger since unpackMessage should throw exception - assertTrue(false); - } - - @Test - public void testUnpackMessageErrorsWithInvalidPackedMessageStructure() throws Exception { - String packedMessage = "jibberish"; - - thrown.expect(ExecutionException.class); - thrown.expectCause(isA(InvalidParameterException.class)); - - Crypto.unpackMessage(wallet, packedMessage.getBytes()).get(); - - // this assert should never trigger since unpackMessage should throw exception - assertTrue(false); - } - @Test public void testUnpackMessageAnoncryptWorks() throws Exception { String receiverVerkey = Crypto.createKey(wallet, "{}").get(); diff --git a/wrappers/java/src/test/java/org/hyperledger/indy/sdk/crypto/SetKeyMetadataTest.java b/wrappers/java/src/test/java/org/hyperledger/indy/sdk/crypto/SetKeyMetadataTest.java index 0404e142df..f46e10b1b4 100644 --- a/wrappers/java/src/test/java/org/hyperledger/indy/sdk/crypto/SetKeyMetadataTest.java +++ b/wrappers/java/src/test/java/org/hyperledger/indy/sdk/crypto/SetKeyMetadataTest.java @@ -4,8 +4,6 @@ import org.junit.Before; import org.junit.Test; -import static org.junit.Assert.assertEquals; - public class SetKeyMetadataTest extends IndyIntegrationTestWithSingleWallet { @@ -21,23 +19,6 @@ public void testSetKeyMetadataWorks() throws Exception { Crypto.setKeyMetadata(wallet, key, METADATA).get(); } - @Test - public void testSetKeyMetadataWorksForReplace() throws Exception { - Crypto.setKeyMetadata(wallet, key, METADATA).get(); - String receivedMetadata = Crypto.getKeyMetadata(wallet, key).get(); - assertEquals(METADATA, receivedMetadata); - - String newMetadata = "updated metadata"; - Crypto.setKeyMetadata(wallet, key, newMetadata).get(); - String updatedMetadata = Crypto.getKeyMetadata(wallet, key).get(); - assertEquals(newMetadata, updatedMetadata); - } - - @Test - public void testSetKeyMetadataWorksForEmptyString() throws Exception { - Crypto.setKeyMetadata(wallet, key, "").get(); - } - @Test public void testSetKeyMetadataWorksForNoKey() throws Exception { Crypto.setKeyMetadata(wallet, VERKEY, METADATA).get(); diff --git a/wrappers/java/src/test/java/org/hyperledger/indy/sdk/did/CreateMyDidTest.java b/wrappers/java/src/test/java/org/hyperledger/indy/sdk/did/CreateMyDidTest.java index 17b590d577..a3654f6507 100644 --- a/wrappers/java/src/test/java/org/hyperledger/indy/sdk/did/CreateMyDidTest.java +++ b/wrappers/java/src/test/java/org/hyperledger/indy/sdk/did/CreateMyDidTest.java @@ -31,36 +31,6 @@ public void testCreateMyDidWorksForSeed() throws Exception { assertEquals(VERKEY_MY1, result.getVerkey()); } - @Test - public void testCreateMyDidWorksAsCid() throws Exception { - String didJson = new DidJSONParameters.CreateAndStoreMyDidJSONParameter(null, MY1_SEED, null, true).toJson(); - - CreateAndStoreMyDidResult result = Did.createAndStoreMyDid(this.wallet, didJson).get(); - - assertEquals(VERKEY_MY1, result.getDid()); - assertEquals(VERKEY_MY1, result.getVerkey()); - } - - @Test - public void testCreateMyDidWorksForPassedDid() throws Exception { - - String didJson = new DidJSONParameters.CreateAndStoreMyDidJSONParameter(DID, null, null, false).toJson(); - - CreateAndStoreMyDidResult result = Did.createAndStoreMyDid(this.wallet, didJson).get(); - - assertEquals(DID, result.getDid()); - } - - @Test - public void testCreateMyDidWorksForCorrectCryptoType() throws Exception { - String didJson = new DidJSONParameters.CreateAndStoreMyDidJSONParameter(null, MY1_SEED, CRYPTO_TYPE, null).toJson(); - - CreateAndStoreMyDidResult result = Did.createAndStoreMyDid(this.wallet, didJson).get(); - - assertEquals(DID_MY1, result.getDid()); - assertEquals(VERKEY_MY1, result.getVerkey()); - } - @Test public void testCreateMyDidWorksForInvalidSeed() throws Exception { thrown.expect(ExecutionException.class); @@ -71,26 +41,6 @@ public void testCreateMyDidWorksForInvalidSeed() throws Exception { Did.createAndStoreMyDid(this.wallet, didJson).get(); } - @Test - public void testCreateMyDidWorksForInvalidCryptoType() throws Exception { - thrown.expect(ExecutionException.class); - thrown.expectCause(isA(UnknownCryptoException.class)); - - String didJson = new DidJSONParameters.CreateAndStoreMyDidJSONParameter(null, MY1_SEED, "crypto_type", null).toJson(); - - Did.createAndStoreMyDid(this.wallet, didJson).get(); - } - - @Test - public void testCreateMyDidWorksForAllParams() throws Exception { - String didJson = new DidJSONParameters.CreateAndStoreMyDidJSONParameter(DID, MY1_SEED, CRYPTO_TYPE, true).toJson(); - - CreateAndStoreMyDidResult result = Did.createAndStoreMyDid(this.wallet, didJson).get(); - - assertEquals(DID, result.getDid()); - assertEquals(VERKEY_MY1, result.getVerkey()); - } - @Test public void testCreateMyDidWorksForDuplicate() throws Exception { CreateAndStoreMyDidResult result = Did.createAndStoreMyDid(this.wallet, "{}").get(); diff --git a/wrappers/java/src/test/java/org/hyperledger/indy/sdk/did/GetDidMetadataTest.java b/wrappers/java/src/test/java/org/hyperledger/indy/sdk/did/GetDidMetadataTest.java index 2c0b5a448c..a7d91860e8 100644 --- a/wrappers/java/src/test/java/org/hyperledger/indy/sdk/did/GetDidMetadataTest.java +++ b/wrappers/java/src/test/java/org/hyperledger/indy/sdk/did/GetDidMetadataTest.java @@ -28,21 +28,6 @@ public void testGetDidMetadataWorks() throws Exception { assertEquals(METADATA, receivedMetadata); } - @Test - public void testGetDidMetadataWorksForEmptyString() throws Exception { - Did.setDidMetadata(wallet, did, "").get(); - String receivedMetadata = Did.getDidMetadata(wallet, did).get(); - assertEquals("", receivedMetadata); - } - - @Test - public void testGetDidMetadataWorksForNotFoundDid() throws Exception { - thrown.expect(ExecutionException.class); - thrown.expectCause(isA(WalletItemNotFoundException.class)); - - Did.getDidMetadata(wallet, DID).get(); - } - @Test public void testGetDidMetadataWorksForNoMetadata() throws Exception { thrown.expect(ExecutionException.class); diff --git a/wrappers/java/src/test/java/org/hyperledger/indy/sdk/did/GetEndpointForDidTest.java b/wrappers/java/src/test/java/org/hyperledger/indy/sdk/did/GetEndpointForDidTest.java index e73c76d27c..c037fa1014 100644 --- a/wrappers/java/src/test/java/org/hyperledger/indy/sdk/did/GetEndpointForDidTest.java +++ b/wrappers/java/src/test/java/org/hyperledger/indy/sdk/did/GetEndpointForDidTest.java @@ -2,15 +2,12 @@ import org.hyperledger.indy.sdk.IndyIntegrationTestWithPoolAndSingleWallet; import org.hyperledger.indy.sdk.InvalidStateException; -import org.hyperledger.indy.sdk.ledger.Ledger; -import org.hyperledger.indy.sdk.utils.PoolUtils; import org.junit.Test; import java.util.concurrent.ExecutionException; import static org.hamcrest.CoreMatchers.isA; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; public class GetEndpointForDidTest extends IndyIntegrationTestWithPoolAndSingleWallet { @@ -23,29 +20,6 @@ public void testGetEndpointForDidWorks() throws Exception { assertEquals(VERKEY, receivedEndpoint.getTransportKey()); } - @Test(timeout = PoolUtils.TEST_TIMEOUT_FOR_REQUEST_ENSURE) - public void testGetEndpointForDidWorksFromLedger() throws Exception { - DidResults.CreateAndStoreMyDidResult trusteeDidResult = Did.createAndStoreMyDid(wallet, TRUSTEE_IDENTITY_JSON).get(); - String trusteeDid = trusteeDidResult.getDid(); - String trusteeVerkey = trusteeDidResult.getVerkey(); - - String endpoint = String.format("{\"endpoint\":{\"ha\":\"%s\",\"verkey\":\"%s\"}}", ENDPOINT, trusteeVerkey); - - String attribRequest = Ledger.buildAttribRequest(trusteeDid, trusteeDid, null, endpoint, null).get(); - Ledger.signAndSubmitRequest(pool, wallet, trusteeDid, attribRequest).get(); - - assertTrue(PoolUtils.retryCheck( - () -> { - String respEndpoint = null; - try { - respEndpoint = Did.getEndpointForDid(wallet, pool, trusteeDid).get().toString(); - } catch (ExecutionException ignore) { - } - return respEndpoint; - }, - didEndpoint -> new DidResults.EndpointForDidResult(ENDPOINT, trusteeVerkey).toString().equals(didEndpoint))); - } - @Test public void testGetEndpointForDidWorksForUnknownDid() throws Exception { thrown.expect(ExecutionException.class); diff --git a/wrappers/java/src/test/java/org/hyperledger/indy/sdk/did/KeyForDidTest.java b/wrappers/java/src/test/java/org/hyperledger/indy/sdk/did/KeyForDidTest.java index f0f98ba027..f5d6a5e3c7 100644 --- a/wrappers/java/src/test/java/org/hyperledger/indy/sdk/did/KeyForDidTest.java +++ b/wrappers/java/src/test/java/org/hyperledger/indy/sdk/did/KeyForDidTest.java @@ -1,7 +1,6 @@ package org.hyperledger.indy.sdk.did; import org.hyperledger.indy.sdk.IndyIntegrationTestWithPoolAndSingleWallet; -import org.hyperledger.indy.sdk.ledger.Ledger; import org.hyperledger.indy.sdk.wallet.WalletItemNotFoundException; import org.junit.Test; @@ -23,27 +22,6 @@ public void testKeyForDidWorksForMyDid() throws Exception { assertEquals(key, receivedKey); } - @Test - public void testKeyForDidWorksForTheirDid() throws Exception { - Did.storeTheirDid(wallet, String.format(IDENTITY_JSON_TEMPLATE, DID_MY1, VERKEY_MY1)).get(); - - String receivedKey = Did.keyForDid(pool, wallet, DID_MY1).get(); - assertEquals(VERKEY_MY1, receivedKey); - } - - @Test - public void testKeyForDidWorksForGetKeyFromLedger() throws Exception { - DidResults.CreateAndStoreMyDidResult result = Did.createAndStoreMyDid(this.wallet, TRUSTEE_IDENTITY_JSON).get(); - String trusteeDid = result.getDid(); - - Did.storeTheirDid(wallet, String.format(IDENTITY_JSON_TEMPLATE, DID_MY1, VERKEY_MY1)).get(); - String nymRequest = Ledger.buildNymRequest(trusteeDid, DID_MY1, VERKEY_MY1, null, null).get(); - Ledger.signAndSubmitRequest(pool, wallet, trusteeDid, nymRequest).get(); - - String receivedKey = Did.keyForDid(pool, wallet, DID_MY1).get(); - assertEquals(VERKEY_MY1, receivedKey); - } - @Test public void testKeyForDidWorksForNoKey() throws Exception { thrown.expect(ExecutionException.class); diff --git a/wrappers/java/src/test/java/org/hyperledger/indy/sdk/did/KeyForLocalDidTest.java b/wrappers/java/src/test/java/org/hyperledger/indy/sdk/did/KeyForLocalDidTest.java index 3ddacbe3ce..a2f415ba7c 100644 --- a/wrappers/java/src/test/java/org/hyperledger/indy/sdk/did/KeyForLocalDidTest.java +++ b/wrappers/java/src/test/java/org/hyperledger/indy/sdk/did/KeyForLocalDidTest.java @@ -22,14 +22,6 @@ public void testKeyForLocalDidWorksForMyDid() throws Exception { assertEquals(key, receivedKey); } - @Test - public void testKeyForLocalDidWorksForTheirDid() throws Exception { - Did.storeTheirDid(wallet, String.format(IDENTITY_JSON_TEMPLATE, DID_MY1, VERKEY_MY1)).get(); - - String receivedKey = Did.keyForLocalDid(wallet, DID_MY1).get(); - assertEquals(VERKEY_MY1, receivedKey); - } - @Test public void testKeyForDidWorksForNoKey() throws Exception { thrown.expect(ExecutionException.class); diff --git a/wrappers/java/src/test/java/org/hyperledger/indy/sdk/did/SetDidMetadataTest.java b/wrappers/java/src/test/java/org/hyperledger/indy/sdk/did/SetDidMetadataTest.java index 2ae6aebcb9..208dde08b4 100644 --- a/wrappers/java/src/test/java/org/hyperledger/indy/sdk/did/SetDidMetadataTest.java +++ b/wrappers/java/src/test/java/org/hyperledger/indy/sdk/did/SetDidMetadataTest.java @@ -8,7 +8,6 @@ import java.util.concurrent.ExecutionException; import static org.hamcrest.CoreMatchers.isA; -import static org.junit.Assert.assertEquals; public class SetDidMetadataTest extends IndyIntegrationTestWithSingleWallet { @@ -26,28 +25,6 @@ public void testSetDidMetadataWorks() throws Exception { Did.setDidMetadata(wallet, did, METADATA).get(); } - @Test - public void testSetDidMetadataWorksForReplace() throws Exception { - Did.setDidMetadata(wallet, did, METADATA).get(); - String receivedMetadata = Did.getDidMetadata(wallet, did).get(); - assertEquals(METADATA, receivedMetadata); - - String newMetadata = "updated metadata"; - Did.setDidMetadata(wallet, did, newMetadata).get(); - String updatedMetadata = Did.getDidMetadata(wallet, did).get(); - assertEquals(newMetadata, updatedMetadata); - } - - @Test - public void testSetDidMetadataWorksForEmptyString() throws Exception { - Did.setDidMetadata(wallet, did, "").get(); - } - - @Test - public void testSetDidMetadataWorksForUnknownDid() throws Exception { - Did.setDidMetadata(wallet, DID, METADATA).get(); - } - @Test public void testSetDidMetadataWorksForInvalidDid() throws Exception { thrown.expect(ExecutionException.class); diff --git a/wrappers/java/src/test/java/org/hyperledger/indy/sdk/did/SetEndpointForDidTest.java b/wrappers/java/src/test/java/org/hyperledger/indy/sdk/did/SetEndpointForDidTest.java index e17a507a46..93c819f941 100644 --- a/wrappers/java/src/test/java/org/hyperledger/indy/sdk/did/SetEndpointForDidTest.java +++ b/wrappers/java/src/test/java/org/hyperledger/indy/sdk/did/SetEndpointForDidTest.java @@ -7,7 +7,6 @@ import java.util.concurrent.ExecutionException; import static org.hamcrest.CoreMatchers.isA; -import static org.junit.Assert.assertEquals; public class SetEndpointForDidTest extends IndyIntegrationTestWithPoolAndSingleWallet { @@ -17,28 +16,6 @@ public void testSetEndpointForDidWorks() throws Exception { Did.setEndpointForDid(wallet, DID, ENDPOINT, VERKEY).get(); } - @Test - public void testSetEndpointForDidWorksForReplace() throws Exception { - Did.setEndpointForDid(wallet, DID, ENDPOINT, VERKEY).get(); - DidResults.EndpointForDidResult receivedEndpoint = Did.getEndpointForDid(wallet, pool, DID).get(); - assertEquals(ENDPOINT, receivedEndpoint.getAddress()); - assertEquals(VERKEY, receivedEndpoint.getTransportKey()); - - String newEndpoint = "10.10.10.1:9710"; - Did.setEndpointForDid(wallet, DID, newEndpoint, VERKEY_MY2).get(); - DidResults.EndpointForDidResult updatedEndpoint = Did.getEndpointForDid(wallet, pool, DID).get(); - assertEquals(newEndpoint, updatedEndpoint.getAddress()); - assertEquals(VERKEY_MY2, updatedEndpoint.getTransportKey()); - } - - @Test - public void testSetEndpointForDidWorksForInvalidDid() throws Exception { - thrown.expect(ExecutionException.class); - thrown.expectCause(isA(InvalidStructureException.class)); - - Did.setEndpointForDid(wallet, INVALID_DID, ENDPOINT, VERKEY).get(); - } - @Test public void testSetEndpointForDidWorksForInvalidTransportKey() throws Exception { thrown.expect(ExecutionException.class); diff --git a/wrappers/java/src/test/java/org/hyperledger/indy/sdk/did/StoreTheirDidTest.java b/wrappers/java/src/test/java/org/hyperledger/indy/sdk/did/StoreTheirDidTest.java index ed96b10a8c..d7082711ab 100644 --- a/wrappers/java/src/test/java/org/hyperledger/indy/sdk/did/StoreTheirDidTest.java +++ b/wrappers/java/src/test/java/org/hyperledger/indy/sdk/did/StoreTheirDidTest.java @@ -22,17 +22,4 @@ public void testCreateMyDidWorksForInvalidIdentityJson() throws Exception { Did.storeTheirDid(this.wallet, "{\"field\":\"value\"}").get(); } - - @Test - public void testStoreTheirDidWorksWithVerkey() throws Exception { - Did.storeTheirDid(this.wallet, String.format(IDENTITY_JSON_TEMPLATE, DID, VERKEY)).get(); - } - - @Test - public void testStoreTheirDidWorksWithoutDid() throws Exception { - thrown.expect(ExecutionException.class); - thrown.expectCause(isA(InvalidStructureException.class)); - - Did.storeTheirDid(this.wallet, String.format("{\"verkey\":\"%s\"}", VERKEY)).get(); - } } diff --git a/wrappers/java/src/test/java/org/hyperledger/indy/sdk/ledger/AppendAuthorAgreementAcceptanceToRequestTest.java b/wrappers/java/src/test/java/org/hyperledger/indy/sdk/ledger/AppendAuthorAgreementAcceptanceToRequestTest.java index 6b1a61ff09..fa092aa6d7 100644 --- a/wrappers/java/src/test/java/org/hyperledger/indy/sdk/ledger/AppendAuthorAgreementAcceptanceToRequestTest.java +++ b/wrappers/java/src/test/java/org/hyperledger/indy/sdk/ledger/AppendAuthorAgreementAcceptanceToRequestTest.java @@ -38,10 +38,4 @@ public void testAppendAuthorAgreementAcceptanceToRequestForHash() throws Excepti String requestWithAcceptance = Ledger.appendTxnAuthorAgreementAcceptanceToRequest(REQUEST.toString(), null, null, hash, acceptanceMechanismType, timeOfAcceptance).get(); checkRequestAcceptance(requestWithAcceptance); } - - @Test - public void testAppendAuthorAgreementAcceptanceToRequestForTextVersionHash() throws Exception { - String requestWithAcceptance = Ledger.appendTxnAuthorAgreementAcceptanceToRequest(REQUEST.toString(), text, version, hash, acceptanceMechanismType, timeOfAcceptance).get(); - checkRequestAcceptance(requestWithAcceptance); - } } \ No newline at end of file diff --git a/wrappers/java/src/test/java/org/hyperledger/indy/sdk/ledger/AttribRequestsTest.java b/wrappers/java/src/test/java/org/hyperledger/indy/sdk/ledger/AttribRequestsTest.java index 0de9e479f3..6dc39c56df 100644 --- a/wrappers/java/src/test/java/org/hyperledger/indy/sdk/ledger/AttribRequestsTest.java +++ b/wrappers/java/src/test/java/org/hyperledger/indy/sdk/ledger/AttribRequestsTest.java @@ -119,16 +119,6 @@ public void testBuildGetAttribRequestWorksForDefaultSubmitter() throws Exception Ledger.buildGetAttribRequest(null, DID_TRUSTEE, "endpoint", null, null).get(); } - @Test - public void testSendAttribRequestWorksWithoutSignature() throws Exception { - DidResults.CreateAndStoreMyDidResult trusteeDidResult = Did.createAndStoreMyDid(wallet, TRUSTEE_IDENTITY_JSON).get(); - String trusteeDid = trusteeDidResult.getDid(); - - String attribRequest = Ledger.buildAttribRequest(trusteeDidResult.getDid(), trusteeDid, null, endpoint, null).get(); - String response = Ledger.submitRequest(pool, attribRequest).get(); - checkResponseType(response, "REQNACK"); - } - @Test(timeout = PoolUtils.TEST_TIMEOUT_FOR_REQUEST_ENSURE) public void testAttribRequestsWorksForRawValue() throws Exception { DidResults.CreateAndStoreMyDidResult trusteeDidResult = Did.createAndStoreMyDid(wallet, TRUSTEE_IDENTITY_JSON).get(); @@ -153,54 +143,6 @@ public void testAttribRequestsWorksForRawValue() throws Exception { assertNotNull(getAttribResponse); } - @Test(timeout = PoolUtils.TEST_TIMEOUT_FOR_REQUEST_ENSURE) - public void testAttribRequestsWorksForHashValue() throws Exception { - DidResults.CreateAndStoreMyDidResult trusteeDidResult = Did.createAndStoreMyDid(wallet, TRUSTEE_IDENTITY_JSON).get(); - String trusteeDid = trusteeDidResult.getDid(); - - DidResults.CreateAndStoreMyDidResult myDidResult = Did.createAndStoreMyDid(wallet, "{}").get(); - String myDid = myDidResult.getDid(); - String myVerkey = myDidResult.getVerkey(); - - String nymRequest = Ledger.buildNymRequest(trusteeDid, myDid, myVerkey, null, null).get(); - Ledger.signAndSubmitRequest(pool, wallet, trusteeDid, nymRequest).get(); - - String attribRequest = Ledger.buildAttribRequest(myDid, myDid, hash, null, null).get(); - Ledger.signAndSubmitRequest(pool, wallet, myDid, attribRequest).get(); - - String getAttribRequest = Ledger.buildGetAttribRequest(myDid, myDid, null, hash, null).get(); - - String getAttribResponse = PoolUtils.ensurePreviousRequestApplied(pool, getAttribRequest, response -> { - JSONObject getAttribResponseObject = new JSONObject(response); - return hash.equals(getAttribResponseObject.getJSONObject("result").getString("data")); - }); - assertNotNull(getAttribResponse); - } - - @Test(timeout = PoolUtils.TEST_TIMEOUT_FOR_REQUEST_ENSURE) - public void testAttribRequestsWorksForEncValue() throws Exception { - DidResults.CreateAndStoreMyDidResult trusteeDidResult = Did.createAndStoreMyDid(wallet, TRUSTEE_IDENTITY_JSON).get(); - String trusteeDid = trusteeDidResult.getDid(); - - DidResults.CreateAndStoreMyDidResult myDidResult = Did.createAndStoreMyDid(wallet, "{}").get(); - String myDid = myDidResult.getDid(); - String myVerkey = myDidResult.getVerkey(); - - String nymRequest = Ledger.buildNymRequest(trusteeDid, myDid, myVerkey, null, null).get(); - Ledger.signAndSubmitRequest(pool, wallet, trusteeDid, nymRequest).get(); - - String attribRequest = Ledger.buildAttribRequest(myDid, myDid, null, null, enc).get(); - Ledger.signAndSubmitRequest(pool, wallet, myDid, attribRequest).get(); - - String getAttribRequest = Ledger.buildGetAttribRequest(myDid, myDid, null, null, enc).get(); - - String getAttribResponse = PoolUtils.ensurePreviousRequestApplied(pool, getAttribRequest, response -> { - JSONObject getAttribResponseObject = new JSONObject(response); - return enc.equals(getAttribResponseObject.getJSONObject("result").getString("data")); - }); - assertNotNull(getAttribResponse); - } - @Test public void testBuildAttribRequestWorksForInvalidIdentifier() throws Exception { thrown.expect(ExecutionException.class); diff --git a/wrappers/java/src/test/java/org/hyperledger/indy/sdk/ledger/CredDefRequestsTest.java b/wrappers/java/src/test/java/org/hyperledger/indy/sdk/ledger/CredDefRequestsTest.java index da66f31331..b08f30725d 100644 --- a/wrappers/java/src/test/java/org/hyperledger/indy/sdk/ledger/CredDefRequestsTest.java +++ b/wrappers/java/src/test/java/org/hyperledger/indy/sdk/ledger/CredDefRequestsTest.java @@ -1,15 +1,12 @@ package org.hyperledger.indy.sdk.ledger; -import org.hyperledger.indy.sdk.InvalidStructureException; import org.hyperledger.indy.sdk.utils.PoolUtils; import org.json.JSONObject; import org.junit.*; import org.junit.rules.Timeout; -import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeUnit; -import static org.hamcrest.CoreMatchers.isA; import static org.junit.Assert.assertTrue; import org.hyperledger.indy.sdk.JsonObjectSimilar; @@ -71,16 +68,6 @@ public void testBuildGetCredDefRequestWorks() throws Exception { assertTrue(getCredDefRequest.replace("\\", "").contains(expectedResult)); } - @Test - public void testBuildCredDefRequestWorksForInvalidJson() throws Exception { - thrown.expect(ExecutionException.class); - thrown.expectCause(isA(InvalidStructureException.class)); - - String data = "{\"primary\":{\"n\":\"1\",\"s\":\"2\",\"rms\":\"3\",\"r\":{\"name\":\"1\"}}}"; - - Ledger.buildCredDefRequest(DID, data).get(); - } - @Test(timeout = PoolUtils.TEST_TIMEOUT_FOR_REQUEST_ENSURE) public void testCredDefRequestsWorks() throws Exception { postEntities(); diff --git a/wrappers/java/src/test/java/org/hyperledger/indy/sdk/ledger/GetTxnRequestTest.java b/wrappers/java/src/test/java/org/hyperledger/indy/sdk/ledger/GetTxnRequestTest.java index 383c8e471e..cf553d2d8d 100644 --- a/wrappers/java/src/test/java/org/hyperledger/indy/sdk/ledger/GetTxnRequestTest.java +++ b/wrappers/java/src/test/java/org/hyperledger/indy/sdk/ledger/GetTxnRequestTest.java @@ -61,21 +61,4 @@ public void testGetTxnRequestWorks() throws Exception { }); assertNotNull(getTxnResponse); } - - @Test - public void testGetTxnRequestWorksForInvalidSeqNo() throws Exception { - String did = createStoreAndPublishDidFromTrustee(); - - String schemaRequest = Ledger.buildSchemaRequest(did, SCHEMA_DATA).get(); - String schemaResponse = Ledger.signAndSubmitRequest(pool, wallet, did, schemaRequest).get(); - - JSONObject schemaResponseObj = new JSONObject(schemaResponse); - int seqNo = schemaResponseObj.getJSONObject("result").getJSONObject("txnMetadata").getInt("seqNo") + 1; - - String getTxnRequest = Ledger.buildGetTxnRequest(did, null, seqNo).get(); - String getTxnResponse = Ledger.submitRequest(pool, getTxnRequest).get(); - - JSONObject getTxnResponseObj = new JSONObject(getTxnResponse); - assertTrue(getTxnResponseObj.getJSONObject("result").isNull("data")); - } } diff --git a/wrappers/java/src/test/java/org/hyperledger/indy/sdk/ledger/NodeRequestsTest.java b/wrappers/java/src/test/java/org/hyperledger/indy/sdk/ledger/NodeRequestsTest.java index d0413a562f..14794b32b3 100644 --- a/wrappers/java/src/test/java/org/hyperledger/indy/sdk/ledger/NodeRequestsTest.java +++ b/wrappers/java/src/test/java/org/hyperledger/indy/sdk/ledger/NodeRequestsTest.java @@ -1,15 +1,11 @@ package org.hyperledger.indy.sdk.ledger; import org.hyperledger.indy.sdk.IndyIntegrationTestWithPoolAndSingleWallet; -import org.hyperledger.indy.sdk.InvalidStructureException; import org.hyperledger.indy.sdk.did.Did; import org.hyperledger.indy.sdk.did.DidJSONParameters; import org.hyperledger.indy.sdk.did.DidResults; import org.junit.*; -import java.util.concurrent.ExecutionException; - -import static org.hamcrest.CoreMatchers.isA; import static org.junit.Assert.assertTrue; public class NodeRequestsTest extends IndyIntegrationTestWithPoolAndSingleWallet { @@ -42,54 +38,6 @@ public void testBuildNodeRequestWorks() throws Exception { assertTrue(nodeRequest.replace("\\", "").contains(expectedResult)); } - @Test - public void testSendNodeRequestWorksWithoutSignature() throws Exception { - DidResults.CreateAndStoreMyDidResult didResult = Did.createAndStoreMyDid(wallet, stewardDidJson.toJson()).get(); - String did = didResult.getDid(); - - String nodeRequest = Ledger.buildNodeRequest(did, did, data).get(); - String response = Ledger.submitRequest(pool, nodeRequest).get(); - checkResponseType(response,"REQNACK" ); - } - - @Test - public void testBuildNodeRequestWorksForWrongServiceType() throws Exception { - thrown.expect(ExecutionException.class); - thrown.expectCause(isA(InvalidStructureException.class)); - - String data = "{\"node_ip\":\"10.0.0.100\"," + - "\"node_port\":910," + - "\"client_ip\":\"10.0.0.100\"," + - "\"client_port\":911," + - "\"alias\":\"some\"," + - "\"services\":[\"SERVICE\"]" + - "\"blskey\":\"4N8aUNHSgjQVgkpm8nhNEfDf6txHznoYREg9kirmJrkivgL4oSEimFF6nsQ6M41QvhM2Z33nves5vfSn9n1UwNFJBYtWVnHYMATn76vLuL3zU88KyeAYcHfsih3He6UHcXDxcaecHVz6jhCYz1P2UZn2bDVruL5wXpehgBfBaLKm3Ba\"," + - "\"blskey_pop\":\"RahHYiCvoNCtPTrVtP7nMC5eTYrsUA8WjXbdhNc8debh1agE9bGiJxWBXYNFbnJXoXhWFMvyqhqhRoq737YQemH5ik9oL7R4NTTCz2LEZhkgLJzB3QRQqJyBNyv7acbdHrAT8nQ9UkLbaVL9NBpnWXBTw4LEMePaSHEw66RzPNdAX1\"" + - "}"; - - Ledger.buildNodeRequest(DID, dest, data).get(); - } - - @Test - public void testBuildNodeRequestWorksForMissedFields() throws Exception { - thrown.expect(ExecutionException.class); - thrown.expectCause(isA(InvalidStructureException.class)); - - String data = "{ }"; - - Ledger.buildNodeRequest(DID, dest, data).get(); - } - - @Test - public void testSendNodeRequestWorksForWrongRole() throws Exception { - DidResults.CreateAndStoreMyDidResult didResult = Did.createAndStoreMyDid(wallet, TRUSTEE_IDENTITY_JSON).get(); - String did = didResult.getDid(); - - String nodeRequest = Ledger.buildNodeRequest(did, dest, data).get(); - String response = Ledger.signAndSubmitRequest(pool, wallet, did, nodeRequest).get(); - checkResponseType(response,"REJECT" ); - } - @Test @Ignore public void testSendNodeRequestWorksForNewSteward() throws Exception { diff --git a/wrappers/java/src/test/java/org/hyperledger/indy/sdk/ledger/NymRequestsTest.java b/wrappers/java/src/test/java/org/hyperledger/indy/sdk/ledger/NymRequestsTest.java index 20974aa195..300ca612c0 100644 --- a/wrappers/java/src/test/java/org/hyperledger/indy/sdk/ledger/NymRequestsTest.java +++ b/wrappers/java/src/test/java/org/hyperledger/indy/sdk/ledger/NymRequestsTest.java @@ -66,91 +66,6 @@ public void testBuildGetNymRequestWorksForDefaultSubmitter() throws Exception { Ledger.buildGetNymRequest(null, dest).get(); } - @Test - public void testNymRequestWorksWithoutSignature() throws Exception { - DidResults.CreateAndStoreMyDidResult result = Did.createAndStoreMyDid(wallet, "{}").get(); - String did = result.getDid(); - - String nymRequest = Ledger.buildNymRequest(did, did, null, null, null).get(); - String response = Ledger.submitRequest(pool, nymRequest).get(); - checkResponseType(response, "REQNACK"); - } - - @Test - public void testSendNymRequestsWorksForOnlyRequiredFields() throws Exception { - DidResults.CreateAndStoreMyDidResult trusteeDidResult = Did.createAndStoreMyDid(wallet, TRUSTEE_IDENTITY_JSON).get(); - String trusteeDid = trusteeDidResult.getDid(); - - DidResults.CreateAndStoreMyDidResult myDidResult = Did.createAndStoreMyDid(wallet, "{}").get(); - String myDid = myDidResult.getDid(); - - String nymRequest = Ledger.buildNymRequest(trusteeDid, myDid, null, null, null).get(); - String nymResponse = Ledger.signAndSubmitRequest(pool, wallet, trusteeDid, nymRequest).get(); - assertNotNull(nymResponse); - } - - @Test - public void testSendNymRequestsWorksForOptionalFields() throws Exception { - DidResults.CreateAndStoreMyDidResult trusteeDidResult = Did.createAndStoreMyDid(wallet, TRUSTEE_IDENTITY_JSON).get(); - String trusteeDid = trusteeDidResult.getDid(); - - DidResults.CreateAndStoreMyDidResult myDidResult = Did.createAndStoreMyDid(wallet, "{}").get(); - String myDid = myDidResult.getDid(); - String myVerkey = myDidResult.getVerkey(); - - String nymRequest = Ledger.buildNymRequest(trusteeDid, myDid, myVerkey, alias, role).get(); - String nymResponse = Ledger.signAndSubmitRequest(pool, wallet, trusteeDid, nymRequest).get(); - assertNotNull(nymResponse); - } - - @Test - public void testGetNymRequestWorks() throws Exception { - DidResults.CreateAndStoreMyDidResult result = Did.createAndStoreMyDid(wallet, TRUSTEE_IDENTITY_JSON).get(); - String did = result.getDid(); - - String getNymRequest = Ledger.buildGetNymRequest(did, did).get(); - String getNymResponseJson = Ledger.submitRequest(pool, getNymRequest).get(); - - JSONObject getNymResponse = new JSONObject(getNymResponseJson); - assertEquals(did, getNymResponse.getJSONObject("result").getString("dest")); - } - - @Test - public void testSendNymRequestsWorksForWrongSignerRole() throws Exception { - DidResults.CreateAndStoreMyDidResult trusteeDidResult = Did.createAndStoreMyDid(wallet, TRUSTEE_IDENTITY_JSON).get(); - String trusteeDid = trusteeDidResult.getDid(); - - DidResults.CreateAndStoreMyDidResult myDidResult = Did.createAndStoreMyDid(wallet, "{}").get(); - String myDid = myDidResult.getDid(); - - String nymRequest = Ledger.buildNymRequest(trusteeDid, myDid, null, null, null).get(); - Ledger.signAndSubmitRequest(pool, wallet, trusteeDid, nymRequest).get(); - - DidResults.CreateAndStoreMyDidResult myDidResult2 = Did.createAndStoreMyDid(wallet, "{}").get(); - String myDid2 = myDidResult2.getDid(); - - String nymRequest2 = Ledger.buildNymRequest(myDid, myDid2, null, null, null).get(); - String response = Ledger.signAndSubmitRequest(pool, wallet, myDid, nymRequest2).get(); - checkResponseType(response, "REQNACK"); - - } - - @Test - public void testSendNymRequestsWorksForUnknownSigner() throws Exception { - String identityJson = - new DidJSONParameters.CreateAndStoreMyDidJSONParameter(null, "000000000000000000000000Trustee9", null, null).toJson(); - - DidResults.CreateAndStoreMyDidResult trusteeDidResult = Did.createAndStoreMyDid(wallet, identityJson).get(); - String trusteeDid = trusteeDidResult.getDid(); - - DidResults.CreateAndStoreMyDidResult myDidResult = Did.createAndStoreMyDid(wallet, "{}").get(); - String myDid = myDidResult.getDid(); - - String nymRequest = Ledger.buildNymRequest(trusteeDid, myDid, null, null, null).get(); - String response = Ledger.signAndSubmitRequest(pool, wallet, trusteeDid, nymRequest).get(); - checkResponseType(response, "REQNACK"); - } - @Test(timeout = PoolUtils.TEST_TIMEOUT_FOR_REQUEST_ENSURE) public void testNymRequestsWorks() throws Exception { DidResults.CreateAndStoreMyDidResult trusteeDidResult = Did.createAndStoreMyDid(wallet, TRUSTEE_IDENTITY_JSON).get(); @@ -168,12 +83,4 @@ public void testNymRequestsWorks() throws Exception { response -> compareResponseType(response, "REPLY")); assertNotNull(getNymResponse); } - - @Test - public void testSendNymRequestsWorksForWrongRole() throws Exception { - thrown.expect(ExecutionException.class); - thrown.expectCause(isA(InvalidStructureException.class)); - - Ledger.buildNymRequest(DID, dest, null, null, "WRONG_ROLE").get(); - } } diff --git a/wrappers/java/src/test/java/org/hyperledger/indy/sdk/non_secrets/AddRecordTagsTest.java b/wrappers/java/src/test/java/org/hyperledger/indy/sdk/non_secrets/AddRecordTagsTest.java index 78ea3fe163..019dfb6f28 100644 --- a/wrappers/java/src/test/java/org/hyperledger/indy/sdk/non_secrets/AddRecordTagsTest.java +++ b/wrappers/java/src/test/java/org/hyperledger/indy/sdk/non_secrets/AddRecordTagsTest.java @@ -21,24 +21,6 @@ public void testAddRecordTagsWorks() throws Exception { checkRecordField(wallet, type, id, "tags", tags); } - @Test - public void testAddRecordTagsWorksForTwice() throws Exception { - WalletRecord.add(wallet, type, id, value, tagsEmpty).get(); - - checkRecordField(wallet, type, id, "tags", tagsEmpty); - - String tags1 = "{\"tagName1\": \"str1\"}"; - WalletRecord.addTags(wallet, type, id, tags1).get(); - - checkRecordField(wallet, type, id, "tags", tags1); - - String tags2 = "{\"tagName2\": \"str2\"}"; - WalletRecord.addTags(wallet, type, id, tags2).get(); - - String expectedTags = "{\"tagName1\": \"str1\", \"tagName2\": \"str2\"}"; - checkRecordField(wallet, type, id, "tags", expectedTags); - } - @Test public void testAddRecordTagsWorksForNotFoundRecord() throws Exception { thrown.expect(ExecutionException.class); diff --git a/wrappers/java/src/test/java/org/hyperledger/indy/sdk/non_secrets/AddRecordTest.java b/wrappers/java/src/test/java/org/hyperledger/indy/sdk/non_secrets/AddRecordTest.java index bb4b721616..f971ac57a0 100644 --- a/wrappers/java/src/test/java/org/hyperledger/indy/sdk/non_secrets/AddRecordTest.java +++ b/wrappers/java/src/test/java/org/hyperledger/indy/sdk/non_secrets/AddRecordTest.java @@ -15,12 +15,6 @@ public void testAddRecordWorks() throws Exception { WalletRecord.add(wallet, type, id, value, tagsEmpty).get(); } - @Test - public void testAddRecordWorksForDifferentIds() throws Exception { - WalletRecord.add(wallet, type, id, value, tagsEmpty).get(); - WalletRecord.add(wallet, type, id2, value, tagsEmpty).get(); - } - @Test public void testAddRecordWorksForDuplicate() throws Exception { WalletRecord.add(wallet, type, id, value, tagsEmpty).get(); diff --git a/wrappers/java/src/test/java/org/hyperledger/indy/sdk/non_secrets/DeleteRecordTagsTest.java b/wrappers/java/src/test/java/org/hyperledger/indy/sdk/non_secrets/DeleteRecordTagsTest.java index 9c3c894b4b..cfea5c2017 100644 --- a/wrappers/java/src/test/java/org/hyperledger/indy/sdk/non_secrets/DeleteRecordTagsTest.java +++ b/wrappers/java/src/test/java/org/hyperledger/indy/sdk/non_secrets/DeleteRecordTagsTest.java @@ -22,17 +22,6 @@ public void testDeleteRecordTagsWorks() throws Exception { checkRecordField(wallet, type, id, "tags", expectedTags); } - @Test - public void testDeleteRecordTagsWorksForDeleteAll() throws Exception { - WalletRecord.add(wallet, type, id, value, tags).get(); - - checkRecordField(wallet, type, id, "tags", tags); - - WalletRecord.deleteTags(wallet, type, id, "[\"tagName1\", \"tagName2\", \"tagName3\"]").get(); - - checkRecordField(wallet, type, id, "tags", tagsEmpty); - } - @Test public void testDeleteRecordTagsWorksForNotFoundRecord() throws Exception { thrown.expect(ExecutionException.class); diff --git a/wrappers/java/src/test/java/org/hyperledger/indy/sdk/non_secrets/DeleteRecordTest.java b/wrappers/java/src/test/java/org/hyperledger/indy/sdk/non_secrets/DeleteRecordTest.java index 768d8aa408..e6c8dafa1b 100644 --- a/wrappers/java/src/test/java/org/hyperledger/indy/sdk/non_secrets/DeleteRecordTest.java +++ b/wrappers/java/src/test/java/org/hyperledger/indy/sdk/non_secrets/DeleteRecordTest.java @@ -21,18 +21,6 @@ public void testDeleteRecordWorks() throws Exception { WalletRecord.get(wallet, type, id, optionsEmpty).get(); } - @Test - public void testDeleteRecordWorksForTwice() throws Exception { - WalletRecord.add(wallet, type, id, value, tags).get(); - - WalletRecord.delete(wallet, type, id).get(); - - thrown.expect(ExecutionException.class); - thrown.expectCause(isA(WalletItemNotFoundException.class)); - - WalletRecord.delete(wallet, type, id).get(); - } - @Test public void testDeleteRecordWorksForNotFoundRecord() throws Exception { thrown.expect(ExecutionException.class); diff --git a/wrappers/java/src/test/java/org/hyperledger/indy/sdk/non_secrets/UpdateRecordTagsTest.java b/wrappers/java/src/test/java/org/hyperledger/indy/sdk/non_secrets/UpdateRecordTagsTest.java index 7153f32d0e..f21ec74a9a 100644 --- a/wrappers/java/src/test/java/org/hyperledger/indy/sdk/non_secrets/UpdateRecordTagsTest.java +++ b/wrappers/java/src/test/java/org/hyperledger/indy/sdk/non_secrets/UpdateRecordTagsTest.java @@ -21,21 +21,6 @@ public void testUpdateRecordTagsWorks() throws Exception { checkRecordField(wallet, type, id, "tags", tags); } - @Test - public void testUpdateRecordTagsWorksForTwice() throws Exception { - WalletRecord.add(wallet, type, id, value, tagsEmpty).get(); - - checkRecordField(wallet, type, id, "tags", tagsEmpty); - - WalletRecord.updateTags(wallet, type, id, tags).get(); - - checkRecordField(wallet, type, id, "tags", tags); - - WalletRecord.updateTags(wallet, type, id, tags2).get(); - - checkRecordField(wallet, type, id, "tags", tags2); - } - @Test public void testUpdateRecordTagsWorksForNotFoundRecord() throws Exception { thrown.expect(ExecutionException.class); diff --git a/wrappers/java/src/test/java/org/hyperledger/indy/sdk/pairwise/CreatePairwiseTest.java b/wrappers/java/src/test/java/org/hyperledger/indy/sdk/pairwise/CreatePairwiseTest.java index 347f458258..22c16b0683 100644 --- a/wrappers/java/src/test/java/org/hyperledger/indy/sdk/pairwise/CreatePairwiseTest.java +++ b/wrappers/java/src/test/java/org/hyperledger/indy/sdk/pairwise/CreatePairwiseTest.java @@ -14,11 +14,6 @@ public void testCreatePairwiseWorks() throws Exception { Pairwise.createPairwise(wallet, theirDid, myDid, metadata).get(); } - @Test - public void testCreatePairwiseWorksForEmptyMetadata() throws Exception { - Pairwise.createPairwise(wallet, theirDid, myDid, null).get(); - } - @Test public void testCreatePairwiseWorksForNotFoundMyDid() throws Exception { thrown.expect(ExecutionException.class); @@ -26,12 +21,4 @@ public void testCreatePairwiseWorksForNotFoundMyDid() throws Exception { Pairwise.createPairwise(wallet, theirDid, DID, null).get(); } - - @Test - public void testCreatePairwiseWorksForNotFoundTheirDid() throws Exception { - thrown.expect(ExecutionException.class); - thrown.expectCause(isA(WalletItemNotFoundException.class)); - - Pairwise.createPairwise(wallet, DID, myDid, null).get(); - } } diff --git a/wrappers/java/src/test/java/org/hyperledger/indy/sdk/pairwise/SetPairwiseMetadataTest.java b/wrappers/java/src/test/java/org/hyperledger/indy/sdk/pairwise/SetPairwiseMetadataTest.java index b300ecf534..a9a1956995 100644 --- a/wrappers/java/src/test/java/org/hyperledger/indy/sdk/pairwise/SetPairwiseMetadataTest.java +++ b/wrappers/java/src/test/java/org/hyperledger/indy/sdk/pairwise/SetPairwiseMetadataTest.java @@ -28,19 +28,6 @@ public void testSetPairwiseMetadataWorks() throws Exception { assertEquals(String.format(PAIRWISE_TEMPLATE_WITH_META, myDid, metadata), pairwiseWithMetadata); } - @Test - public void testSetPairwiseMetadataWorksForReset() throws Exception { - Pairwise.createPairwise(wallet, theirDid, myDid, metadata).get(); - String pairwiseWithMetadata = Pairwise.getPairwise(wallet, theirDid).get(); - assertEquals(String.format(PAIRWISE_TEMPLATE_WITH_META, myDid, metadata), pairwiseWithMetadata); - - Pairwise.setPairwiseMetadata(wallet, theirDid, null).get(); - String pairwiseWithoutMetadata = Pairwise.getPairwise(wallet, theirDid).get(); - - assertNotEquals(pairwiseWithMetadata, pairwiseWithoutMetadata); - assertEquals(String.format(PAIRWISE_TEMPLATE_WITHOUT_META, myDid), pairwiseWithoutMetadata); - } - @Test public void testSetPairwiseMetadataWorksForNotCreatedPairwise() throws Exception { thrown.expect(ExecutionException.class); diff --git a/wrappers/java/src/test/java/org/hyperledger/indy/sdk/payment/AddRequestFeesTest.java b/wrappers/java/src/test/java/org/hyperledger/indy/sdk/payment/AddRequestFeesTest.java index 9c395f7d40..7ba346f9b4 100644 --- a/wrappers/java/src/test/java/org/hyperledger/indy/sdk/payment/AddRequestFeesTest.java +++ b/wrappers/java/src/test/java/org/hyperledger/indy/sdk/payment/AddRequestFeesTest.java @@ -35,12 +35,4 @@ public void testAddRequestFeesWorksForSeveralMethods() throws Exception { Payments.addRequestFees(wallet, DID_TRUSTEE, emptyObject, incompatibleInputs, emptyObject, null).get(); } - - @Test - public void testAddRequestFeesWorksForInvalidInputs() throws Exception { - thrown.expect(ExecutionException.class); - thrown.expectCause(isA(InvalidStructureException.class)); - - Payments.addRequestFees(wallet, DID_TRUSTEE, emptyObject, invalidInputs, emptyObject, null).get(); - } } diff --git a/wrappers/java/src/test/java/org/hyperledger/indy/sdk/payment/BuildGetPaymentSourcesWithFromRequestTest.java b/wrappers/java/src/test/java/org/hyperledger/indy/sdk/payment/BuildGetPaymentSourcesWithFromRequestTest.java index 9405b9f987..ece2152edb 100644 --- a/wrappers/java/src/test/java/org/hyperledger/indy/sdk/payment/BuildGetPaymentSourcesWithFromRequestTest.java +++ b/wrappers/java/src/test/java/org/hyperledger/indy/sdk/payment/BuildGetPaymentSourcesWithFromRequestTest.java @@ -26,12 +26,4 @@ public void testBuildGetPaymentSourcesWithFromRequestWorksForInvalidPaymentAddre Payments.buildGetPaymentSourcesWithFromRequest(wallet, DID_TRUSTEE, "pay:null1", 1).get(); } - - @Test - public void testBuildGetPaymentSourcesWithFromRequestWorksForInvalidPaymentAddressWithoutFrom() throws Exception { - thrown.expect(ExecutionException.class); - thrown.expectCause(isA(IncompatiblePaymentException.class)); - - Payments.buildGetPaymentSourcesWithFromRequest(wallet, DID_TRUSTEE, "pay:null1").get(); - } } diff --git a/wrappers/java/src/test/java/org/hyperledger/indy/sdk/payment/BuildPaymentRequestTest.java b/wrappers/java/src/test/java/org/hyperledger/indy/sdk/payment/BuildPaymentRequestTest.java index 7521bb61d1..41f6bfd18f 100644 --- a/wrappers/java/src/test/java/org/hyperledger/indy/sdk/payment/BuildPaymentRequestTest.java +++ b/wrappers/java/src/test/java/org/hyperledger/indy/sdk/payment/BuildPaymentRequestTest.java @@ -28,14 +28,6 @@ public void testBuildPaymentRequestWorksForEmptyInputs() throws Exception { Payments.buildPaymentRequest(wallet, DID_TRUSTEE, emptyArray, outputs, null).get(); } - @Test - public void testBuildPaymentRequestWorksForEmptyOutputs() throws Exception { - thrown.expect(ExecutionException.class); - thrown.expectCause(isA(InvalidStructureException.class)); - - Payments.buildPaymentRequest(wallet, DID_TRUSTEE, inputs, emptyObject, null).get(); - } - @Test public void testBuildPaymentRequestWorksForIncompatiblePaymentMethods() throws Exception { thrown.expect(ExecutionException.class); @@ -43,12 +35,4 @@ public void testBuildPaymentRequestWorksForIncompatiblePaymentMethods() throws E Payments.buildPaymentRequest(wallet, DID_TRUSTEE, incompatibleInputs, outputs, null).get(); } - - @Test - public void testBuildPaymentRequestWorksForInvalidInputs() throws Exception { - thrown.expect(ExecutionException.class); - thrown.expectCause(isA(InvalidStructureException.class)); - - Payments.buildPaymentRequest(wallet, DID_TRUSTEE, invalidInputs, outputs, null).get(); - } } diff --git a/wrappers/java/src/test/java/org/hyperledger/indy/sdk/pool/ClosePoolTest.java b/wrappers/java/src/test/java/org/hyperledger/indy/sdk/pool/ClosePoolTest.java index 8e260394eb..4193ff46cb 100644 --- a/wrappers/java/src/test/java/org/hyperledger/indy/sdk/pool/ClosePoolTest.java +++ b/wrappers/java/src/test/java/org/hyperledger/indy/sdk/pool/ClosePoolTest.java @@ -4,7 +4,6 @@ import org.hyperledger.indy.sdk.utils.PoolUtils; import org.junit.Test; -import static org.hamcrest.CoreMatchers.isA; import static org.junit.Assert.assertNotNull; public class ClosePoolTest extends IndyIntegrationTest { @@ -19,31 +18,6 @@ public void testClosePoolWorks() throws Exception { openedPools.remove(pool); } - @Test - public void testClosePoolWorksForTwice() throws Exception { - thrown.expectCause(isA(InvalidPoolException.class)); - - Pool pool = PoolUtils.createAndOpenPoolLedger(); - assertNotNull(pool); - openedPools.add(pool); - - pool.closePoolLedger().get(); - openedPools.remove(pool); - pool.closePoolLedger().get(); - } - - @Test - public void testClosePoolWorksForReopenAfterClose() throws Exception { - String poolName = PoolUtils.createPoolLedgerConfig(); - - Pool pool = Pool.openPoolLedger(poolName, null).get(); - assertNotNull(pool); - - pool.closePoolLedger().get(); - - pool = Pool.openPoolLedger(poolName, null).get(); - openedPools.add(pool); - } @Test public void testAutoCloseWorks() throws Exception { diff --git a/wrappers/java/src/test/java/org/hyperledger/indy/sdk/pool/CreatePoolTest.java b/wrappers/java/src/test/java/org/hyperledger/indy/sdk/pool/CreatePoolTest.java index 5afebd34a8..f1829fb939 100644 --- a/wrappers/java/src/test/java/org/hyperledger/indy/sdk/pool/CreatePoolTest.java +++ b/wrappers/java/src/test/java/org/hyperledger/indy/sdk/pool/CreatePoolTest.java @@ -30,17 +30,6 @@ public void testCreatePoolWorksForConfigJSON() throws Exception { Pool.createPoolLedgerConfig("testCreatePoolWorks", createPoolLedgerConfigJSONParameter.toJson()).get(); } - @Test - public void testCreatePoolWorksForEmptyName() throws Exception { - thrown.expect(IllegalArgumentException.class); - - File genesisTxnFile = PoolUtils.createGenesisTxnFile("genesis.txn"); - - PoolJSONParameters.CreatePoolLedgerConfigJSONParameter createPoolLedgerConfigJSONParameter - = new PoolJSONParameters.CreatePoolLedgerConfigJSONParameter(genesisTxnFile.getAbsolutePath()); - Pool.createPoolLedgerConfig("", createPoolLedgerConfigJSONParameter.toJson()).get(); - } - @Test public void testCreatePoolWorksForTwice() throws Exception { thrown.expectCause(isA(PoolLedgerConfigExistsException.class)); diff --git a/wrappers/java/src/test/java/org/hyperledger/indy/sdk/pool/OpenPoolTest.java b/wrappers/java/src/test/java/org/hyperledger/indy/sdk/pool/OpenPoolTest.java index 999cef414e..f0534e3841 100644 --- a/wrappers/java/src/test/java/org/hyperledger/indy/sdk/pool/OpenPoolTest.java +++ b/wrappers/java/src/test/java/org/hyperledger/indy/sdk/pool/OpenPoolTest.java @@ -44,27 +44,6 @@ public void testOpenPoolWorksForTwice() throws Exception { Pool.openPoolLedger(poolName, null).get(); } - @Test - public void testOpenPoolWorksForTwoNodes() throws Exception { - String poolName = PoolUtils.createPoolLedgerConfig(); - - Pool pool = Pool.openPoolLedger(poolName, null).get(); - - assertNotNull(pool); - openedPools.add(pool); - } - - @Test - public void testOpenPoolWorksForThreeNodes() throws Exception { - String poolName = PoolUtils.createPoolLedgerConfig(); - - Pool pool = Pool.openPoolLedger(poolName, null).get(); - - assertNotNull(pool); - openedPools.add(pool); - } - - @Test public void testOpenPoolWorksForIncompatibleProtocolVersion() throws Exception { thrown.expectCause(isA(PoolIncompatibleProtocolVersionException.class)); diff --git a/wrappers/java/src/test/java/org/hyperledger/indy/sdk/wallet/CloseWalletTest.java b/wrappers/java/src/test/java/org/hyperledger/indy/sdk/wallet/CloseWalletTest.java index d6db92a4a4..689c3952c3 100644 --- a/wrappers/java/src/test/java/org/hyperledger/indy/sdk/wallet/CloseWalletTest.java +++ b/wrappers/java/src/test/java/org/hyperledger/indy/sdk/wallet/CloseWalletTest.java @@ -20,18 +20,6 @@ public void testCloseWalletWorks() throws Exception { wallet.closeWallet().get(); } - @Test - public void testCloseWalletWorksForTwice() throws Exception { - thrown.expect(ExecutionException.class); - thrown.expectCause(isA(InvalidWalletException.class)); - - Wallet.createWallet(WALLET_CONFIG, WALLET_CREDENTIALS).get(); - Wallet wallet = Wallet.openWallet(WALLET_CONFIG, WALLET_CREDENTIALS).get(); - - wallet.closeWallet().get(); - wallet.closeWallet().get(); - } - @Test public void testAutoCloseWorks() throws Exception { Wallet.createWallet(WALLET_CONFIG, WALLET_CREDENTIALS).get(); diff --git a/wrappers/java/src/test/java/org/hyperledger/indy/sdk/wallet/DeleteWalletTest.java b/wrappers/java/src/test/java/org/hyperledger/indy/sdk/wallet/DeleteWalletTest.java index d24c2ec50b..dd79b65055 100644 --- a/wrappers/java/src/test/java/org/hyperledger/indy/sdk/wallet/DeleteWalletTest.java +++ b/wrappers/java/src/test/java/org/hyperledger/indy/sdk/wallet/DeleteWalletTest.java @@ -22,19 +22,6 @@ public void testDeleteWalletWorks() throws Exception { Wallet.deleteWallet(WALLET_CONFIG, WALLET_CREDENTIALS).get(); } - @Test - public void testDeleteWalletWorksForClosed() throws Exception { - Wallet.createWallet(WALLET_CONFIG, WALLET_CREDENTIALS).get(); - - Wallet wallet = Wallet.openWallet(WALLET_CONFIG, WALLET_CREDENTIALS).get(); - assertNotNull(wallet); - - wallet.closeWallet().get(); - Wallet.deleteWallet(WALLET_CONFIG, WALLET_CREDENTIALS).get(); - Wallet.createWallet(WALLET_CONFIG, WALLET_CREDENTIALS).get(); - Wallet.deleteWallet(WALLET_CONFIG, WALLET_CREDENTIALS).get(); - } - @Test public void testDeleteWalletWorksForOpened() throws Exception { thrown.expect(ExecutionException.class); @@ -49,21 +36,6 @@ public void testDeleteWalletWorksForOpened() throws Exception { Wallet.deleteWallet(config, WALLET_CREDENTIALS).get(); } - @Test - public void testDeleteWalletWorksForTwice() throws Exception { - thrown.expect(ExecutionException.class); - thrown.expectCause(isA(WalletNotFoundException.class)); - - Wallet.createWallet(WALLET_CONFIG, WALLET_CREDENTIALS).get(); - - Wallet wallet = Wallet.openWallet(WALLET_CONFIG, WALLET_CREDENTIALS).get(); - - wallet.closeWallet().get(); - - Wallet.deleteWallet(WALLET_CONFIG, WALLET_CREDENTIALS).get(); - Wallet.deleteWallet(WALLET_CONFIG, WALLET_CREDENTIALS).get(); - } - @Test public void testDeleteWalletWorksForNotCreated() throws Exception { thrown.expect(ExecutionException.class); diff --git a/wrappers/java/src/test/java/org/hyperledger/indy/sdk/wallet/OpenWalletTest.java b/wrappers/java/src/test/java/org/hyperledger/indy/sdk/wallet/OpenWalletTest.java index 66d8463a71..61a785118b 100644 --- a/wrappers/java/src/test/java/org/hyperledger/indy/sdk/wallet/OpenWalletTest.java +++ b/wrappers/java/src/test/java/org/hyperledger/indy/sdk/wallet/OpenWalletTest.java @@ -33,17 +33,6 @@ public void testOpenWalletWorksForInvalidCredentials() throws Exception { Wallet.openWallet(WALLET_CONFIG, "{\"key\": \"other_key\"}").get(); } - @Test - public void testOpenWalletWorksForChangingCredentials() throws Exception { - Wallet.createWallet(WALLET_CONFIG, "{\"key\": \"key\"}").get(); - - Wallet wallet = Wallet.openWallet(WALLET_CONFIG, "{\"key\": \"key\", \"rekey\": \"other_key\"}").get(); - wallet.closeWallet().get(); - - wallet = Wallet.openWallet(WALLET_CONFIG, "{\"key\": \"other_key\"}").get(); - wallet.closeWallet().get(); - } - @Test public void testOpenWalletWorksForNotCreatedWallet() throws Exception { thrown.expect(ExecutionException.class); From e97519084ca6cb4a0d6402c2f7118068d200ac74 Mon Sep 17 00:00:00 2001 From: "artem.ivanov" Date: Mon, 19 Aug 2019 10:38:35 +0300 Subject: [PATCH 261/320] Removed part of Medium Cases tests from Python wrapper Signed-off-by: artem.ivanov --- ..._issuer_create_and_store_credential_def.py | 25 -- .../test_issuer_create_credential.py | 17 +- .../test_prover_create_credential_req.py | 14 - .../test_prover_create_master_secret.py | 11 - .../anoncreds/test_prover_create_proof.py | 32 -- .../anoncreds/test_prover_get_credentials.py | 38 -- ...st_prover_get_credentials_for_proof_req.py | 366 ------------------ .../anoncreds/test_prover_store_credential.py | 13 - .../python/tests/crypto/test_auth_crypt.py | 12 - .../python/tests/crypto/test_create_key.py | 8 - .../python/tests/crypto/test_crypto_sign.py | 9 +- .../python/tests/crypto/test_crypto_verify.py | 7 - .../tests/crypto/test_get_key_metadata.py | 23 -- .../tests/crypto/test_set_key_metadata.py | 13 - .../tests/did/test_create_and_store_my_did.py | 33 -- .../python/tests/did/test_get_did_metadata.py | 15 - .../tests/did/test_get_endpoint_for_did.py | 38 +- .../tests/did/test_get_my_did_with_meta.py | 4 - wrappers/python/tests/did/test_key_for_did.py | 23 -- .../tests/did/test_key_for_local_did.py | 19 +- .../tests/did/test_replace_keys_apply.py | 8 - .../tests/did/test_replace_keys_start.py | 21 - .../python/tests/did/test_set_did_metadata.py | 28 +- .../tests/did/test_set_endpoint_for_did.py | 31 -- .../python/tests/did/test_store_their_did.py | 23 -- .../ledger/test_sign_and_submit_request.py | 4 +- .../python/tests/ledger/test_sign_request.py | 7 - .../tests/ledger/test_submit_request.py | 274 ------------- .../non_secrets/test_add_wallet_record.py | 7 - .../test_add_wallet_record_tags.py | 16 - .../non_secrets/test_delete_wallet_record.py | 8 - .../test_delete_wallet_record_tags.py | 9 - .../test_update_wallet_record_tags.py | 12 - .../test_update_wallet_record_value.py | 12 - .../tests/pairwise/test_create_pairwise.py | 29 +- .../tests/pairwise/test_get_pairwise.py | 13 +- .../tests/pairwise/test_list_pairwise.py | 13 +- .../tests/pairwise/test_pairwise_exists.py | 15 +- .../pairwise/test_set_pairwise_metadata.py | 28 +- .../tests/payment/test_add_request_fees.py | 8 +- .../tests/pool/test_close_pool_ledger.py | 27 +- .../python/tests/wallet/test_open_wallet.py | 10 - 42 files changed, 17 insertions(+), 1306 deletions(-) diff --git a/wrappers/python/tests/anoncreds/test_issuer_create_and_store_credential_def.py b/wrappers/python/tests/anoncreds/test_issuer_create_and_store_credential_def.py index 487ad853f5..49153dfc88 100644 --- a/wrappers/python/tests/anoncreds/test_issuer_create_and_store_credential_def.py +++ b/wrappers/python/tests/anoncreds/test_issuer_create_and_store_credential_def.py @@ -1,31 +1,6 @@ -import json - import pytest -from indy.anoncreds import issuer_create_and_store_credential_def -from indy import error - @pytest.mark.asyncio async def test_issuer_create_and_store_credential_def_works(wallet_handle, prepopulated_wallet): pass - - -@pytest.mark.asyncio -async def test_issuer_create_and_store_credential_def_works_for_invalid_wallet(wallet_handle, issuer_did, - gvt_schema_json, tag, - default_cred_def_config): - invalid_wallet_handle = wallet_handle + 100 - - with pytest.raises(error.WalletInvalidHandle): - await issuer_create_and_store_credential_def(invalid_wallet_handle, issuer_did, gvt_schema_json, tag, "CL", - default_cred_def_config) - - - -@pytest.mark.asyncio -async def test_issuer_create_and_store_credential_def_works_for_duplicate(wallet_handle, prepopulated_wallet, - issuer_did, gvt_schema, tag, - default_cred_def_config): - await issuer_create_and_store_credential_def(wallet_handle, issuer_did, json.dumps(gvt_schema), tag, "CL", - default_cred_def_config) diff --git a/wrappers/python/tests/anoncreds/test_issuer_create_credential.py b/wrappers/python/tests/anoncreds/test_issuer_create_credential.py index ea9932a356..1e12c6a3aa 100644 --- a/wrappers/python/tests/anoncreds/test_issuer_create_credential.py +++ b/wrappers/python/tests/anoncreds/test_issuer_create_credential.py @@ -1,6 +1,6 @@ import pytest -from indy import wallet, error +from indy import error from indy.anoncreds import issuer_create_credential @@ -13,21 +13,8 @@ async def test_issuer_create_credential_works(wallet_handle, prepopulated_wallet # noinspection PyUnusedLocal @pytest.mark.asyncio async def test_issuer_create_credential_works_for_credential_values_not_correspond_to_credential_req( - wallet_handle, prepopulated_wallet, xyz_cred_values_json): + wallet_handle, prepopulated_wallet, xyz_cred_values_json): _, cred_offer, cred_req, _, _ = prepopulated_wallet with pytest.raises(error.CommonInvalidStructure): await issuer_create_credential(wallet_handle, cred_offer, cred_req, xyz_cred_values_json, None, None) - - - -# noinspection PyUnusedLocal -@pytest.mark.asyncio -async def test_issuer_create_credential_works_for_for_invalid_wallet_handle( - wallet_handle, prepopulated_wallet, gvt_cred_values_json): - _, cred_offer, cred_req, _, _ = prepopulated_wallet - - invalid_wallet_handle = wallet_handle + 100 - - with pytest.raises(error.WalletInvalidHandle): - await issuer_create_credential(invalid_wallet_handle, cred_offer, cred_req, gvt_cred_values_json, None, None) diff --git a/wrappers/python/tests/anoncreds/test_prover_create_credential_req.py b/wrappers/python/tests/anoncreds/test_prover_create_credential_req.py index 734126d9a5..3a262387c1 100644 --- a/wrappers/python/tests/anoncreds/test_prover_create_credential_req.py +++ b/wrappers/python/tests/anoncreds/test_prover_create_credential_req.py @@ -1,20 +1,6 @@ import pytest -from indy.anoncreds import prover_create_credential_req -from indy import error - @pytest.mark.asyncio async def test_prover_create_credential_req_works(wallet_handle, prepopulated_wallet): pass - - -@pytest.mark.asyncio -async def test_prover_create_credential_req_works_for_invalid_wallet(wallet_handle, prepopulated_wallet, - prover_did, master_secret_id): - credential_def_json, credential_offer, _, _, _ = prepopulated_wallet - invalid_wallet_handle = wallet_handle + 100 - - with pytest.raises(error.WalletInvalidHandle): - await prover_create_credential_req(invalid_wallet_handle, prover_did, credential_offer, credential_def_json, - master_secret_id) diff --git a/wrappers/python/tests/anoncreds/test_prover_create_master_secret.py b/wrappers/python/tests/anoncreds/test_prover_create_master_secret.py index d072c71eea..4fdb1e3098 100644 --- a/wrappers/python/tests/anoncreds/test_prover_create_master_secret.py +++ b/wrappers/python/tests/anoncreds/test_prover_create_master_secret.py @@ -1,18 +1,7 @@ import pytest -from indy.anoncreds import prover_create_master_secret -from indy import error - # noinspection PyUnusedLocal @pytest.mark.asyncio async def test_prover_create_master_secret_works(wallet_handle, prepopulated_wallet): pass - - -@pytest.mark.asyncio -async def test_prover_create_master_secret_works_invalid_wallet_handle(wallet_handle): - invalid_wallet_handle = wallet_handle + 100 - - with pytest.raises(error.WalletInvalidHandle): - await prover_create_master_secret(invalid_wallet_handle, "master_secret_name") diff --git a/wrappers/python/tests/anoncreds/test_prover_create_proof.py b/wrappers/python/tests/anoncreds/test_prover_create_proof.py index c4bc02fafc..74ba2049be 100644 --- a/wrappers/python/tests/anoncreds/test_prover_create_proof.py +++ b/wrappers/python/tests/anoncreds/test_prover_create_proof.py @@ -72,35 +72,3 @@ async def test_prover_create_proof_works_for_using_not_satisfy_credential(wallet await prover_create_proof(wallet_handle, json.dumps(proof_req), json.dumps(requested_credentials), master_secret_id, json.dumps(schemas), json.dumps(credential_defs), "{}") - - -@pytest.mark.asyncio -async def test_prover_create_proof_works_for_invalid_wallet_handle(wallet_handle, prepopulated_wallet, gvt_schema_id, - gvt_schema, master_secret_id, proof_req, - id_credential_1, issuer_1_gvt_cred_def_id): - credential_def_json, _, _, _, _ = prepopulated_wallet - - requested_credentials = { - "self_attested_attributes": {}, - "requested_attributes": { - "attr1_referent": {"cred_id": id_credential_1, "revealed": True} - }, - "requested_predicates": { - "predicate1_referent": {"cred_id": id_credential_1} - } - } - - schemas = { - gvt_schema_id: gvt_schema - } - - credential_defs = { - issuer_1_gvt_cred_def_id: json.loads(credential_def_json) - } - - invalid_wallet_handle = wallet_handle + 100 - - with pytest.raises(error.WalletInvalidHandle): - await prover_create_proof(invalid_wallet_handle, json.dumps(proof_req), json.dumps(requested_credentials), - master_secret_id, json.dumps(schemas), json.dumps(credential_defs), "{}") - diff --git a/wrappers/python/tests/anoncreds/test_prover_get_credentials.py b/wrappers/python/tests/anoncreds/test_prover_get_credentials.py index 408a76e894..15ad870cb0 100644 --- a/wrappers/python/tests/anoncreds/test_prover_get_credentials.py +++ b/wrappers/python/tests/anoncreds/test_prover_get_credentials.py @@ -2,7 +2,6 @@ import pytest from indy.anoncreds import prover_get_credentials -from indy import error # noinspection PyUnusedLocal @@ -14,15 +13,6 @@ async def test_prover_get_credentials_works_for_empty_filter(wallet_handle, prep assert len(credentials) == 3 -# noinspection PyUnusedLocal -@pytest.mark.asyncio -async def test_prover_get_credentials_works_for_filter_by_issuer_did(wallet_handle, prepopulated_wallet, issuer_did): - credentials = json.loads( - await prover_get_credentials(wallet_handle, json.dumps({"issuer_did": issuer_did}))) - - assert len(credentials) == 2 - - # noinspection PyUnusedLocal @pytest.mark.asyncio async def test_prover_get_credentials_works_for_filter_by_schema_id(wallet_handle, prepopulated_wallet, gvt_schema_id): @@ -32,25 +22,6 @@ async def test_prover_get_credentials_works_for_filter_by_schema_id(wallet_handl assert len(credentials) == 2 -# noinspection PyUnusedLocal -@pytest.mark.asyncio -async def test_prover_get_credentials_works_for_filter_by_schema_name(wallet_handle, prepopulated_wallet): - credentials = json.loads( - await prover_get_credentials(wallet_handle, json.dumps({"schema_name": "gvt"}))) - - assert len(credentials) == 2 - - -# noinspection PyUnusedLocal -@pytest.mark.asyncio -async def test_prover_get_credentials_works_for_filter_by_cred_def_id(wallet_handle, prepopulated_wallet, - issuer_1_xyz_cred_def_id): - credentials = json.loads( - await prover_get_credentials(wallet_handle, json.dumps({"cred_def_id": issuer_1_xyz_cred_def_id}))) - - assert len(credentials) == 1 - - # noinspection PyUnusedLocal @pytest.mark.asyncio async def test_prover_get_credentials_works_for_empty_result(wallet_handle, prepopulated_wallet, issuer_did): @@ -59,12 +30,3 @@ async def test_prover_get_credentials_works_for_empty_result(wallet_handle, prep wallet_handle, json.dumps({"issuer_did": issuer_did + 'a'}))) assert len(credentials) == 0 - - -# noinspection PyUnusedLocal -@pytest.mark.asyncio -async def test_prover_get_credentials_works_for_invalid_wallet_handle(wallet_handle, prepopulated_wallet): - invalid_wallet_handle = wallet_handle + 100 - - with pytest.raises(error.WalletInvalidHandle): - await prover_get_credentials(invalid_wallet_handle, '{}') diff --git a/wrappers/python/tests/anoncreds/test_prover_get_credentials_for_proof_req.py b/wrappers/python/tests/anoncreds/test_prover_get_credentials_for_proof_req.py index 97d055580c..33c7259aac 100644 --- a/wrappers/python/tests/anoncreds/test_prover_get_credentials_for_proof_req.py +++ b/wrappers/python/tests/anoncreds/test_prover_get_credentials_for_proof_req.py @@ -2,7 +2,6 @@ import pytest from indy.anoncreds import prover_get_credentials_for_proof_req -from indy import error # noinspection PyUnusedLocal @@ -28,54 +27,6 @@ async def test_prover_get_credentials_for_proof_req_works_for_revealed_attr(wall assert len(credentials['attrs']['attr1_referent']) == 2 -# noinspection PyUnusedLocal -@pytest.mark.asyncio -async def test_prover_get_credentials_for_proof_req_works_for_revealed_attr_in_upper_case(wallet_handle, - prepopulated_wallet): - proof_req = { - "nonce": "123432421212", - "name": "proof_req_1", - "version": "0.1", - "requested_attributes": { - "attr1_referent": { - "name": "NAME" - } - }, - "requested_predicates": {} - } - - credentials = json.loads( - await prover_get_credentials_for_proof_req(wallet_handle, json.dumps(proof_req))) - - assert len(credentials['attrs']) == 1 - assert len(credentials['predicates']) == 0 - assert len(credentials['attrs']['attr1_referent']) == 2 - - -# noinspection PyUnusedLocal -@pytest.mark.asyncio -async def test_prover_get_credentials_for_proof_req_works_for_revealed_attr_contains_spaces(wallet_handle, - prepopulated_wallet): - proof_req = { - "nonce": "123432421212", - "name": "proof_req_1", - "version": "0.1", - "requested_attributes": { - "attr1_referent": { - "name": " name " - } - }, - "requested_predicates": {} - } - - credentials = json.loads( - await prover_get_credentials_for_proof_req(wallet_handle, json.dumps(proof_req))) - - assert len(credentials['attrs']) == 1 - assert len(credentials['predicates']) == 0 - assert len(credentials['attrs']['attr1_referent']) == 2 - - # noinspection PyUnusedLocal @pytest.mark.asyncio async def test_prover_get_credentials_for_proof_req_works_for_revealed_attr_for_specific_schema(wallet_handle, @@ -102,135 +53,6 @@ async def test_prover_get_credentials_for_proof_req_works_for_revealed_attr_for_ assert len(credentials['attrs']['attr1_referent']) == 2 -# noinspection PyUnusedLocal -@pytest.mark.asyncio -async def test_prover_get_credentials_for_proof_req_works_for_revealed_attr_for_schema_name(wallet_handle, - prepopulated_wallet): - proof_req = { - "nonce": "123432421212", - "name": "proof_req_1", - "version": "0.1", - "requested_attributes": { - "attr1_referent": { - "name": "name", - "restrictions": [{"schema_name": "gvt"}] - } - }, - "requested_predicates": {} - } - - credentials = json.loads( - await prover_get_credentials_for_proof_req(wallet_handle, json.dumps(proof_req))) - - assert len(credentials['attrs']) == 1 - assert len(credentials['predicates']) == 0 - assert len(credentials['attrs']['attr1_referent']) == 2 - - -# noinspection PyUnusedLocal -@pytest.mark.asyncio -async def test_prover_get_credentials_for_proof_req_works_for_revealed_attr_for_issuer_did(wallet_handle, - prepopulated_wallet, - issuer_did): - proof_req = { - "nonce": "123432421212", - "name": "proof_req_1", - "version": "0.1", - "requested_attributes": { - "attr1_referent": { - "name": "name", - "restrictions": [{"issuer_did": issuer_did}] - } - }, - "requested_predicates": {} - } - - credentials = json.loads( - await prover_get_credentials_for_proof_req(wallet_handle, json.dumps(proof_req))) - - assert len(credentials['attrs']) == 1 - assert len(credentials['predicates']) == 0 - assert len(credentials['attrs']['attr1_referent']) == 1 - - -# noinspection PyUnusedLocal -@pytest.mark.asyncio -async def test_prover_get_credentials_for_proof_req_works_for_revealed_attr_for_cred_def_id(wallet_handle, - prepopulated_wallet, - issuer_1_gvt_cred_def_id): - proof_req = { - "nonce": "123432421212", - "name": "proof_req_1", - "version": "0.1", - "requested_attributes": { - "attr1_referent": { - "name": "name", - "restrictions": [{"cred_def_id": issuer_1_gvt_cred_def_id}] - } - }, - "requested_predicates": {} - } - - credentials = json.loads( - await prover_get_credentials_for_proof_req(wallet_handle, json.dumps(proof_req))) - - assert len(credentials['attrs']) == 1 - assert len(credentials['predicates']) == 0 - assert len(credentials['attrs']['attr1_referent']) == 1 - - -# noinspection PyUnusedLocal -@pytest.mark.asyncio -async def test_prover_get_credentials_for_proof_req_works_for_revealed_attr_for_multiple_schemas(wallet_handle, - prepopulated_wallet, - gvt_schema_id, - xyz_schema_id): - proof_req = { - "nonce": "123432421212", - "name": "proof_req_1", - "version": "0.1", - "requested_attributes": { - "attr1_referent": { - "name": "name", - "restrictions": [{"schema_id": gvt_schema_id}, {"schema_id": xyz_schema_id}] - } - }, - "requested_predicates": {} - } - - credentials = json.loads( - await prover_get_credentials_for_proof_req(wallet_handle, json.dumps(proof_req))) - - assert len(credentials['attrs']) == 1 - assert len(credentials['predicates']) == 0 - assert len(credentials['attrs']['attr1_referent']) == 2 - - -# noinspection PyUnusedLocal -@pytest.mark.asyncio -async def test_prover_get_credentials_for_proof_req_works_for_revealed_attr_for_schema_id_or_issuer_did( - wallet_handle, prepopulated_wallet, gvt_schema_id, issuer_did_2): - proof_req = { - "nonce": "123432421212", - "name": "proof_req_1", - "version": "0.1", - "requested_attributes": { - "attr1_referent": { - "name": "name", - "restrictions": [{"issuer_did": issuer_did_2}, {"schema_id": gvt_schema_id}] - } - }, - "requested_predicates": {} - } - - credentials = json.loads( - await prover_get_credentials_for_proof_req(wallet_handle, json.dumps(proof_req))) - - assert len(credentials['attrs']) == 1 - assert len(credentials['predicates']) == 0 - assert len(credentials['attrs']['attr1_referent']) == 2 - - # noinspection PyUnusedLocal @pytest.mark.asyncio async def test_prover_get_credentials_for_proof_req_works_for_not_found_attribute(wallet_handle, prepopulated_wallet): @@ -254,32 +76,6 @@ async def test_prover_get_credentials_for_proof_req_works_for_not_found_attribut assert len(credentials['attrs']['attr1_referent']) == 0 -# noinspection PyUnusedLocal -@pytest.mark.asyncio -async def test_prover_get_credentials_for_proof_req_works_for_revealed_attr_for_other_issuer(wallet_handle, - prepopulated_wallet, - issuer_did_2): - proof_req = { - "nonce": "123432421212", - "name": "proof_req_1", - "version": "0.1", - "requested_attributes": { - "attr1_referent": { - "name": "status", - "restrictions": [{"issuer_did": issuer_did_2}] - } - }, - "requested_predicates": {} - } - - credentials = json.loads( - await prover_get_credentials_for_proof_req(wallet_handle, json.dumps(proof_req))) - - assert len(credentials['attrs']) == 1 - assert len(credentials['predicates']) == 0 - assert len(credentials['attrs']['attr1_referent']) == 0 - - # noinspection PyUnusedLocal @pytest.mark.asyncio async def test_prover_get_credentials_for_proof_req_works_for_predicate(wallet_handle, prepopulated_wallet): @@ -306,60 +102,6 @@ async def test_prover_get_credentials_for_proof_req_works_for_predicate(wallet_h assert len(credentials['predicates']['predicate1_referent']) == 2 -# noinspection PyUnusedLocal -@pytest.mark.asyncio -async def test_prover_get_credentials_for_proof_req_works_for_predicate_attr_in_upper_case(wallet_handle, - prepopulated_wallet): - proof_req = { - "nonce": "123432421212", - "name": "proof_req_1", - "version": "0.1", - "requested_attributes": {}, - "requested_predicates": { - "predicate1_referent": - { - "name": "AGE", - "p_type": ">=", - "p_value": 18 - } - } - } - - credentials = json.loads( - await prover_get_credentials_for_proof_req(wallet_handle, json.dumps(proof_req))) - - assert len(credentials['attrs']) == 0 - assert len(credentials['predicates']) == 1 - assert len(credentials['predicates']['predicate1_referent']) == 2 - - -# noinspection PyUnusedLocal -@pytest.mark.asyncio -async def test_prover_get_credentials_for_proof_req_works_for_predicate_attr_contains_spaces(wallet_handle, - prepopulated_wallet): - proof_req = { - "nonce": "123432421212", - "name": "proof_req_1", - "version": "0.1", - "requested_attributes": {}, - "requested_predicates": { - "predicate1_referent": - { - "name": " age ", - "p_type": ">=", - "p_value": 18 - } - } - } - - credentials = json.loads( - await prover_get_credentials_for_proof_req(wallet_handle, json.dumps(proof_req))) - - assert len(credentials['attrs']) == 0 - assert len(credentials['predicates']) == 1 - assert len(credentials['predicates']['predicate1_referent']) == 2 - - # noinspection PyUnusedLocal @pytest.mark.asyncio async def test_prover_get_credentials_for_proof_req_works_for_predicate_for_schema_id(wallet_handle, gvt_schema_id, @@ -387,90 +129,6 @@ async def test_prover_get_credentials_for_proof_req_works_for_predicate_for_sche assert len(credentials['predicates']['predicate1_referent']) == 2 -# noinspection PyUnusedLocal -@pytest.mark.asyncio -async def test_prover_get_credentials_for_proof_req_works_for_predicate_for_issuer(wallet_handle, issuer_did, - prepopulated_wallet): - proof_req = { - "nonce": "123432421212", - "name": "proof_req_1", - "version": "0.1", - "requested_attributes": {}, - "requested_predicates": { - "predicate1_referent": - { - "name": "age", - "p_type": ">=", - "p_value": 18, - "restrictions": [{"issuer_did": issuer_did}] - } - } - } - - credentials = json.loads(await prover_get_credentials_for_proof_req(wallet_handle, json.dumps(proof_req))) - - assert len(credentials['attrs']) == 0 - assert len(credentials['predicates']) == 1 - assert len(credentials['predicates']['predicate1_referent']) == 1 - - -# noinspection PyUnusedLocal -@pytest.mark.asyncio -async def test_prover_get_credentials_for_proof_req_works_for_predicate_for_cred_def_id(wallet_handle, - issuer_1_gvt_cred_def_id, - prepopulated_wallet): - proof_req = { - "nonce": "123432421212", - "name": "proof_req_1", - "version": "0.1", - "requested_attributes": {}, - "requested_predicates": { - "predicate1_referent": - { - "name": "age", - "p_type": ">=", - "p_value": 18, - "restrictions": [{"cred_def_id": issuer_1_gvt_cred_def_id}] - } - } - } - - credentials = json.loads(await prover_get_credentials_for_proof_req(wallet_handle, json.dumps(proof_req))) - - assert len(credentials['attrs']) == 0 - assert len(credentials['predicates']) == 1 - assert len(credentials['predicates']['predicate1_referent']) == 1 - - -# noinspection PyUnusedLocal -@pytest.mark.asyncio -async def test_prover_get_credentials_for_proof_req_works_for_predicate_for_multiple_issuers(wallet_handle, - issuer_did, - issuer_did_2, - prepopulated_wallet): - proof_req = { - "nonce": "123432421212", - "name": "proof_req_1", - "version": "0.1", - "requested_attributes": {}, - "requested_predicates": { - "predicate1_referent": - { - "name": "age", - "p_type": ">=", - "p_value": 18, - "restrictions": [{"issuer_did": issuer_did}, {"issuer_did": issuer_did_2}] - } - } - } - - credentials = json.loads(await prover_get_credentials_for_proof_req(wallet_handle, json.dumps(proof_req))) - - assert len(credentials['attrs']) == 0 - assert len(credentials['predicates']) == 1 - assert len(credentials['predicates']['predicate1_referent']) == 2 - - @pytest.mark.asyncio async def test_prover_get_credentials_for_proof_req_works_for_not_found_predicate_attribute(wallet_handle, prepopulated_wallet): @@ -548,27 +206,3 @@ async def test_prover_get_credentials_for_proof_req_works_for_multiply_attribute assert len(credentials['attrs']['attr2_referent']) == 2 assert len(credentials['predicates']['predicate1_referent']) == 2 assert len(credentials['predicates']['predicate2_referent']) == 2 - - -# noinspection PyUnusedLocal -@pytest.mark.asyncio -async def test_prover_get_credentials_for_proof_req_works_for_invalid_wallet_handle(wallet_handle, prepopulated_wallet): - proof_req = { - "nonce": "123432421212", - "name": "proof_req_1", - "version": "0.1", - "requested_attributes": {}, - "requested_predicates": { - "predicate1_referent": - { - "name": "age", - "p_type": ">=", - "p_value": 58 - } - } - } - - invalid_wallet_handle = wallet_handle + 100 - - with pytest.raises(error.WalletInvalidHandle): - await prover_get_credentials_for_proof_req(invalid_wallet_handle, json.dumps(proof_req)) diff --git a/wrappers/python/tests/anoncreds/test_prover_store_credential.py b/wrappers/python/tests/anoncreds/test_prover_store_credential.py index 44732cdbac..c9ff7d4dd0 100644 --- a/wrappers/python/tests/anoncreds/test_prover_store_credential.py +++ b/wrappers/python/tests/anoncreds/test_prover_store_credential.py @@ -1,19 +1,6 @@ import pytest -from indy.anoncreds import prover_store_credential -from indy import error - @pytest.mark.asyncio async def test_prover_store_credential_works(wallet_handle, prepopulated_wallet): pass - - -@pytest.mark.asyncio -async def test_prover_store_credential_works_for_invalid_wallet_handle(wallet_handle, prepopulated_wallet): - cred_def, _, _, cred_req_metadata, credential_json = prepopulated_wallet - invalid_wallet_handle = wallet_handle + 100 - - with pytest.raises(error.WalletInvalidHandle): - await prover_store_credential(invalid_wallet_handle, "id_1", cred_req_metadata, - credential_json, cred_def, None) diff --git a/wrappers/python/tests/crypto/test_auth_crypt.py b/wrappers/python/tests/crypto/test_auth_crypt.py index d45fb789b0..fa8ca77a19 100644 --- a/wrappers/python/tests/crypto/test_auth_crypt.py +++ b/wrappers/python/tests/crypto/test_auth_crypt.py @@ -11,18 +11,6 @@ async def test_auth_crypt_works_for_created_key(wallet_handle, seed_my1, verkey_ await crypto.auth_crypt(wallet_handle, verkey, verkey_my2, message) -@pytest.mark.asyncio -async def test_auth_crypt_works_for_created_did(wallet_handle, seed_my1, verkey_my2, message): - (_, verkey) = await did.create_and_store_my_did(wallet_handle, json.dumps({'seed': seed_my1})) - await crypto.auth_crypt(wallet_handle, verkey, verkey_my2, message) - - -@pytest.mark.asyncio -async def test_auth_crypt_works_for_created_did_as_cid(wallet_handle, seed_my1, verkey_my2, message): - (_, verkey) = await did.create_and_store_my_did(wallet_handle, json.dumps({'seed': seed_my1, 'cid': True})) - await crypto.auth_crypt(wallet_handle, verkey, verkey_my2, message) - - @pytest.mark.asyncio async def test_auth_crypt_works_for_unknown_sender_verkey(wallet_handle, verkey_my1, verkey_my2, message): with pytest.raises(error.WalletItemNotFound): diff --git a/wrappers/python/tests/crypto/test_create_key.py b/wrappers/python/tests/crypto/test_create_key.py index 7ff8a1fbcf..7ffee110e5 100644 --- a/wrappers/python/tests/crypto/test_create_key.py +++ b/wrappers/python/tests/crypto/test_create_key.py @@ -22,11 +22,3 @@ async def test_create_key_works_without_seed(wallet_handle): async def test_create_my_did_works_for_invalid_seed(wallet_handle): with pytest.raises(error.CommonInvalidStructure): await did.create_key(wallet_handle, json.dumps({'seed': 'invalidSeedLength'})) - - - -@pytest.mark.asyncio -async def test_create_my_did_works_for_invalid_handle(wallet_handle): - with pytest.raises(error.WalletInvalidHandle): - invalid_wallet_handle = wallet_handle + 1 - await did.create_key(invalid_wallet_handle, '{}') diff --git a/wrappers/python/tests/crypto/test_crypto_sign.py b/wrappers/python/tests/crypto/test_crypto_sign.py index 00333d29f7..a8bf097805 100644 --- a/wrappers/python/tests/crypto/test_crypto_sign.py +++ b/wrappers/python/tests/crypto/test_crypto_sign.py @@ -1,6 +1,6 @@ import pytest -from indy import crypto, did, error +from indy import crypto, error @pytest.mark.asyncio @@ -18,10 +18,3 @@ async def test_crypto_sign_works(wallet_handle, key_my1, message): async def test_crypto_sign_works_for_unknown_signer(wallet_handle, message, verkey_my1): with pytest.raises(error.WalletItemNotFound): await crypto.crypto_sign(wallet_handle, verkey_my1, message) - - -@pytest.mark.asyncio -async def test_crypto_sign_works_for_invalid_handle(wallet_handle, message): - with pytest.raises(error.WalletInvalidHandle): - key = await did.create_key(wallet_handle, "{}") - await crypto.crypto_sign(wallet_handle + 1, key, message) diff --git a/wrappers/python/tests/crypto/test_crypto_verify.py b/wrappers/python/tests/crypto/test_crypto_verify.py index 77e670d07a..47d7339eab 100644 --- a/wrappers/python/tests/crypto/test_crypto_verify.py +++ b/wrappers/python/tests/crypto/test_crypto_verify.py @@ -14,13 +14,6 @@ async def test_crypto_verify_works(verkey_my1, message): assert valid -@pytest.mark.asyncio -async def test_crypto_verify_works_for_verkey_with_correct_crypto_type(verkey_my1, message): - verkey = verkey_my1 + ':ed25519' - valid = await crypto.crypto_verify(verkey, message, signature) - assert valid - - @pytest.mark.asyncio async def test_crypto_verify_works_for_other_signer(verkey_my2, message): valid = await crypto.crypto_verify(verkey_my2, message, signature) diff --git a/wrappers/python/tests/crypto/test_get_key_metadata.py b/wrappers/python/tests/crypto/test_get_key_metadata.py index daeda011e3..15d8e9ed37 100644 --- a/wrappers/python/tests/crypto/test_get_key_metadata.py +++ b/wrappers/python/tests/crypto/test_get_key_metadata.py @@ -11,31 +11,8 @@ async def test_get_key_metadata_works(wallet_handle, metadata): assert metadata == received_metadata -@pytest.mark.asyncio -async def test_get_key_metadata_works_for_empty_string(wallet_handle): - verkey = await did.create_key(wallet_handle, "{}") - await did.set_key_metadata(wallet_handle, verkey, '') - received_metadata = await did.get_key_metadata(wallet_handle, verkey) - assert '' == received_metadata - - -@pytest.mark.asyncio -async def test_get_key_metadata_works_for_no_key(wallet_handle, verkey_my1): - with pytest.raises(error.WalletItemNotFound): - await did.get_key_metadata(wallet_handle, verkey_my1) - - @pytest.mark.asyncio async def test_get_key_metadata_works_for_no_metadata(wallet_handle): verkey = await did.create_key(wallet_handle, "{}") with pytest.raises(error.WalletItemNotFound): await did.get_key_metadata(wallet_handle, verkey) - - -@pytest.mark.asyncio -async def test_get_key_metadata_works_for_invalid_handle(wallet_handle, metadata): - verkey = await did.create_key(wallet_handle, "{}") - await did.set_key_metadata(wallet_handle, verkey, metadata) - with pytest.raises(error.WalletInvalidHandle): - invalid_wallet_handle = wallet_handle + 1 - await did.get_key_metadata(invalid_wallet_handle, verkey) diff --git a/wrappers/python/tests/crypto/test_set_key_metadata.py b/wrappers/python/tests/crypto/test_set_key_metadata.py index e542e3e80d..a6406c2ea2 100644 --- a/wrappers/python/tests/crypto/test_set_key_metadata.py +++ b/wrappers/python/tests/crypto/test_set_key_metadata.py @@ -9,19 +9,6 @@ async def test_set_key_metadata_works(wallet_handle, metadata): await did.set_key_metadata(wallet_handle, verkey, metadata) -@pytest.mark.asyncio -async def test_set_key_metadata_works_for_replace(wallet_handle, metadata): - verkey = await did.create_key(wallet_handle, "{}") - await did.set_key_metadata(wallet_handle, verkey, metadata) - received_metadata = await did.get_key_metadata(wallet_handle, verkey) - assert metadata == received_metadata - - new_metadata = 'new metadata' - await did.set_key_metadata(wallet_handle, verkey, new_metadata) - updated_metadata = await did.get_key_metadata(wallet_handle, verkey) - assert new_metadata == updated_metadata - - @pytest.mark.asyncio async def test_set_key_metadata_works_for_empty_string(wallet_handle): verkey = await did.create_key(wallet_handle, "{}") diff --git a/wrappers/python/tests/did/test_create_and_store_my_did.py b/wrappers/python/tests/did/test_create_and_store_my_did.py index 3bd1352cfe..91f1e6ba40 100644 --- a/wrappers/python/tests/did/test_create_and_store_my_did.py +++ b/wrappers/python/tests/did/test_create_and_store_my_did.py @@ -21,45 +21,12 @@ async def test_create_my_did_works_for_seed(wallet_handle, seed_my1, did_my1, ve assert verkey_my1 == ver_key -@pytest.mark.asyncio -async def test_create_my_did_works_as_cid(wallet_handle, seed_my1, verkey_my1): - (_did, ver_key) = await did.create_and_store_my_did(wallet_handle, json.dumps({'seed': seed_my1, 'cid': True})) - assert verkey_my1 == _did - assert verkey_my1 == ver_key - - -@pytest.mark.asyncio -async def test_create_my_did_works_for_passed_did(wallet_handle, did_my1): - (_did, _) = await did.create_and_store_my_did(wallet_handle, json.dumps({'did': did_my1})) - assert did_my1 == _did - - -@pytest.mark.asyncio -async def test_create_my_did_works_for_correct_type(wallet_handle, seed_my1, did_my1, verkey_my1, crypto_type): - (_did, ver_key) = \ - await did.create_and_store_my_did(wallet_handle, json.dumps({'seed': seed_my1, 'crypto_type': crypto_type})) - assert did_my1 == _did - assert verkey_my1 == ver_key - - -@pytest.mark.asyncio -async def test_create_my_did_works_for_invalid_seed(wallet_handle): - with pytest.raises(error.CommonInvalidStructure): - await did.create_and_store_my_did(wallet_handle, json.dumps({'seed': 'aaaaaaaaaaa'})) - - @pytest.mark.asyncio async def test_create_my_did_works_for_invalid_crypto_type(wallet_handle): with pytest.raises(error.UnknownCryptoTypeError): await did.create_and_store_my_did(wallet_handle, json.dumps({'crypto_type': 'crypto_type'})) -@pytest.mark.asyncio -async def test_create_my_did_works_for_invalid_handle(wallet_handle): - with pytest.raises(error.WalletInvalidHandle): - await did.create_and_store_my_did(wallet_handle + 1, '{}') - - @pytest.mark.asyncio async def test_create_my_did_works_for_duplicate(wallet_handle): (_did, _) = await did.create_and_store_my_did(wallet_handle, '{}') diff --git a/wrappers/python/tests/did/test_get_did_metadata.py b/wrappers/python/tests/did/test_get_did_metadata.py index 099d289e1b..7d2fa6b1e6 100644 --- a/wrappers/python/tests/did/test_get_did_metadata.py +++ b/wrappers/python/tests/did/test_get_did_metadata.py @@ -23,18 +23,3 @@ async def test_get_did_metadata_works_for_empty_string(wallet_handle): async def test_get_did_metadata_works_for_no_metadata(wallet_handle, did_my1): with pytest.raises(error.WalletItemNotFound): await did.get_did_metadata(wallet_handle, did_my1) - - -@pytest.mark.asyncio -async def test_get_did_metadata_works_for_invalid_handle(wallet_handle, metadata): - (_did, _) = await did.create_and_store_my_did(wallet_handle, "{}") - await did.set_did_metadata(wallet_handle, _did, metadata) - with pytest.raises(error.WalletInvalidHandle): - invalid_wallet_handle = wallet_handle + 1 - await did.get_did_metadata(invalid_wallet_handle, _did) - - -@pytest.mark.asyncio -async def test_get_did_metadata_works_for_not_found_did(wallet_handle, did_my1): - with pytest.raises(error.WalletItemNotFound): - await did.get_did_metadata(wallet_handle, did_my1) diff --git a/wrappers/python/tests/did/test_get_endpoint_for_did.py b/wrappers/python/tests/did/test_get_endpoint_for_did.py index 3f2f4875d2..cf7c4617f5 100644 --- a/wrappers/python/tests/did/test_get_endpoint_for_did.py +++ b/wrappers/python/tests/did/test_get_endpoint_for_did.py @@ -1,9 +1,6 @@ -import json -import time - import pytest -from indy import did, ledger, error +from indy import did, error @pytest.mark.asyncio @@ -15,40 +12,7 @@ async def test_get_endpoint_for_did_works(wallet_handle, identity_trustee1, endp assert key == received_key -@pytest.mark.asyncio -async def test_get_endpoint_for_did_works_from_ledger(pool_handle, wallet_handle, identity_trustee1, endpoint): - (_did, key) = identity_trustee1 - - endpoint_json = json.dumps({"endpoint": {"ha": endpoint, "verkey": key}}) - attrib_request = await ledger.build_attrib_request(_did, _did, None, endpoint_json, None) - await ledger.sign_and_submit_request(pool_handle, wallet_handle, _did, attrib_request) - - time.sleep(1) - - received_endpoint, received_key = await did.get_endpoint_for_did(wallet_handle, pool_handle, _did) - assert endpoint == received_endpoint - assert key == received_key - - @pytest.mark.asyncio async def test_get_endpoint_for_did_works_for_unknown_did(pool_handle, wallet_handle, did_my1): with pytest.raises(error.CommonInvalidState): await did.get_endpoint_for_did(wallet_handle, pool_handle, did_my1) - - -@pytest.mark.asyncio -async def test_get_endpoint_for_did_works_invalid_wallet_handle(pool_handle, wallet_handle, - identity_trustee1, endpoint): - (_did, key) = identity_trustee1 - await did.set_endpoint_for_did(wallet_handle, _did, endpoint, key) - with pytest.raises(error.WalletInvalidHandle): - invalid_wallet_handle = wallet_handle + 1 - await did.get_endpoint_for_did(invalid_wallet_handle, pool_handle, _did) - - -@pytest.mark.asyncio -async def test_get_endpoint_for_did_works_invalid_pool_handle(pool_handle, wallet_handle, identity_trustee1, endpoint): - (_did, key) = identity_trustee1 - with pytest.raises(error.PoolLedgerInvalidPoolHandle): - invalid_pool_handle = pool_handle + 1 - await did.get_endpoint_for_did(wallet_handle, invalid_pool_handle, _did) diff --git a/wrappers/python/tests/did/test_get_my_did_with_meta.py b/wrappers/python/tests/did/test_get_my_did_with_meta.py index f8ce1783dc..60db579087 100644 --- a/wrappers/python/tests/did/test_get_my_did_with_meta.py +++ b/wrappers/python/tests/did/test_get_my_did_with_meta.py @@ -17,10 +17,6 @@ async def test_get_my_did_works(wallet_handle, seed_my1, did_my1, verkey_my1, me assert res["metadata"] == metadata assert res["verkey"] == verkey_my1 -@pytest.mark.asyncio -async def test_get_my_dids_works_for_invalid_handle(wallet_handle, did_my1): - with pytest.raises(error.WalletInvalidHandle): - await did.get_my_did_with_meta(wallet_handle + 1, did_my1) @pytest.mark.asyncio async def test_get_my_did_with_metadata_works_for_no_metadata(wallet_handle, did_my1): diff --git a/wrappers/python/tests/did/test_key_for_did.py b/wrappers/python/tests/did/test_key_for_did.py index 5ea3993283..4e32443c5a 100644 --- a/wrappers/python/tests/did/test_key_for_did.py +++ b/wrappers/python/tests/did/test_key_for_did.py @@ -1,5 +1,3 @@ -import json - import pytest from indy import did, error @@ -13,28 +11,7 @@ async def test_key_for_did_works_for_my_did(wallet_handle, identity_trustee1): assert verkey == received_key -@pytest.mark.asyncio -async def test_key_for_did_works_for_their_did(wallet_handle, did_my1, verkey_my1): - await did.store_their_did(wallet_handle, json.dumps({'did': did_my1, 'verkey': verkey_my1})) - received_key = await did.key_for_did(-1, wallet_handle, did_my1) - assert verkey_my1 == received_key - - @pytest.mark.asyncio async def test_key_for_did_works_for_unknown_did(pool_handle, wallet_handle, did_my2): with pytest.raises(error.WalletItemNotFound): await did.key_for_did(pool_handle, wallet_handle, did_my2) - - -@pytest.mark.asyncio -async def test_key_for_did_works_for_invalid_pool_handle(pool_handle, wallet_handle, did_my1): - with pytest.raises(error.PoolLedgerInvalidPoolHandle): - await did.key_for_did(pool_handle + 1, wallet_handle, did_my1) - - -@pytest.mark.asyncio -async def test_key_for_did_works_for_invalid_wallet_handle(wallet_handle, identity_trustee1): - (_did, _) = identity_trustee1 - with pytest.raises(error.WalletInvalidHandle): - invalid_wallet_handle = wallet_handle + 1 - await did.key_for_did(-1, invalid_wallet_handle, _did) diff --git a/wrappers/python/tests/did/test_key_for_local_did.py b/wrappers/python/tests/did/test_key_for_local_did.py index f12a6294a8..9bac53e2a8 100644 --- a/wrappers/python/tests/did/test_key_for_local_did.py +++ b/wrappers/python/tests/did/test_key_for_local_did.py @@ -1,33 +1,16 @@ -import json - import pytest from indy import did, error @pytest.mark.asyncio -async def test_key_for_local_did_works_for_my_did(wallet_handle, identity_trustee1): +async def test_key_for_local_did_works(wallet_handle, identity_trustee1): (_did, verkey) = identity_trustee1 received_key = await did.key_for_local_did(wallet_handle, _did) assert verkey == received_key -@pytest.mark.asyncio -async def test_key_for_local_did_works_for_their_did(wallet_handle, did_my1, verkey_my1): - await did.store_their_did(wallet_handle, json.dumps({'did': did_my1, 'verkey': verkey_my1})) - received_key = await did.key_for_local_did(wallet_handle, did_my1) - assert verkey_my1 == received_key - - @pytest.mark.asyncio async def test_key_for_local_did_works_for_unknown_did(wallet_handle, did_my2): with pytest.raises(error.WalletItemNotFound): await did.key_for_local_did(wallet_handle, did_my2) - - -@pytest.mark.asyncio -async def test_key_for_local_did_works_for_invalid_wallet_handle(wallet_handle, identity_trustee1): - (_did, _) = identity_trustee1 - with pytest.raises(error.WalletInvalidHandle): - invalid_wallet_handle = wallet_handle + 1 - await did.key_for_local_did(invalid_wallet_handle, _did) diff --git a/wrappers/python/tests/did/test_replace_keys_apply.py b/wrappers/python/tests/did/test_replace_keys_apply.py index 3eacadee9c..441b308072 100644 --- a/wrappers/python/tests/did/test_replace_keys_apply.py +++ b/wrappers/python/tests/did/test_replace_keys_apply.py @@ -23,11 +23,3 @@ async def test_replace_keys_apply_works_for_unknown_did(wallet_handle, did_my1): await did.replace_keys_start(wallet_handle, _did, "{}") with pytest.raises(error.WalletItemNotFound): await did.replace_keys_apply(wallet_handle, did_my1) - - -@pytest.mark.asyncio -async def test_replace_keys_apply_works_invalid_wallet_handle(wallet_handle): - (_did, _) = await did.create_and_store_my_did(wallet_handle, "{}") - await did.replace_keys_start(wallet_handle, _did, "{}") - with pytest.raises(error.WalletInvalidHandle): - await did.replace_keys_apply(wallet_handle + 1, _did) diff --git a/wrappers/python/tests/did/test_replace_keys_start.py b/wrappers/python/tests/did/test_replace_keys_start.py index 9e77b43985..72688a01be 100644 --- a/wrappers/python/tests/did/test_replace_keys_start.py +++ b/wrappers/python/tests/did/test_replace_keys_start.py @@ -20,28 +20,7 @@ async def test_replace_keys_start_works_for_seed(wallet_handle, seed_my1, verkey assert verkey_my1 == new_ver_key -@pytest.mark.asyncio -async def test_replace_keys_start_works_for_correct_crypto_type(wallet_handle, crypto_type): - (_did, ver_key) = await did.create_and_store_my_did(wallet_handle, "{}") - new_ver_key = await did.replace_keys_start(wallet_handle, _did, json.dumps({"crypto_type": crypto_type})) - assert new_ver_key != _did - - @pytest.mark.asyncio async def test_replace_keys_start_works_for_not_exists_did(wallet_handle, did_my1): with pytest.raises(error.WalletItemNotFound): await did.replace_keys_start(wallet_handle, did_my1, "{}") - - -@pytest.mark.asyncio -async def test_replace_keys_start_works_for_invalid_handle(wallet_handle): - with pytest.raises(error.WalletInvalidHandle): - (_did, _) = await did.create_and_store_my_did(wallet_handle, "{}") - await did.replace_keys_start(wallet_handle + 1, _did, "{}") - - -@pytest.mark.asyncio -async def test_replace_keys_works_start_for_invalid_crypto_type(wallet_handle): - with pytest.raises(error.UnknownCryptoTypeError): - (_did, _) = await did.create_and_store_my_did(wallet_handle, "{}") - await did.replace_keys_start(wallet_handle, _did, '{"crypto_type": "type"}') diff --git a/wrappers/python/tests/did/test_set_did_metadata.py b/wrappers/python/tests/did/test_set_did_metadata.py index 84665f1f16..83e5562155 100644 --- a/wrappers/python/tests/did/test_set_did_metadata.py +++ b/wrappers/python/tests/did/test_set_did_metadata.py @@ -1,6 +1,6 @@ import pytest -from indy import did, error +from indy import did @pytest.mark.asyncio @@ -9,33 +9,7 @@ async def test_set_did_metadata_works(wallet_handle, metadata): await did.set_did_metadata(wallet_handle, _did, metadata) -@pytest.mark.asyncio -async def test_set_did_metadata_works_for_replace(wallet_handle, metadata): - (_did, _) = await did.create_and_store_my_did(wallet_handle, "{}") - await did.set_did_metadata(wallet_handle, _did, metadata) - received_metadata = await did.get_did_metadata(wallet_handle, _did) - assert metadata == received_metadata - - new_metadata = 'new metadata' - await did.set_did_metadata(wallet_handle, _did, new_metadata) - updated_metadata = await did.get_did_metadata(wallet_handle, _did) - assert new_metadata == updated_metadata - - @pytest.mark.asyncio async def test_set_did_metadata_works_for_empty_string(wallet_handle): (_did, _) = await did.create_and_store_my_did(wallet_handle, "{}") await did.set_did_metadata(wallet_handle, _did, '') - - -@pytest.mark.asyncio -async def test_set_did_metadata_works_for_invalid_handle(wallet_handle, did_my1, metadata): - (_did, _) = await did.create_and_store_my_did(wallet_handle, "{}") - with pytest.raises(error.WalletInvalidHandle): - invalid_wallet_handle = wallet_handle + 1 - await did.set_did_metadata(invalid_wallet_handle, did_my1, metadata) - - -@pytest.mark.asyncio -async def test_set_did_metadata_works_for_unknown_did(wallet_handle, did_my1, metadata): - await did.set_did_metadata(wallet_handle, did_my1, metadata) diff --git a/wrappers/python/tests/did/test_set_endpoint_for_did.py b/wrappers/python/tests/did/test_set_endpoint_for_did.py index 0d35199b5a..b9f420c722 100644 --- a/wrappers/python/tests/did/test_set_endpoint_for_did.py +++ b/wrappers/python/tests/did/test_set_endpoint_for_did.py @@ -9,38 +9,7 @@ async def test_set_endpoint_for_did_works(wallet_handle, identity_trustee1, endp await did.set_endpoint_for_did(wallet_handle, _did, endpoint, verkey) -@pytest.mark.asyncio -async def test_set_endpoint_for_did_works_for_replace(pool_handle,wallet_handle, identity_trustee1, endpoint): - (_did, key) = identity_trustee1 - await did.set_endpoint_for_did(wallet_handle, _did, endpoint, key) - received_endpoint, received_key = await did.get_endpoint_for_did(wallet_handle, pool_handle, _did) - assert endpoint == received_endpoint - assert key == received_key - - new_endpoint = '100.0.0.1:9710' - new_key = 'CnEDk9HrMnmiHXEV1WFgbVCRteYnPqsJwrTdcZaNhFVW' - await did.set_endpoint_for_did(wallet_handle, _did, new_endpoint, new_key) - updated_endpoint, updated_key = await did.get_endpoint_for_did(wallet_handle, pool_handle, _did) - assert new_endpoint == updated_endpoint - assert new_key == updated_key - - @pytest.mark.asyncio async def test_set_endpoint_for_did_works_for_invalid_did(wallet_handle, verkey_my1, endpoint): with pytest.raises(error.CommonInvalidStructure): await did.set_endpoint_for_did(wallet_handle, 'invalid_base58string', endpoint, verkey_my1) - - -@pytest.mark.asyncio -async def test_set_endpoint_for_did_works_for_invalid_transport_key(wallet_handle, identity_trustee1, endpoint): - (_did, _) = identity_trustee1 - with pytest.raises(error.CommonInvalidStructure): - await did.set_endpoint_for_did(wallet_handle, _did, endpoint, 'CnEDk___MnmiHXEV1WFgbV___eYnPqs___TdcZaNhFVW') - - -@pytest.mark.asyncio -async def test_set_endpoint_for_did_works_for_invalid_handle(wallet_handle, identity_trustee1, endpoint): - (_did, key) = identity_trustee1 - with pytest.raises(error.WalletInvalidHandle): - invalid_wallet_handle = wallet_handle + 1 - await did.set_endpoint_for_did(invalid_wallet_handle, _did, endpoint, key) diff --git a/wrappers/python/tests/did/test_store_their_did.py b/wrappers/python/tests/did/test_store_their_did.py index 378d236f16..e5a727f477 100644 --- a/wrappers/python/tests/did/test_store_their_did.py +++ b/wrappers/python/tests/did/test_store_their_did.py @@ -14,26 +14,3 @@ async def test_store_their_did_works(wallet_handle, did_my): async def test_store_their_did_works_for_invalid_json(wallet_handle): with pytest.raises(error.CommonInvalidStructure): await did.store_their_did(wallet_handle, '{"field":"value"}') - - -@pytest.mark.asyncio -async def test_store_their_did_works_for_invalid_handle(wallet_handle, did_my): - with pytest.raises(error.WalletInvalidHandle): - await did.store_their_did(wallet_handle + 1, json.dumps({"did": did_my})) - - -@pytest.mark.asyncio -async def test_store_their_did_works_with_verkey(wallet_handle, did_my1, verkey_my1): - await did.store_their_did(wallet_handle, json.dumps({"did": did_my1, "verkey": verkey_my1})) - - -@pytest.mark.asyncio -async def test_store_their_did_works_without_did(wallet_handle, verkey_my1): - with pytest.raises(error.CommonInvalidStructure): - await did.store_their_did(wallet_handle, json.dumps({"verkey": verkey_my1})) - - -@pytest.mark.asyncio -async def test_store_their_did_works_for_invalid_did(wallet_handle): - with pytest.raises(error.CommonInvalidStructure): - await did.store_their_did(wallet_handle, '{"did": "invalid_base58_string"}') diff --git a/wrappers/python/tests/ledger/test_sign_and_submit_request.py b/wrappers/python/tests/ledger/test_sign_and_submit_request.py index 7937b8896f..1cf689a082 100644 --- a/wrappers/python/tests/ledger/test_sign_and_submit_request.py +++ b/wrappers/python/tests/ledger/test_sign_and_submit_request.py @@ -1,8 +1,6 @@ -import json - import pytest -from indy import wallet, did, ledger, error +from indy import ledger, error @pytest.mark.asyncio diff --git a/wrappers/python/tests/ledger/test_sign_request.py b/wrappers/python/tests/ledger/test_sign_request.py index 3708104955..4448fb586b 100644 --- a/wrappers/python/tests/ledger/test_sign_request.py +++ b/wrappers/python/tests/ledger/test_sign_request.py @@ -35,10 +35,3 @@ async def test_sign_works_for_invalid_message_format(wallet_handle): with pytest.raises(error.CommonInvalidStructure): (_did, _) = await did.create_and_store_my_did(wallet_handle, '{}') await ledger.sign_request(wallet_handle, _did, '"reqId":1495034346617224651') - - -@pytest.mark.asyncio -async def test_sign_works_for_invalid_handle(wallet_handle): - with pytest.raises(error.WalletInvalidHandle): - (_did, _) = await did.create_and_store_my_did(wallet_handle, '{}') - await ledger.sign_request(wallet_handle + 1, _did, json.dumps({"reqId": 1496822211362017764})) diff --git a/wrappers/python/tests/ledger/test_submit_request.py b/wrappers/python/tests/ledger/test_submit_request.py index 6a4b5bc912..3bcea39517 100644 --- a/wrappers/python/tests/ledger/test_submit_request.py +++ b/wrappers/python/tests/ledger/test_submit_request.py @@ -51,26 +51,6 @@ async def test_submit_request_works_for_invalid_pool_handle(pool_handle, identit await ledger.submit_request(invalid_pool_handle, get_nym_request) -@pytest.mark.asyncio -async def test_send_nym_request_works_without_signature(pool_handle, identity_my): - (my_did, _) = identity_my - - nym_request = await ledger.build_nym_request(my_did, my_did, None, None, None) - - response = await ledger.submit_request(pool_handle, nym_request) - assert json.loads(response)['op'] == 'REQNACK' - - -@pytest.mark.asyncio -async def test_send_get_nym_request_works(pool_handle, identity_trustee1): - (my_did, _) = identity_trustee1 - - get_nym_request = await ledger.build_get_nym_request(my_did, my_did) - - response = json.loads(await ledger.submit_request(pool_handle, get_nym_request)) - assert response['result']['data'] is not None - - @pytest.mark.asyncio async def test_nym_requests_works(pool_handle, wallet_handle, identity_trustee1, identity_my): (trustee_did, _) = identity_trustee1 @@ -86,16 +66,6 @@ async def test_nym_requests_works(pool_handle, wallet_handle, identity_trustee1, assert get_nym_response -@pytest.mark.asyncio -async def test_send_attrib_request_works_without_signature(pool_handle, identity_my): - (my_did, _) = identity_my - - attrib_request = await ledger.build_attrib_request(my_did, my_did, None, - "{\"endpoint\":{\"ha\":\"127.0.0.1:5555\"}}", None) - response = await ledger.submit_request(pool_handle, attrib_request) - assert json.loads(response)['op'] == 'REQNACK' - - @pytest.mark.asyncio async def test_attrib_requests_works_for_raw_value(pool_handle, wallet_handle, identity_trustee1, identity_my): (trustee_did, _) = identity_trustee1 @@ -115,56 +85,6 @@ async def test_attrib_requests_works_for_raw_value(pool_handle, wallet_handle, i assert get_attrib_response['result']['data'] == raw -@pytest.mark.asyncio -async def test_attrib_requests_works_for_hash_value(pool_handle, wallet_handle, identity_trustee1, identity_my): - (trustee_did, _) = identity_trustee1 - (my_did, my_ver_key) = identity_my - - nym_request = await ledger.build_nym_request(trustee_did, my_did, my_ver_key, None, None) - await ledger.sign_and_submit_request(pool_handle, wallet_handle, trustee_did, nym_request) - - xhash = "83d907821df1c87db829e96569a11f6fc2e7880acba5e43d07ab786959e13bd3" - attrib_request = await ledger.build_attrib_request(my_did, my_did, xhash, None, None) - await ledger.sign_and_submit_request(pool_handle, wallet_handle, my_did, attrib_request) - - get_attrib_request = await ledger.build_get_attrib_request(my_did, my_did, None, xhash, None) - get_attrib_response = json.loads( - await ensure_previous_request_applied(pool_handle, get_attrib_request, - lambda response: response['result']['data'] is not None)) - assert get_attrib_response['result']['data'] == xhash - - -@pytest.mark.asyncio -async def test_attrib_requests_works_for_enc_value(pool_handle, wallet_handle, identity_trustee1, identity_my): - (trustee_did, _) = identity_trustee1 - (my_did, my_ver_key) = identity_my - - nym_request = await ledger.build_nym_request(trustee_did, my_did, my_ver_key, None, None) - await ledger.sign_and_submit_request(pool_handle, wallet_handle, trustee_did, nym_request) - - enc = "aa3f41f619aa7e5e6b6d0de555e05331787f9bf9aa672b94b57ab65b9b66c3ea960b18a98e3834b1fc6cebf49f463b81fd6e3181" - attrib_request = await ledger.build_attrib_request(my_did, my_did, None, None, enc) - await ledger.sign_and_submit_request(pool_handle, wallet_handle, my_did, attrib_request) - - get_attrib_request = await ledger.build_get_attrib_request(my_did, my_did, None, None, enc) - get_attrib_response = json.loads( - await ensure_previous_request_applied(pool_handle, get_attrib_request, - lambda response: response['result']['data'] is not None)) - assert get_attrib_response['result']['data'] == enc - - -@pytest.mark.asyncio -async def test_send_schema_request_works_without_signature(pool_handle, identity_my): - (my_did, _) = identity_my - (schema_id, schema_json) = \ - await anoncreds.issuer_create_schema(my_did, "gvt", "1.0", json.dumps(["name", "age", "sex", "height"])) - - schema_request = await ledger.build_schema_request(my_did, schema_json) - - response = await ledger.submit_request(pool_handle, schema_request) - assert json.loads(response)['op'] == 'REQNACK' - - @pytest.mark.asyncio async def test_schema_requests_works(pool_handle, wallet_handle, identity_my): (my_did, my_ver_key) = identity_my @@ -181,183 +101,6 @@ async def test_schema_requests_works(pool_handle, wallet_handle, identity_my): await ledger.parse_get_schema_response(get_schema_response) -@pytest.mark.asyncio -async def test_send_node_request_works_without_signature(pool_handle, identity_my): - (my_did, _) = identity_my - - node_data = { - "node_ip": "10.0.0.100", - "node_port": 9710, - "client_ip": "10.0.0.100", - "client_port": 9709, - "alias": "Node5", - "services": ["VALIDATOR"], - "blskey": "CnEDk9HrMnmiHXEV1WFgbVCRteYnPqsJwrTdcZaNhFVW" - } - - node_request = await ledger.build_node_request(my_did, my_did, json.dumps(node_data)) - - response = await ledger.submit_request(pool_handle, node_request) - assert json.loads(response)['op'] == 'REQNACK' - - -@pytest.mark.asyncio -async def test_cred_def_requests_works(pool_handle, wallet_handle, identity_my): - (my_did, my_ver_key) = identity_my - - (schema_id, schema_json) = \ - await anoncreds.issuer_create_schema(my_did, "gvt", "1.0", json.dumps(["name", "age", "sex", "height"])) - - schema_request = await ledger.build_schema_request(my_did, schema_json) - await ledger.sign_and_submit_request(pool_handle, wallet_handle, my_did, schema_request) - - get_schema_request = await ledger.build_get_schema_request(my_did, schema_id) - get_schema_response = \ - await ensure_previous_request_applied(pool_handle, get_schema_request, - lambda response: response['result']['seqNo'] is not None) - (schema_id, schema_json) = await ledger.parse_get_schema_response(get_schema_response) - - (cred_def_id, cred_def_json) = \ - await anoncreds.issuer_create_and_store_credential_def(wallet_handle, my_did, schema_json, "TAG", "CL", - json.dumps({"support_revocation": False})) - - cred_def_request = await ledger.build_cred_def_request(my_did, cred_def_json) - await ledger.sign_and_submit_request(pool_handle, wallet_handle, my_did, cred_def_request) - - get_cred_def_request = await ledger.build_get_cred_def_request(my_did, cred_def_id) - get_cred_def_response = \ - await ensure_previous_request_applied(pool_handle, get_cred_def_request, - lambda response: response['result']['seqNo'] is not None) - await ledger.parse_get_cred_def_response(get_cred_def_response) - - -@pytest.mark.asyncio -async def test_revoc_reg_def_requests_works(pool_handle, wallet_handle, identity_my, path_home): - (my_did, my_ver_key) = identity_my - - (schema_id, schema_json) = \ - await anoncreds.issuer_create_schema(my_did, "gvt", "1.0", json.dumps(["name", "age", "sex", "height"])) - schema_request = await ledger.build_schema_request(my_did, schema_json) - await ledger.sign_and_submit_request(pool_handle, wallet_handle, my_did, schema_request) - - get_schema_request = await ledger.build_get_schema_request(my_did, schema_id) - get_schema_response = \ - await ensure_previous_request_applied(pool_handle, get_schema_request, - lambda response: response['result']['seqNo'] is not None) - (schema_id, schema_json) = await ledger.parse_get_schema_response(get_schema_response) - - (cred_def_id, cred_def_json) = \ - await anoncreds.issuer_create_and_store_credential_def(wallet_handle, my_did, schema_json, "TAG", "CL", - json.dumps({"support_revocation": True})) - - cred_def_request = await ledger.build_cred_def_request(my_did, cred_def_json) - await ledger.sign_and_submit_request(pool_handle, wallet_handle, my_did, cred_def_request) - - tails_writer_config = json.dumps({'base_dir': str(path_home.joinpath("tails")), 'uri_pattern': ''}) - tails_writer = await blob_storage.open_writer('default', tails_writer_config) - - (rev_reg_def_id, rev_reg_def_json, _) = \ - await anoncreds.issuer_create_and_store_revoc_reg(wallet_handle, my_did, None, 'tag1', cred_def_id, - '{"max_cred_num": 5}', tails_writer) - - revoc_reg_request = await ledger.build_revoc_reg_def_request(my_did, rev_reg_def_json) - await ledger.sign_and_submit_request(pool_handle, wallet_handle, my_did, revoc_reg_request) - - get_revoc_reg_def_request = await ledger.build_get_revoc_reg_def_request(my_did, rev_reg_def_id) - get_revoc_reg_def_response = \ - await ensure_previous_request_applied(pool_handle, get_revoc_reg_def_request, - lambda response: response['result']['seqNo'] is not None) - await ledger.parse_get_revoc_reg_def_response(get_revoc_reg_def_response) - - -@pytest.mark.asyncio -async def test_revoc_reg_requests_works(pool_handle, wallet_handle, identity_my, path_home): - (my_did, my_ver_key) = identity_my - - (schema_id, schema_json) = \ - await anoncreds.issuer_create_schema(my_did, "gvt", "1.0", json.dumps(["name", "age", "sex", "height"])) - schema_request = await ledger.build_schema_request(my_did, schema_json) - await ledger.sign_and_submit_request(pool_handle, wallet_handle, my_did, schema_request) - - get_schema_request = await ledger.build_get_schema_request(my_did, schema_id) - get_schema_response = \ - await ensure_previous_request_applied(pool_handle, get_schema_request, - lambda response: response['result']['seqNo'] is not None) - (schema_id, schema_json) = await ledger.parse_get_schema_response(get_schema_response) - - (cred_def_id, cred_def_json) = \ - await anoncreds.issuer_create_and_store_credential_def(wallet_handle, my_did, schema_json, "TAG", "CL", - json.dumps({"support_revocation": True})) - - cred_def_request = await ledger.build_cred_def_request(my_did, cred_def_json) - await ledger.sign_and_submit_request(pool_handle, wallet_handle, my_did, cred_def_request) - - tails_writer_config = json.dumps({'base_dir': str(path_home.joinpath("tails")), 'uri_pattern': ''}) - tails_writer = await blob_storage.open_writer('default', tails_writer_config) - - (rev_reg_def_id, rev_reg_def_json, rev_reg_entry_json) = \ - await anoncreds.issuer_create_and_store_revoc_reg(wallet_handle, my_did, None, 'tag1', cred_def_id, - '{"max_cred_num": 5}', tails_writer) - - revoc_reg_request = await ledger.build_revoc_reg_def_request(my_did, rev_reg_def_json) - await ledger.sign_and_submit_request(pool_handle, wallet_handle, my_did, revoc_reg_request) - - revoc_reg_entry_request = \ - await ledger.build_revoc_reg_entry_request(my_did, rev_reg_def_id, "CL_ACCUM", rev_reg_entry_json) - await ledger.sign_and_submit_request(pool_handle, wallet_handle, my_did, revoc_reg_entry_request) - - timestamp = int(time.time()) + 100 - get_revoc_reg_request = await ledger.build_get_revoc_reg_request(my_did, rev_reg_def_id, timestamp) - get_revoc_reg_response = \ - await ensure_previous_request_applied(pool_handle, get_revoc_reg_request, - lambda response: response['result']['seqNo'] is not None) - await ledger.parse_get_revoc_reg_response(get_revoc_reg_response) - - -@pytest.mark.asyncio -async def test_revoc_reg_delta_requests_works(pool_handle, wallet_handle, identity_my, path_home): - (my_did, my_ver_key) = identity_my - - (schema_id, schema_json) = \ - await anoncreds.issuer_create_schema(my_did, "gvt", "1.0", json.dumps(["name", "age", "sex", "height"])) - schema_request = await ledger.build_schema_request(my_did, schema_json) - schema_response = await ledger.sign_and_submit_request(pool_handle, wallet_handle, my_did, schema_request) - - get_schema_request = await ledger.build_get_schema_request(my_did, schema_id) - get_schema_response = \ - await ensure_previous_request_applied(pool_handle, get_schema_request, - lambda response: response['result']['seqNo'] is not None) - (schema_id, schema_json) = await ledger.parse_get_schema_response(get_schema_response) - - (cred_def_id, cred_def_json) = \ - await anoncreds.issuer_create_and_store_credential_def(wallet_handle, my_did, schema_json, "TAG", "CL", - json.dumps({"support_revocation": True})) - - cred_def_request = await ledger.build_cred_def_request(my_did, cred_def_json) - await ledger.sign_and_submit_request(pool_handle, wallet_handle, my_did, cred_def_request) - - tails_writer_config = json.dumps({'base_dir': str(path_home.joinpath("tails")), 'uri_pattern': ''}) - tails_writer = await blob_storage.open_writer('default', tails_writer_config) - - (rev_reg_def_id, rev_reg_def_json, rev_reg_entry_json) = \ - await anoncreds.issuer_create_and_store_revoc_reg(wallet_handle, my_did, None, 'tag1', cred_def_id, - '{"max_cred_num": 5}', tails_writer) - - revoc_reg_request = await ledger.build_revoc_reg_def_request(my_did, rev_reg_def_json) - await ledger.sign_and_submit_request(pool_handle, wallet_handle, my_did, revoc_reg_request) - - revoc_reg_entry_request = \ - await ledger.build_revoc_reg_entry_request(my_did, rev_reg_def_id, "CL_ACCUM", rev_reg_entry_json) - await ledger.sign_and_submit_request(pool_handle, wallet_handle, my_did, revoc_reg_entry_request) - - to = int(time.time()) + 100 - get_revoc_reg_delta_request = await ledger.build_get_revoc_reg_delta_request(my_did, rev_reg_def_id, None, to) - get_revoc_reg_delta_response = \ - await ensure_previous_request_applied(pool_handle, get_revoc_reg_delta_request, - lambda response: response['result']['seqNo'] is not None) - await ledger.parse_get_revoc_reg_delta_response(get_revoc_reg_delta_response) - - @pytest.mark.asyncio async def test_get_txn_request_works(pool_handle, wallet_handle, identity_my): (my_did, _) = identity_my @@ -380,23 +123,6 @@ async def test_get_txn_request_works(pool_handle, wallet_handle, identity_my): assert schema['version'] == received_schema['version'] -@pytest.mark.asyncio -async def test_get_txn_request_works_for_invalid_seq_no(pool_handle, wallet_handle, identity_my): - (my_did, _) = identity_my - - (schema_id, schema_json) = \ - await anoncreds.issuer_create_schema(my_did, "gvt", "1.0", json.dumps(["name", "age", "sex", "height"])) - schema_request = await ledger.build_schema_request(my_did, schema_json) - schema_response = await ledger.sign_and_submit_request(pool_handle, wallet_handle, my_did, schema_request) - schema_id = json.loads(schema_response)["result"]['txnMetadata']["seqNo"] - - seq_no = schema_id + 1 - - get_txn_request = await ledger.build_get_txn_request(my_did, None, seq_no) - get_txn_response = json.loads(await ledger.submit_request(pool_handle, get_txn_request)) - assert not get_txn_response['result']['data'] - - @pytest.mark.asyncio async def test_pool_config_request_works(pool_handle, wallet_handle, identity_trustee1): (did_trustee, _) = identity_trustee1 diff --git a/wrappers/python/tests/non_secrets/test_add_wallet_record.py b/wrappers/python/tests/non_secrets/test_add_wallet_record.py index 0c968026d0..1de087e7cf 100644 --- a/wrappers/python/tests/non_secrets/test_add_wallet_record.py +++ b/wrappers/python/tests/non_secrets/test_add_wallet_record.py @@ -9,13 +9,6 @@ async def test_add_wallet_record_works(wallet_handle): await non_secrets.add_wallet_record(wallet_handle, type_, id1, value1, tags1) -@pytest.mark.asyncio -async def test_add_wallet_record_works_for_different_ids(wallet_handle): - await non_secrets.add_wallet_record(wallet_handle, type_, id1, value1, tags1) - await non_secrets.add_wallet_record(wallet_handle, type_, id2, value1, tags1) - await non_secrets.add_wallet_record(wallet_handle, type_, id3, value1, tags1) - - @pytest.mark.asyncio async def test_add_wallet_record_works_for_duplicate(wallet_handle): await non_secrets.add_wallet_record(wallet_handle, type_, id1, value1, tags1) diff --git a/wrappers/python/tests/non_secrets/test_add_wallet_record_tags.py b/wrappers/python/tests/non_secrets/test_add_wallet_record_tags.py index b07ba07da7..af7b51794f 100644 --- a/wrappers/python/tests/non_secrets/test_add_wallet_record_tags.py +++ b/wrappers/python/tests/non_secrets/test_add_wallet_record_tags.py @@ -13,22 +13,6 @@ async def test_add_wallet_record_tags_works(wallet_handle): await check_record_field(wallet_handle, "tags", tags1) -@pytest.mark.asyncio -async def test_add_wallet_record_tags_works_for_twice(wallet_handle): - await non_secrets.add_wallet_record(wallet_handle, type_, id1, value1, tags_empty) - await check_record_field(wallet_handle, "tags", tags_empty) - - tags1 = '{"tagName1": "str1"}' - await non_secrets.add_wallet_record_tags(wallet_handle, type_, id1, tags1) - await check_record_field(wallet_handle, "tags", tags1) - - tags2 = '{"tagName2": "str2"}' - await non_secrets.add_wallet_record_tags(wallet_handle, type_, id1, tags2) - - expected_tags = '{"tagName1": "str1", "tagName2": "str2"}' - await check_record_field(wallet_handle, "tags", expected_tags) - - @pytest.mark.asyncio async def test_add_wallet_record_tags_works_for_not_found_record(wallet_handle): with pytest.raises(error.WalletItemNotFound): diff --git a/wrappers/python/tests/non_secrets/test_delete_wallet_record.py b/wrappers/python/tests/non_secrets/test_delete_wallet_record.py index 4ce55b760e..b6983a7cf4 100644 --- a/wrappers/python/tests/non_secrets/test_delete_wallet_record.py +++ b/wrappers/python/tests/non_secrets/test_delete_wallet_record.py @@ -11,14 +11,6 @@ async def test_delete_wallet_record_works(wallet_handle): with pytest.raises(error.WalletItemNotFound): await non_secrets.get_wallet_record(wallet_handle, type_, id1, "{}") -@pytest.mark.asyncio -async def test_delete_wallet_record_works_for_twice(wallet_handle): - await non_secrets.add_wallet_record(wallet_handle, type_, id1, value1, tags1) - await non_secrets.delete_wallet_record(wallet_handle, type_, id1) - - with pytest.raises(error.WalletItemNotFound): - await non_secrets.delete_wallet_record(wallet_handle, type_, id1) - @pytest.mark.asyncio async def test_delete_wallet_record_works_for_not_found_record(wallet_handle): diff --git a/wrappers/python/tests/non_secrets/test_delete_wallet_record_tags.py b/wrappers/python/tests/non_secrets/test_delete_wallet_record_tags.py index a11700537e..dcbeb0b422 100644 --- a/wrappers/python/tests/non_secrets/test_delete_wallet_record_tags.py +++ b/wrappers/python/tests/non_secrets/test_delete_wallet_record_tags.py @@ -14,15 +14,6 @@ async def test_delete_wallet_record_tags_works(wallet_handle): await check_record_field(wallet_handle, "tags", expected_tags) -@pytest.mark.asyncio -async def test_delete_wallet_record_tags_works_for_delete_all(wallet_handle): - await non_secrets.add_wallet_record(wallet_handle, type_, id1, value1, tags1) - await check_record_field(wallet_handle, "tags", tags1) - - await non_secrets.delete_wallet_record_tags(wallet_handle, type_, id1, '["tagName1", "tagName2", "tagName3"]') - await check_record_field(wallet_handle, "tags", tags_empty) - - @pytest.mark.asyncio async def test_delete_wallet_record_tags_works_for_not_found_record(wallet_handle): with pytest.raises(error.WalletItemNotFound): diff --git a/wrappers/python/tests/non_secrets/test_update_wallet_record_tags.py b/wrappers/python/tests/non_secrets/test_update_wallet_record_tags.py index c304452ee2..13d99cde20 100644 --- a/wrappers/python/tests/non_secrets/test_update_wallet_record_tags.py +++ b/wrappers/python/tests/non_secrets/test_update_wallet_record_tags.py @@ -13,18 +13,6 @@ async def test_update_wallet_record_tags_works(wallet_handle): await check_record_field(wallet_handle, "tags", tags1) -@pytest.mark.asyncio -async def test_update_wallet_record_tags_works_for_twice(wallet_handle): - await non_secrets.add_wallet_record(wallet_handle, type_, id1, value1, tags_empty) - await check_record_field(wallet_handle, "tags", tags_empty) - - await non_secrets.update_wallet_record_tags(wallet_handle, type_, id1, tags1) - await check_record_field(wallet_handle, "tags", tags1) - - await non_secrets.update_wallet_record_tags(wallet_handle, type_, id1, tags2) - await check_record_field(wallet_handle, "tags", tags2) - - @pytest.mark.asyncio async def test_update_wallet_record_tags_works_for_not_found_record(wallet_handle): with pytest.raises(error.WalletItemNotFound): diff --git a/wrappers/python/tests/non_secrets/test_update_wallet_record_value.py b/wrappers/python/tests/non_secrets/test_update_wallet_record_value.py index fd3946129f..047e1ae33c 100644 --- a/wrappers/python/tests/non_secrets/test_update_wallet_record_value.py +++ b/wrappers/python/tests/non_secrets/test_update_wallet_record_value.py @@ -13,18 +13,6 @@ async def test_update_wallet_record_value_works(wallet_handle): await check_record_field(wallet_handle, "value", value2) -@pytest.mark.asyncio -async def test_update_wallet_record_value_works_for_twice(wallet_handle): - await non_secrets.add_wallet_record(wallet_handle, type_, id1, value1, tags_empty) - await check_record_field(wallet_handle, "value", value1) - - await non_secrets.update_wallet_record_value(wallet_handle, type_, id1, value2) - await check_record_field(wallet_handle, "value", value2) - - await non_secrets.update_wallet_record_value(wallet_handle, type_, id1, value3) - await check_record_field(wallet_handle, "value", value3) - - @pytest.mark.asyncio async def test_update_wallet_record_value_works_for_not_found_record(wallet_handle): with pytest.raises(error.WalletItemNotFound): diff --git a/wrappers/python/tests/pairwise/test_create_pairwise.py b/wrappers/python/tests/pairwise/test_create_pairwise.py index 1f029a4ab6..0fe8804c3c 100644 --- a/wrappers/python/tests/pairwise/test_create_pairwise.py +++ b/wrappers/python/tests/pairwise/test_create_pairwise.py @@ -1,7 +1,6 @@ import pytest -import json -from indy import did, error, pairwise +from indy import error, pairwise UNKNOWN_DID = 'NcYxiDXkpYi6ov5FcYDi1e' @@ -13,32 +12,8 @@ async def test_create_pairwise_works(wallet_handle, identity_my2, identity_trust await pairwise.create_pairwise(wallet_handle, their_did, my_did, metadata) -@pytest.mark.asyncio -async def test_create_pairwise_works_for_empty_metadata(wallet_handle, identity_my2, identity_trustee1): - (my_did, _) = identity_my2 - (their_did, _) = identity_trustee1 - await pairwise.create_pairwise(wallet_handle, their_did, my_did, None) - - @pytest.mark.asyncio async def test_create_pairwise_works_for_not_found_my_did(wallet_handle, identity_trustee1): (their_did, _) = identity_trustee1 with pytest.raises(error.WalletItemNotFound): - await pairwise.create_pairwise(wallet_handle, their_did, UNKNOWN_DID, None) - - -@pytest.mark.asyncio -async def test_create_pairwise_works_for_not_found_their_did(wallet_handle, identity_trustee1): - (my_did, _) = identity_trustee1 - with pytest.raises(error.WalletItemNotFound): - await pairwise.create_pairwise(wallet_handle, UNKNOWN_DID, my_did, None) - - -@pytest.mark.asyncio -async def test_create_pairwise_works_for_invalid_handle(wallet_handle, identity_my2, identity_trustee1): - (my_did, _) = identity_my2 - (their_did, _) = identity_trustee1 - - with pytest.raises(error.WalletInvalidHandle): - invalid_wallet_handle = wallet_handle + 1 - await pairwise.create_pairwise(invalid_wallet_handle, their_did, my_did, None) + await pairwise.create_pairwise(wallet_handle, their_did, UNKNOWN_DID, None) \ No newline at end of file diff --git a/wrappers/python/tests/pairwise/test_get_pairwise.py b/wrappers/python/tests/pairwise/test_get_pairwise.py index c293f28d99..d732853bcc 100644 --- a/wrappers/python/tests/pairwise/test_get_pairwise.py +++ b/wrappers/python/tests/pairwise/test_get_pairwise.py @@ -1,7 +1,7 @@ import pytest import json -from indy import did, error, pairwise +from indy import error, pairwise @pytest.mark.asyncio @@ -29,14 +29,3 @@ async def test_get_pairwise_works_for_not_created_pairwise(wallet_handle, identi with pytest.raises(error.WalletItemNotFound): await pairwise.get_pairwise(wallet_handle, their_did) - - -@pytest.mark.asyncio -async def test_get_pairwise_works_for_invalid_handle(wallet_handle, identity_my2, identity_trustee1): - (my_did, _) = identity_my2 - (their_did, _) = identity_trustee1 - await pairwise.create_pairwise(wallet_handle, their_did, my_did, None) - - with pytest.raises(error.WalletInvalidHandle): - invalid_wallet_handle = wallet_handle + 1 - await pairwise.get_pairwise(invalid_wallet_handle, their_did) diff --git a/wrappers/python/tests/pairwise/test_list_pairwise.py b/wrappers/python/tests/pairwise/test_list_pairwise.py index 8e026a55eb..ecb01b1fa1 100644 --- a/wrappers/python/tests/pairwise/test_list_pairwise.py +++ b/wrappers/python/tests/pairwise/test_list_pairwise.py @@ -1,7 +1,7 @@ import pytest import json -from indy import error, pairwise +from indy import pairwise @pytest.mark.asyncio @@ -19,14 +19,3 @@ async def test_list_pairwise_works(wallet_handle, identity_my2, identity_trustee async def test_list_pairwise_works_for_empty_result(wallet_handle): list_pairwise = json.loads(await pairwise.list_pairwise(wallet_handle)) assert 0 == len(list_pairwise) - - -@pytest.mark.asyncio -async def test_list_pairwise_works_for_invalid_handle(wallet_handle, identity_my2, identity_trustee1): - (my_did, _) = identity_my2 - (their_did, _) = identity_trustee1 - await pairwise.create_pairwise(wallet_handle, their_did, my_did, None) - - with pytest.raises(error.WalletInvalidHandle): - invalid_wallet_handle = wallet_handle + 1 - await pairwise.list_pairwise(invalid_wallet_handle) diff --git a/wrappers/python/tests/pairwise/test_pairwise_exists.py b/wrappers/python/tests/pairwise/test_pairwise_exists.py index 982e378936..4a115565aa 100644 --- a/wrappers/python/tests/pairwise/test_pairwise_exists.py +++ b/wrappers/python/tests/pairwise/test_pairwise_exists.py @@ -1,6 +1,6 @@ import pytest -from indy import pairwise, error +from indy import pairwise @pytest.mark.asyncio @@ -14,15 +14,4 @@ async def test_is_pairwise_exists_works(wallet_handle, identity_my2, identity_tr @pytest.mark.asyncio async def test_is_pairwise_exists_works_for_not_created(wallet_handle, identity_my2, identity_trustee1): (their_did, _) = identity_trustee1 - assert not await pairwise.is_pairwise_exists(wallet_handle, their_did) - - -@pytest.mark.asyncio -async def test_is_pairwise_exists_works_for_invalid_handle(wallet_handle, identity_my2, identity_trustee1): - (my_did, _) = identity_my2 - (their_did, _) = identity_trustee1 - await pairwise.create_pairwise(wallet_handle, their_did, my_did, None) - - with pytest.raises(error.WalletInvalidHandle): - invalid_wallet_handle = wallet_handle + 1 - await pairwise.is_pairwise_exists(invalid_wallet_handle, their_did) + assert not await pairwise.is_pairwise_exists(wallet_handle, their_did) \ No newline at end of file diff --git a/wrappers/python/tests/pairwise/test_set_pairwise_metadata.py b/wrappers/python/tests/pairwise/test_set_pairwise_metadata.py index 071a5ff5b1..18c5d0100c 100644 --- a/wrappers/python/tests/pairwise/test_set_pairwise_metadata.py +++ b/wrappers/python/tests/pairwise/test_set_pairwise_metadata.py @@ -19,34 +19,8 @@ async def test_set_pairwise_metadata_works(wallet_handle, identity_my2, identity assert {'my_did': my_did, 'metadata': metadata} == json.loads(pairwise_with_metadata) -@pytest.mark.asyncio -async def test_set_pairwise_metadata_works_for_reset(wallet_handle, identity_my2, identity_trustee1, metadata): - (my_did, _) = identity_my2 - (their_did, _) = identity_trustee1 - - await pairwise.create_pairwise(wallet_handle, their_did, my_did, metadata) - pairwise_with_metadata = await pairwise.get_pairwise(wallet_handle, their_did) - assert {'my_did': my_did, 'metadata': metadata} == json.loads(pairwise_with_metadata) - - await pairwise.set_pairwise_metadata(wallet_handle, their_did, None) - pairwise_without_metadata = await pairwise.get_pairwise(wallet_handle, their_did) - assert {'my_did': my_did} == json.loads(pairwise_without_metadata) - assert pairwise_without_metadata != pairwise_with_metadata - - @pytest.mark.asyncio async def test_set_pairwise_metadata_works_for_not_created_pairwise(wallet_handle, identity_trustee1, metadata): (their_did, _) = identity_trustee1 with pytest.raises(error.WalletItemNotFound): - await pairwise.set_pairwise_metadata(wallet_handle, their_did, metadata) - - -@pytest.mark.asyncio -async def test_set_pairwise_metadata_works_for_invalid_handle(wallet_handle, identity_my2, identity_trustee1, metadata): - (my_did, _) = identity_my2 - (their_did, _) = identity_trustee1 - await pairwise.create_pairwise(wallet_handle, their_did, my_did, None) - - with pytest.raises(error.WalletInvalidHandle): - invalid_wallet_handle = wallet_handle + 1 - await pairwise.set_pairwise_metadata(invalid_wallet_handle, their_did, metadata) + await pairwise.set_pairwise_metadata(wallet_handle, their_did, metadata) \ No newline at end of file diff --git a/wrappers/python/tests/payment/test_add_request_fees.py b/wrappers/python/tests/payment/test_add_request_fees.py index 601782388c..a856938bb1 100644 --- a/wrappers/python/tests/payment/test_add_request_fees.py +++ b/wrappers/python/tests/payment/test_add_request_fees.py @@ -19,10 +19,4 @@ async def test_add_request_fees_works_for_empty_inputs(wallet_handle, did_truste @pytest.mark.asyncio async def test_add_request_fees_works_for_several_methods(wallet_handle, did_trustee): with pytest.raises(error.PaymentIncompatibleMethodsError): - await payment.add_request_fees(wallet_handle, did_trustee, empty_object, incompatible_inputs, empty_array, None) - - -@pytest.mark.asyncio -async def test_add_request_fees_works_for_invalid_input(wallet_handle, did_trustee): - with pytest.raises(error.CommonInvalidStructure): - await payment.add_request_fees(wallet_handle, did_trustee, empty_object, invalid_inputs, empty_array, None) + await payment.add_request_fees(wallet_handle, did_trustee, empty_object, incompatible_inputs, empty_array, None) \ No newline at end of file diff --git a/wrappers/python/tests/pool/test_close_pool_ledger.py b/wrappers/python/tests/pool/test_close_pool_ledger.py index 769a5eb0a6..5da4465314 100644 --- a/wrappers/python/tests/pool/test_close_pool_ledger.py +++ b/wrappers/python/tests/pool/test_close_pool_ledger.py @@ -1,33 +1,10 @@ import pytest -from indy import pool, error +from indy import pool # noinspection PyUnusedLocal @pytest.mark.asyncio @pytest.mark.parametrize("pool_handle_cleanup", [False]) async def test_close_pool_ledger_works(pool_handle, pool_handle_cleanup): - await pool.close_pool_ledger(pool_handle) - - -# noinspection PyUnusedLocal -@pytest.mark.asyncio -@pytest.mark.parametrize("pool_handle_cleanup", [False]) -async def test_close_pool_ledger_works_for_twice(pool_handle, pool_handle_cleanup): - await pool.close_pool_ledger(pool_handle) - - with pytest.raises(error.PoolLedgerInvalidPoolHandle): - await pool.close_pool_ledger(pool_handle) - - - -# noinspection PyUnusedLocal -@pytest.mark.asyncio -@pytest.mark.parametrize("pool_handle_cleanup", [False]) -async def test_close_pool_ledger_works_for_reopen_after_close(pool_name, pool_config, pool_handle, pool_handle_cleanup): - await pool.close_pool_ledger(pool_handle) - - pool_handle = await pool.open_pool_ledger(pool_name, pool_config) - assert pool_handle is not None - - await pool.close_pool_ledger(pool_handle) + await pool.close_pool_ledger(pool_handle) \ No newline at end of file diff --git a/wrappers/python/tests/wallet/test_open_wallet.py b/wrappers/python/tests/wallet/test_open_wallet.py index 67cd278461..b6023145df 100644 --- a/wrappers/python/tests/wallet/test_open_wallet.py +++ b/wrappers/python/tests/wallet/test_open_wallet.py @@ -24,13 +24,3 @@ async def test_open_wallet_works_for_twice(wallet_handle, wallet_config, credent async def test_open_wallet_works_for_missed_key(xwallet, wallet_config): with pytest.raises(error.CommonInvalidStructure): await wallet.open_wallet(wallet_config, "{}") - - -@pytest.mark.asyncio -async def test_open_wallet_works_for_changing_credentials(wallet_config): - await wallet.create_wallet(wallet_config, '{"key":"key"}') - handle = await wallet.open_wallet(wallet_config, '{"key":"key", "rekey":"other_key"}') - await wallet.close_wallet(handle) - - handle = await wallet.open_wallet(wallet_config, '{"key":"other_key"}') - await wallet.close_wallet(handle) From 0dd7b2084986af5ba18375bc5d0c8824794ae702 Mon Sep 17 00:00:00 2001 From: Nikita Khateev Date: Mon, 19 Aug 2019 12:36:12 +0300 Subject: [PATCH 262/320] IS-1316 First stage of integration Signed-off-by: Nikita Khateev --- libindy/src/services/pool/state_proof/mod.rs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/libindy/src/services/pool/state_proof/mod.rs b/libindy/src/services/pool/state_proof/mod.rs index 3af9f7da06..f79c0f05af 100644 --- a/libindy/src/services/pool/state_proof/mod.rs +++ b/libindy/src/services/pool/state_proof/mod.rs @@ -80,7 +80,9 @@ pub fn verify_parsed_sp(parsed_sps: Vec, gen: &Generator) -> bool { for parsed_sp in parsed_sps { if parsed_sp.multi_signature["value"]["state_root_hash"].as_str().ne( + &Some(&parsed_sp.root_hash)) && parsed_sp.multi_signature["value"]["txn_root_hash"].as_str().ne( &Some(&parsed_sp.root_hash)) { + error!("Given signature is not for current root hash, aborting"); return false; } @@ -538,6 +540,8 @@ fn _verify_merkle_tree(proof_nodes: &[u8], root_hash: &[u8], kvs: &[(String, Opt trace!("_verify_merkle_tree >> hashes: {:?}", hashes); let (key, value) = &kvs[0]; + let key = unwrap_or_return!(base64::decode(&key), false); + let key = unwrap_or_return!(std::str::from_utf8(&key), false); let seq_no = match key.parse::() { Ok(num) => num, Err(err) => { @@ -556,14 +560,18 @@ fn _verify_merkle_tree(proof_nodes: &[u8], root_hash: &[u8], kvs: &[(String, Opt let hashes_with_turns = hashes.iter().zip(turns).collect::>(); - let _value = match value{ + let value = match value{ Some(val) => val, None => {return false;} }; - trace!("Value to hash: {}", _value); + trace!("Value to hash: {}", value); - let mut hash = match Hash::hash_leaf(&_value) { + let value = unwrap_or_return!(serde_json::from_str::(&value), false); + trace!("serde json success"); + let value = unwrap_or_return!(rmp_serde::to_vec(&value), false); + trace!("rmp serde success"); + let mut hash = match Hash::hash_leaf(&value) { Ok(hash) => hash, Err(err) => { error!("Error while hashing: {:?}", err); From 1a688ecab06c4adc4f403862f7104a1fe79a4add Mon Sep 17 00:00:00 2001 From: "artem.ivanov" Date: Mon, 19 Aug 2019 13:59:23 +0300 Subject: [PATCH 263/320] IS-1352: CLI: support number nodes to send read request Signed-off-by: artem.ivanov --- cli/src/commands/pool.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cli/src/commands/pool.rs b/cli/src/commands/pool.rs index 505bc2bd0c..a8eff38685 100644 --- a/cli/src/commands/pool.rs +++ b/cli/src/commands/pool.rs @@ -82,6 +82,7 @@ pub mod connect_command { .add_optional_param("timeout", "Timeout for network request (in sec)") .add_optional_param("extended-timeout", "Extended timeout for network request (in sec)") .add_optional_param("pre-ordered-nodes", "Names of nodes which will have a priority during request sending") + .add_optional_param("number-read-nodes", "The number of nodes to send read requests (2 by default)") .add_example("pool connect pool1") .add_example("pool connect pool1 protocol-version=2") .add_example("pool connect pool1 protocol-version=2 timeout=100") @@ -97,12 +98,14 @@ pub mod connect_command { let timeout = get_opt_number_param::("timeout", params).map_err(error_err!())?; let extended_timeout = get_opt_number_param::("extended-timeout", params).map_err(error_err!())?; let pre_ordered_nodes = get_opt_str_array_param("pre-ordered-nodes", params).map_err(error_err!())?; + let number_read_nodes = get_opt_number_param::("number-read-nodes", params).map_err(error_err!())?; let config = { let mut json = JSONMap::new(); update_json_map_opt_key!(json, "timeout", timeout); update_json_map_opt_key!(json, "extended_timeout", extended_timeout); update_json_map_opt_key!(json, "preordered_nodes", pre_ordered_nodes); + update_json_map_opt_key!(json, "number_read_nodes", number_read_nodes); JSONValue::from(json).to_string() }; From 6be001493910527b35e16916a5f4b5fe02615e86 Mon Sep 17 00:00:00 2001 From: "artem.ivanov" Date: Mon, 19 Aug 2019 11:44:11 +0300 Subject: [PATCH 264/320] CI: run wrappers tests on the same node Signed-off-by: artem.ivanov --- Jenkinsfile.ci | 39 ++++++++++++++++----------------------- 1 file changed, 16 insertions(+), 23 deletions(-) diff --git a/Jenkinsfile.ci b/Jenkinsfile.ci index f5e6fcbb47..a01a96ffde 100644 --- a/Jenkinsfile.ci +++ b/Jenkinsfile.ci @@ -381,17 +381,8 @@ def linuxTesting(file, env_name, network_name, full_testing) { } ] if (full_testing) { - jobs["${env_name}-nodejs-test"] = { - linuxModuleTesting(file, env_name, network_name, this.&linuxNodejsTesting) - } - jobs["${env_name}-java-test"] = { - linuxModuleTesting(file, env_name, network_name, this.&linuxJavaTesting) - } - jobs["${env_name}-python-test"] = { - linuxModuleTesting(file, env_name, network_name, this.&linuxPythonTesting) - } - jobs["${env_name}-rust-test"] = { - linuxModuleTesting(file, env_name, network_name, this.&linuxRustTesting) + jobs["${env_name}wrappers-test"] = { + linuxModuleTesting(file, env_name, network_name, this.&linuxIndyWrappersTesting) } jobs["${env_name}-cloud-agent-test"] = { linuxModuleTesting(file, env_name, network_name, this.&linuxCloudAgentTesting) @@ -415,18 +406,7 @@ def vcxTesting(file, env_name, network_name, full_testing) { waitUntil { libvcxBuildFinished[env_name] } - def jobs = [ - "${env_name}-vcx-nodejs-test": { - linuxModuleTesting(file, env_name, network_name, this.&linuxVcxNodejsTesting) - }, - "${env_name}-vcx-java-test" : { - linuxModuleTesting(file, env_name, network_name, this.&linuxVcxJavaTesting) - }, - "${env_name}-vcx-python-test": { - linuxModuleTesting(file, env_name, network_name, this.&linuxVcxPythonTesting) - } - ] - parallel(jobs) + linuxModuleTesting(file, env_name, network_name, this.&linuxVcxWrappersTesting) } }, ]) @@ -616,6 +596,19 @@ def linuxAndroidOnEmulatorTesting(env_name, network_name, testEnv) { } } +def linuxIndyWrappersTesting(env_name, network_name, testEnv) { + linuxJavaTesting(env_name, network_name, testEnv) + linuxPythonTesting(env_name, network_name, testEnv) + linuxNodejsTesting(env_name, network_name, testEnv) + linuxRustTesting(env_name, network_name, testEnv) +} + +def linuxVcxWrappersTesting(env_name, network_name, testEnv) { + linuxVcxNodejsTesting(env_name, network_name, testEnv) + linuxVcxJavaTesting(env_name, network_name, testEnv) + linuxVcxPythonTesting(env_name, network_name, testEnv) +} + def linuxJavaTesting(env_name, network_name, testEnv) { unstash name: "LibindyJavaSO${env_name}" dir('wrappers/java') { From 467a0b4079eb1a544f6b4d75bca2c922f2159ef8 Mon Sep 17 00:00:00 2001 From: "artem.ivanov" Date: Mon, 19 Aug 2019 17:00:03 +0300 Subject: [PATCH 265/320] IS-1319: Added check that encoded values from Libindy Proof [requested_proof][revealed_attrs] are equal to encoded values from Crypto Proof. Signed-off-by: artem.ivanov --- libindy/src/services/anoncreds/verifier.rs | 37 ++++++++++--- libindy/tests/anoncreds.rs | 61 +++++++++------------- 2 files changed, 55 insertions(+), 43 deletions(-) diff --git a/libindy/src/services/anoncreds/verifier.rs b/libindy/src/services/anoncreds/verifier.rs index aaacca3b1c..5db038a3c4 100644 --- a/libindy/src/services/anoncreds/verifier.rs +++ b/libindy/src/services/anoncreds/verifier.rs @@ -45,16 +45,14 @@ impl Verifier { let received_predicates: HashMap = Verifier::_received_predicates(&full_proof)?; let received_self_attested_attrs: HashSet = Verifier::_received_self_attested_attrs(&full_proof); - println!("received_revealed_attrs={:?}", &received_revealed_attrs); - println!("received_predicates={:?}", &received_predicates); - println!("received_self_attested_attrs={:?}", &received_self_attested_attrs); - Verifier::_compare_attr_from_proof_and_request(proof_req, &received_revealed_attrs, &received_unrevealed_attrs, &received_self_attested_attrs, &received_predicates)?; - println!("Requested attributes and predicates present"); + + Verifier::_verify_revealed_attributes(&proof_req, &full_proof)?; + Verifier::_verify_requested_restrictions(&proof_req, schemas, cred_defs, @@ -103,7 +101,6 @@ impl Verifier { } else { (None, None) }; let attrs_for_credential = Verifier::_get_revealed_attributes_for_credential(sub_proof_index, &full_proof.requested_proof, proof_req)?; - println!("revealed attrs_for_credential={:?}", &attrs_for_credential); let predicates_for_credential = Verifier::_get_predicates_for_credential(sub_proof_index, &full_proof.requested_proof, proof_req)?; let credential_schema = build_credential_schema(&schema.attr_names)?; @@ -303,6 +300,33 @@ impl Verifier { )) } + fn _verify_revealed_attribute_values(proof_req: &ProofRequest, + proof: &Proof) -> IndyResult<()> { + for (attr_referent, attr_info) in proof.requested_proof.revealed_attrs.iter() { + let reveal_attr_encoded = attr_info.encoded.to_string(); + let sub_proof_index = attr_info.sub_proof_index as usize; + + let attr_name = proof_req.requested_attributes.get(attr_referent.as_str()) + .as_ref() + .map(|attr_info| attr_info.name.as_str()) + .ok_or(IndyError::from_msg(IndyErrorKind::ProofRejected, format!("Attribute with referent \"{}\" not found in ProofRequest", attr_referent)))?; + + let crypto_proof_encoded = proof.proof.proofs + .get(sub_proof_index) + .ok_or(IndyError::from_msg(IndyErrorKind::ProofRejected, format!("CryptoProof not found by index \"{}\"", sub_proof_index)))? + .revealed_attrs()? + .get(attr_name) + .ok_or(IndyError::from_msg(IndyErrorKind::ProofRejected, format!("Attribute with name \"{}\" not found in CryptoProof", attr_name)))? + .to_string(); + + if reveal_attr_encoded != crypto_proof_encoded { + return Err(IndyError::from_msg(IndyErrorKind::ProofRejected, + format!("Encoded Values for \"{}\" are different in RequestedProof \"{}\" and CryptoProof \"{}\"", attr_name, reveal_attr_encoded, crypto_proof_encoded))); + } + } + Ok(()) + } + fn _verify_requested_restrictions(proof_req: &ProofRequest, schemas: &HashMap, cred_defs: &HashMap, @@ -326,7 +350,6 @@ impl Verifier { let op = parse_from_json( &build_wql_query(&info.name, &referent, &info.restrictions, None)? )?; - println!("Operator is {:?}", &op); let filter = Verifier::_gather_filter_info(&referent, &proof_attr_identifiers, schemas, cred_defs)?; diff --git a/libindy/tests/anoncreds.rs b/libindy/tests/anoncreds.rs index 9b358abaf1..d0df91390e 100644 --- a/libindy/tests/anoncreds.rs +++ b/libindy/tests/anoncreds.rs @@ -35,7 +35,7 @@ use indy::ErrorCode; use utils::constants::*; use utils::Setup; -use utils::domain::anoncreds::schema::{Schema}; +use utils::domain::anoncreds::schema::Schema; use utils::domain::anoncreds::credential_definition::CredentialDefinition; use utils::domain::anoncreds::credential::CredentialInfo; use utils::domain::anoncreds::credential_for_proof_request::{CredentialsForProofRequest, RequestedCredential}; @@ -2951,39 +2951,40 @@ mod high_cases { fn verifier_verify_proof_works_for_wrong_revealed_attr_value() { let proof_json = anoncreds::proof_json().replace(r#"name":"1139481716457488690172217916278103335"#, r#"name":"1111111111111111111111111111111111111"#); - let valid = anoncreds::verifier_verify_proof(&anoncreds::proof_request_attr(), - &proof_json, - &anoncreds::schemas_for_proof(), - &anoncreds::cred_defs_for_proof(), - "{}", - "{}").unwrap(); - assert!(!valid); + let res = anoncreds::verifier_verify_proof(&anoncreds::proof_request_attr(), + &proof_json, + &anoncreds::schemas_for_proof(), + &anoncreds::cred_defs_for_proof(), + "{}", + "{}"); + assert_code!(ErrorCode::AnoncredsProofRejected, res); } #[test] fn verifier_verify_proof_works_for_wrong_encoded() { let proof_json = anoncreds::proof_json().replace(r#"encoded":"1139481716457488690172217916278103335"#, r#"encoded":"1111111111111111111111111111111111111"#); - let valid = anoncreds::verifier_verify_proof(&anoncreds::proof_request_attr(), - &proof_json, - &anoncreds::schemas_for_proof(), - &anoncreds::cred_defs_for_proof(), - "{}", - "{}").unwrap(); - assert!(!valid); + let res = anoncreds::verifier_verify_proof(&anoncreds::proof_request_attr(), + &proof_json, + &anoncreds::schemas_for_proof(), + &anoncreds::cred_defs_for_proof(), + "{}", + "{}"); + assert_code!(ErrorCode::AnoncredsProofRejected, res); } #[test] + #[ignore] // TODO: Libindy doesn't aware about algorithm used for encoding of attribute values. We can do this check only on application level. fn verifier_verify_proof_works_for_wrong_raw() { - let proof_json = anoncreds::proof_json().replace(r#"encoded":"Alex"#, r#"encoded":"Bob"#); + let proof_json = anoncreds::proof_json().replace(r#"raw":"Alex"#, r#"raw":"Bob"#); - let valid = anoncreds::verifier_verify_proof(&anoncreds::proof_request_attr(), - &proof_json, - &anoncreds::schemas_for_proof(), - &anoncreds::cred_defs_for_proof(), - "{}", - "{}").unwrap(); - assert!(!valid); + let res = anoncreds::verifier_verify_proof(&anoncreds::proof_request_attr(), + &proof_json, + &anoncreds::schemas_for_proof(), + &anoncreds::cred_defs_for_proof(), + "{}", + "{}"); + assert_code!(ErrorCode::AnoncredsProofRejected, res); } } @@ -2999,7 +3000,6 @@ mod high_cases { "{}", "{}").unwrap(); assert!(valid); - } #[test] @@ -3083,7 +3083,6 @@ mod high_cases { #[test] fn verifier_verify_proof_success_for_valid_schema_id() { - let proof_req = json!({ "nonce":"123432421212", "name":"proof_req_1", @@ -3108,7 +3107,6 @@ mod high_cases { #[test] fn verifier_verify_proof_fails_for_missing_schema_id() { - let proof_req = json!({ "nonce":"123432421212", "name":"proof_req_1", @@ -3133,7 +3131,6 @@ mod high_cases { #[test] fn verifier_verify_proof_success_for_valid_schema_issuer_did() { - let proof_req = json!({ "nonce":"123432421212", "name":"proof_req_1", @@ -3158,7 +3155,6 @@ mod high_cases { #[test] fn verifier_verify_proof_fails_for_missing_schema_issuer_did() { - let proof_req = json!({ "nonce":"123432421212", "name":"proof_req_1", @@ -3183,7 +3179,6 @@ mod high_cases { #[test] fn verifier_verify_proof_success_for_valid_schema_name() { - let proof_req = json!({ "nonce":"123432421212", "name":"proof_req_1", @@ -3208,7 +3203,6 @@ mod high_cases { #[test] fn verifier_verify_proof_fails_for_missing_schema_name() { - let proof_req = json!({ "nonce":"123432421212", "name":"proof_req_1", @@ -3233,7 +3227,6 @@ mod high_cases { #[test] fn verifier_verify_proof_success_for_valid_schema_version() { - let proof_req = json!({ "nonce":"123432421212", "name":"proof_req_1", @@ -3258,7 +3251,6 @@ mod high_cases { #[test] fn verifier_verify_proof_fails_for_missing_schema_version() { - let proof_req = json!({ "nonce":"123432421212", "name":"proof_req_1", @@ -3283,7 +3275,6 @@ mod high_cases { #[test] fn verifier_verify_proof_success_for_valid_cred_def_id() { - let proof_req = json!({ "nonce":"123432421212", "name":"proof_req_1", @@ -3308,7 +3299,6 @@ mod high_cases { #[test] fn verifier_verify_proof_fails_for_missing_cred_def_id() { - let proof_req = json!({ "nonce":"123432421212", "name":"proof_req_1", @@ -3333,7 +3323,6 @@ mod high_cases { #[test] fn verifier_verify_proof_fails_for_unknown_restriction() { - let proof_req = json!({ "nonce":"123432421212", "name":"proof_req_1", @@ -3398,7 +3387,7 @@ mod high_cases { } } -#[cfg(not(feature="only_high_cases"))] +#[cfg(not(feature = "only_high_cases"))] mod medium_cases { use super::*; use std::collections::HashSet; From 4027031954c355a4af64b727e38528b179d85c3a Mon Sep 17 00:00:00 2001 From: Axel Nennker Date: Mon, 19 Aug 2019 16:12:45 +0200 Subject: [PATCH 266/320] update crates Signed-off-by: Axel Nennker --- libindy/Cargo.lock | 554 ++++++++++++++++++++++-------------- libindy/Cargo.toml | 44 +-- libindy/src/utils/logger.rs | 2 +- libindy/tests/crypto.rs | 2 +- 4 files changed, 366 insertions(+), 236 deletions(-) diff --git a/libindy/Cargo.lock b/libindy/Cargo.lock index f77e68fc01..0fda68f8c1 100644 --- a/libindy/Cargo.lock +++ b/libindy/Cargo.lock @@ -2,7 +2,7 @@ # It is not intended for manual editing. [[package]] name = "aho-corasick" -version = "0.7.4" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -25,16 +25,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "android_log-sys 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "argon2rs" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", - "scoped_threadpool 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -72,7 +63,7 @@ dependencies = [ "backtrace-sys 0.1.30 (registry+https://github.com/rust-lang/crates.io-index)", "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-demangle 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-demangle 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -87,11 +78,10 @@ dependencies = [ [[package]] name = "base64" -version = "0.6.0" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "safemem 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -107,14 +97,15 @@ dependencies = [ "byte-tools 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "crypto-mac 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "digest 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", - "opaque-debug 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "opaque-debug 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "blake2-rfc" -version = "0.2.18" +name = "blake2b_simd" +version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ + "arrayref 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", "arrayvec 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", "constant_time_eq 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -140,13 +131,13 @@ dependencies = [ [[package]] name = "bstr" -version = "0.2.2" +version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-automata 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.97 (registry+https://github.com/rust-lang/crates.io-index)", + "regex-automata 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -164,6 +155,15 @@ name = "byteorder" version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "c2-chacha" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "ppv-lite86 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "cast" version = "0.2.2" @@ -229,11 +229,11 @@ dependencies = [ "rand_xoshiro 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "rayon 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "rayon-core 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.97 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.97 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", "tinytemplate 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "walkdir 2.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "walkdir 2.2.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -251,21 +251,21 @@ name = "crossbeam-deque" version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "crossbeam-epoch 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-epoch 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "crossbeam-epoch" -version = "0.7.1" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "arrayvec 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "memoffset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "memoffset 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "scopeguard 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -273,12 +273,12 @@ name = "crossbeam-queue" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "crossbeam-utils" -version = "0.6.5" +version = "0.6.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", @@ -299,11 +299,11 @@ name = "csv" version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "bstr 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "bstr 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)", "csv-core 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", "ryu 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.97 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -316,14 +316,14 @@ dependencies = [ [[package]] name = "curve25519-dalek" -version = "1.2.1" +version = "1.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "clear_on_drop 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "digest 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "subtle 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "subtle 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -345,7 +345,7 @@ dependencies = [ "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", "strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.39 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -355,7 +355,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "darling_core 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.39 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -365,7 +365,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.39 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -378,11 +378,21 @@ dependencies = [ [[package]] name = "dirs" -version = "1.0.5" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "dirs-sys 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "dirs-sys" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ + "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_users 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_users 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -392,7 +402,7 @@ version = "1.0.0-pre.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "clear_on_drop 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "curve25519-dalek 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "curve25519-dalek 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", "sha2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -415,8 +425,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "atty 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)", "humantime 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "termcolor 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "env_logger" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "atty 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)", + "humantime 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "termcolor 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -476,7 +498,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.39 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)", "synstructure 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -536,6 +558,16 @@ dependencies = [ "typenum 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "getrandom" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", + "wasi 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "hex" version = "0.3.2" @@ -563,11 +595,11 @@ dependencies = [ "indy-sys 1.11.0", "lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "num-derive 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.97 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.97 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -576,8 +608,8 @@ name = "indy-sys" version = "1.11.0" dependencies = [ "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", - "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "vcpkg 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -625,12 +657,12 @@ version = "1.11.0" dependencies = [ "android_logger 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", "backtrace 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)", - "base64 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "criterion 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "derivative 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "dirs 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", - "env_logger 0.5.13 (registry+https://github.com/rust-lang/crates.io-index)", + "dirs 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "env_logger 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", "errno 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", "etcommon-rlp 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -641,19 +673,19 @@ dependencies = [ "int_traits 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "log-derive 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "log-panics 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "named_type 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "named_type_derive 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "named_type 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "named_type_derive 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "openssl 0.10.24 (registry+https://github.com/rust-lang/crates.io-index)", "owning_ref 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "rmp-serde 0.13.7 (registry+https://github.com/rust-lang/crates.io-index)", - "rusqlite 0.19.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rusqlite 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)", "rust-base58 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.97 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.97 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", "sha2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "sha3 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -661,8 +693,8 @@ dependencies = [ "threadpool 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", "ursa 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "uuid 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "zeroize 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)", + "uuid 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)", + "zeroize 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)", "zmq 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -672,16 +704,16 @@ version = "0.0.16" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", - "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "libsqlite3-sys" -version = "0.15.0" +version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cc 1.0.26 (registry+https://github.com/rust-lang/crates.io-index)", - "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", "vcpkg 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -692,7 +724,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "log" -version = "0.4.7" +version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", @@ -704,10 +736,10 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "darling 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.39 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -715,7 +747,7 @@ name = "log-panics" version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -736,8 +768,11 @@ dependencies = [ [[package]] name = "memoffset" -version = "0.2.1" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", +] [[package]] name = "metadeps" @@ -745,7 +780,7 @@ version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "error-chain 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", - "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", "toml 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -754,9 +789,14 @@ name = "named_type" version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "named_type" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "named_type_derive" -version = "0.1.6" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "named_type 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -807,7 +847,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.39 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -866,7 +906,7 @@ dependencies = [ [[package]] name = "opaque-debug" -version = "0.2.2" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -879,18 +919,18 @@ dependencies = [ "foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl-sys 0.9.48 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl-sys 0.9.49 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "openssl-sys" -version = "0.9.48" +version = "0.9.49" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "autocfg 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "cc 1.0.26 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", - "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", "vcpkg 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -904,7 +944,12 @@ dependencies = [ [[package]] name = "pkg-config" -version = "0.3.14" +version = "0.3.15" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "ppv-lite86" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -915,6 +960,14 @@ dependencies = [ "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "proc-macro2" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "quick-error" version = "1.2.2" @@ -934,12 +987,11 @@ dependencies = [ ] [[package]] -name = "rand" -version = "0.3.23" +name = "quote" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -962,7 +1014,7 @@ dependencies = [ "autocfg 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", "rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "rand_hc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand_isaac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "rand_jitter 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", @@ -972,6 +1024,18 @@ dependencies = [ "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "rand" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "getrandom 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_chacha 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_hc 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "rand_chacha" version = "0.1.1" @@ -981,19 +1045,36 @@ dependencies = [ "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "rand_chacha" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "c2-chacha 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "rand_core" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rand_core" -version = "0.4.0" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "rand_core" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "getrandom 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "rand_hc" version = "0.1.0" @@ -1002,6 +1083,14 @@ dependencies = [ "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "rand_hc" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rand_core 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "rand_isaac" version = "0.1.1" @@ -1016,7 +1105,7 @@ version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1028,9 +1117,9 @@ dependencies = [ "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen 0.2.49 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1040,7 +1129,7 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "autocfg 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1077,7 +1166,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "crossbeam-deque 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", "crossbeam-queue 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "num_cpus 1.10.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1097,30 +1186,29 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "redox_users" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "argon2rs 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "rand_os 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)", + "rust-argon2 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "regex" -version = "1.1.9" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "aho-corasick 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)", + "aho-corasick 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)", "memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-syntax 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)", + "regex-syntax 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", "thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", - "utf8-ranges 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "regex-automata" -version = "0.1.7" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1128,11 +1216,8 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.6.8" +version = "0.6.11" source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "ucd-util 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", -] [[package]] name = "rmp" @@ -1150,23 +1235,33 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "rmp 0.8.7 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.97 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rusqlite" -version = "0.19.0" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "fallible-iterator 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "fallible-streaming-iterator 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", - "libsqlite3-sys 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libsqlite3-sys 0.16.0 (registry+https://github.com/rust-lang/crates.io-index)", "lru-cache 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "rust-argon2" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", + "blake2b_simd 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "rust-base58" version = "0.0.4" @@ -1177,17 +1272,20 @@ dependencies = [ [[package]] name = "rustc-demangle" -version = "0.1.15" +version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] -name = "ryu" -version = "1.0.0" +name = "rustc_version" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", +] [[package]] -name = "safemem" -version = "0.2.0" +name = "ryu" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -1198,14 +1296,9 @@ dependencies = [ "winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "scoped_threadpool" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "scopeguard" -version = "0.3.3" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -1215,22 +1308,35 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cc 1.0.26 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.97 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "semver" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "semver-parser" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "serde" -version = "1.0.97" +version = "1.0.99" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "serde_derive" -version = "1.0.97" +version = "1.0.99" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.39 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1240,7 +1346,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", "ryu 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.97 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1251,7 +1357,7 @@ dependencies = [ "block-buffer 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", "digest 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "fake-simd 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "opaque-debug 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "opaque-debug 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1263,7 +1369,7 @@ dependencies = [ "byte-tools 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "digest 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "keccak 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "opaque-debug 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "opaque-debug 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1273,7 +1379,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", "libsodium-sys 0.0.16 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.97 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1293,7 +1399,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "subtle" -version = "2.1.0" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -1308,7 +1414,7 @@ dependencies = [ [[package]] name = "syn" -version = "0.15.39" +version = "0.15.44" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1316,6 +1422,16 @@ dependencies = [ "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "syn" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "synom" version = "0.11.3" @@ -1331,7 +1447,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.39 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1340,7 +1456,7 @@ name = "termcolor" version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "wincolor 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "wincolor 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1382,7 +1498,7 @@ name = "tinytemplate" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "serde 1.0.97 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1396,11 +1512,6 @@ name = "typenum" version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "ucd-util" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "unicode-width" version = "0.1.5" @@ -1416,6 +1527,11 @@ name = "unicode-xid" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "unicode-xid" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "ursa" version = "0.1.1" @@ -1430,13 +1546,13 @@ dependencies = [ "generic-array 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)", "int_traits 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "openssl 0.10.24 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", "rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "secp256k1 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.97 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.97 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", "sha2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "sha3 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1444,17 +1560,12 @@ dependencies = [ "zeroize 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "utf8-ranges" -version = "1.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "uuid" -version = "0.5.1" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "rand 0.3.23 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1464,7 +1575,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "walkdir" -version = "2.2.8" +version = "2.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "same-file 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1472,52 +1583,58 @@ dependencies = [ "winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "wasi" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "wasm-bindgen" -version = "0.2.48" +version = "0.2.49" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "wasm-bindgen-macro 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-macro 0.2.49 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "wasm-bindgen-backend" -version = "0.2.48" +version = "0.2.49" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bumpalo 2.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.39 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-shared 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-shared 0.2.49 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "wasm-bindgen-macro" -version = "0.2.48" +version = "0.2.49" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-macro-support 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-macro-support 0.2.49 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.48" +version = "0.2.49" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.39 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-backend 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-shared 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-backend 0.2.49 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-shared 0.2.49 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.48" +version = "0.2.49" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -1549,7 +1666,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "wincolor" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1563,20 +1680,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "zeroize" -version = "0.9.2" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "zeroize_derive 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "zeroize_derive 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "zeroize_derive" -version = "0.9.0" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.39 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)", "synstructure 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1586,7 +1703,7 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "zmq-sys 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1600,27 +1717,27 @@ dependencies = [ ] [metadata] -"checksum aho-corasick 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)" = "36b7aa1ccb7d7ea3f437cf025a2ab1c47cc6c1bc9fc84918ff449def12f5e282" +"checksum aho-corasick 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)" = "58fb5e95d83b38284460a5fda7d6470aa0b8844d283a0b614b8535e880800d2d" "checksum amcl 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee5cca1ddc8b9dceb55b7f1272a9d1e643d73006f350a20ab4926d24e33f0f0d" "checksum android_log-sys 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b8052e2d8aabbb8d556d6abbcce2a22b9590996c5f849b9c7ce4544a2e3b984e" "checksum android_logger 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "86983875e7c3a202e31471cc6d60fcc18f30e194f1729cfff3bfb43d646ffced" -"checksum argon2rs 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "3f67b0b6a86dae6e67ff4ca2b6201396074996379fba2b92ff649126f37cb392" "checksum arrayref 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "0d382e583f07208808f6b1249e60848879ba3543f57c32277bf52d69c2f0f0ee" "checksum arrayvec 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)" = "b8d73f9beda665eaa98ab9e4f7442bd4e7de6652587de55b2525e52e29c1b0ba" "checksum atty 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)" = "1803c647a3ec87095e7ae7acfca019e98de5ec9a7d01343f611cf3152ed71a90" "checksum autocfg 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "22130e92352b948e7e82a49cdb0aa94f2211761117f29e052dd397c1ac33542b" "checksum backtrace 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)" = "18b65ea1161bfb2dd6da6fade5edd4dbd08fba85012123dd333d2fd1b90b2782" "checksum backtrace-sys 0.1.30 (registry+https://github.com/rust-lang/crates.io-index)" = "5b3a000b9c543553af61bc01cbfc403b04b5caa9e421033866f2e98061eb3e61" -"checksum base64 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "96434f987501f0ed4eb336a411e0631ecd1afa11574fe148587adc4ff96143c9" +"checksum base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0b25d992356d2eb0ed82172f5248873db5560c4721f564b13cb5193bda5e668e" "checksum bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3d155346769a6855b86399e9bc3814ab343cd3d62c7e985113d46a0ec3c281fd" "checksum blake2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "91721a6330935673395a0607df4d49a9cb90ae12d259f1b3e0a3f6e1d486872e" -"checksum blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)" = "5d6d530bdd2d52966a6d03b7a964add7ae1a288d25214066fd4b600f0f796400" +"checksum blake2b_simd 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "461f4b879a8eb70c1debf7d0788a9a5ff15f1ea9d25925fea264ef4258bed6b2" "checksum block-buffer 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c0940dc441f31689269e10ac70eb1002a3a1d3ad1390e030043662eb7fe4688b" "checksum block-padding 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "6d4dc3af3ee2e12f3e5d224e5e1e3d73668abbeb69e566d361f7d5563a4fdf09" -"checksum bstr 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "fc0662252f9bba48c251a16d16a768b9fcd959593bde07544710bce6efe60b7a" +"checksum bstr 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "94cdf78eb7e94c566c1f5dbe2abf8fc70a548fc902942a48c4b3a98b48ca9ade" "checksum bumpalo 2.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2cd43d82f27d68911e6ee11ee791fb248f138f5d69424dc02e098d4f152b0b05" "checksum byte-tools 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7" "checksum byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a7c3dd8985a7111efc5c80b44e23ecdd8c007de8ade3b96595387e812b957cf5" +"checksum c2-chacha 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7d64d04786e0f528460fc884753cf8dddcc466be308f6026f8e355c41a0e4101" "checksum cast 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "926013f2860c46252efceabb19f4a6b308197505082c609025aa6706c011d427" "checksum cc 1.0.26 (registry+https://github.com/rust-lang/crates.io-index)" = "389803e36973d242e7fecb092b2de44a3d35ac62524b3b9339e51d577d668e02" "checksum cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "b486ce3ccf7ffd79fdeb678eac06a9e6c09fc88d33836340becb8fffe87c5e33" @@ -1631,23 +1748,25 @@ dependencies = [ "checksum criterion 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "0363053954f3e679645fc443321ca128b7b950a6fe288cf5f9335cc22ee58394" "checksum criterion-plot 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "76f9212ddf2f4a9eb2d401635190600656a1f88a932ef53d06e7fa4c7e02fb8e" "checksum crossbeam-deque 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "05e44b8cf3e1a625844d1750e1f7820da46044ff6d28f4d43e455ba3e5bb2c13" -"checksum crossbeam-epoch 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "04c9e3102cc2d69cd681412141b390abd55a362afc1540965dad0ad4d34280b4" +"checksum crossbeam-epoch 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "fedcd6772e37f3da2a9af9bf12ebe046c0dfe657992377b4df982a2b54cd37a9" "checksum crossbeam-queue 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7c979cd6cfe72335896575c6b5688da489e420d36a27a0b9eb0c73db574b4a4b" -"checksum crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "f8306fcef4a7b563b76b7dd949ca48f52bc1141aa067d2ea09565f3e2652aa5c" +"checksum crossbeam-utils 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)" = "04973fa96e96579258a5091af6003abde64af786b860f18622b82e026cca60e6" "checksum crypto-mac 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4434400df11d95d556bac068ddfedd482915eb18fe8bea89bc80b6e4b1c179e5" "checksum csv 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "37519ccdfd73a75821cac9319d4fce15a81b9fcf75f951df5b9988aa3a0af87d" "checksum csv-core 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "9b5cadb6b25c77aeff80ba701712494213f4a8418fcda2ee11b6560c3ad0bf4c" -"checksum curve25519-dalek 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "5d4b820e8711c211745880150f5fac78ab07d6e3851d8ce9f5a02cedc199174c" +"checksum curve25519-dalek 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8b7dcd30ba50cdf88b55b033456138b7c0ac4afdc436d82e1b79f370f24cc66d" "checksum darling 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fcfbcb0c5961907597a7d1148e3af036268f2b773886b8bb3eeb1e1281d3d3d6" "checksum darling_core 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6afc018370c3bff3eb51f89256a6bdb18b4fdcda72d577982a14954a7a0b402c" "checksum darling_macro 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c6d8dac1c6f1d29a41c4712b4400f878cb4fcc4c7628f298dd75038e024998d1" "checksum derivative 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6073e9676dbebdddeabaeb63e3b7cefd23c86f5c41d381ee1237cc77b1079898" "checksum digest 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5" -"checksum dirs 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "3fd78930633bd1c6e35c4b42b1df7b0cbc6bc191146e512bb3bedf243fcc3901" +"checksum dirs 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "13aea89a5c93364a98e9b37b2fa237effbb694d5cfe01c5b70941f7eb087d5e3" +"checksum dirs-sys 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "afa0b23de8fd801745c471deffa6e12d248f962c9fd4b4c33787b055599bde7b" "checksum ed25519-dalek 1.0.0-pre.1 (registry+https://github.com/rust-lang/crates.io-index)" = "81956bcf7ef761fb4e1d88de3fa181358a0d26cbcb9755b587a08f9119824b86" "checksum either 1.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "5527cfe0d098f36e3f8839852688e63c8fff1c90b2b405aef730615f9a7bcf7b" "checksum elastic-array-plus 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "562cc8504a01eb20c10fb154abd7c4baeb9beba2329cf85838ee2bd48a468b18" "checksum env_logger 0.5.13 (registry+https://github.com/rust-lang/crates.io-index)" = "15b0a4d2e39f8420210be8b27eeda28029729e2fd4291019455016c348240c38" +"checksum env_logger 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "aafcde04e90a5226a6443b7aabdb016ba2f8307c847d524724bd9b346dd1a2d3" "checksum errno 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "c2a071601ed01b988f896ab14b95e67335d1eeb50190932a1320f7fe3cadc84e" "checksum errno-dragonfly 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "14ca354e36190500e1e1fb267c647932382b54053c50b14970856c0b00a35067" "checksum error-chain 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d9435d864e017c3c6afeac1654189b06cdb491cf2ff73dbf0d73b0f292f42ff8" @@ -1665,6 +1784,7 @@ dependencies = [ "checksum futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)" = "45dc39533a6cae6da2b56da48edae506bb767ec07370f86f70fc062e9d435869" "checksum gcc 0.3.55 (registry+https://github.com/rust-lang/crates.io-index)" = "8f5f3913fa0bfe7ee1fd8248b6b9f42a5af4b9d65ec2dd2c3c26132b950ecfc2" "checksum generic-array 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c68f0274ae0e023facc3c97b2e00f076be70e254bc851d972503b328db79b2ec" +"checksum getrandom 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "6171a6cc63fbabbe27c2b5ee268e8b7fe5dc1eb0dd2dfad537c1dfed6f69117e" "checksum hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "805026a5d0141ffc30abb3be3173848ad46a1b1664fe632428479619a3644d77" "checksum humantime 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3ca7e5f2e110db35f93b837c81797f3714500b81d517bf20c431b16d3ca4f114" "checksum ident_case 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" @@ -1676,17 +1796,18 @@ dependencies = [ "checksum lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bc5729f27f159ddd61f4df6228e827e86643d4d3e7c32183cb30a1c08f604a14" "checksum libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)" = "d44e80633f007889c7eff624b709ab43c92d708caad982295768a7b13ca3b5eb" "checksum libsodium-sys 0.0.16 (registry+https://github.com/rust-lang/crates.io-index)" = "fcbd1beeed8d44caa8a669ebaa697c313976e242c03cc9fb23d88bf1656f5542" -"checksum libsqlite3-sys 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)" = "72b1e07fcc60484f42e246f0cf1f133940c98117c81b2cefcdf71be288069680" +"checksum libsqlite3-sys 0.16.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5e5b95e89c330291768dc840238db7f9e204fd208511ab6319b56193a7f2ae25" "checksum linked-hash-map 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "ae91b68aebc4ddb91978b11a1b02ddd8602a05ec19002801c5666000e05e0f83" -"checksum log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)" = "c275b6ad54070ac2d665eef9197db647b32239c9d244bfb6f041a766d00da5b3" +"checksum log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)" = "14b6052be84e6b71ab17edffc2eeabf5c2c3ae1fdb464aae35ac50c67a44e1f7" "checksum log-derive 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "90b7e153f2d4bf69d46a9e640e2c96573940fca671d275bf6f7687f6bab803fc" "checksum log-panics 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ae0136257df209261daa18d6c16394757c63e032e27aafd8b07788b051082bef" "checksum lru-cache 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "31e24f1ad8321ca0e8a1e0ac13f23cb668e6f5466c2c57319f6a5cf1cc8e3b1c" "checksum memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "88579771288728879b57485cc7d6b07d648c9f0141eb955f8ab7f9d45394468e" -"checksum memoffset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0f9dc261e2b62d7a622bf416ea3c5245cdd5d9a7fcc428c0d06804dfce1775b3" +"checksum memoffset 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ce6075db033bbbb7ee5a0bbd3a3186bbae616f57fb001c485c7ff77955f8177f" "checksum metadeps 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "73b122901b3a675fac8cecf68dcb2f0d3036193bc861d1ac0e1c337f7d5254c2" "checksum named_type 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c39ac6c5ee13bf558879a82198b0afe84989cf3f7fb7592b56d73eb1a50c9e66" -"checksum named_type_derive 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "651d7e408d728ded66748986dc046156dbc7bd25add9ea334bcf762c7a83e14a" +"checksum named_type 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3a9b45469f7e8314cd4a0791e914c5b65c02ba6451c0662eeb29ccc1714013d7" +"checksum named_type_derive 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c13c91ae49fb502a04f2e993e63e06a28fc5a1ecff01eaa09448735c7ad1243b" "checksum nodrop 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "2f9667ddcc6cc8a43afc9b7917599d7216aa09c463919ea32c59ed6cac8bc945" "checksum num 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "cf4825417e1e1406b3782a8ce92f4d53f26ec055e3622e1881ca8e9f5f9e08db" "checksum num-bigint 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "57450397855d951f1a41305e54851b1a7b8f5d2e349543a02a2effe25459f718" @@ -1698,22 +1819,28 @@ dependencies = [ "checksum num-traits 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)" = "92e5113e9fd4cc14ded8e499429f396a20f98c772a47cc8622a736e1ec843c31" "checksum num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "6ba9a427cfca2be13aa6f6403b0b7e7368fe982bfa16fccc450ce74c46cd9b32" "checksum num_cpus 1.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "bcef43580c035376c0705c42792c294b66974abbfd2789b511784023f71f3273" -"checksum opaque-debug 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "93f5bb2e8e8dec81642920ccff6b61f1eb94fa3020c5a325c9851ff604152409" +"checksum opaque-debug 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c" "checksum openssl 0.10.24 (registry+https://github.com/rust-lang/crates.io-index)" = "8152bb5a9b5b721538462336e3bef9a539f892715e5037fda0f984577311af15" -"checksum openssl-sys 0.9.48 (registry+https://github.com/rust-lang/crates.io-index)" = "b5ba300217253bcc5dc68bed23d782affa45000193866e025329aa8a7a9f05b8" +"checksum openssl-sys 0.9.49 (registry+https://github.com/rust-lang/crates.io-index)" = "f4fad9e54bd23bd4cbbe48fdc08a1b8091707ac869ef8508edea2fec77dcc884" "checksum owning_ref 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "49a4b8ea2179e6a2e27411d3bca09ca6dd630821cf6894c6c7c8467a8ee7ef13" -"checksum pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)" = "676e8eb2b1b4c9043511a9b7bea0915320d7e502b0a079fb03f9635a5252b18c" +"checksum pkg-config 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "a7c1d2cfa5a714db3b5f24f0915e74fcdf91d09d496ba61329705dda7774d2af" +"checksum ppv-lite86 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "e3cbf9f658cdb5000fcf6f362b8ea2ba154b9f146a61c7a20d647034c6b6561b" "checksum proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)" = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759" +"checksum proc-macro2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4c5c2380ae88876faae57698be9e9775e3544decad214599c3a6266cca6ac802" "checksum quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9274b940887ce9addde99c4eee6b5c44cc494b182b97e73dc8ffdcb3397fd3f0" "checksum quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a" "checksum quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)" = "6ce23b6b870e8f94f81fb0a363d65d86675884b34a09043c81e5562f11c1f8e1" -"checksum rand 0.3.23 (registry+https://github.com/rust-lang/crates.io-index)" = "64ac302d8f83c0c1974bf758f6b041c6c8ada916fbb44a609158ca8b064cc76c" +"checksum quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "053a8c8bcc71fcce321828dc897a98ab9760bef03a4fc36693c231e5b3216cfe" "checksum rand 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "552840b97013b1a26992c11eac34bdd778e464601a4c2054b5f0bff7c6761293" "checksum rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "6d71dacdc3c88c1fde3885a3be3fbab9f35724e6ce99467f7d9c5026132184ca" +"checksum rand 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d47eab0e83d9693d40f825f86948aa16eff6750ead4bdffc4ab95b8b3a7f052c" "checksum rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "556d3a1ca6600bfcbab7c7c91ccb085ac7fbbcd70e008a98742e7847f4f7bcef" +"checksum rand_chacha 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "03a2a90da8c7523f554344f921aa97283eadf6ac484a6d2a7d0212fa7f8d6853" "checksum rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b" -"checksum rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d0e7a549d590831370895ab7ba4ea0c1b6b011d106b5ff2da6eee112615e6dc0" +"checksum rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc" +"checksum rand_core 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "615e683324e75af5d43d8f7a39ffe3ee4a9dc42c5c701167a71dc59c3a493aca" "checksum rand_hc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7b40677c7be09ae76218dc623efbf7b18e34bced3f38883af07bb75630a21bc4" +"checksum rand_hc 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" "checksum rand_isaac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ded997c9d5f13925be2a6fd7e66bf1872597f759fd9dd93513dd7e92e5a5ee08" "checksum rand_jitter 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "1166d5c91dc97b88d1decc3285bb0a99ed84b05cfd0bc2341bdf2d43fc41e39b" "checksum rand_os 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "7b75f676a1e053fc562eafbb47838d67c84801e38fc1ba459e8f180deabd5071" @@ -1724,23 +1851,25 @@ dependencies = [ "checksum rayon-core 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ebbe0df8435ac0c397d467b6cad6d25543d06e8a019ef3f6af3c384597515bd2" "checksum rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2" "checksum redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)" = "2439c63f3f6139d1b57529d16bc3b8bb855230c8efcc5d3a896c8bea7c3b1e84" -"checksum redox_users 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3fe5204c3a17e97dde73f285d49be585df59ed84b50a872baf416e73b62c3828" -"checksum regex 1.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "d9d8297cc20bbb6184f8b45ff61c8ee6a9ac56c156cec8e38c3e5084773c44ad" -"checksum regex-automata 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "3ed09217220c272b29ef237a974ad58515bde75f194e3ffa7e6d0bf0f3b01f86" -"checksum regex-syntax 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)" = "9b01330cce219c1c6b2e209e5ed64ccd587ae5c67bed91c0b49eecf02ae40e21" +"checksum redox_users 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4ecedbca3bf205f8d8f5c2b44d83cd0690e39ee84b951ed649e9f1841132b66d" +"checksum regex 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "88c3d9193984285d544df4a30c23a4e62ead42edf70a4452ceb76dac1ce05c26" +"checksum regex-automata 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "92b73c2a1770c255c240eaa4ee600df1704a38dc3feaa6e949e7fcd4f8dc09f9" +"checksum regex-syntax 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)" = "b143cceb2ca5e56d5671988ef8b15615733e7ee16cd348e064333b251b89343f" "checksum rmp 0.8.7 (registry+https://github.com/rust-lang/crates.io-index)" = "a3d45d7afc9b132b34a2479648863aa95c5c88e98b32285326a6ebadc80ec5c9" "checksum rmp-serde 0.13.7 (registry+https://github.com/rust-lang/crates.io-index)" = "011e1d58446e9fa3af7cdc1fb91295b10621d3ac4cb3a85cc86385ee9ca50cd3" -"checksum rusqlite 0.19.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6ebca2e7e3deb7241b7fa5929c088548c590728b1b740c479594c23f813eb8a7" +"checksum rusqlite 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2a194373ef527035645a1bc21b10dc2125f73497e6e155771233eb187aedd051" +"checksum rust-argon2 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4ca4eaef519b494d1f2848fc602d18816fed808a981aedf4f1f00ceb7c9d32cf" "checksum rust-base58 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "b313b91fcdc6719ad41fa2dad2b7e810b03833fae4bf911950e15529a5f04439" -"checksum rustc-demangle 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)" = "a7f4dccf6f4891ebcc0c39f9b6eb1a83b9bf5d747cb439ec6fba4f3b977038af" +"checksum rustc-demangle 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "4c691c0e608126e00913e33f0ccf3727d5fc84573623b8d65b2df340b5201783" +"checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" "checksum ryu 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c92464b447c0ee8c4fb3824ecc8383b81717b9f1e74ba2e72540aef7b9f82997" -"checksum safemem 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e27a8b19b835f7aea908818e871f5cc3a5a186550c30773be987e155e8163d8f" "checksum same-file 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "585e8ddcedc187886a30fa705c47985c3fa88d06624095856b36ca0b82ff4421" -"checksum scoped_threadpool 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "1d51f5df5af43ab3f1360b429fa5e0152ac5ce8c0bd6485cae490332e96846a8" -"checksum scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "94258f53601af11e6a49f722422f6e3425c52b06245a5cf9bc09908b174f5e27" +"checksum scopeguard 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b42e15e59b18a828bbf5c58ea01debb36b9b096346de35d941dcb89009f24a0d" "checksum secp256k1 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)" = "bfaccd3a23619349e0878d9a241f34b1982343cdf67367058cd7d078d326b63e" -"checksum serde 1.0.97 (registry+https://github.com/rust-lang/crates.io-index)" = "d46b3dfedb19360a74316866cef04687cd4d6a70df8e6a506c63512790769b72" -"checksum serde_derive 1.0.97 (registry+https://github.com/rust-lang/crates.io-index)" = "c22a0820adfe2f257b098714323563dd06426502abbbce4f51b72ef544c5027f" +"checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" +"checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" +"checksum serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)" = "fec2851eb56d010dc9a21b89ca53ee75e6528bab60c11e89d38390904982da9f" +"checksum serde_derive 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)" = "cb4dc18c61206b08dc98216c98faa0232f4337e1e1b8574551d5bad29ea1b425" "checksum serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)" = "051c49229f282f7c6f3813f8286cc1e3323e8051823fce42c7ea80fe13521704" "checksum sha2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7b4d8bfd0e469f417657573d8451fb33d16cfe0989359b93baf3a1ffc639543d" "checksum sha3 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dd26bc0e7a2e3a7c959bc494caf58b72ee0c71d67704e9520f736ca7e4853ecf" @@ -1748,9 +1877,10 @@ dependencies = [ "checksum stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dba1a27d3efae4351c8051072d619e3ade2820635c3958d826bfea39d59b54c8" "checksum strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bb4f380125926a99e52bc279241539c018323fab05ad6368b56f93d9369ff550" "checksum subtle 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2d67a5a62ba6e01cb2192ff309324cb4875d0c451d55fe2319433abe7a05a8ee" -"checksum subtle 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "01dca13cf6c3b179864ab3292bd794e757618d35a7766b7c46050c614ba00829" +"checksum subtle 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "01f40907d9ffc762709e4ff3eb4a6f6b41b650375a3f09ac92b641942b7fb082" "checksum syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)" = "d3b891b9015c88c576343b9b3e41c2c11a51c219ef067b264bd9c8aa9b441dad" -"checksum syn 0.15.39 (registry+https://github.com/rust-lang/crates.io-index)" = "b4d960b829a55e56db167e861ddb43602c003c7be0bee1d345021703fac2fb7c" +"checksum syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)" = "9ca4b3b69a77cbe1ffc9e198781b7acb0c7365a883670e8f1c1bc66fba79a5c5" +"checksum syn 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "158521e6f544e7e3dcfc370ac180794aa38cb34a1b1e07609376d4adcf429b93" "checksum synom 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a393066ed9010ebaed60b9eafa373d4b1baac186dd7e008555b0f702b51945b6" "checksum synstructure 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)" = "02353edf96d6e4dc81aea2d8490a7e9db177bf8acb0e951c24940bf866cb313f" "checksum termcolor 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "96d6098003bde162e4277c70665bd87c326f5a0c3f3fbfb285787fa482d54e6e" @@ -1761,27 +1891,27 @@ dependencies = [ "checksum tinytemplate 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4574b75faccaacddb9b284faecdf0b544b80b6b294f3d062d325c5726a209c20" "checksum toml 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "736b60249cb25337bc196faa43ee12c705e426f3d55c214d73a4e7be06f92cb4" "checksum typenum 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "612d636f949607bdf9b123b4a6f6d966dedf3ff669f7f045890d3a4a73948169" -"checksum ucd-util 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "535c204ee4d8434478593480b8f86ab45ec9aae0e83c568ca81abf0fd0e88f86" "checksum unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "882386231c45df4700b275c7ff55b6f3698780a650026380e72dabe76fa46526" "checksum unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f860d7d29cf02cb2f3f359fd35991af3d30bac52c57d265a3c461074cb4dc" "checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" +"checksum unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c" "checksum ursa 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9081683a6861bee60c4005c280dafd50c6ee9c2ffd14935865f72658e5f2d9f8" -"checksum utf8-ranges 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "9d50aa7650df78abf942826607c62468ce18d9019673d4a2ebe1865dbb96ffde" -"checksum uuid 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "bcc7e3b898aa6f6c08e5295b6c89258d1331e9ac578cc992fb818759951bdc22" +"checksum uuid 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)" = "90dbc611eb48397705a6b0f6e917da23ae517e4d127123d2cf7674206627d32a" "checksum vcpkg 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "33dd455d0f96e90a75803cfeb7f948768c08d70a6de9a8d2362461935698bf95" -"checksum walkdir 2.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "c7904a7e2bb3cdf0cf5e783f44204a85a37a93151738fa349f06680f59a98b45" -"checksum wasm-bindgen 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)" = "4de97fa1806bb1a99904216f6ac5e0c050dc4f8c676dc98775047c38e5c01b55" -"checksum wasm-bindgen-backend 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)" = "5d82c170ef9f5b2c63ad4460dfcee93f3ec04a9a36a4cc20bc973c39e59ab8e3" -"checksum wasm-bindgen-macro 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)" = "f07d50f74bf7a738304f6b8157f4a581e1512cd9e9cdb5baad8c31bbe8ffd81d" -"checksum wasm-bindgen-macro-support 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)" = "95cf8fe77e45ba5f91bc8f3da0c3aa5d464b3d8ed85d84f4d4c7cc106436b1d7" -"checksum wasm-bindgen-shared 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)" = "d9c2d4d4756b2e46d3a5422e06277d02e4d3e1d62d138b76a4c681e925743623" +"checksum walkdir 2.2.9 (registry+https://github.com/rust-lang/crates.io-index)" = "9658c94fa8b940eab2250bd5a457f9c48b748420d71293b165c8cdbe2f55f71e" +"checksum wasi 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fd5442abcac6525a045cc8c795aedb60da7a2e5e89c7bf18a0d5357849bb23c7" +"checksum wasm-bindgen 0.2.49 (registry+https://github.com/rust-lang/crates.io-index)" = "220f01bcb6b306c063e3283f97dd974bcab4e5affed2b654bae1a22d0d99c3aa" +"checksum wasm-bindgen-backend 0.2.49 (registry+https://github.com/rust-lang/crates.io-index)" = "8894c95e23cc5082786192ebbd2ac0e31e9f77a022132ba03e8b8de32a2323c6" +"checksum wasm-bindgen-macro 0.2.49 (registry+https://github.com/rust-lang/crates.io-index)" = "ec031a3190c51dda28c9f3623e2674e58c79f6d88c020c2157417fcf62298a3f" +"checksum wasm-bindgen-macro-support 0.2.49 (registry+https://github.com/rust-lang/crates.io-index)" = "3b7cad0ab0bb5fefbb770279f522dcebb6433585174d93ea648390f61db57401" +"checksum wasm-bindgen-shared 0.2.49 (registry+https://github.com/rust-lang/crates.io-index)" = "9142625bbb0d70710b3f2a6b20924c80fa182b05888b6bd21600ab9075673563" "checksum winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)" = "f10e386af2b13e47c89e7236a7a14a086791a2b88ebad6df9bf42040195cf770" "checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" "checksum winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7168bab6e1daee33b4557efd0e95d5ca70a03706d39fa5f3fe7a236f584b03c9" "checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" -"checksum wincolor 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "561ed901ae465d6185fa7864d63fbd5720d0ef718366c9a4dc83cf6170d7e9ba" +"checksum wincolor 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "96f5016b18804d24db43cebf3c77269e7569b8954a8464501c216cc5e070eaa9" "checksum zeroize 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "8ddfeb6eee2fb3b262ef6e0898a52b7563bb8e0d5955a313b3cf2f808246ea14" -"checksum zeroize 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4177936c03b5a349c1b8e4509c46add268e66bc66fe92663729fa0570fe4f213" -"checksum zeroize_derive 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "afd1469e4bbca3b96606d26ba6e9bd6d3aed3b1299c82b92ec94377d22d78dbc" +"checksum zeroize 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)" = "45af6a010d13e4cf5b54c94ba5a2b2eba5596b9e46bf5875612d332a1f2b3f86" +"checksum zeroize_derive 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)" = "080616bd0e31f36095288bb0acdf1f78ef02c2fa15527d7e993f2a6c7591643e" "checksum zmq 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8ff1c5e9ff4ac9c2847b2e72ada1c1eb3e188adb49fe3f1dd3bbcdc47f414d17" "checksum zmq-sys 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)" = "4b770cf495ad41e920ab25c465f35b7eec09d0ce8d7c892a7c8334a5e0de037c" diff --git a/libindy/Cargo.toml b/libindy/Cargo.toml index 81e0784f6a..96f65e99c6 100644 --- a/libindy/Cargo.toml +++ b/libindy/Cargo.toml @@ -46,56 +46,56 @@ fatal_warnings = [] [dependencies] int_traits = { version = "0.1.1", optional = true } -env_logger = "0.5.10" -errno = "0.2.3" -etcommon-rlp = "0.2.3" -failure = "0.1.3" +env_logger = "0.6.2" +errno = "0.2.4" +etcommon-rlp = "0.2.4" +failure = "0.1.5" hex = "0.3.2" libc = "0.2.60" -log = "0.4.1" +log = "0.4.8" log-derive = "0.3.0" -derivative = "1.0.0" -dirs = "1.0.4" +derivative = "1.0.2" +dirs = "2.0.2" openssl = { version = "0.10", optional = true } backtrace = "=0.3.11" owning_ref = "0.4" -rand = "0.6.5" -rusqlite = "0.19" # Make sure rusqlite for android is also bumped with this. Rusqlite for android is at the bottom of this document. +rand = "0.7.0" +rusqlite = "0.20" # Make sure rusqlite for android is also bumped with this. Rusqlite for android is at the bottom of this document. rust-base58 = {version = "0.0.4", optional = true} -base64 = {version = "0.6.0", optional = true} -serde = "1.0.97" +base64 = {version = "0.10.1", optional = true} +serde = "1.0.99" serde_json = "1.0.40" -serde_derive = "1.0.97" +serde_derive = "1.0.99" sha2 = "0.8" sha3 = "0.8" -rmp-serde = "0.13.6" +rmp-serde = "0.13.7" sodiumoxide = {version = "0.0.16", optional = true} -time = "0.1.36" +time = "0.1.42" threadpool = "1.7.1" zmq = "0.8.2" -lazy_static = "1.0" -named_type = "0.1.3" -named_type_derive = "0.1.3" -byteorder = "1.0.0" +lazy_static = "1.3" +named_type = "0.2.1" +named_type_derive = "0.2.1" +byteorder = "1.3.2" log-panics = "2.0.0" -zeroize = "0.9.1" +zeroize = "0.9.3" ursa = { version = "0.1.1", optional = true } [dependencies.uuid] -version = "0.5.0" +version = "0.7.4" default-features = false features = ["v4"] [target.'cfg(target_os = "android")'.dependencies] android_logger = "0.5" [target.'cfg(any(target_os = "android", target_os = "ios"))'.dependencies] -rusqlite = { version = "0.19", features=["bundled"] } +rusqlite = { version = "0.20", features=["bundled"] } [dev-dependencies] criterion = "0.2" indy = { path = "../wrappers/rust" } indy-sys = { path = "../wrappers/rust/indy-sys" } -futures = "0.1.24" +futures = "0.1.28" [[bench]] name = "wallet" diff --git a/libindy/src/utils/logger.rs b/libindy/src/utils/logger.rs index b1718e57af..b2f6afc293 100644 --- a/libindy/src/utils/logger.rs +++ b/libindy/src/utils/logger.rs @@ -162,7 +162,7 @@ impl LibindyDefaultLogger { EnvLoggerBuilder::new() .format(|buf, record| writeln!(buf, "{:>5}|{:<30}|{:>35}:{:<4}| {}", record.level(), record.target(), record.file().get_or_insert(""), record.line().get_or_insert(0), record.args())) .filter(None, LevelFilter::Off) - .parse(pattern.as_ref().map(String::as_str).unwrap_or("")) + .parse_filters(pattern.as_ref().map(String::as_str).unwrap_or("")) .try_init()?; } unsafe { LOGGER_STATE = LoggerState::Default }; diff --git a/libindy/tests/crypto.rs b/libindy/tests/crypto.rs index 04fac33da5..8d31704416 100644 --- a/libindy/tests/crypto.rs +++ b/libindy/tests/crypto.rs @@ -598,7 +598,7 @@ mod load { let operations_cnt = std::env::var("OPERATIONS_CNT").ok().and_then(|s| s.parse::().ok()).unwrap_or(OPERATIONS_CNT); let mut agents = Vec::new(); - let mut os_rng = OsRng::new().unwrap(); + let mut os_rng = OsRng; for i in 0..agent_cnt { let (wallet, wallet_config) = wallet::create_and_open_default_wallet(&format!("parallel_auth_encrypt-{}", i)).unwrap(); let (_did, verkey) = did::create_and_store_my_did(wallet, None).unwrap(); From 923310a9af428dd67a14ae583900cb098b2f1882 Mon Sep 17 00:00:00 2001 From: Darko Kulic Date: Mon, 19 Aug 2019 17:37:35 +0200 Subject: [PATCH 267/320] Fix checks in java wrapper Signed-off-by: Darko Kulic --- .../com/evernym/sdk/vcx/credentialDef/CredentialDefApi.java | 4 ++-- .../src/main/java/com/evernym/sdk/vcx/issuer/IssuerApi.java | 4 ++-- .../src/main/java/com/evernym/sdk/vcx/schema/SchemaApi.java | 5 +++-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/vcx/wrappers/java/src/main/java/com/evernym/sdk/vcx/credentialDef/CredentialDefApi.java b/vcx/wrappers/java/src/main/java/com/evernym/sdk/vcx/credentialDef/CredentialDefApi.java index 3a2256be2c..6403ba5199 100644 --- a/vcx/wrappers/java/src/main/java/com/evernym/sdk/vcx/credentialDef/CredentialDefApi.java +++ b/vcx/wrappers/java/src/main/java/com/evernym/sdk/vcx/credentialDef/CredentialDefApi.java @@ -36,8 +36,8 @@ public static CompletableFuture credentialDefCreate(String sourceId, int paymentHandle ) throws VcxException { ParamGuard.notNullOrWhiteSpace(sourceId, "sourceId"); - ParamGuard.notNullOrWhiteSpace(sourceId, "credentialName"); - ParamGuard.notNullOrWhiteSpace(sourceId, "schemaId"); + ParamGuard.notNullOrWhiteSpace(credentialName, "credentialName"); + ParamGuard.notNullOrWhiteSpace(schemaId, "schemaId"); logger.debug("credentialDefCreate() called with: sourceId = [" + sourceId + "], credentialName = [" + credentialName + "], schemaId = [" + schemaId + "], issuerId = [" + issuerId + "], tag = [" + tag + "], config = [" + config + "], paymentHandle = [" + paymentHandle + "]"); //TODO: Check for more mandatory params in vcx to add in PamaGuard CompletableFuture future = new CompletableFuture<>(); diff --git a/vcx/wrappers/java/src/main/java/com/evernym/sdk/vcx/issuer/IssuerApi.java b/vcx/wrappers/java/src/main/java/com/evernym/sdk/vcx/issuer/IssuerApi.java index fc46636b93..00c71d6028 100644 --- a/vcx/wrappers/java/src/main/java/com/evernym/sdk/vcx/issuer/IssuerApi.java +++ b/vcx/wrappers/java/src/main/java/com/evernym/sdk/vcx/issuer/IssuerApi.java @@ -34,8 +34,8 @@ public static CompletableFuture issuerCreateCredential(String sourceId, String credentialName, long price) throws VcxException { ParamGuard.notNullOrWhiteSpace(sourceId, "sourceId"); - ParamGuard.notNullOrWhiteSpace(sourceId, "credentialDefId"); - ParamGuard.notNullOrWhiteSpace(sourceId, "SchemaId"); + ParamGuard.notNullOrWhiteSpace(credentialData, "credentialData"); + ParamGuard.notNullOrWhiteSpace(credentialName, "credentialName"); logger.debug("issuerCreateCredential() called with: sourceId = [" + sourceId + "], credentialDefHandle = [" + credentialDefHandle + "], issuerId = [" + issuerId + "], credentialData = [" + credentialData + "], credentialName = [" + credentialName + "], price = [" + price + "]"); //TODO: Check for more mandatory params in vcx to add in PamaGuard diff --git a/vcx/wrappers/java/src/main/java/com/evernym/sdk/vcx/schema/SchemaApi.java b/vcx/wrappers/java/src/main/java/com/evernym/sdk/vcx/schema/SchemaApi.java index 6ad7fa51e0..14c1426794 100644 --- a/vcx/wrappers/java/src/main/java/com/evernym/sdk/vcx/schema/SchemaApi.java +++ b/vcx/wrappers/java/src/main/java/com/evernym/sdk/vcx/schema/SchemaApi.java @@ -33,8 +33,9 @@ public static CompletableFuture schemaCreate(String sourceId, String data, int paymentHandle) throws VcxException { ParamGuard.notNullOrWhiteSpace(sourceId, "sourceId"); - ParamGuard.notNullOrWhiteSpace(sourceId, "schemaName"); - ParamGuard.notNullOrWhiteSpace(sourceId, "version"); + ParamGuard.notNullOrWhiteSpace(schemaName, "schemaName"); + ParamGuard.notNullOrWhiteSpace(version, "version"); + ParamGuard.notNullOrWhiteSpace(data, "data"); logger.debug("schemaCreate() called with: sourceId = [" + sourceId + "], schemaName = [" + schemaName + "], version = [" + version + "]" + " data = <" + data + ">" + " payment_handle = <" + paymentHandle + ">"); CompletableFuture future = new CompletableFuture(); int commandHandle = addFuture(future); From c79c6bd4ae9958ce92552b54177de40cbea1f3eb Mon Sep 17 00:00:00 2001 From: "artem.ivanov" Date: Tue, 20 Aug 2019 09:12:52 +0300 Subject: [PATCH 268/320] IS-1319: Added check that proof raw value match to encoded value into Libvcx. Signed-off-by: artem.ivanov --- vcx/libvcx/src/proof.rs | 91 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 87 insertions(+), 4 deletions(-) diff --git a/vcx/libvcx/src/proof.rs b/vcx/libvcx/src/proof.rs index 7801caca4f..1325ef785a 100644 --- a/vcx/libvcx/src/proof.rs +++ b/vcx/libvcx/src/proof.rs @@ -17,6 +17,7 @@ use utils::libindy::anoncreds; use utils::constants::DEFAULT_SERIALIZE_VERSION; use object_cache::ObjectCache; use error::prelude::*; +use utils::openssl::encode; lazy_static! { static ref PROOF_MAP: ObjectCache = Default::default(); @@ -61,6 +62,32 @@ impl Proof { Ok(error::SUCCESS.code_num) } + + pub fn validate_proof_revealed_attributes(&mut self, proof_json: &str) -> VcxResult<()> { + if settings::test_indy_mode_enabled() { return Ok(()); } + + let proof: Value = serde_json::from_str(proof_json) + .map_err(|err| VcxError::from_msg(VcxErrorKind::InvalidJson, format!("Cannot deserialize liibndy proof: {}", err)))?; + + let revealed_attrs = proof["requested_proof"]["revealed_attrs"] + .as_object() + .ok_or(VcxError::from_msg(VcxErrorKind::InvalidProof, "Cannot get Proof revealed attribute"))?; + + for (attr1_referent, info) in revealed_attrs.iter() { + let raw = info["raw"].as_str().ok_or(VcxError::from_msg(VcxErrorKind::InvalidProof, format!("Cannot get raw value for \"{}\" attribute", attr1_referent)))?; + let encoded_ = info["encoded"].as_str().ok_or(VcxError::from_msg(VcxErrorKind::InvalidProof, format!("Cannot get encoded value for \"{}\" attribute", attr1_referent)))?; + + let expected_encoded = encode(&raw)?; + + if expected_encoded != encoded_.to_string() { + self.proof_state = ProofStateType::ProofInvalid; + return Err(VcxError::from_msg(VcxErrorKind::InvalidProof, format!("Encoded values are different. Expected: {}. From Proof: {}", expected_encoded, encoded_))); + } + } + + Ok(()) + } + fn validate_proof_indy(&mut self, proof_req_json: &str, proof_json: &str, @@ -221,6 +248,8 @@ impl Proof { let proof_json = self.build_proof_json()?; let proof_req_json = self.build_proof_req_json()?; + self.validate_proof_revealed_attributes(&proof_json)?; + debug!("*******\n{}\n********", credential_defs_json); debug!("*******\n{}\n********", schemas_json); debug!("*******\n{}\n********", proof_json); @@ -311,10 +340,10 @@ impl Proof { None => { // Check cloud agent for pending messages let (_, message) = messages::get_message::get_ref_msg(&self.msg_uid, - &self.prover_did, - &self.prover_vk, - &self.agent_did, - &self.agent_vk)?; + &self.prover_did, + &self.prover_vk, + &self.agent_did, + &self.agent_vk)?; let (payload, thread) = Payloads::decrypt(&self.prover_vk, &message)?; @@ -1165,5 +1194,59 @@ mod tests { assert_eq!(proof.proof_state, ProofStateType::ProofValidated); } + #[cfg(feature = "pool_tests")] + #[test] + fn test_proof_validate_attribute() { + init!("ledger"); + let did = settings::get_config_value(settings::CONFIG_INSTITUTION_DID).unwrap(); + let (schemas, cred_defs, proof_req, proof_json) = ::utils::libindy::anoncreds::tests::create_proof(); + + let mut proof_req_obj = ProofRequestMessage::create(); + + proof_req_obj.proof_request_data = serde_json::from_str(&proof_req).unwrap(); + + let mut proof_msg = ProofMessage::new(); + let mut proof = create_boxed_proof(); + proof.proof_request = Some(proof_req_obj); + + // valid proof_obj + { + proof_msg.libindy_proof = proof_json.clone(); + proof.proof = Some(proof_msg); + + let rc = proof.proof_validation().unwrap(); + assert_eq!(proof.proof_state, ProofStateType::ProofValidated); + } + + let mut proof_obj: serde_json::Value = serde_json::from_str(&proof_json).unwrap(); + + // change Raw value + { + let mut proof_msg = ProofMessage::new(); + proof_obj["requested_proof"]["revealed_attrs"]["address1_1"]["raw"] = json!("Other Value"); + let proof_json = serde_json::to_string(&proof_obj).unwrap(); + + proof_msg.libindy_proof = proof_json; + proof.proof = Some(proof_msg); + + let rc = proof.proof_validation(); + rc.unwrap_err(); + assert_eq!(proof.get_proof_state(), ProofStateType::ProofInvalid as u32); + } + + // change Encoded value + { + let mut proof_msg = ProofMessage::new(); + proof_obj["requested_proof"]["revealed_attrs"]["address1_1"]["encoded"] = json!("1111111111111111111111111111111111111111111111111111111111"); + let proof_json = serde_json::to_string(&proof_obj).unwrap(); + + proof_msg.libindy_proof = proof_json; + proof.proof = Some(proof_msg); + + let rc = proof.proof_validation(); + rc.unwrap_err(); //FIXME check error code also + assert_eq!(proof.get_proof_state(), ProofStateType::ProofInvalid as u32); + } + } } From 7debaa881ddbf4110ec01c6c8f20edf305b9f938 Mon Sep 17 00:00:00 2001 From: "artem.ivanov" Date: Tue, 20 Aug 2019 11:02:43 +0300 Subject: [PATCH 269/320] IS-1356: Pool refresh doesn't throw timeout error in CLI Signed-off-by: artem.ivanov --- libindy/src/services/pool/pool.rs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/libindy/src/services/pool/pool.rs b/libindy/src/services/pool/pool.rs index 0e2dd7f22f..fd5d5c836f 100644 --- a/libindy/src/services/pool/pool.rs +++ b/libindy/src/services/pool/pool.rs @@ -304,8 +304,7 @@ impl> PoolSM { PoolState::Closed(state.into()) } PoolEvent::CatchupTargetNotFound(err) => { - let pc = PoolCommand::OpenAck(state.cmd_id, id, Err(err)); - CommandExecutor::instance().send(Command::Pool(pc)).unwrap(); + _send_open_refresh_ack(state.cmd_id, id, state.refresh,Err(err)); PoolState::Terminated(state.into()) } PoolEvent::CatchupRestart(merkle_tree) => { @@ -332,7 +331,7 @@ impl> PoolSM { PoolEvent::Synced(merkle) => { if let Ok((nodes, remotes)) = _get_nodes_and_remotes(&merkle) { state.networker.borrow_mut().process_event(Some(NetworkerEvent::NodesStateUpdated(remotes))); - _send_open_refresh_ack(state.cmd_id, id, state.refresh); + _send_open_refresh_ack(state.cmd_id, id, state.refresh, Ok(())); PoolState::Active((state, nodes).into()) } else { PoolState::Terminated(state.into()) @@ -440,7 +439,7 @@ impl> PoolSM { PoolEvent::Synced(merkle) => { if let Ok((nodes, remotes)) = _get_nodes_and_remotes(&merkle).map_err(map_err_err!()) { state.networker.borrow_mut().process_event(Some(NetworkerEvent::NodesStateUpdated(remotes))); - _send_open_refresh_ack(state.cmd_id, id, state.refresh); + _send_open_refresh_ack(state.cmd_id, id, state.refresh, Ok(())); PoolState::Active((state, nodes).into()) } else { PoolState::Terminated(state.into()) @@ -721,12 +720,12 @@ fn _send_submit_ack(cmd_id: CommandHandle, res: IndyResult) { CommandExecutor::instance().send(Command::Ledger(lc)).unwrap(); } -fn _send_open_refresh_ack(cmd_id: CommandHandle, id: PoolHandle, is_refresh: bool) { +fn _send_open_refresh_ack(cmd_id: CommandHandle, id: PoolHandle, is_refresh: bool, res: IndyResult<()>) { trace!("PoolSM: from getting catchup target to active"); let pc = if is_refresh { - PoolCommand::RefreshAck(cmd_id, Ok(())) + PoolCommand::RefreshAck(cmd_id, res) } else { - PoolCommand::OpenAck(cmd_id, id, Ok(())) + PoolCommand::OpenAck(cmd_id, id, res) }; CommandExecutor::instance().send(Command::Pool(pc)).unwrap(); } From 1797fe91a9abb9c3e465d3e0a86edbaf26f13135 Mon Sep 17 00:00:00 2001 From: Axel Nennker Date: Tue, 20 Aug 2019 10:48:37 +0200 Subject: [PATCH 270/320] fix IS-1274 double-reference Signed-off-by: Axel Nennker --- libindy/src/services/wallet/storage/default/mod.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libindy/src/services/wallet/storage/default/mod.rs b/libindy/src/services/wallet/storage/default/mod.rs index 810771a0a7..b9ae860d1c 100644 --- a/libindy/src/services/wallet/storage/default/mod.rs +++ b/libindy/src/services/wallet/storage/default/mod.rs @@ -294,7 +294,7 @@ impl WalletStorage for SQLiteStorage { let value = if options.retrieve_value { Some(EncryptedValue::new(item.1, item.2)) } else { None }; - let type_ = if options.retrieve_type { Some(type_.clone()) } else { None }; + let type_ = if options.retrieve_type { Some(type_.to_vec()) } else { None }; let tags = if options.retrieve_tags { let mut tags = Vec::new(); @@ -316,7 +316,7 @@ impl WalletStorage for SQLiteStorage { Some(tags) } else { None }; - Ok(StorageRecord::new(id.to_vec(), value, type_.map(|val| val.to_vec()), tags)) + Ok(StorageRecord::new(id.to_vec(), value, type_, tags)) } /// From 7bc17f4060c8218b591edf10ea7fc6bf7d2151e9 Mon Sep 17 00:00:00 2001 From: Axel Nennker Date: Tue, 20 Aug 2019 10:48:57 +0200 Subject: [PATCH 271/320] Cargo.lock update Signed-off-by: Axel Nennker --- libindy/Cargo.lock | 446 +++++++++++++++++++++++++-------------------- 1 file changed, 249 insertions(+), 197 deletions(-) diff --git a/libindy/Cargo.lock b/libindy/Cargo.lock index f77e68fc01..25423d3332 100644 --- a/libindy/Cargo.lock +++ b/libindy/Cargo.lock @@ -2,7 +2,7 @@ # It is not intended for manual editing. [[package]] name = "aho-corasick" -version = "0.7.4" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -25,16 +25,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "android_log-sys 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "argon2rs" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", - "scoped_threadpool 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -61,7 +52,7 @@ dependencies = [ [[package]] name = "autocfg" -version = "0.1.5" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -72,7 +63,7 @@ dependencies = [ "backtrace-sys 0.1.30 (registry+https://github.com/rust-lang/crates.io-index)", "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-demangle 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-demangle 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -94,6 +85,14 @@ dependencies = [ "safemem 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "base64" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "bitflags" version = "1.1.0" @@ -107,14 +106,15 @@ dependencies = [ "byte-tools 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "crypto-mac 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "digest 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", - "opaque-debug 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "opaque-debug 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "blake2-rfc" -version = "0.2.18" +name = "blake2b_simd" +version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ + "arrayref 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", "arrayvec 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", "constant_time_eq 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -140,18 +140,18 @@ dependencies = [ [[package]] name = "bstr" -version = "0.2.2" +version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-automata 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.97 (registry+https://github.com/rust-lang/crates.io-index)", + "regex-automata 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "bumpalo" -version = "2.5.0" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -186,7 +186,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-width 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -229,11 +229,11 @@ dependencies = [ "rand_xoshiro 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "rayon 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "rayon-core 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.97 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.97 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", "tinytemplate 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "walkdir 2.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "walkdir 2.2.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -251,21 +251,21 @@ name = "crossbeam-deque" version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "crossbeam-epoch 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-epoch 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "crossbeam-epoch" -version = "0.7.1" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "arrayvec 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "memoffset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "memoffset 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "scopeguard 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -273,12 +273,12 @@ name = "crossbeam-queue" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "crossbeam-utils" -version = "0.6.5" +version = "0.6.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", @@ -299,11 +299,11 @@ name = "csv" version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "bstr 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "bstr 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)", "csv-core 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", "ryu 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.97 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -316,14 +316,14 @@ dependencies = [ [[package]] name = "curve25519-dalek" -version = "1.2.1" +version = "1.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "clear_on_drop 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "digest 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "subtle 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "subtle 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -345,7 +345,7 @@ dependencies = [ "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", "strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.39 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -355,7 +355,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "darling_core 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.39 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -365,7 +365,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.39 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -382,7 +382,7 @@ version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_users 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_users 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -392,7 +392,7 @@ version = "1.0.0-pre.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "clear_on_drop 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "curve25519-dalek 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "curve25519-dalek 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", "sha2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -415,8 +415,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "atty 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)", "humantime 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "termcolor 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -476,7 +476,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.39 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)", "synstructure 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -563,11 +563,11 @@ dependencies = [ "indy-sys 1.11.0", "lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "num-derive 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.97 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.97 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -576,8 +576,8 @@ name = "indy-sys" version = "1.11.0" dependencies = [ "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", - "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "vcpkg 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -641,7 +641,7 @@ dependencies = [ "int_traits 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "log-derive 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "log-panics 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "named_type 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -652,8 +652,8 @@ dependencies = [ "rmp-serde 0.13.7 (registry+https://github.com/rust-lang/crates.io-index)", "rusqlite 0.19.0 (registry+https://github.com/rust-lang/crates.io-index)", "rust-base58 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.97 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.97 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", "sha2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "sha3 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -662,7 +662,7 @@ dependencies = [ "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", "ursa 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "uuid 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "zeroize 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)", + "zeroize 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)", "zmq 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -672,7 +672,7 @@ version = "0.0.16" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", - "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -681,7 +681,7 @@ version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cc 1.0.26 (registry+https://github.com/rust-lang/crates.io-index)", - "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", "vcpkg 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -692,7 +692,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "log" -version = "0.4.7" +version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", @@ -704,10 +704,10 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "darling 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.39 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -715,7 +715,7 @@ name = "log-panics" version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -736,8 +736,11 @@ dependencies = [ [[package]] name = "memoffset" -version = "0.2.1" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", +] [[package]] name = "metadeps" @@ -745,7 +748,7 @@ version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "error-chain 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", - "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", "toml 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -796,7 +799,7 @@ name = "num-complex" version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "autocfg 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -807,7 +810,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.39 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -815,7 +818,7 @@ name = "num-integer" version = "0.1.41" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "autocfg 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -824,7 +827,7 @@ name = "num-iter" version = "0.1.39" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "autocfg 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -834,7 +837,7 @@ name = "num-rational" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "autocfg 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "num-bigint 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", @@ -853,7 +856,7 @@ name = "num-traits" version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "autocfg 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -866,7 +869,7 @@ dependencies = [ [[package]] name = "opaque-debug" -version = "0.2.2" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -879,18 +882,18 @@ dependencies = [ "foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl-sys 0.9.48 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl-sys 0.9.49 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "openssl-sys" -version = "0.9.48" +version = "0.9.49" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "autocfg 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "cc 1.0.26 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", - "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", "vcpkg 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -904,7 +907,7 @@ dependencies = [ [[package]] name = "pkg-config" -version = "0.3.14" +version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -915,6 +918,14 @@ dependencies = [ "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "proc-macro2" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "quick-error" version = "1.2.2" @@ -933,6 +944,14 @@ dependencies = [ "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "quote" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "rand" version = "0.3.23" @@ -959,10 +978,10 @@ name = "rand" version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "autocfg 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", "rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "rand_hc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand_isaac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "rand_jitter 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", @@ -977,7 +996,7 @@ name = "rand_chacha" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "autocfg 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -986,12 +1005,12 @@ name = "rand_core" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rand_core" -version = "0.4.0" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -1016,7 +1035,7 @@ version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1028,9 +1047,9 @@ dependencies = [ "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1039,8 +1058,8 @@ name = "rand_pcg" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "autocfg 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1077,7 +1096,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "crossbeam-deque 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", "crossbeam-queue 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "num_cpus 1.10.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1097,30 +1116,29 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "redox_users" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "argon2rs 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "rand_os 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)", + "rust-argon2 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "regex" -version = "1.1.9" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "aho-corasick 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)", + "aho-corasick 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)", "memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-syntax 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)", + "regex-syntax 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", "thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", - "utf8-ranges 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "regex-automata" -version = "0.1.7" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1128,11 +1146,8 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.6.8" +version = "0.6.11" source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "ucd-util 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", -] [[package]] name = "rmp" @@ -1150,7 +1165,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "rmp 0.8.7 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.97 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1167,6 +1182,16 @@ dependencies = [ "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "rust-argon2" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", + "blake2b_simd 0.5.7 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "rust-base58" version = "0.0.4" @@ -1177,9 +1202,17 @@ dependencies = [ [[package]] name = "rustc-demangle" -version = "0.1.15" +version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "rustc_version" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "ryu" version = "1.0.0" @@ -1198,14 +1231,9 @@ dependencies = [ "winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "scoped_threadpool" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "scopeguard" -version = "0.3.3" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -1215,22 +1243,35 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cc 1.0.26 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.97 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "semver" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "semver-parser" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "serde" -version = "1.0.97" +version = "1.0.99" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "serde_derive" -version = "1.0.97" +version = "1.0.99" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.39 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1240,7 +1281,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", "ryu 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.97 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1251,7 +1292,7 @@ dependencies = [ "block-buffer 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", "digest 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "fake-simd 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "opaque-debug 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "opaque-debug 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1263,7 +1304,7 @@ dependencies = [ "byte-tools 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "digest 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "keccak 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "opaque-debug 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "opaque-debug 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1273,7 +1314,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", "libsodium-sys 0.0.16 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.97 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1293,7 +1334,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "subtle" -version = "2.1.0" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -1308,7 +1349,7 @@ dependencies = [ [[package]] name = "syn" -version = "0.15.39" +version = "0.15.44" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1316,6 +1357,16 @@ dependencies = [ "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "syn" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "synom" version = "0.11.3" @@ -1331,7 +1382,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.39 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1340,7 +1391,7 @@ name = "termcolor" version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "wincolor 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "wincolor 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1348,7 +1399,7 @@ name = "textwrap" version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-width 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1382,7 +1433,7 @@ name = "tinytemplate" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "serde 1.0.97 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1396,14 +1447,9 @@ name = "typenum" version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "ucd-util" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "unicode-width" -version = "0.1.5" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -1416,6 +1462,11 @@ name = "unicode-xid" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "unicode-xid" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "ursa" version = "0.1.1" @@ -1430,13 +1481,13 @@ dependencies = [ "generic-array 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)", "int_traits 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "openssl 0.10.24 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", "rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "secp256k1 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.97 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.97 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", "sha2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "sha3 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1444,11 +1495,6 @@ dependencies = [ "zeroize 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "utf8-ranges" -version = "1.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "uuid" version = "0.5.1" @@ -1464,7 +1510,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "walkdir" -version = "2.2.8" +version = "2.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "same-file 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1474,50 +1520,51 @@ dependencies = [ [[package]] name = "wasm-bindgen" -version = "0.2.48" +version = "0.2.50" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "wasm-bindgen-macro 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-macro 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "wasm-bindgen-backend" -version = "0.2.48" +version = "0.2.50" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "bumpalo 2.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "bumpalo 2.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.39 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-shared 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-shared 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "wasm-bindgen-macro" -version = "0.2.48" +version = "0.2.50" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-macro-support 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-macro-support 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.48" +version = "0.2.50" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.39 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-backend 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-shared 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-backend 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-shared 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.48" +version = "0.2.50" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -1549,7 +1596,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "wincolor" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1563,20 +1610,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "zeroize" -version = "0.9.2" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "zeroize_derive 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "zeroize_derive 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "zeroize_derive" -version = "0.9.0" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.39 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)", "synstructure 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1586,7 +1633,7 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "zmq-sys 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1600,25 +1647,25 @@ dependencies = [ ] [metadata] -"checksum aho-corasick 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)" = "36b7aa1ccb7d7ea3f437cf025a2ab1c47cc6c1bc9fc84918ff449def12f5e282" +"checksum aho-corasick 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)" = "58fb5e95d83b38284460a5fda7d6470aa0b8844d283a0b614b8535e880800d2d" "checksum amcl 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee5cca1ddc8b9dceb55b7f1272a9d1e643d73006f350a20ab4926d24e33f0f0d" "checksum android_log-sys 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b8052e2d8aabbb8d556d6abbcce2a22b9590996c5f849b9c7ce4544a2e3b984e" "checksum android_logger 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "86983875e7c3a202e31471cc6d60fcc18f30e194f1729cfff3bfb43d646ffced" -"checksum argon2rs 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "3f67b0b6a86dae6e67ff4ca2b6201396074996379fba2b92ff649126f37cb392" "checksum arrayref 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "0d382e583f07208808f6b1249e60848879ba3543f57c32277bf52d69c2f0f0ee" "checksum arrayvec 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)" = "b8d73f9beda665eaa98ab9e4f7442bd4e7de6652587de55b2525e52e29c1b0ba" "checksum atty 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)" = "1803c647a3ec87095e7ae7acfca019e98de5ec9a7d01343f611cf3152ed71a90" -"checksum autocfg 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "22130e92352b948e7e82a49cdb0aa94f2211761117f29e052dd397c1ac33542b" +"checksum autocfg 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "b671c8fb71b457dd4ae18c4ba1e59aa81793daacc361d82fcd410cef0d491875" "checksum backtrace 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)" = "18b65ea1161bfb2dd6da6fade5edd4dbd08fba85012123dd333d2fd1b90b2782" "checksum backtrace-sys 0.1.30 (registry+https://github.com/rust-lang/crates.io-index)" = "5b3a000b9c543553af61bc01cbfc403b04b5caa9e421033866f2e98061eb3e61" +"checksum base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0b25d992356d2eb0ed82172f5248873db5560c4721f564b13cb5193bda5e668e" "checksum base64 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "96434f987501f0ed4eb336a411e0631ecd1afa11574fe148587adc4ff96143c9" "checksum bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3d155346769a6855b86399e9bc3814ab343cd3d62c7e985113d46a0ec3c281fd" "checksum blake2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "91721a6330935673395a0607df4d49a9cb90ae12d259f1b3e0a3f6e1d486872e" -"checksum blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)" = "5d6d530bdd2d52966a6d03b7a964add7ae1a288d25214066fd4b600f0f796400" +"checksum blake2b_simd 0.5.7 (registry+https://github.com/rust-lang/crates.io-index)" = "bf775a81bb2d464e20ff170ac20316c7b08a43d11dbc72f0f82e8e8d3d6d0499" "checksum block-buffer 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c0940dc441f31689269e10ac70eb1002a3a1d3ad1390e030043662eb7fe4688b" "checksum block-padding 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "6d4dc3af3ee2e12f3e5d224e5e1e3d73668abbeb69e566d361f7d5563a4fdf09" -"checksum bstr 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "fc0662252f9bba48c251a16d16a768b9fcd959593bde07544710bce6efe60b7a" -"checksum bumpalo 2.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2cd43d82f27d68911e6ee11ee791fb248f138f5d69424dc02e098d4f152b0b05" +"checksum bstr 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "94cdf78eb7e94c566c1f5dbe2abf8fc70a548fc902942a48c4b3a98b48ca9ade" +"checksum bumpalo 2.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ad807f2fc2bf185eeb98ff3a901bd46dc5ad58163d0fa4577ba0d25674d71708" "checksum byte-tools 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7" "checksum byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a7c3dd8985a7111efc5c80b44e23ecdd8c007de8ade3b96595387e812b957cf5" "checksum cast 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "926013f2860c46252efceabb19f4a6b308197505082c609025aa6706c011d427" @@ -1631,13 +1678,13 @@ dependencies = [ "checksum criterion 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "0363053954f3e679645fc443321ca128b7b950a6fe288cf5f9335cc22ee58394" "checksum criterion-plot 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "76f9212ddf2f4a9eb2d401635190600656a1f88a932ef53d06e7fa4c7e02fb8e" "checksum crossbeam-deque 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "05e44b8cf3e1a625844d1750e1f7820da46044ff6d28f4d43e455ba3e5bb2c13" -"checksum crossbeam-epoch 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "04c9e3102cc2d69cd681412141b390abd55a362afc1540965dad0ad4d34280b4" +"checksum crossbeam-epoch 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "fedcd6772e37f3da2a9af9bf12ebe046c0dfe657992377b4df982a2b54cd37a9" "checksum crossbeam-queue 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7c979cd6cfe72335896575c6b5688da489e420d36a27a0b9eb0c73db574b4a4b" -"checksum crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "f8306fcef4a7b563b76b7dd949ca48f52bc1141aa067d2ea09565f3e2652aa5c" +"checksum crossbeam-utils 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)" = "04973fa96e96579258a5091af6003abde64af786b860f18622b82e026cca60e6" "checksum crypto-mac 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4434400df11d95d556bac068ddfedd482915eb18fe8bea89bc80b6e4b1c179e5" "checksum csv 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "37519ccdfd73a75821cac9319d4fce15a81b9fcf75f951df5b9988aa3a0af87d" "checksum csv-core 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "9b5cadb6b25c77aeff80ba701712494213f4a8418fcda2ee11b6560c3ad0bf4c" -"checksum curve25519-dalek 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "5d4b820e8711c211745880150f5fac78ab07d6e3851d8ce9f5a02cedc199174c" +"checksum curve25519-dalek 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8b7dcd30ba50cdf88b55b033456138b7c0ac4afdc436d82e1b79f370f24cc66d" "checksum darling 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fcfbcb0c5961907597a7d1148e3af036268f2b773886b8bb3eeb1e1281d3d3d6" "checksum darling_core 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6afc018370c3bff3eb51f89256a6bdb18b4fdcda72d577982a14954a7a0b402c" "checksum darling_macro 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c6d8dac1c6f1d29a41c4712b4400f878cb4fcc4c7628f298dd75038e024998d1" @@ -1678,12 +1725,12 @@ dependencies = [ "checksum libsodium-sys 0.0.16 (registry+https://github.com/rust-lang/crates.io-index)" = "fcbd1beeed8d44caa8a669ebaa697c313976e242c03cc9fb23d88bf1656f5542" "checksum libsqlite3-sys 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)" = "72b1e07fcc60484f42e246f0cf1f133940c98117c81b2cefcdf71be288069680" "checksum linked-hash-map 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "ae91b68aebc4ddb91978b11a1b02ddd8602a05ec19002801c5666000e05e0f83" -"checksum log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)" = "c275b6ad54070ac2d665eef9197db647b32239c9d244bfb6f041a766d00da5b3" +"checksum log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)" = "14b6052be84e6b71ab17edffc2eeabf5c2c3ae1fdb464aae35ac50c67a44e1f7" "checksum log-derive 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "90b7e153f2d4bf69d46a9e640e2c96573940fca671d275bf6f7687f6bab803fc" "checksum log-panics 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ae0136257df209261daa18d6c16394757c63e032e27aafd8b07788b051082bef" "checksum lru-cache 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "31e24f1ad8321ca0e8a1e0ac13f23cb668e6f5466c2c57319f6a5cf1cc8e3b1c" "checksum memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "88579771288728879b57485cc7d6b07d648c9f0141eb955f8ab7f9d45394468e" -"checksum memoffset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0f9dc261e2b62d7a622bf416ea3c5245cdd5d9a7fcc428c0d06804dfce1775b3" +"checksum memoffset 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ce6075db033bbbb7ee5a0bbd3a3186bbae616f57fb001c485c7ff77955f8177f" "checksum metadeps 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "73b122901b3a675fac8cecf68dcb2f0d3036193bc861d1ac0e1c337f7d5254c2" "checksum named_type 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c39ac6c5ee13bf558879a82198b0afe84989cf3f7fb7592b56d73eb1a50c9e66" "checksum named_type_derive 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "651d7e408d728ded66748986dc046156dbc7bd25add9ea334bcf762c7a83e14a" @@ -1698,21 +1745,23 @@ dependencies = [ "checksum num-traits 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)" = "92e5113e9fd4cc14ded8e499429f396a20f98c772a47cc8622a736e1ec843c31" "checksum num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "6ba9a427cfca2be13aa6f6403b0b7e7368fe982bfa16fccc450ce74c46cd9b32" "checksum num_cpus 1.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "bcef43580c035376c0705c42792c294b66974abbfd2789b511784023f71f3273" -"checksum opaque-debug 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "93f5bb2e8e8dec81642920ccff6b61f1eb94fa3020c5a325c9851ff604152409" +"checksum opaque-debug 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c" "checksum openssl 0.10.24 (registry+https://github.com/rust-lang/crates.io-index)" = "8152bb5a9b5b721538462336e3bef9a539f892715e5037fda0f984577311af15" -"checksum openssl-sys 0.9.48 (registry+https://github.com/rust-lang/crates.io-index)" = "b5ba300217253bcc5dc68bed23d782affa45000193866e025329aa8a7a9f05b8" +"checksum openssl-sys 0.9.49 (registry+https://github.com/rust-lang/crates.io-index)" = "f4fad9e54bd23bd4cbbe48fdc08a1b8091707ac869ef8508edea2fec77dcc884" "checksum owning_ref 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "49a4b8ea2179e6a2e27411d3bca09ca6dd630821cf6894c6c7c8467a8ee7ef13" -"checksum pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)" = "676e8eb2b1b4c9043511a9b7bea0915320d7e502b0a079fb03f9635a5252b18c" +"checksum pkg-config 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "a7c1d2cfa5a714db3b5f24f0915e74fcdf91d09d496ba61329705dda7774d2af" "checksum proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)" = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759" +"checksum proc-macro2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4c5c2380ae88876faae57698be9e9775e3544decad214599c3a6266cca6ac802" "checksum quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9274b940887ce9addde99c4eee6b5c44cc494b182b97e73dc8ffdcb3397fd3f0" "checksum quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a" "checksum quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)" = "6ce23b6b870e8f94f81fb0a363d65d86675884b34a09043c81e5562f11c1f8e1" +"checksum quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "053a8c8bcc71fcce321828dc897a98ab9760bef03a4fc36693c231e5b3216cfe" "checksum rand 0.3.23 (registry+https://github.com/rust-lang/crates.io-index)" = "64ac302d8f83c0c1974bf758f6b041c6c8ada916fbb44a609158ca8b064cc76c" "checksum rand 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "552840b97013b1a26992c11eac34bdd778e464601a4c2054b5f0bff7c6761293" "checksum rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "6d71dacdc3c88c1fde3885a3be3fbab9f35724e6ce99467f7d9c5026132184ca" "checksum rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "556d3a1ca6600bfcbab7c7c91ccb085ac7fbbcd70e008a98742e7847f4f7bcef" "checksum rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b" -"checksum rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d0e7a549d590831370895ab7ba4ea0c1b6b011d106b5ff2da6eee112615e6dc0" +"checksum rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc" "checksum rand_hc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7b40677c7be09ae76218dc623efbf7b18e34bced3f38883af07bb75630a21bc4" "checksum rand_isaac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ded997c9d5f13925be2a6fd7e66bf1872597f759fd9dd93513dd7e92e5a5ee08" "checksum rand_jitter 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "1166d5c91dc97b88d1decc3285bb0a99ed84b05cfd0bc2341bdf2d43fc41e39b" @@ -1724,23 +1773,26 @@ dependencies = [ "checksum rayon-core 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ebbe0df8435ac0c397d467b6cad6d25543d06e8a019ef3f6af3c384597515bd2" "checksum rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2" "checksum redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)" = "2439c63f3f6139d1b57529d16bc3b8bb855230c8efcc5d3a896c8bea7c3b1e84" -"checksum redox_users 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3fe5204c3a17e97dde73f285d49be585df59ed84b50a872baf416e73b62c3828" -"checksum regex 1.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "d9d8297cc20bbb6184f8b45ff61c8ee6a9ac56c156cec8e38c3e5084773c44ad" -"checksum regex-automata 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "3ed09217220c272b29ef237a974ad58515bde75f194e3ffa7e6d0bf0f3b01f86" -"checksum regex-syntax 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)" = "9b01330cce219c1c6b2e209e5ed64ccd587ae5c67bed91c0b49eecf02ae40e21" +"checksum redox_users 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4ecedbca3bf205f8d8f5c2b44d83cd0690e39ee84b951ed649e9f1841132b66d" +"checksum regex 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "88c3d9193984285d544df4a30c23a4e62ead42edf70a4452ceb76dac1ce05c26" +"checksum regex-automata 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "92b73c2a1770c255c240eaa4ee600df1704a38dc3feaa6e949e7fcd4f8dc09f9" +"checksum regex-syntax 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)" = "b143cceb2ca5e56d5671988ef8b15615733e7ee16cd348e064333b251b89343f" "checksum rmp 0.8.7 (registry+https://github.com/rust-lang/crates.io-index)" = "a3d45d7afc9b132b34a2479648863aa95c5c88e98b32285326a6ebadc80ec5c9" "checksum rmp-serde 0.13.7 (registry+https://github.com/rust-lang/crates.io-index)" = "011e1d58446e9fa3af7cdc1fb91295b10621d3ac4cb3a85cc86385ee9ca50cd3" "checksum rusqlite 0.19.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6ebca2e7e3deb7241b7fa5929c088548c590728b1b740c479594c23f813eb8a7" +"checksum rust-argon2 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4ca4eaef519b494d1f2848fc602d18816fed808a981aedf4f1f00ceb7c9d32cf" "checksum rust-base58 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "b313b91fcdc6719ad41fa2dad2b7e810b03833fae4bf911950e15529a5f04439" -"checksum rustc-demangle 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)" = "a7f4dccf6f4891ebcc0c39f9b6eb1a83b9bf5d747cb439ec6fba4f3b977038af" +"checksum rustc-demangle 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "4c691c0e608126e00913e33f0ccf3727d5fc84573623b8d65b2df340b5201783" +"checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" "checksum ryu 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c92464b447c0ee8c4fb3824ecc8383b81717b9f1e74ba2e72540aef7b9f82997" "checksum safemem 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e27a8b19b835f7aea908818e871f5cc3a5a186550c30773be987e155e8163d8f" "checksum same-file 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "585e8ddcedc187886a30fa705c47985c3fa88d06624095856b36ca0b82ff4421" -"checksum scoped_threadpool 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "1d51f5df5af43ab3f1360b429fa5e0152ac5ce8c0bd6485cae490332e96846a8" -"checksum scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "94258f53601af11e6a49f722422f6e3425c52b06245a5cf9bc09908b174f5e27" +"checksum scopeguard 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b42e15e59b18a828bbf5c58ea01debb36b9b096346de35d941dcb89009f24a0d" "checksum secp256k1 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)" = "bfaccd3a23619349e0878d9a241f34b1982343cdf67367058cd7d078d326b63e" -"checksum serde 1.0.97 (registry+https://github.com/rust-lang/crates.io-index)" = "d46b3dfedb19360a74316866cef04687cd4d6a70df8e6a506c63512790769b72" -"checksum serde_derive 1.0.97 (registry+https://github.com/rust-lang/crates.io-index)" = "c22a0820adfe2f257b098714323563dd06426502abbbce4f51b72ef544c5027f" +"checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" +"checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" +"checksum serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)" = "fec2851eb56d010dc9a21b89ca53ee75e6528bab60c11e89d38390904982da9f" +"checksum serde_derive 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)" = "cb4dc18c61206b08dc98216c98faa0232f4337e1e1b8574551d5bad29ea1b425" "checksum serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)" = "051c49229f282f7c6f3813f8286cc1e3323e8051823fce42c7ea80fe13521704" "checksum sha2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7b4d8bfd0e469f417657573d8451fb33d16cfe0989359b93baf3a1ffc639543d" "checksum sha3 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dd26bc0e7a2e3a7c959bc494caf58b72ee0c71d67704e9520f736ca7e4853ecf" @@ -1748,9 +1800,10 @@ dependencies = [ "checksum stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dba1a27d3efae4351c8051072d619e3ade2820635c3958d826bfea39d59b54c8" "checksum strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bb4f380125926a99e52bc279241539c018323fab05ad6368b56f93d9369ff550" "checksum subtle 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2d67a5a62ba6e01cb2192ff309324cb4875d0c451d55fe2319433abe7a05a8ee" -"checksum subtle 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "01dca13cf6c3b179864ab3292bd794e757618d35a7766b7c46050c614ba00829" +"checksum subtle 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "01f40907d9ffc762709e4ff3eb4a6f6b41b650375a3f09ac92b641942b7fb082" "checksum syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)" = "d3b891b9015c88c576343b9b3e41c2c11a51c219ef067b264bd9c8aa9b441dad" -"checksum syn 0.15.39 (registry+https://github.com/rust-lang/crates.io-index)" = "b4d960b829a55e56db167e861ddb43602c003c7be0bee1d345021703fac2fb7c" +"checksum syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)" = "9ca4b3b69a77cbe1ffc9e198781b7acb0c7365a883670e8f1c1bc66fba79a5c5" +"checksum syn 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "158521e6f544e7e3dcfc370ac180794aa38cb34a1b1e07609376d4adcf429b93" "checksum synom 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a393066ed9010ebaed60b9eafa373d4b1baac186dd7e008555b0f702b51945b6" "checksum synstructure 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)" = "02353edf96d6e4dc81aea2d8490a7e9db177bf8acb0e951c24940bf866cb313f" "checksum termcolor 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "96d6098003bde162e4277c70665bd87c326f5a0c3f3fbfb285787fa482d54e6e" @@ -1761,27 +1814,26 @@ dependencies = [ "checksum tinytemplate 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4574b75faccaacddb9b284faecdf0b544b80b6b294f3d062d325c5726a209c20" "checksum toml 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "736b60249cb25337bc196faa43ee12c705e426f3d55c214d73a4e7be06f92cb4" "checksum typenum 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "612d636f949607bdf9b123b4a6f6d966dedf3ff669f7f045890d3a4a73948169" -"checksum ucd-util 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "535c204ee4d8434478593480b8f86ab45ec9aae0e83c568ca81abf0fd0e88f86" -"checksum unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "882386231c45df4700b275c7ff55b6f3698780a650026380e72dabe76fa46526" +"checksum unicode-width 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "7007dbd421b92cc6e28410fe7362e2e0a2503394908f417b68ec8d1c364c4e20" "checksum unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f860d7d29cf02cb2f3f359fd35991af3d30bac52c57d265a3c461074cb4dc" "checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" +"checksum unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c" "checksum ursa 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9081683a6861bee60c4005c280dafd50c6ee9c2ffd14935865f72658e5f2d9f8" -"checksum utf8-ranges 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "9d50aa7650df78abf942826607c62468ce18d9019673d4a2ebe1865dbb96ffde" "checksum uuid 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "bcc7e3b898aa6f6c08e5295b6c89258d1331e9ac578cc992fb818759951bdc22" "checksum vcpkg 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "33dd455d0f96e90a75803cfeb7f948768c08d70a6de9a8d2362461935698bf95" -"checksum walkdir 2.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "c7904a7e2bb3cdf0cf5e783f44204a85a37a93151738fa349f06680f59a98b45" -"checksum wasm-bindgen 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)" = "4de97fa1806bb1a99904216f6ac5e0c050dc4f8c676dc98775047c38e5c01b55" -"checksum wasm-bindgen-backend 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)" = "5d82c170ef9f5b2c63ad4460dfcee93f3ec04a9a36a4cc20bc973c39e59ab8e3" -"checksum wasm-bindgen-macro 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)" = "f07d50f74bf7a738304f6b8157f4a581e1512cd9e9cdb5baad8c31bbe8ffd81d" -"checksum wasm-bindgen-macro-support 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)" = "95cf8fe77e45ba5f91bc8f3da0c3aa5d464b3d8ed85d84f4d4c7cc106436b1d7" -"checksum wasm-bindgen-shared 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)" = "d9c2d4d4756b2e46d3a5422e06277d02e4d3e1d62d138b76a4c681e925743623" +"checksum walkdir 2.2.9 (registry+https://github.com/rust-lang/crates.io-index)" = "9658c94fa8b940eab2250bd5a457f9c48b748420d71293b165c8cdbe2f55f71e" +"checksum wasm-bindgen 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)" = "dcddca308b16cd93c2b67b126c688e5467e4ef2e28200dc7dfe4ae284f2faefc" +"checksum wasm-bindgen-backend 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)" = "f805d9328b5fc7e5c6399960fd1889271b9b58ae17bdb2417472156cc9fafdd0" +"checksum wasm-bindgen-macro 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)" = "3ff88201a482abfc63921621f6cb18eb1efd74f136b05e5841e7f8ca434539e9" +"checksum wasm-bindgen-macro-support 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)" = "6a433d89ecdb9f77d46fcf00c8cf9f3467b7de9954d8710c175f61e2e245bb0e" +"checksum wasm-bindgen-shared 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)" = "d41fc1bc3570cdf8d108c15e014045fd45a95bb5eb36605f96a90461fc34027d" "checksum winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)" = "f10e386af2b13e47c89e7236a7a14a086791a2b88ebad6df9bf42040195cf770" "checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" "checksum winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7168bab6e1daee33b4557efd0e95d5ca70a03706d39fa5f3fe7a236f584b03c9" "checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" -"checksum wincolor 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "561ed901ae465d6185fa7864d63fbd5720d0ef718366c9a4dc83cf6170d7e9ba" +"checksum wincolor 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "96f5016b18804d24db43cebf3c77269e7569b8954a8464501c216cc5e070eaa9" "checksum zeroize 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "8ddfeb6eee2fb3b262ef6e0898a52b7563bb8e0d5955a313b3cf2f808246ea14" -"checksum zeroize 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4177936c03b5a349c1b8e4509c46add268e66bc66fe92663729fa0570fe4f213" -"checksum zeroize_derive 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "afd1469e4bbca3b96606d26ba6e9bd6d3aed3b1299c82b92ec94377d22d78dbc" +"checksum zeroize 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)" = "45af6a010d13e4cf5b54c94ba5a2b2eba5596b9e46bf5875612d332a1f2b3f86" +"checksum zeroize_derive 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)" = "080616bd0e31f36095288bb0acdf1f78ef02c2fa15527d7e993f2a6c7591643e" "checksum zmq 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8ff1c5e9ff4ac9c2847b2e72ada1c1eb3e188adb49fe3f1dd3bbcdc47f414d17" "checksum zmq-sys 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)" = "4b770cf495ad41e920ab25c465f35b7eec09d0ce8d7c892a7c8334a5e0de037c" From 801c9db840c1de7dcb98e325d575ff5f0382f245 Mon Sep 17 00:00:00 2001 From: "artem.ivanov" Date: Tue, 20 Aug 2019 10:01:19 +0300 Subject: [PATCH 272/320] Liibndy test cleaning Signed-off-by: artem.ivanov --- Jenkinsfile.cd | 2 +- Jenkinsfile.ci | 6 +++--- libindy/tests/demo.rs | 15 +++++++++++---- libindy/tests/interaction.rs | 18 +++++++++--------- libindy/tests/wallet.rs | 13 +++++++------ 5 files changed, 31 insertions(+), 23 deletions(-) diff --git a/Jenkinsfile.cd b/Jenkinsfile.cd index 7bc8f2fa46..3eeaf3267e 100644 --- a/Jenkinsfile.cd +++ b/Jenkinsfile.cd @@ -350,7 +350,7 @@ def linuxLibindyBuild(file, env_name, network_name, stashBuildResults, full_test echo "${env_name} Libindy Test: Test" testEnv.inside("--network=${network_name}") { - def features_args = full_testing ? "--features sodium_static" : "--features 'sodium_static only_high_cases'" + def features_args = full_testing ? "--features sodium_static" : "--features \"sodium_static only_high_cases\"" sh """ cd libindy diff --git a/Jenkinsfile.ci b/Jenkinsfile.ci index a01a96ffde..55cf298c77 100644 --- a/Jenkinsfile.ci +++ b/Jenkinsfile.ci @@ -84,7 +84,7 @@ def windowsTesting() { "RUST_BACKTRACE=1" ]) { bat "cargo build --features fatal_warnings" - bat 'cargo test --no-run --features "only_high_cases"' + bat 'cargo test --no-run --features only_high_cases' echo "Windows Libindy before Test: Deleting %TEMP\\indy_client" bat "DEL /S /Q /F %TEMP%\\indy_client" @@ -96,7 +96,7 @@ def windowsTesting() { "RUST_LOG=indy::=debug,zmq=trace", "TEST_POOL_IP=$INDY_SDK_SERVER_IP" ]) { - bat 'cargo test --features "only_high_cases"' + bat 'cargo test --features only_high_cases' } echo "Windows Libindy after Test: Deleting %TEMP\\indy_client" @@ -472,7 +472,7 @@ def linuxLibindyBuild(file, env_name, network_name, full_testing) { echo "${env_name} Libindy Test: Test" testEnv.inside("--network=${network_name}") { - def features_args = full_testing ? "--features sodium_static" : "--features 'sodium_static only_high_cases'" + def features_args = full_testing ? "--features sodium_static" : "--features \"sodium_static only_high_cases\"" sh """ cd libindy diff --git a/libindy/tests/demo.rs b/libindy/tests/demo.rs index bf6abb99e1..772247e145 100644 --- a/libindy/tests/demo.rs +++ b/libindy/tests/demo.rs @@ -473,17 +473,19 @@ fn anoncreds_demo_works() { assert_eq!(ErrorCode::from(res), ErrorCode::Success); let res = prover_close_wallet_receiver.recv_timeout(timeout::medium_timeout()).unwrap(); assert_eq!(ErrorCode::from(res), ErrorCode::Success); + + utils::test::cleanup_storage("issuer_wallet"); + utils::test::cleanup_storage("prover_wallet"); } #[test] #[cfg(feature = "local_nodes_pool")] fn ledger_demo_works() { - Setup::empty(); + let setup = Setup::empty(); let my_wallet_config = json!({"id": "my_wallet"}).to_string(); let their_wallet_config = json!({"id": "their_wallet"}).to_string(); - let pool_name = "ledger_demo_works"; - let c_pool_name = CString::new(pool_name).unwrap(); + let c_pool_name = CString::new(setup.name.clone()).unwrap(); let (set_protocol_version_receiver, set_protocol_version_command_handle, set_protocol_version_callback) = callback::_closure_to_cb_ec(); let (open_receiver, open_command_handle, open_callback) = callback::_closure_to_cb_ec_i32(); @@ -515,7 +517,7 @@ fn ledger_demo_works() { assert_eq!(ErrorCode::from(err), ErrorCode::Success); // 1. Create ledger config from genesis txn file - let txn_file_path = pool_utils::create_genesis_txn_file_for_test_pool(pool_name, None, None); + let txn_file_path = pool_utils::create_genesis_txn_file_for_test_pool(&setup.name, None, None); let pool_config = pool_utils::pool_config_json(txn_file_path.as_path()); let c_pool_config = CString::new(pool_config).unwrap(); @@ -717,6 +719,9 @@ fn ledger_demo_works() { let res = close_their_wallet_receiver.recv_timeout(timeout::medium_timeout()).unwrap(); assert_eq!(ErrorCode::from(res), ErrorCode::Success); + utils::test::cleanup_storage("my_wallet"); + utils::test::cleanup_storage("their_wallet"); + #[derive(Deserialize, Eq, PartialEq, Debug)] struct Reply { op: String, @@ -842,4 +847,6 @@ fn crypto_demo_works() { assert_eq!(ErrorCode::from(res), ErrorCode::Success); let res = close_wallet_receiver.recv_timeout(timeout::medium_timeout()).unwrap(); assert_eq!(ErrorCode::from(res), ErrorCode::Success); + + utils::test::cleanup_storage("wallet_1"); } diff --git a/libindy/tests/interaction.rs b/libindy/tests/interaction.rs index 40739bd782..8c113ef46b 100644 --- a/libindy/tests/interaction.rs +++ b/libindy/tests/interaction.rs @@ -531,7 +531,7 @@ impl Verifier { #[cfg(feature = "revocation_tests")] #[test] fn anoncreds_revocation_interaction_test_issuance_by_demand() { - anoncreds_revocation_interaction_test_one_prover("anoncreds_revocation_interaction_test_issuance_by_demand", r#"{"max_cred_num":5, "issuance_type":"ISSUANCE_ON_DEMAND"}"#); + anoncreds_revocation_interaction_test_one_prover(r#"{"max_cred_num":5, "issuance_type":"ISSUANCE_ON_DEMAND"}"#); } #[cfg(feature = "revocation_tests")] @@ -540,15 +540,15 @@ fn anoncreds_revocation_interaction_test_issuance_by_demand() { #[test] fn anoncreds_revocation_interaction_test_issuance_by_default() { - anoncreds_revocation_interaction_test_one_prover("anoncreds_revocation_interaction_test_issuance_by_default", r#"{"max_cred_num":5, "issuance_type":"ISSUANCE_BY_DEFAULT"}"#); + anoncreds_revocation_interaction_test_one_prover(r#"{"max_cred_num":5, "issuance_type":"ISSUANCE_BY_DEFAULT"}"#); } // the common function for two previous tests -fn anoncreds_revocation_interaction_test_one_prover(pool_name: &str, revocation_registry_config: &str) +fn anoncreds_revocation_interaction_test_one_prover(revocation_registry_config: &str) { - Setup::empty(); + let setup = Setup::empty(); - let pool = Pool::new(pool_name); + let pool = Pool::new(&setup.name); let mut issuer = Issuer::new(&pool); @@ -661,9 +661,9 @@ fn multi_steps_create_revocation_credential(pool: &Pool, issuer: &Issuer, prover #[cfg(not(feature="only_high_cases"))] #[test] fn anoncreds_revocation_interaction_test_issuance_by_demand_three_credentials_post_entry_three_times_proving_first() { - Setup::empty(); + let setup = Setup::empty(); - let pool = Pool::new("anoncreds_4711"); + let pool = Pool::new(&setup.name); let mut issuer = Issuer::new(&pool); @@ -738,9 +738,9 @@ fn anoncreds_revocation_interaction_test_issuance_by_demand_three_credentials_po #[cfg(not(feature="only_high_cases"))] #[test] fn anoncreds_revocation_interaction_test_issuance_by_demand_three_credentials_post_common_entry_proving_all() { - Setup::empty(); + let setup = Setup::empty(); - let pool = Pool::new("aritibdtcpcepa"); + let pool = Pool::new(&setup.name); let mut issuer = Issuer::new(&pool); diff --git a/libindy/tests/wallet.rs b/libindy/tests/wallet.rs index e75cba13ef..74dee065ce 100644 --- a/libindy/tests/wallet.rs +++ b/libindy/tests/wallet.rs @@ -272,7 +272,7 @@ mod high_cases { #[test] fn indy_import_wallet_works() { - let setup = Setup::wallet(); + let setup = Setup::empty(); let config = config(&setup.name); let path = wallet::export_wallet_path(&setup.name); @@ -299,6 +299,7 @@ mod high_cases { assert_eq!(did_with_meta, did_with_meta_after_import); + wallet::close_and_delete_wallet(wallet_handle, &config).unwrap(); cleanup_file(&path); } } @@ -309,7 +310,7 @@ mod high_cases { #[test] fn indy_generate_wallet_key_works() { - let setup = Setup::wallet(); + let setup = Setup::empty(); let config = config(&setup.name); let key = wallet::generate_wallet_key(None).unwrap(); @@ -324,7 +325,7 @@ mod high_cases { #[test] fn indy_generate_wallet_key_works_for_seed() { - let setup = Setup::wallet(); + let setup = Setup::empty(); let wallet_config = config(&setup.name); let config = json!({"seed": MY1_SEED}).to_string(); @@ -390,7 +391,7 @@ mod medium_cases { #[test] fn indy_create_wallet_works_for_empty_type() { - let setup = Setup::wallet(); + let setup = Setup::empty(); let config = config(&setup.name); wallet::create_wallet(&config, WALLET_CREDENTIALS).unwrap(); @@ -398,7 +399,7 @@ mod medium_cases { #[test] fn indy_create_wallet_works_for_duplicate_name() { - let setup = Setup::wallet(); + let setup = Setup::empty(); let config = config(&setup.name); wallet::create_wallet(&config, WALLET_CREDENTIALS).unwrap(); @@ -660,7 +661,7 @@ mod medium_cases { #[test] fn indy_import_wallet_returns_error_if_path_doesnt_exist() { - let setup= Setup::wallet(); + let setup= Setup::empty(); let import_config = json!({"id": &setup.name}).to_string(); From e518fe01177854ea5cc7bfcea664d6e433a57cbd Mon Sep 17 00:00:00 2001 From: "artem.ivanov" Date: Tue, 20 Aug 2019 10:01:19 +0300 Subject: [PATCH 273/320] Liibndy test cleaning Signed-off-by: artem.ivanov --- Jenkinsfile.cd | 2 +- Jenkinsfile.ci | 6 +++--- libindy/tests/demo.rs | 15 +++++++++++---- libindy/tests/interaction.rs | 18 +++++++++--------- libindy/tests/wallet.rs | 13 +++++++------ 5 files changed, 31 insertions(+), 23 deletions(-) diff --git a/Jenkinsfile.cd b/Jenkinsfile.cd index 7bc8f2fa46..3eeaf3267e 100644 --- a/Jenkinsfile.cd +++ b/Jenkinsfile.cd @@ -350,7 +350,7 @@ def linuxLibindyBuild(file, env_name, network_name, stashBuildResults, full_test echo "${env_name} Libindy Test: Test" testEnv.inside("--network=${network_name}") { - def features_args = full_testing ? "--features sodium_static" : "--features 'sodium_static only_high_cases'" + def features_args = full_testing ? "--features sodium_static" : "--features \"sodium_static only_high_cases\"" sh """ cd libindy diff --git a/Jenkinsfile.ci b/Jenkinsfile.ci index a01a96ffde..55cf298c77 100644 --- a/Jenkinsfile.ci +++ b/Jenkinsfile.ci @@ -84,7 +84,7 @@ def windowsTesting() { "RUST_BACKTRACE=1" ]) { bat "cargo build --features fatal_warnings" - bat 'cargo test --no-run --features "only_high_cases"' + bat 'cargo test --no-run --features only_high_cases' echo "Windows Libindy before Test: Deleting %TEMP\\indy_client" bat "DEL /S /Q /F %TEMP%\\indy_client" @@ -96,7 +96,7 @@ def windowsTesting() { "RUST_LOG=indy::=debug,zmq=trace", "TEST_POOL_IP=$INDY_SDK_SERVER_IP" ]) { - bat 'cargo test --features "only_high_cases"' + bat 'cargo test --features only_high_cases' } echo "Windows Libindy after Test: Deleting %TEMP\\indy_client" @@ -472,7 +472,7 @@ def linuxLibindyBuild(file, env_name, network_name, full_testing) { echo "${env_name} Libindy Test: Test" testEnv.inside("--network=${network_name}") { - def features_args = full_testing ? "--features sodium_static" : "--features 'sodium_static only_high_cases'" + def features_args = full_testing ? "--features sodium_static" : "--features \"sodium_static only_high_cases\"" sh """ cd libindy diff --git a/libindy/tests/demo.rs b/libindy/tests/demo.rs index bf6abb99e1..772247e145 100644 --- a/libindy/tests/demo.rs +++ b/libindy/tests/demo.rs @@ -473,17 +473,19 @@ fn anoncreds_demo_works() { assert_eq!(ErrorCode::from(res), ErrorCode::Success); let res = prover_close_wallet_receiver.recv_timeout(timeout::medium_timeout()).unwrap(); assert_eq!(ErrorCode::from(res), ErrorCode::Success); + + utils::test::cleanup_storage("issuer_wallet"); + utils::test::cleanup_storage("prover_wallet"); } #[test] #[cfg(feature = "local_nodes_pool")] fn ledger_demo_works() { - Setup::empty(); + let setup = Setup::empty(); let my_wallet_config = json!({"id": "my_wallet"}).to_string(); let their_wallet_config = json!({"id": "their_wallet"}).to_string(); - let pool_name = "ledger_demo_works"; - let c_pool_name = CString::new(pool_name).unwrap(); + let c_pool_name = CString::new(setup.name.clone()).unwrap(); let (set_protocol_version_receiver, set_protocol_version_command_handle, set_protocol_version_callback) = callback::_closure_to_cb_ec(); let (open_receiver, open_command_handle, open_callback) = callback::_closure_to_cb_ec_i32(); @@ -515,7 +517,7 @@ fn ledger_demo_works() { assert_eq!(ErrorCode::from(err), ErrorCode::Success); // 1. Create ledger config from genesis txn file - let txn_file_path = pool_utils::create_genesis_txn_file_for_test_pool(pool_name, None, None); + let txn_file_path = pool_utils::create_genesis_txn_file_for_test_pool(&setup.name, None, None); let pool_config = pool_utils::pool_config_json(txn_file_path.as_path()); let c_pool_config = CString::new(pool_config).unwrap(); @@ -717,6 +719,9 @@ fn ledger_demo_works() { let res = close_their_wallet_receiver.recv_timeout(timeout::medium_timeout()).unwrap(); assert_eq!(ErrorCode::from(res), ErrorCode::Success); + utils::test::cleanup_storage("my_wallet"); + utils::test::cleanup_storage("their_wallet"); + #[derive(Deserialize, Eq, PartialEq, Debug)] struct Reply { op: String, @@ -842,4 +847,6 @@ fn crypto_demo_works() { assert_eq!(ErrorCode::from(res), ErrorCode::Success); let res = close_wallet_receiver.recv_timeout(timeout::medium_timeout()).unwrap(); assert_eq!(ErrorCode::from(res), ErrorCode::Success); + + utils::test::cleanup_storage("wallet_1"); } diff --git a/libindy/tests/interaction.rs b/libindy/tests/interaction.rs index 40739bd782..8c113ef46b 100644 --- a/libindy/tests/interaction.rs +++ b/libindy/tests/interaction.rs @@ -531,7 +531,7 @@ impl Verifier { #[cfg(feature = "revocation_tests")] #[test] fn anoncreds_revocation_interaction_test_issuance_by_demand() { - anoncreds_revocation_interaction_test_one_prover("anoncreds_revocation_interaction_test_issuance_by_demand", r#"{"max_cred_num":5, "issuance_type":"ISSUANCE_ON_DEMAND"}"#); + anoncreds_revocation_interaction_test_one_prover(r#"{"max_cred_num":5, "issuance_type":"ISSUANCE_ON_DEMAND"}"#); } #[cfg(feature = "revocation_tests")] @@ -540,15 +540,15 @@ fn anoncreds_revocation_interaction_test_issuance_by_demand() { #[test] fn anoncreds_revocation_interaction_test_issuance_by_default() { - anoncreds_revocation_interaction_test_one_prover("anoncreds_revocation_interaction_test_issuance_by_default", r#"{"max_cred_num":5, "issuance_type":"ISSUANCE_BY_DEFAULT"}"#); + anoncreds_revocation_interaction_test_one_prover(r#"{"max_cred_num":5, "issuance_type":"ISSUANCE_BY_DEFAULT"}"#); } // the common function for two previous tests -fn anoncreds_revocation_interaction_test_one_prover(pool_name: &str, revocation_registry_config: &str) +fn anoncreds_revocation_interaction_test_one_prover(revocation_registry_config: &str) { - Setup::empty(); + let setup = Setup::empty(); - let pool = Pool::new(pool_name); + let pool = Pool::new(&setup.name); let mut issuer = Issuer::new(&pool); @@ -661,9 +661,9 @@ fn multi_steps_create_revocation_credential(pool: &Pool, issuer: &Issuer, prover #[cfg(not(feature="only_high_cases"))] #[test] fn anoncreds_revocation_interaction_test_issuance_by_demand_three_credentials_post_entry_three_times_proving_first() { - Setup::empty(); + let setup = Setup::empty(); - let pool = Pool::new("anoncreds_4711"); + let pool = Pool::new(&setup.name); let mut issuer = Issuer::new(&pool); @@ -738,9 +738,9 @@ fn anoncreds_revocation_interaction_test_issuance_by_demand_three_credentials_po #[cfg(not(feature="only_high_cases"))] #[test] fn anoncreds_revocation_interaction_test_issuance_by_demand_three_credentials_post_common_entry_proving_all() { - Setup::empty(); + let setup = Setup::empty(); - let pool = Pool::new("aritibdtcpcepa"); + let pool = Pool::new(&setup.name); let mut issuer = Issuer::new(&pool); diff --git a/libindy/tests/wallet.rs b/libindy/tests/wallet.rs index e75cba13ef..74dee065ce 100644 --- a/libindy/tests/wallet.rs +++ b/libindy/tests/wallet.rs @@ -272,7 +272,7 @@ mod high_cases { #[test] fn indy_import_wallet_works() { - let setup = Setup::wallet(); + let setup = Setup::empty(); let config = config(&setup.name); let path = wallet::export_wallet_path(&setup.name); @@ -299,6 +299,7 @@ mod high_cases { assert_eq!(did_with_meta, did_with_meta_after_import); + wallet::close_and_delete_wallet(wallet_handle, &config).unwrap(); cleanup_file(&path); } } @@ -309,7 +310,7 @@ mod high_cases { #[test] fn indy_generate_wallet_key_works() { - let setup = Setup::wallet(); + let setup = Setup::empty(); let config = config(&setup.name); let key = wallet::generate_wallet_key(None).unwrap(); @@ -324,7 +325,7 @@ mod high_cases { #[test] fn indy_generate_wallet_key_works_for_seed() { - let setup = Setup::wallet(); + let setup = Setup::empty(); let wallet_config = config(&setup.name); let config = json!({"seed": MY1_SEED}).to_string(); @@ -390,7 +391,7 @@ mod medium_cases { #[test] fn indy_create_wallet_works_for_empty_type() { - let setup = Setup::wallet(); + let setup = Setup::empty(); let config = config(&setup.name); wallet::create_wallet(&config, WALLET_CREDENTIALS).unwrap(); @@ -398,7 +399,7 @@ mod medium_cases { #[test] fn indy_create_wallet_works_for_duplicate_name() { - let setup = Setup::wallet(); + let setup = Setup::empty(); let config = config(&setup.name); wallet::create_wallet(&config, WALLET_CREDENTIALS).unwrap(); @@ -660,7 +661,7 @@ mod medium_cases { #[test] fn indy_import_wallet_returns_error_if_path_doesnt_exist() { - let setup= Setup::wallet(); + let setup= Setup::empty(); let import_config = json!({"id": &setup.name}).to_string(); From b65757cecfb47192a92bc01ed3db11a272e09c0f Mon Sep 17 00:00:00 2001 From: "artem.ivanov" Date: Tue, 20 Aug 2019 15:48:09 +0300 Subject: [PATCH 274/320] IS-912: UX: Early static validation - work started Signed-off-by: artem.ivanov --- libindy/src/api/anoncreds.rs | 16 ++--- libindy/src/api/cache.rs | 11 +-- libindy/src/api/ledger.rs | 16 ++--- libindy/src/api/pool.rs | 3 +- libindy/src/commands/anoncreds/issuer.rs | 23 ++---- libindy/src/commands/cache.rs | 70 ++++++------------- libindy/src/commands/ledger.rs | 8 +-- libindy/src/domain/anoncreds/credential.rs | 14 ++++ .../domain/anoncreds/credential_definition.rs | 4 +- .../src/domain/anoncreds/credential_offer.rs | 2 +- .../domain/anoncreds/credential_request.rs | 2 +- libindy/src/domain/anoncreds/proof.rs | 2 +- libindy/src/domain/anoncreds/proof_request.rs | 2 +- .../revocation_registry_definition.rs | 16 ++++- .../anoncreds/revocation_registry_delta.rs | 2 +- libindy/src/domain/anoncreds/schema.rs | 27 ++++++- libindy/src/domain/cache.rs | 14 ++++ libindy/src/domain/ledger/author_agreement.rs | 23 ++++++ libindy/src/domain/ledger/node.rs | 20 ++++++ libindy/src/domain/mod.rs | 1 + libindy/src/domain/pool.rs | 23 ++++++ libindy/src/services/anoncreds/issuer.rs | 10 ++- libindy/src/services/ledger/mod.rs | 26 ++----- libindy/src/utils/ctypes.rs | 39 +++++++++++ libindy/src/utils/mod.rs | 2 + libindy/src/utils/validation.rs | 3 + libindy/tests/utils/anoncreds.rs | 4 +- libindy/tests/utils/mod.rs | 3 + 28 files changed, 254 insertions(+), 132 deletions(-) create mode 100644 libindy/src/domain/cache.rs create mode 100644 libindy/src/utils/validation.rs diff --git a/libindy/src/api/anoncreds.rs b/libindy/src/api/anoncreds.rs index d91722fa09..cb7cba7a26 100644 --- a/libindy/src/api/anoncreds.rs +++ b/libindy/src/api/anoncreds.rs @@ -10,7 +10,7 @@ use domain::anoncreds::credential_definition::{CredentialDefinition, CredentialD use domain::anoncreds::credential_offer::CredentialOffer; use domain::anoncreds::credential_request::{CredentialRequest, CredentialRequestMetadata}; use domain::anoncreds::credential_attr_tag_policy::CredentialAttrTagPolicy; -use domain::anoncreds::credential::{Credential, AttributeValues}; +use domain::anoncreds::credential::{Credential, CredentialValues}; use domain::anoncreds::revocation_registry_definition::{RevocationRegistryConfig, RevocationRegistryDefinition}; use domain::anoncreds::revocation_registry_delta::RevocationRegistryDelta; use domain::anoncreds::proof::Proof; @@ -24,6 +24,8 @@ use libc::c_char; use std::ptr; use std::collections::HashMap; +use utils::validation::Validatable; + /* These functions wrap the Ursa algorithm as documented in this paper: https://github.com/hyperledger/ursa/blob/master/libursa/docs/AnonCred.pdf @@ -71,15 +73,11 @@ pub extern fn indy_issuer_create_schema(command_handle: CommandHandle, check_useful_c_str!(issuer_did, ErrorCode::CommonInvalidParam2); check_useful_c_str!(name, ErrorCode::CommonInvalidParam3); check_useful_c_str!(version, ErrorCode::CommonInvalidParam4); - check_useful_json!(attrs, ErrorCode::CommonInvalidParam5, AttributeNames); + check_useful_validateable_json!(attrs, ErrorCode::CommonInvalidParam5, AttributeNames); check_useful_c_callback!(cb, ErrorCode::CommonInvalidParam6); trace!("indy_issuer_create_schema: entity >>> issuer_did: {:?}, name: {:?}, version: {:?}, attrs: {:?}", issuer_did, name, version, attrs); - if attrs.is_empty() { - return err_msg(IndyErrorKind::InvalidStructure, "Empty list of Schema attributes has been passed").into(); - } - let result = CommandExecutor::instance() .send(Command::Anoncreds( AnoncredsCommand::Issuer( @@ -170,7 +168,7 @@ pub extern fn indy_issuer_create_and_store_credential_def(command_handle: Comman signature_type: {:?}, config_json: {:?}", wallet_handle, issuer_did, schema_json, tag, signature_type, config_json); check_useful_c_str!(issuer_did, ErrorCode::CommonInvalidParam3); - check_useful_json!(schema_json, ErrorCode::CommonInvalidParam4, Schema); + check_useful_validateable_json!(schema_json, ErrorCode::CommonInvalidParam4, Schema); check_useful_c_str!(tag, ErrorCode::CommonInvalidParam5); check_useful_opt_c_str!(signature_type, ErrorCode::CommonInvalidParam6); check_useful_opt_json!(config_json, ErrorCode::CommonInvalidParam7, CredentialDefinitionConfig); @@ -415,7 +413,7 @@ pub extern fn indy_issuer_create_and_store_revoc_reg(command_handle: CommandHand check_useful_opt_c_str!(revoc_def_type, ErrorCode::CommonInvalidParam4); check_useful_c_str!(tag, ErrorCode::CommonInvalidParam5); check_useful_c_str!(cred_def_id, ErrorCode::CommonInvalidParam6); - check_useful_json!(config_json, ErrorCode::CommonInvalidParam7, RevocationRegistryConfig); + check_useful_validateable_json!(config_json, ErrorCode::CommonInvalidParam7, RevocationRegistryConfig); check_useful_c_callback!(cb, ErrorCode::CommonInvalidParam9); trace!("indy_issuer_create_and_store_credential_def: entities >>> wallet_handle: {:?}, issuer_did: {:?}, revoc_def_type: {:?}, tag: {:?}, \ @@ -570,7 +568,7 @@ pub extern fn indy_issuer_create_credential(command_handle: CommandHandle, check_useful_json!(cred_offer_json, ErrorCode::CommonInvalidParam3, CredentialOffer); check_useful_json!(cred_req_json, ErrorCode::CommonInvalidParam4, CredentialRequest); - check_useful_json!(cred_values_json, ErrorCode::CommonInvalidParam5, HashMap); + check_useful_validateable_json!(cred_values_json, ErrorCode::CommonInvalidParam5, CredentialValues); check_useful_opt_c_str!(rev_reg_id, ErrorCode::CommonInvalidParam6); check_useful_c_callback!(cb, ErrorCode::CommonInvalidParam8); diff --git a/libindy/src/api/cache.rs b/libindy/src/api/cache.rs index 2926885e1a..40327a51d3 100644 --- a/libindy/src/api/cache.rs +++ b/libindy/src/api/cache.rs @@ -3,6 +3,7 @@ use commands::{Command, CommandExecutor}; use commands::cache::CacheCommand; use errors::prelude::*; use utils::ctypes; +use domain::cache::{GetCacheOptions, PurgeOptions}; use libc::c_char; @@ -40,7 +41,7 @@ pub extern fn indy_get_cred_def(command_handle: CommandHandle, check_useful_c_str!(submitter_did, ErrorCode::CommonInvalidParam4); check_useful_c_str!(id, ErrorCode::CommonInvalidParam5); - check_useful_c_str!(options_json, ErrorCode::CommonInvalidParam6); + check_useful_json!(options_json, ErrorCode::CommonInvalidParam6, GetCacheOptions); check_useful_c_callback!(cb, ErrorCode::CommonInvalidParam7); trace!("indy_get_cred_def: entities >>> pool_handle: {:?}, wallet_handle: {:?}, submitter_did: {:?}, id: {:?}, options_json: {:?}", @@ -98,7 +99,7 @@ pub extern fn indy_get_schema(command_handle: CommandHandle, check_useful_c_str!(submitter_did, ErrorCode::CommonInvalidParam4); check_useful_c_str!(id, ErrorCode::CommonInvalidParam5); - check_useful_c_str!(options_json, ErrorCode::CommonInvalidParam6); + check_useful_json!(options_json, ErrorCode::CommonInvalidParam6, GetCacheOptions); check_useful_c_callback!(cb, ErrorCode::CommonInvalidParam7); trace!("indy_get_schema: entities >>> pool_handle: {:?}, wallet_handle: {:?}, submitter_did: {:?}, id: {:?}, options_json: {:?}", @@ -142,7 +143,7 @@ pub extern fn indy_purge_cred_def_cache(command_handle: CommandHandle, trace!("indy_purge_cred_def_cache: >>> wallet_handle: {:?}, options_json: {:?}", wallet_handle, options_json); - check_useful_c_str!(options_json, ErrorCode::CommonInvalidParam3); + check_useful_json!(options_json, ErrorCode::CommonInvalidParam3, PurgeOptions); check_useful_c_callback!(cb, ErrorCode::CommonInvalidParam4); trace!("indy_purge_cred_def_cache: entities >>> wallet_handle: {:?}, options_json: {:?}", @@ -175,7 +176,7 @@ pub extern fn indy_purge_cred_def_cache(command_handle: CommandHandle, /// wallet_handle: wallet handle (created by open_wallet). /// options_json: /// { -/// maxAge: (int, optional, -1 by default) Purge cached data if older than this many seconds. -1 means purge all. +/// minFresh: (int, optional, -1 by default) Purge cached data if older than this many seconds. -1 means purge all. /// } /// cb: Callback that takes command result as parameter. #[no_mangle] @@ -187,7 +188,7 @@ pub extern fn indy_purge_schema_cache(command_handle: CommandHandle, trace!("indy_purge_schema_cache: >>> wallet_handle: {:?}, options_json: {:?}", wallet_handle, options_json); - check_useful_c_str!(options_json, ErrorCode::CommonInvalidParam3); + check_useful_json!(options_json, ErrorCode::CommonInvalidParam3, PurgeOptions); check_useful_c_callback!(cb, ErrorCode::CommonInvalidParam4); trace!("indy_purge_schema_cache: entities >>> wallet_handle: {:?}, options_json: {:?}", diff --git a/libindy/src/api/ledger.rs b/libindy/src/api/ledger.rs index d88a563397..0f48af3211 100644 --- a/libindy/src/api/ledger.rs +++ b/libindy/src/api/ledger.rs @@ -8,8 +8,9 @@ use domain::anoncreds::revocation_registry_definition::RevocationRegistryDefinit use domain::anoncreds::revocation_registry_delta::RevocationRegistryDelta; use domain::ledger::author_agreement::{GetTxnAuthorAgreementData, AcceptanceMechanisms}; use domain::ledger::node::NodeOperationData; -use domain::ledger::auth_rule::AuthRules; +use domain::ledger::auth_rule::{Constraint, AuthRules}; use utils::ctypes; +use utils::validation::Validatable; use serde_json; use libc::c_char; @@ -570,7 +571,7 @@ pub extern fn indy_build_schema_request(command_handle: CommandHandle, trace!("indy_build_schema_request: >>> submitter_did: {:?}, data: {:?}", submitter_did, data); check_useful_c_str!(submitter_did, ErrorCode::CommonInvalidParam2); - check_useful_json!(data, ErrorCode::CommonInvalidParam3, Schema); + check_useful_validateable_json!(data, ErrorCode::CommonInvalidParam3, Schema); check_useful_c_callback!(cb, ErrorCode::CommonInvalidParam4); trace!("indy_build_schema_request: entities >>> submitter_did: {:?}, data: {:?}", submitter_did, data); @@ -1777,7 +1778,7 @@ pub extern fn indy_build_auth_rule_request(command_handle: CommandHandle, check_useful_c_str!(field, ErrorCode::CommonInvalidParam5); check_useful_opt_c_str!(old_value, ErrorCode::CommonInvalidParam6); check_useful_opt_c_str!(new_value, ErrorCode::CommonInvalidParam7); - check_useful_c_str!(constraint, ErrorCode::CommonInvalidParam8); + check_useful_json!(constraint, ErrorCode::CommonInvalidParam8, Constraint); check_useful_c_callback!(cb, ErrorCode::CommonInvalidParam9); trace!("indy_build_auth_rule_request: entities >>> submitter_did: {:?}, txn_type: {:?}, action: {:?}, field: {:?}, \ @@ -2015,7 +2016,7 @@ pub extern fn indy_build_get_txn_author_agreement_request(command_handle: Comman trace!("indy_build_get_txn_author_agreement_request: >>> submitter_did: {:?}, data: {:?}?", submitter_did, data); check_useful_opt_c_str!(submitter_did, ErrorCode::CommonInvalidParam2); - check_useful_opt_json!(data, ErrorCode::CommonInvalidParam3, GetTxnAuthorAgreementData); + check_useful_opt_validateable_json!(data, ErrorCode::CommonInvalidParam3, GetTxnAuthorAgreementData); check_useful_c_callback!(cb, ErrorCode::CommonInvalidParam4); trace!("indy_build_get_txn_author_agreement_request: entities >>> submitter_did: {:?}, data: {:?}", submitter_did, data); @@ -2072,16 +2073,11 @@ pub extern fn indy_build_acceptance_mechanisms_request(command_handle: CommandHa submitter_did, aml, version, aml_context); check_useful_c_str!(submitter_did, ErrorCode::CommonInvalidParam2); - check_useful_json!(aml, ErrorCode::CommonInvalidParam3, AcceptanceMechanisms); + check_useful_validateable_json!(aml, ErrorCode::CommonInvalidParam3, AcceptanceMechanisms); check_useful_c_str!(version, ErrorCode::CommonInvalidParam4); check_useful_opt_c_str!(aml_context, ErrorCode::CommonInvalidParam5); check_useful_c_callback!(cb, ErrorCode::CommonInvalidParam6); - //break early and error out if no acceptance mechanisms - if aml.is_empty() { - return ErrorCode::CommonInvalidParam3; - } - trace!("indy_build_acceptance_mechanisms_request: entities >>> submitter_did: {:?}, aml: {:?}, version: {:?}, aml_context: {:?}", submitter_did, aml, version, aml_context); diff --git a/libindy/src/api/pool.rs b/libindy/src/api/pool.rs index 5dfceea39a..4b209616d6 100755 --- a/libindy/src/api/pool.rs +++ b/libindy/src/api/pool.rs @@ -5,6 +5,7 @@ use commands::pool::PoolCommand; use domain::pool::{PoolConfig, PoolOpenConfig}; use errors::prelude::*; use utils::ctypes; +use utils::validation::Validatable; use serde_json; use libc::c_char; @@ -91,7 +92,7 @@ pub extern fn indy_open_pool_ledger(command_handle: CommandHandle, trace!("indy_open_pool_ledger: >>> config_name: {:?}, config: {:?}", config_name, config); check_useful_c_str!(config_name, ErrorCode::CommonInvalidParam2); - check_useful_opt_json!(config, ErrorCode::CommonInvalidParam3, PoolOpenConfig); + check_useful_opt_validateable_json!(config, ErrorCode::CommonInvalidParam3, PoolOpenConfig); check_useful_c_callback!(cb, ErrorCode::CommonInvalidParam4); trace!("indy_open_pool_ledger: entities >>> config_name: {:?}, config: {:?}", config_name, config); diff --git a/libindy/src/commands/anoncreds/issuer.rs b/libindy/src/commands/anoncreds/issuer.rs index d629f0f8b0..cbf14a5a8e 100644 --- a/libindy/src/commands/anoncreds/issuer.rs +++ b/libindy/src/commands/anoncreds/issuer.rs @@ -11,7 +11,7 @@ use ursa::cl::{CredentialKeyCorrectnessProof, CredentialPrivateKey}; use commands::{Command, CommandExecutor}; use commands::anoncreds::AnoncredsCommand; -use domain::anoncreds::credential::{AttributeValues, Credential}; +use domain::anoncreds::credential::{CredentialValues, Credential}; use domain::anoncreds::credential_definition::{ CredentialDefinition, CredentialDefinitionConfig, @@ -42,7 +42,7 @@ use domain::anoncreds::revocation_registry_delta::{ RevocationRegistryDelta, RevocationRegistryDeltaV1, }; -use domain::anoncreds::schema::{AttributeNames, Schema, SchemaV1, MAX_ATTRIBUTES_COUNT}; +use domain::anoncreds::schema::{AttributeNames, Schema, SchemaV1}; use domain::wallet::Tags; use errors::prelude::*; use services::anoncreds::AnoncredsService; @@ -117,7 +117,7 @@ pub enum IssuerCommand { WalletHandle, CredentialOffer, // credential offer CredentialRequest, // credential request - HashMap, // credential values + CredentialValues, // credential values Option, // revocation registry id Option, // blob storage reader config handle Box, Option)>) + Send>), @@ -237,11 +237,6 @@ impl IssuerCommandExecutor { self.crypto_service.validate_did(issuer_did)?; - if attrs.len() > MAX_ATTRIBUTES_COUNT { - return Err(err_msg(IndyErrorKind::InvalidStructure, - format!("The number of Schema attributes {} cannot be greater than {}", attrs.len(), MAX_ATTRIBUTES_COUNT))); - } - let schema_id = Schema::schema_id(issuer_did, name, version); let schema = Schema::SchemaV1(SchemaV1 { @@ -552,13 +547,7 @@ impl IssuerCommandExecutor { RegistryType::CL_ACCUM }; - let issuance_type = if let Some(ref type_) = config.issuance_type { - serde_json::from_str::(&format!("\"{}\"", type_)) - .to_indy(IndyErrorKind::InvalidStructure, "Invalid Issuance Type format")? - } else { - IssuanceType::ISSUANCE_ON_DEMAND - }; - + let issuance_type = config.issuance_type.clone().unwrap_or(IssuanceType::ISSUANCE_ON_DEMAND); let max_cred_num = config.max_cred_num.unwrap_or(100000); let rev_reg_id = RevocationRegistryDefinition::rev_reg_id(issuer_did, cred_def_id, &rev_reg_type, tag); @@ -581,7 +570,7 @@ impl IssuerCommandExecutor { let revoc_reg_def_value = RevocationRegistryDefinitionValue { max_cred_num, - issuance_type: issuance_type.clone(), + issuance_type, public_keys: revoc_public_keys, tails_location, tails_hash, @@ -659,7 +648,7 @@ impl IssuerCommandExecutor { wallet_handle: WalletHandle, cred_offer: &CredentialOffer, cred_request: &CredentialRequest, - cred_values: &HashMap, + cred_values: &CredentialValues, rev_reg_id: Option<&str>, blob_storage_reader_handle: Option) -> IndyResult<(String, Option, Option)> { debug!("new_credential >>> wallet_handle: {:?}, cred_offer: {:?}, cred_req: {:?}, cred_values_json: {:?}, rev_reg_id: {:?}, blob_storage_reader_handle: {:?}", diff --git a/libindy/src/commands/cache.rs b/libindy/src/commands/cache.rs index 9bcb8f766f..8d66c9e661 100644 --- a/libindy/src/commands/cache.rs +++ b/libindy/src/commands/cache.rs @@ -9,6 +9,7 @@ use services::wallet::{WalletService, WalletRecord}; use api::{WalletHandle, PoolHandle, CommandHandle}; use commands::{Command, CommandExecutor}; use commands::ledger::LedgerCommand; +use domain::cache::{GetCacheOptions, PurgeOptions}; use api::next_command_handle; @@ -20,7 +21,7 @@ pub enum CacheCommand { WalletHandle, String, // submitter_did String, // id - String, // options_json + GetCacheOptions, // options Box) + Send>), GetSchemaContinue( WalletHandle, @@ -32,7 +33,7 @@ pub enum CacheCommand { WalletHandle, String, // submitter_did String, // id - String, // options_json + GetCacheOptions, // options Box) + Send>), GetCredDefContinue( WalletHandle, @@ -41,10 +42,10 @@ pub enum CacheCommand { CommandHandle, // cb_id ), PurgeSchemaCache(WalletHandle, - String, // options json + PurgeOptions, // options Box) + Send>), PurgeCredDefCache(WalletHandle, - String, // options json + PurgeOptions, // options Box) + Send>), } @@ -85,29 +86,29 @@ impl CacheCommandExecutor { pub fn execute(&self, command: CacheCommand) { match command { - CacheCommand::GetSchema(pool_handle, wallet_handle, submitter_did, id, options_json, cb) => { + CacheCommand::GetSchema(pool_handle, wallet_handle, submitter_did, id, options, cb) => { info!(target: "non_secrets_command_executor", "GetSchema command received"); - self.get_schema(pool_handle, wallet_handle, &submitter_did, &id, &options_json, cb); + self.get_schema(pool_handle, wallet_handle, &submitter_did, &id, options, cb); } CacheCommand::GetSchemaContinue(wallet_handle, ledger_response, options, cb_id) => { info!(target: "non_secrets_command_executor", "GetSchemaContinue command received"); self._get_schema_continue(wallet_handle, ledger_response, options, cb_id); } - CacheCommand::GetCredDef(pool_handle, wallet_handle, submitter_did, id, options_json, cb) => { + CacheCommand::GetCredDef(pool_handle, wallet_handle, submitter_did, id, options, cb) => { info!(target: "non_secrets_command_executor", "GetCredDef command received"); - self.get_cred_def(pool_handle, wallet_handle, &submitter_did, &id, &options_json, cb); + self.get_cred_def(pool_handle, wallet_handle, &submitter_did, &id, options, cb); } CacheCommand::GetCredDefContinue(wallet_handle, ledger_response, options, cb_id) => { info!(target: "non_secrets_command_executor", "GetCredDefContinue command received"); self._get_cred_def_continue(wallet_handle, ledger_response, options, cb_id); } - CacheCommand::PurgeSchemaCache(wallet_handle, options_json, cb) => { + CacheCommand::PurgeSchemaCache(wallet_handle, options, cb) => { info!(target: "non_secrets_command_executor", "PurgeSchemaCache command received"); - cb(self.purge_schema_cache(wallet_handle, &options_json)); + cb(self.purge_schema_cache(wallet_handle, options)); } - CacheCommand::PurgeCredDefCache(wallet_handle, options_json, cb) => { + CacheCommand::PurgeCredDefCache(wallet_handle, options, cb) => { info!(target: "non_secrets_command_executor", "PurgeCredDefCache command received"); - cb(self.purge_cred_def_cache(wallet_handle, &options_json)); + cb(self.purge_cred_def_cache(wallet_handle, options)); } } } @@ -117,12 +118,10 @@ impl CacheCommandExecutor { wallet_handle: WalletHandle, submitter_did: &str, id: &str, - options_json: &str, + options: GetCacheOptions, cb: Box) + Send>) { - trace!("get_schema >>> pool_handle: {:?}, wallet_handle: {:?}, submitter_did: {:?}, id: {:?}, options_json: {:?}", - pool_handle, wallet_handle, submitter_did, id, options_json); - - let options = try_cb!(serde_json::from_str::(options_json).to_indy(IndyErrorKind::InvalidStructure, "Cannot deserialize options"), cb); + trace!("get_schema >>> pool_handle: {:?}, wallet_handle: {:?}, submitter_did: {:?}, id: {:?}, options: {:?}", + pool_handle, wallet_handle, submitter_did, id, options); let cache = self.get_record_from_cache(wallet_handle, id, &options, SCHEMA_CACHE); let cache = try_cb!(cache, cb); @@ -201,12 +200,10 @@ impl CacheCommandExecutor { wallet_handle: WalletHandle, submitter_did: &str, id: &str, - options_json: &str, + options: GetCacheOptions, cb: Box) + Send>) { - trace!("get_cred_def >>> pool_handle: {:?}, wallet_handle: {:?}, submitter_did: {:?}, id: {:?}, options_json: {:?}", - pool_handle, wallet_handle, submitter_did, id, options_json); - - let options = try_cb!(serde_json::from_str::(options_json).to_indy(IndyErrorKind::InvalidStructure, "Cannot deserialize options"), cb); + trace!("get_cred_def >>> pool_handle: {:?}, wallet_handle: {:?}, submitter_did: {:?}, id: {:?}, options: {:?}", + pool_handle, wallet_handle, submitter_did, id, options); let cache = self.get_record_from_cache(wallet_handle, id, &options, CRED_DEF_CACHE); let cache = try_cb!(cache, cb); @@ -289,11 +286,8 @@ impl CacheCommandExecutor { fn purge_schema_cache(&self, wallet_handle: WalletHandle, - options_json: &str) -> IndyResult<()> { - trace!("purge_schema_cache >>> wallet_handle: {:?}, options_json: {:?}", wallet_handle, options_json); - - let options = serde_json::from_str::(options_json) - .to_indy(IndyErrorKind::InvalidStructure, "Cannot deserialize options")?; + options: PurgeOptions) -> IndyResult<()> { + trace!("purge_schema_cache >>> wallet_handle: {:?}, options: {:?}", wallet_handle, options); let max_age = options.max_age.unwrap_or(-1); let query_json = CacheCommandExecutor::build_query_json(max_age)?; @@ -322,11 +316,8 @@ impl CacheCommandExecutor { fn purge_cred_def_cache(&self, wallet_handle: WalletHandle, - options_json: &str) -> IndyResult<()> { - trace!("purge_cred_def_cache >>> wallet_handle: {:?}, options_json: {:?}", wallet_handle, options_json); - - let options = serde_json::from_str::(options_json) - .to_indy(IndyErrorKind::InvalidStructure, "Cannot deserialize options")?; + options: PurgeOptions) -> IndyResult<()> { + trace!("purge_cred_def_cache >>> wallet_handle: {:?}, options: {:?}", wallet_handle, options); let max_age = options.max_age.unwrap_or(-1); let query_json = CacheCommandExecutor::build_query_json(max_age)?; @@ -353,18 +344,3 @@ impl CacheCommandExecutor { Ok(()) } } - -#[serde(rename_all = "camelCase")] -#[derive(Debug, Deserialize, Serialize)] -struct PurgeOptions { - pub max_age: Option, -} - -#[serde(rename_all = "camelCase")] -#[derive(Debug, Deserialize, Serialize, Clone)] -pub struct GetCacheOptions { - pub no_cache: Option, // Skip usage of cache, - pub no_update: Option, // Use only cached data, do not try to update. - pub no_store: Option, // Skip storing fresh data if updated - pub min_fresh: Option, // Return cached data if not older than this many seconds. -1 means do not check age. -} diff --git a/libindy/src/commands/ledger.rs b/libindy/src/commands/ledger.rs index 7157cc0d5e..91be7ac08e 100644 --- a/libindy/src/commands/ledger.rs +++ b/libindy/src/commands/ledger.rs @@ -14,7 +14,7 @@ use domain::crypto::did::Did; use domain::crypto::key::Key; use domain::ledger::node::NodeOperationData; use domain::ledger::author_agreement::{GetTxnAuthorAgreementData, AcceptanceMechanisms}; -use domain::ledger::auth_rule::AuthRules; +use domain::ledger::auth_rule::{Constraint, AuthRules}; use errors::prelude::*; use services::crypto::CryptoService; use services::ledger::LedgerService; @@ -195,7 +195,7 @@ pub enum LedgerCommand { String, // field Option, // old value Option, // new value - String, // constraint + Constraint, // constraint Box) + Send>), BuildAuthRulesRequest( String, // submitter did @@ -442,7 +442,7 @@ impl LedgerCommandExecutor { } LedgerCommand::BuildAuthRuleRequest(submitter_did, txn_type, action, field, old_value, new_value, constraint, cb) => { info!(target: "ledger_command_executor", "BuildAuthRuleRequest command received"); - cb(self.build_auth_rule_request(&submitter_did, &txn_type, &action, &field, old_value.as_ref().map(String::as_str), new_value.as_ref().map(String::as_str), &constraint)); + cb(self.build_auth_rule_request(&submitter_did, &txn_type, &action, &field, old_value.as_ref().map(String::as_str), new_value.as_ref().map(String::as_str), constraint)); } LedgerCommand::BuildAuthRulesRequest(submitter_did, rules, cb) => { info!(target: "ledger_command_executor", "BuildAuthRulesRequest command received"); @@ -1045,7 +1045,7 @@ impl LedgerCommandExecutor { field: &str, old_value: Option<&str>, new_value: Option<&str>, - constraint: &str) -> IndyResult { + constraint: Constraint) -> IndyResult { debug!("build_auth_rule_request >>> submitter_did: {:?}, txn_type: {:?}, action: {:?}, field: {:?}, \ old_value: {:?}, new_value: {:?}, constraint: {:?}", submitter_did, txn_type, action, field, old_value, new_value, constraint); diff --git a/libindy/src/domain/anoncreds/credential.rs b/libindy/src/domain/anoncreds/credential.rs index d422695f42..abe3fcb1b3 100644 --- a/libindy/src/domain/anoncreds/credential.rs +++ b/libindy/src/domain/anoncreds/credential.rs @@ -10,6 +10,8 @@ use super::DELIMITER; use std::collections::HashMap; use named_type::NamedType; +use utils::validation::Validatable; + #[derive(Debug, Deserialize, Serialize, NamedType)] pub struct Credential { pub schema_id: String, @@ -58,8 +60,20 @@ pub struct CredentialInfo { pub cred_rev_id: Option } +pub type CredentialValues = HashMap; + #[derive(Debug, Clone, Deserialize, Serialize, Eq, PartialEq)] pub struct AttributeValues { pub raw: String, pub encoded: String } + +impl Validatable for CredentialValues { + fn validate(&self) -> Result<(), String> { + if self.is_empty() { + return Err(String::from("Empty list of Credential Values has been passed")); + } + + Ok(()) + } +} \ No newline at end of file diff --git a/libindy/src/domain/anoncreds/credential_definition.rs b/libindy/src/domain/anoncreds/credential_definition.rs index f60288dc72..0c381b91a2 100644 --- a/libindy/src/domain/anoncreds/credential_definition.rs +++ b/libindy/src/domain/anoncreds/credential_definition.rs @@ -75,7 +75,7 @@ pub struct TemporaryCredentialDefinition { impl CredentialDefinition { pub fn cred_def_id(did: &str, schema_id: &str, signature_type: &str, tag: &str) -> String { - if ProtocolVersion::is_node_1_3(){ + if ProtocolVersion::is_node_1_3() { format!("{}{}{}{}{}{}{}", did, DELIMITER, CRED_DEF_MARKER, DELIMITER, signature_type, DELIMITER, schema_id) } else { format!("{}{}{}{}{}{}{}{}{}", did, DELIMITER, CRED_DEF_MARKER, DELIMITER, signature_type, DELIMITER, schema_id, DELIMITER, tag) @@ -113,4 +113,4 @@ pub struct CredentialDefinitionPrivateKey { #[derive(Debug, Serialize, Deserialize, NamedType)] pub struct CredentialDefinitionCorrectnessProof { pub value: CredentialKeyCorrectnessProof -} +} \ No newline at end of file diff --git a/libindy/src/domain/anoncreds/credential_offer.rs b/libindy/src/domain/anoncreds/credential_offer.rs index 99d706f965..10129ec656 100644 --- a/libindy/src/domain/anoncreds/credential_offer.rs +++ b/libindy/src/domain/anoncreds/credential_offer.rs @@ -6,4 +6,4 @@ pub struct CredentialOffer { pub cred_def_id: String, pub key_correctness_proof: CredentialKeyCorrectnessProof, pub nonce: Nonce -} +} \ No newline at end of file diff --git a/libindy/src/domain/anoncreds/credential_request.rs b/libindy/src/domain/anoncreds/credential_request.rs index c60d03de21..8f81f77cdf 100644 --- a/libindy/src/domain/anoncreds/credential_request.rs +++ b/libindy/src/domain/anoncreds/credential_request.rs @@ -19,4 +19,4 @@ pub struct CredentialRequestMetadata { pub master_secret_blinding_data: CredentialSecretsBlindingFactors, pub nonce: Nonce, pub master_secret_name: String -} +} \ No newline at end of file diff --git a/libindy/src/domain/anoncreds/proof.rs b/libindy/src/domain/anoncreds/proof.rs index 342d86fe7e..8eaf5fce47 100644 --- a/libindy/src/domain/anoncreds/proof.rs +++ b/libindy/src/domain/anoncreds/proof.rs @@ -47,4 +47,4 @@ pub struct Identifier { pub cred_def_id: String, pub rev_reg_id: Option, pub timestamp: Option -} +} \ No newline at end of file diff --git a/libindy/src/domain/anoncreds/proof_request.rs b/libindy/src/domain/anoncreds/proof_request.rs index 400c45482a..4a05e02b87 100644 --- a/libindy/src/domain/anoncreds/proof_request.rs +++ b/libindy/src/domain/anoncreds/proof_request.rs @@ -71,4 +71,4 @@ pub struct RequestedAttributeInfo { pub struct RequestedPredicateInfo { pub predicate_referent: String, pub predicate_info: PredicateInfo -} +} \ No newline at end of file diff --git a/libindy/src/domain/anoncreds/revocation_registry_definition.rs b/libindy/src/domain/anoncreds/revocation_registry_definition.rs index f34ffd4c59..5a9c179c04 100644 --- a/libindy/src/domain/anoncreds/revocation_registry_definition.rs +++ b/libindy/src/domain/anoncreds/revocation_registry_definition.rs @@ -5,12 +5,14 @@ use super::DELIMITER; use std::collections::{HashMap, HashSet}; use named_type::NamedType; +use utils::validation::Validatable; + pub const CL_ACCUM: &str = "CL_ACCUM"; pub const REV_REG_DEG_MARKER: &str = "4"; #[derive(Deserialize, Debug, Serialize)] pub struct RevocationRegistryConfig { - pub issuance_type: Option, + pub issuance_type: Option, pub max_cred_num: Option } @@ -109,3 +111,15 @@ pub struct RevocationRegistryInfo { pub curr_id: u32, pub used_ids: HashSet } + + +impl Validatable for RevocationRegistryConfig { + fn validate(&self) -> Result<(), String> { + if let Some(num_) = self.max_cred_num { + if num_ == 0 { + return Err(String::from("`max_cred_num` must be greater than 0")); + } + } + Ok(()) + } +} diff --git a/libindy/src/domain/anoncreds/revocation_registry_delta.rs b/libindy/src/domain/anoncreds/revocation_registry_delta.rs index e626f4bf31..e5122136b8 100644 --- a/libindy/src/domain/anoncreds/revocation_registry_delta.rs +++ b/libindy/src/domain/anoncreds/revocation_registry_delta.rs @@ -1,4 +1,4 @@ -use ursa::cl::{RevocationRegistryDelta as RegistryDelta}; +use ursa::cl::RevocationRegistryDelta as RegistryDelta; #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] diff --git a/libindy/src/domain/anoncreds/schema.rs b/libindy/src/domain/anoncreds/schema.rs index d5e7802341..71cb1c5de0 100644 --- a/libindy/src/domain/anoncreds/schema.rs +++ b/libindy/src/domain/anoncreds/schema.rs @@ -3,6 +3,8 @@ use super::DELIMITER; use std::collections::{HashMap, HashSet}; use named_type::NamedType; +use utils::validation::Validatable; + pub const SCHEMA_MARKER: &str = "2"; pub const MAX_ATTRIBUTES_COUNT: usize = 125; @@ -43,7 +45,28 @@ impl From for SchemaV1 { } pub fn schemas_map_to_schemas_v1_map(schemas: HashMap) -> HashMap { - schemas.into_iter().map( |(schema_id, schema)| { (schema_id, SchemaV1::from(schema))}).collect() + schemas.into_iter().map(|(schema_id, schema)| { (schema_id, SchemaV1::from(schema)) }).collect() +} + +pub type AttributeNames = HashSet; + +impl Validatable for Schema { + fn validate(&self) -> Result<(), String> { + match self { + Schema::SchemaV1(schema) => schema.attr_names.validate() + } + } } -pub type AttributeNames = HashSet; \ No newline at end of file +impl Validatable for AttributeNames { + fn validate(&self) -> Result<(), String> { + if self.is_empty() { + return Err(String::from("Empty list of Schema attributes has been passed")); + } + + if self.len() > MAX_ATTRIBUTES_COUNT { + return Err(format!("The number of Schema attributes {} cannot be greater than {}", self.len(), MAX_ATTRIBUTES_COUNT)); + } + Ok(()) + } +} \ No newline at end of file diff --git a/libindy/src/domain/cache.rs b/libindy/src/domain/cache.rs new file mode 100644 index 0000000000..526ffc90f5 --- /dev/null +++ b/libindy/src/domain/cache.rs @@ -0,0 +1,14 @@ +#[serde(rename_all = "camelCase")] +#[derive(Debug, Deserialize, Serialize)] +pub struct PurgeOptions { + pub max_age: Option, +} + +#[serde(rename_all = "camelCase")] +#[derive(Debug, Deserialize, Serialize, Clone)] +pub struct GetCacheOptions { + pub no_cache: Option, // Skip usage of cache, + pub no_update: Option, // Use only cached data, do not try to update. + pub no_store: Option, // Skip storing fresh data if updated + pub min_fresh: Option, // Return cached data if not older than this many seconds. -1 means do not check age. +} \ No newline at end of file diff --git a/libindy/src/domain/ledger/author_agreement.rs b/libindy/src/domain/ledger/author_agreement.rs index 8f4124438f..3c9b5f5e1c 100644 --- a/libindy/src/domain/ledger/author_agreement.rs +++ b/libindy/src/domain/ledger/author_agreement.rs @@ -1,5 +1,7 @@ use super::constants::{TXN_AUTHR_AGRMT, GET_TXN_AUTHR_AGRMT, TXN_AUTHR_AGRMT_AML, GET_TXN_AUTHR_AGRMT_AML}; +use utils::validation::Validatable; + use std::collections::HashMap; #[derive(Serialize, PartialEq, Debug)] @@ -27,6 +29,18 @@ pub struct GetTxnAuthorAgreementData { pub timestamp: Option, } +impl Validatable for GetTxnAuthorAgreementData{ + fn validate(&self) -> Result<(), String> { + match (self.digest.as_ref(), self.version.as_ref(), self.timestamp.as_ref()) { + (Some(_), None, None) => Ok(()), + (None, Some(_), None) => Ok(()), + (None, None, Some(_)) => Ok(()), + (None, None, None) => Ok(()), + (digest, version, timestamp) => Err(format!("Only one of field can be specified: digest: {:?}, version: {:?}, timestamp: {:?}", digest, version, timestamp)) + } + } +} + #[derive(Serialize, PartialEq, Debug)] pub struct GetTxnAuthorAgreementOperation { #[serde(rename = "type")] @@ -52,6 +66,15 @@ impl GetTxnAuthorAgreementOperation { pub type AcceptanceMechanisms = HashMap; +impl Validatable for AcceptanceMechanisms { + fn validate(&self) -> Result<(), String> { + if self.is_empty() { + return Err(String::from("Empty list of Acceptance Mechanisms has been passed")); + } + Ok(()) + } +} + #[derive(Serialize, PartialEq, Debug)] #[serde(rename_all = "camelCase")] pub struct SetAcceptanceMechanismOperation { diff --git a/libindy/src/domain/ledger/node.rs b/libindy/src/domain/ledger/node.rs index a0d438be36..2a60483181 100644 --- a/libindy/src/domain/ledger/node.rs +++ b/libindy/src/domain/ledger/node.rs @@ -1,5 +1,7 @@ use super::constants::NODE; +use utils::validation::Validatable; + #[derive(Serialize, PartialEq, Debug)] pub struct NodeOperation { #[serde(rename = "type")] @@ -42,3 +44,21 @@ pub struct NodeOperationData { #[serde(skip_serializing_if = "Option::is_none")] pub blskey_pop: Option } + +impl Validatable for NodeOperationData{ + fn validate(&self) -> Result<(), String> { + if self.node_ip.is_none() && self.node_port.is_none() + && self.client_ip.is_none() && self.client_port.is_none() + && self.services.is_none() && self.blskey.is_none() + && self.blskey_pop.is_none() { + return Err(String::from("Invalid data json: all fields missed at once")); + } + + if (self.node_ip.is_some() || self.node_port.is_some() || self.client_ip.is_some() || self.client_port.is_some()) && + (self.node_ip.is_none() || self.node_port.is_none() || self.client_ip.is_none() || self.client_port.is_none()) { + return Err(String::from("Invalid data json: Fields node_ip, node_port, client_ip, client_port must be specified together")); + } + + Ok(()) + } +} diff --git a/libindy/src/domain/mod.rs b/libindy/src/domain/mod.rs index 779849bb82..369961c520 100644 --- a/libindy/src/domain/mod.rs +++ b/libindy/src/domain/mod.rs @@ -4,6 +4,7 @@ pub mod ledger; pub mod pairwise; pub mod pool; pub mod wallet; +pub mod cache; #[derive(Debug, Serialize, Deserialize)] pub struct IndyConfig { diff --git a/libindy/src/domain/pool.rs b/libindy/src/domain/pool.rs index c4f182dd5f..0c742362b3 100644 --- a/libindy/src/domain/pool.rs +++ b/libindy/src/domain/pool.rs @@ -1,3 +1,5 @@ +use utils::validation::Validatable; + pub const POOL_CON_ACTIVE_TO: i64 = 5; pub const POOL_ACK_TIMEOUT: i64 = 20; pub const POOL_REPLY_TIMEOUT: i64 = 60; @@ -33,6 +35,27 @@ pub struct PoolOpenConfig { pub number_read_nodes: u8, } +impl Validatable for PoolOpenConfig { + fn validate(&self) -> Result<(), String> { + if self.timeout <= 0 { + return Err(String::from("`timeout` must be greater than 0")); + } + if self.extended_timeout <= 0 { + return Err(String::from("`extended_timeout` must be greater than 0")); + } + if self.conn_limit == 0 { + return Err(String::from("`conn_limit` must be greater than 0")); + } + if self.conn_active_timeout <= 0 { + return Err(String::from("`conn_active_timeout` must be greater than 0")); + } + if self.number_read_nodes == 0 { + return Err(String::from("`number_read_nodes` must be greater than 0")); + } + Ok(()) + } +} + impl Default for PoolOpenConfig { fn default() -> Self { PoolOpenConfig { diff --git a/libindy/src/services/anoncreds/issuer.rs b/libindy/src/services/anoncreds/issuer.rs index b0ac5e0446..dc8a57faaf 100644 --- a/libindy/src/services/anoncreds/issuer.rs +++ b/libindy/src/services/anoncreds/issuer.rs @@ -1,6 +1,3 @@ -use std::collections::HashMap; -use std::collections::HashSet; - use ursa::cl::{ CredentialKeyCorrectnessProof, CredentialPrivateKey, @@ -16,7 +13,8 @@ use ursa::cl::{ }; use ursa::cl::issuer::Issuer as CryptoIssuer; -use domain::anoncreds::credential::AttributeValues; +use domain::anoncreds::schema::AttributeNames; +use domain::anoncreds::credential::CredentialValues; use domain::anoncreds::credential_definition::{CredentialDefinitionData, CredentialDefinitionV1 as CredentialDefinition}; use domain::anoncreds::credential_request::CredentialRequest; use domain::anoncreds::revocation_registry_definition::{RevocationRegistryDefinitionV1, RevocationRegistryDefinitionValuePublicKeys}; @@ -30,7 +28,7 @@ impl Issuer { Issuer {} } - pub fn new_credential_definition(attr_names: &HashSet, + pub fn new_credential_definition(attr_names: &AttributeNames, support_revocation: bool) -> IndyResult<(CredentialDefinitionData, CredentialPrivateKey, CredentialKeyCorrectnessProof)> { @@ -85,7 +83,7 @@ impl Issuer { cred_priv_key: &CredentialPrivateKey, cred_issuance_blinding_nonce: &Nonce, cred_request: &CredentialRequest, - cred_values: &HashMap, + cred_values: &CredentialValues, rev_idx: Option, rev_reg_def: Option<&RevocationRegistryDefinitionV1>, rev_reg: Option<&mut RevocationRegistry>, diff --git a/libindy/src/services/ledger/mod.rs b/libindy/src/services/ledger/mod.rs index 6afe2d4590..ae963b884c 100644 --- a/libindy/src/services/ledger/mod.rs +++ b/libindy/src/services/ledger/mod.rs @@ -181,18 +181,6 @@ impl LedgerService { #[logfn(Info)] pub fn build_node_request(&self, identifier: &str, dest: &str, data: NodeOperationData) -> IndyResult { - if data.node_ip.is_none() && data.node_port.is_none() - && data.client_ip.is_none() && data.client_port.is_none() - && data.services.is_none() && data.blskey.is_none() - && data.blskey_pop.is_none() { - return Err(err_msg(IndyErrorKind::InvalidStructure, "Invalid data json: all fields missed at once")); - } - - if (data.node_ip.is_some() || data.node_port.is_some() || data.client_ip.is_some() || data.client_port.is_some()) && - (data.node_ip.is_none() || data.node_port.is_none() || data.client_ip.is_none() || data.client_port.is_none()) { - return Err(err_msg(IndyErrorKind::InvalidStructure, "Invalid data json: Fields node_ip, node_port, client_ip, client_port must be specified together")); - } - build_result!(NodeOperation, Some(identifier), dest.to_string(), data) } @@ -397,16 +385,13 @@ impl LedgerService { #[logfn(Info)] pub fn build_auth_rule_request(&self, submitter_did: &str, txn_type: &str, action: &str, field: &str, - old_value: Option<&str>, new_value: Option<&str>, constraint: &str) -> IndyResult { + old_value: Option<&str>, new_value: Option<&str>, constraint: Constraint) -> IndyResult { let txn_type = txn_name_to_code(&txn_type) .ok_or(err_msg(IndyErrorKind::InvalidStructure, format!("Unsupported `txn_type`: {}", txn_type)))?; let action = serde_json::from_str::(&format!("\"{}\"", action)) .map_err(|err| IndyError::from_msg(IndyErrorKind::InvalidStructure, format!("Cannot parse auth action: {}", err)))?; - let constraint = serde_json::from_str::(constraint) - .map_err(|err| IndyError::from_msg(IndyErrorKind::InvalidStructure, format!("Can not deserialize Constraint: {}", err)))?; - build_result!(AuthRuleOperation, Some(submitter_did), txn_type.to_string(), field.to_string(), action, old_value.map(String::from), new_value.map(String::from), constraint) } @@ -943,7 +928,7 @@ mod tests { let request = ledger_service.build_auth_rule_request(IDENTIFIER, NYM, ADD_AUTH_ACTION, FIELD, None, Some(NEW_VALUE), - &_role_constraint_json()).unwrap(); + _role_constraint()).unwrap(); check_request(&request, expected_result); } @@ -963,7 +948,6 @@ mod tests { ) ], }); - let constraint_json = serde_json::to_string(&constraint).unwrap(); let expected_result = json!({ "type": AUTH_RULE, @@ -976,7 +960,7 @@ mod tests { let request = ledger_service.build_auth_rule_request(IDENTIFIER, NYM, ADD_AUTH_ACTION, FIELD, None, Some(NEW_VALUE), - &constraint_json).unwrap(); + constraint).unwrap(); check_request(&request, expected_result); } @@ -997,7 +981,7 @@ mod tests { let request = ledger_service.build_auth_rule_request(IDENTIFIER, NYM, EDIT_AUTH_ACTION, FIELD, Some(OLD_VALUE), Some(NEW_VALUE), - &_role_constraint_json()).unwrap(); + _role_constraint()).unwrap(); check_request(&request, expected_result); } @@ -1005,7 +989,7 @@ mod tests { fn build_auth_rule_request_works_for_invalid_auth_action() { let ledger_service = LedgerService::new(); - let res = ledger_service.build_auth_rule_request(IDENTIFIER, NYM, "WRONG", FIELD, None, Some(NEW_VALUE), &_role_constraint_json()); + let res = ledger_service.build_auth_rule_request(IDENTIFIER, NYM, "WRONG", FIELD, None, Some(NEW_VALUE), _role_constraint()); assert_kind!(IndyErrorKind::InvalidStructure, res); } diff --git a/libindy/src/utils/ctypes.rs b/libindy/src/utils/ctypes.rs index 917387167d..b7b2c48d63 100644 --- a/libindy/src/utils/ctypes.rs +++ b/libindy/src/utils/ctypes.rs @@ -75,6 +75,45 @@ macro_rules! check_useful_json { } } +macro_rules! check_useful_validateable_json { + ($x:ident, $e:expr, $t:ty) => { + check_useful_json!($x, $e, $t); + + match $x.validate() { + Ok(ok) => ok, + Err(err) => { + return err_msg($e.into(), err).into() + } + }; + } +} + +macro_rules! check_useful_opt_validateable_json { + ($x:ident, $e:expr, $t:ty) => { + let $x = match ctypes::c_str_to_string($x) { + Ok(Some(val)) => Some(val), + Ok(None) => None, + _ => { + return err_msg($e.into(), "Invalid pointer has been passed").into() + }, + }; + + let $x: Option<$t> = match $x { + Some(val) => { + parse_json!(val, $e, $t); + match val.validate() { + Ok(ok) => ok, + Err(err) => { + return err_msg($e.into(), err).into() + } + }; + Some(val) + }, + None => None + }; + } +} + macro_rules! parse_json { ($x:ident, $e:expr, $t:ty) => { if $x.is_empty() { diff --git a/libindy/src/utils/mod.rs b/libindy/src/utils/mod.rs index 2d80b5996a..4f63fd6a5a 100755 --- a/libindy/src/utils/mod.rs +++ b/libindy/src/utils/mod.rs @@ -26,3 +26,5 @@ pub mod test; #[macro_use] pub mod try; + +pub mod validation; diff --git a/libindy/src/utils/validation.rs b/libindy/src/utils/validation.rs new file mode 100644 index 0000000000..5af0edd164 --- /dev/null +++ b/libindy/src/utils/validation.rs @@ -0,0 +1,3 @@ +pub trait Validatable { + fn validate(&self) -> Result<(), String>; +} diff --git a/libindy/tests/utils/anoncreds.rs b/libindy/tests/utils/anoncreds.rs index 0f2a05700b..0d7826d627 100644 --- a/libindy/tests/utils/anoncreds.rs +++ b/libindy/tests/utils/anoncreds.rs @@ -16,7 +16,7 @@ use std::collections::{HashSet, HashMap}; use utils::domain::anoncreds::schema::{Schema, SchemaV1}; use utils::domain::anoncreds::credential_definition::{CredentialDefinition, CredentialDefinitionConfig}; -use utils::domain::anoncreds::revocation_registry_definition::RevocationRegistryConfig; +use utils::domain::anoncreds::revocation_registry_definition::{RevocationRegistryConfig, IssuanceType}; use utils::domain::anoncreds::credential::{AttributeValues, CredentialInfo}; use utils::domain::anoncreds::credential_for_proof_request::CredentialsForProofRequest; @@ -189,7 +189,7 @@ pub fn issuance_on_demand_rev_reg_config() -> String { } pub fn issuance_by_default_rev_reg_config() -> String { - serde_json::to_string(&RevocationRegistryConfig { max_cred_num: Some(5), issuance_type: Some("ISSUANCE_BY_DEFAULT".to_string()) }).unwrap() + serde_json::to_string(&RevocationRegistryConfig { max_cred_num: Some(5), issuance_type: Some(IssuanceType::ISSUANCE_BY_DEFAULT) }).unwrap() } pub fn gvt_schema_id() -> String { diff --git a/libindy/tests/utils/mod.rs b/libindy/tests/utils/mod.rs index cb95451e62..34c099e323 100644 --- a/libindy/tests/utils/mod.rs +++ b/libindy/tests/utils/mod.rs @@ -39,6 +39,9 @@ pub mod sequence; #[path = "../../src/utils/ctypes.rs"] pub mod ctypes; +#[path = "../../src/utils/validation.rs"] +pub mod validation; + #[path = "../../src/utils/inmem_wallet.rs"] pub mod inmem_wallet; From 12b5147adeeb93b156b1f184c67b7fe0252810f5 Mon Sep 17 00:00:00 2001 From: Nikita Khateev Date: Tue, 20 Aug 2019 18:57:58 +0300 Subject: [PATCH 275/320] IS-1316 -- Integration Signed-off-by: Nikita Khateev --- libindy/src/services/pool/events.rs | 7 ++++++- libindy/src/services/pool/state_proof/mod.rs | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/libindy/src/services/pool/events.rs b/libindy/src/services/pool/events.rs index 80f6c8e0a7..990d7b9c1f 100644 --- a/libindy/src/services/pool/events.rs +++ b/libindy/src/services/pool/events.rs @@ -27,11 +27,12 @@ const REQUEST_FOR_FULL: [&str; 2] = [ ]; -pub const REQUESTS_FOR_STATE_PROOFS_IN_THE_PAST: [&str; 4] = [ +pub const REQUESTS_FOR_STATE_PROOFS_IN_THE_PAST: [&str; 5] = [ constants::GET_REVOC_REG, constants::GET_REVOC_REG_DELTA, constants::GET_TXN_AUTHR_AGRMT, constants::GET_TXN_AUTHR_AGRMT_AML, + constants::GET_TXN, ]; pub const REQUESTS_FOR_MULTI_STATE_PROOFS: [&str; 1] = [ @@ -265,6 +266,10 @@ fn _parse_timestamp_from_req_for_builtin_sp(req: &SJsonValue, op: &str) -> (Opti return (None, None); } + if op == constants::GET_TXN { + return (None, Some(0)); + } + match op { constants::GET_REVOC_REG | constants::GET_TXN_AUTHR_AGRMT | constants::GET_TXN_AUTHR_AGRMT_AML => { (None, req["operation"]["timestamp"].as_u64()) diff --git a/libindy/src/services/pool/state_proof/mod.rs b/libindy/src/services/pool/state_proof/mod.rs index f79c0f05af..3e6d01cae2 100644 --- a/libindy/src/services/pool/state_proof/mod.rs +++ b/libindy/src/services/pool/state_proof/mod.rs @@ -770,7 +770,12 @@ fn _parse_reply_for_proof_value(json_msg: &SJsonValue, data: Option<&str>, parse //TODO constants::GET_DDO => support DDO constants::GET_TXN => { value = if !parsed_data["txn"].is_null() { - parsed_data["txn"].clone() + json!({ + "txn": parsed_data["txn"].clone(), + "txnMetadata": parsed_data["txnMetadata"].clone(), + "ver": parsed_data["ver"].clone(), + "reqSignature": parsed_data["reqSignature"].clone(), + }) } else { return Ok(None) } From 624c0c4e9a2914349f2b0f7c4a2194f690af6727 Mon Sep 17 00:00:00 2001 From: Axel Nennker Date: Wed, 21 Aug 2019 07:48:46 +0200 Subject: [PATCH 276/320] update lazy_static to 1.3 in all crates Signed-off-by: Axel Nennker --- cli/Cargo.toml | 2 +- docs/how-tos/negotiate-proof/rust/Cargo.toml | 2 +- docs/how-tos/save-schema-and-cred-def/rust/Cargo.toml | 4 ++-- docs/how-tos/send-secure-msg/rust/Cargo.toml | 2 +- docs/how-tos/write-did-and-query-verkey/rust/Cargo.toml | 4 ++-- experimental/plugins/postgres_storage/Cargo.toml | 2 +- libnullpay/Cargo.toml | 2 +- vcx/libvcx/Cargo.toml | 2 +- wrappers/rust/Cargo.toml | 2 +- 9 files changed, 11 insertions(+), 11 deletions(-) diff --git a/cli/Cargo.toml b/cli/Cargo.toml index 0b6a6cffad..e2854af23a 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -15,7 +15,7 @@ ansi_term = "0.11" chrono = "0.4" dirs = "1.0.4" unescape = "0.1" -lazy_static = "0.2" +lazy_static = "1.3" libc = "0.2" libloading = "0.5.0" linefeed = "0.3" diff --git a/docs/how-tos/negotiate-proof/rust/Cargo.toml b/docs/how-tos/negotiate-proof/rust/Cargo.toml index c2b6279c0e..2b8ec8b348 100644 --- a/docs/how-tos/negotiate-proof/rust/Cargo.toml +++ b/docs/how-tos/negotiate-proof/rust/Cargo.toml @@ -13,7 +13,7 @@ path = "src/template.rs" [dependencies] indy = "1.6.7" -lazy_static = "0.2" +lazy_static = "1.3" log = "0.4.1" log-panics = "2.0.0" serde = "1.0" diff --git a/docs/how-tos/save-schema-and-cred-def/rust/Cargo.toml b/docs/how-tos/save-schema-and-cred-def/rust/Cargo.toml index 374a10b543..e323a726e1 100644 --- a/docs/how-tos/save-schema-and-cred-def/rust/Cargo.toml +++ b/docs/how-tos/save-schema-and-cred-def/rust/Cargo.toml @@ -14,9 +14,9 @@ path = "src/template.rs" [dependencies] indy = "1.6.7" -lazy_static = "0.2" +lazy_static = "1.3" log = "0.4.1" log-panics = "2.0.0" serde = "1.0" serde_derive = "1.0" -serde_json = "1.0" \ No newline at end of file +serde_json = "1.0" diff --git a/docs/how-tos/send-secure-msg/rust/Cargo.toml b/docs/how-tos/send-secure-msg/rust/Cargo.toml index a07020c86a..e1e927d98e 100644 --- a/docs/how-tos/send-secure-msg/rust/Cargo.toml +++ b/docs/how-tos/send-secure-msg/rust/Cargo.toml @@ -13,7 +13,7 @@ path = "src/template.rs" [dependencies] indy = "1.6.7" -lazy_static = "0.2" +lazy_static = "1.3" log = "0.4.1" log-panics = "2.0.0" serde = "1.0" diff --git a/docs/how-tos/write-did-and-query-verkey/rust/Cargo.toml b/docs/how-tos/write-did-and-query-verkey/rust/Cargo.toml index a615ec4f17..42d7ffaca6 100644 --- a/docs/how-tos/write-did-and-query-verkey/rust/Cargo.toml +++ b/docs/how-tos/write-did-and-query-verkey/rust/Cargo.toml @@ -14,9 +14,9 @@ path = "src/template.rs" [dependencies] indy = "1.6.7" -lazy_static = "0.2" +lazy_static = "1.3" log = "0.4.1" log-panics = "2.0.0" serde = "1.0" serde_derive = "1.0" -serde_json = "1.0" \ No newline at end of file +serde_json = "1.0" diff --git a/experimental/plugins/postgres_storage/Cargo.toml b/experimental/plugins/postgres_storage/Cargo.toml index fd2bafa0b8..dc654ca312 100644 --- a/experimental/plugins/postgres_storage/Cargo.toml +++ b/experimental/plugins/postgres_storage/Cargo.toml @@ -65,7 +65,7 @@ rmp-serde = "0.13.6" sodiumoxide = {version = "0.0.16", optional = true} time = "0.1.36" zmq = "0.8.2" -lazy_static = "1.0" +lazy_static = "1.3" named_type = "0.1.3" named_type_derive = "0.1.3" byteorder = "1.0.0" diff --git a/libnullpay/Cargo.toml b/libnullpay/Cargo.toml index b3828d744b..7f65468b71 100644 --- a/libnullpay/Cargo.toml +++ b/libnullpay/Cargo.toml @@ -13,7 +13,7 @@ crate-type = ["staticlib","cdylib", "rlib"] fatal_warnings = [] [dependencies] -lazy_static = "1.0" +lazy_static = "1.3" libc = "0.2.60" env_logger = "0.5.10" log = "0.4.1" diff --git a/vcx/libvcx/Cargo.toml b/vcx/libvcx/Cargo.toml index e0a33f9f2b..9a083c6c3b 100644 --- a/vcx/libvcx/Cargo.toml +++ b/vcx/libvcx/Cargo.toml @@ -29,7 +29,7 @@ log = "0.4" log4rs = "0.8.0" chrono = "0.4" time = "0.1.36" -lazy_static = "0.2" +lazy_static = "1.3" libc = "=0.2.60" rand = "0.3" serde = "1.0.97" diff --git a/wrappers/rust/Cargo.toml b/wrappers/rust/Cargo.toml index cc54afef09..996707dd9d 100644 --- a/wrappers/rust/Cargo.toml +++ b/wrappers/rust/Cargo.toml @@ -25,7 +25,7 @@ crate-type = ["rlib"] [dependencies] failure = "0.1.2" futures = "0.1.24" -lazy_static = "0.2" +lazy_static = "1.3" log = { version = "0.4.1", features = ["std"] } num-traits = "0.2" num-derive = "0.2" From cd331e7d579c21adbb7dfaa3e088808024dfe4a2 Mon Sep 17 00:00:00 2001 From: Axel Nennker Date: Wed, 21 Aug 2019 07:51:18 +0200 Subject: [PATCH 277/320] update byteorder to 1.3.2 Signed-off-by: Axel Nennker --- experimental/plugins/postgres_storage/Cargo.toml | 2 +- wrappers/rust/Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/experimental/plugins/postgres_storage/Cargo.toml b/experimental/plugins/postgres_storage/Cargo.toml index dc654ca312..9054fe0b15 100644 --- a/experimental/plugins/postgres_storage/Cargo.toml +++ b/experimental/plugins/postgres_storage/Cargo.toml @@ -68,7 +68,7 @@ zmq = "0.8.2" lazy_static = "1.3" named_type = "0.1.3" named_type_derive = "0.1.3" -byteorder = "1.0.0" +byteorder = "1.3.2" log-panics = "2.0.0" postgres = "0.15.2" r2d2 = "0.8.2" diff --git a/wrappers/rust/Cargo.toml b/wrappers/rust/Cargo.toml index 996707dd9d..85e3ca1707 100644 --- a/wrappers/rust/Cargo.toml +++ b/wrappers/rust/Cargo.toml @@ -39,7 +39,7 @@ serde = "1.0.97" bs58 = {version = "0.2.2", features = ["check"]} rand = "0.5.5" rmp-serde = "0.13.6" -byteorder = "1.0.0" +byteorder = "1.3.2" dirs = "1.0.4" [features] From 930194b266381fd8aeb9b1cdd62e9da460aa7f61 Mon Sep 17 00:00:00 2001 From: Axel Nennker Date: Wed, 21 Aug 2019 07:52:48 +0200 Subject: [PATCH 278/320] cargo update Signed-off-by: Axel Nennker --- libindy/Cargo.lock | 82 +++++++++++++++++++++++----------------------- 1 file changed, 41 insertions(+), 41 deletions(-) diff --git a/libindy/Cargo.lock b/libindy/Cargo.lock index 0fda68f8c1..4a2e765c6a 100644 --- a/libindy/Cargo.lock +++ b/libindy/Cargo.lock @@ -52,7 +52,7 @@ dependencies = [ [[package]] name = "autocfg" -version = "0.1.5" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -102,12 +102,12 @@ dependencies = [ [[package]] name = "blake2b_simd" -version = "0.5.6" +version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "arrayref 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", "arrayvec 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", - "constant_time_eq 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "constant_time_eq 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -142,7 +142,7 @@ dependencies = [ [[package]] name = "bumpalo" -version = "2.5.0" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -186,7 +186,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-width 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -207,7 +207,7 @@ dependencies = [ [[package]] name = "constant_time_eq" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -593,7 +593,7 @@ dependencies = [ "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", "indy-sys 1.11.0", - "lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "num-derive 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -836,7 +836,7 @@ name = "num-complex" version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "autocfg 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -855,7 +855,7 @@ name = "num-integer" version = "0.1.41" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "autocfg 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -864,7 +864,7 @@ name = "num-iter" version = "0.1.39" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "autocfg 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -874,7 +874,7 @@ name = "num-rational" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "autocfg 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "num-bigint 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", @@ -893,7 +893,7 @@ name = "num-traits" version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "autocfg 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -927,7 +927,7 @@ name = "openssl-sys" version = "0.9.49" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "autocfg 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "cc 1.0.26 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1011,7 +1011,7 @@ name = "rand" version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "autocfg 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", "rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1041,7 +1041,7 @@ name = "rand_chacha" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "autocfg 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1119,7 +1119,7 @@ dependencies = [ "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen 0.2.49 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1128,7 +1128,7 @@ name = "rand_pcg" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "autocfg 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1258,7 +1258,7 @@ version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", - "blake2b_simd 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", + "blake2b_simd 0.5.7 (registry+https://github.com/rust-lang/crates.io-index)", "crossbeam-utils 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1464,7 +1464,7 @@ name = "textwrap" version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-width 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1514,7 +1514,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "unicode-width" -version = "0.1.5" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -1590,51 +1590,51 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "wasm-bindgen" -version = "0.2.49" +version = "0.2.50" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-macro 0.2.49 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-macro 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "wasm-bindgen-backend" -version = "0.2.49" +version = "0.2.50" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "bumpalo 2.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "bumpalo 2.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", "syn 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-shared 0.2.49 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-shared 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "wasm-bindgen-macro" -version = "0.2.49" +version = "0.2.50" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-macro-support 0.2.49 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-macro-support 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.49" +version = "0.2.50" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", "syn 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-backend 0.2.49 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-shared 0.2.49 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-backend 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-shared 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.49" +version = "0.2.50" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -1724,17 +1724,17 @@ dependencies = [ "checksum arrayref 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "0d382e583f07208808f6b1249e60848879ba3543f57c32277bf52d69c2f0f0ee" "checksum arrayvec 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)" = "b8d73f9beda665eaa98ab9e4f7442bd4e7de6652587de55b2525e52e29c1b0ba" "checksum atty 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)" = "1803c647a3ec87095e7ae7acfca019e98de5ec9a7d01343f611cf3152ed71a90" -"checksum autocfg 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "22130e92352b948e7e82a49cdb0aa94f2211761117f29e052dd397c1ac33542b" +"checksum autocfg 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "b671c8fb71b457dd4ae18c4ba1e59aa81793daacc361d82fcd410cef0d491875" "checksum backtrace 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)" = "18b65ea1161bfb2dd6da6fade5edd4dbd08fba85012123dd333d2fd1b90b2782" "checksum backtrace-sys 0.1.30 (registry+https://github.com/rust-lang/crates.io-index)" = "5b3a000b9c543553af61bc01cbfc403b04b5caa9e421033866f2e98061eb3e61" "checksum base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0b25d992356d2eb0ed82172f5248873db5560c4721f564b13cb5193bda5e668e" "checksum bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3d155346769a6855b86399e9bc3814ab343cd3d62c7e985113d46a0ec3c281fd" "checksum blake2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "91721a6330935673395a0607df4d49a9cb90ae12d259f1b3e0a3f6e1d486872e" -"checksum blake2b_simd 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "461f4b879a8eb70c1debf7d0788a9a5ff15f1ea9d25925fea264ef4258bed6b2" +"checksum blake2b_simd 0.5.7 (registry+https://github.com/rust-lang/crates.io-index)" = "bf775a81bb2d464e20ff170ac20316c7b08a43d11dbc72f0f82e8e8d3d6d0499" "checksum block-buffer 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c0940dc441f31689269e10ac70eb1002a3a1d3ad1390e030043662eb7fe4688b" "checksum block-padding 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "6d4dc3af3ee2e12f3e5d224e5e1e3d73668abbeb69e566d361f7d5563a4fdf09" "checksum bstr 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "94cdf78eb7e94c566c1f5dbe2abf8fc70a548fc902942a48c4b3a98b48ca9ade" -"checksum bumpalo 2.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2cd43d82f27d68911e6ee11ee791fb248f138f5d69424dc02e098d4f152b0b05" +"checksum bumpalo 2.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ad807f2fc2bf185eeb98ff3a901bd46dc5ad58163d0fa4577ba0d25674d71708" "checksum byte-tools 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7" "checksum byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a7c3dd8985a7111efc5c80b44e23ecdd8c007de8ade3b96595387e812b957cf5" "checksum c2-chacha 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7d64d04786e0f528460fc884753cf8dddcc466be308f6026f8e355c41a0e4101" @@ -1744,7 +1744,7 @@ dependencies = [ "checksum clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5067f5bb2d80ef5d68b4c87db81601f0b75bca627bc2ef76b141d7b846a3c6d9" "checksum clear_on_drop 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "97276801e127ffb46b66ce23f35cc96bd454fa311294bced4bbace7baa8b1d17" "checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" -"checksum constant_time_eq 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8ff012e225ce166d4422e0e78419d901719760f62ae2b7969ca6b564d1b54a9e" +"checksum constant_time_eq 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "995a44c877f9212528ccc74b21a232f66ad69001e40ede5bcee2ac9ef2657120" "checksum criterion 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "0363053954f3e679645fc443321ca128b7b950a6fe288cf5f9335cc22ee58394" "checksum criterion-plot 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "76f9212ddf2f4a9eb2d401635190600656a1f88a932ef53d06e7fa4c7e02fb8e" "checksum crossbeam-deque 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "05e44b8cf3e1a625844d1750e1f7820da46044ff6d28f4d43e455ba3e5bb2c13" @@ -1891,7 +1891,7 @@ dependencies = [ "checksum tinytemplate 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4574b75faccaacddb9b284faecdf0b544b80b6b294f3d062d325c5726a209c20" "checksum toml 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "736b60249cb25337bc196faa43ee12c705e426f3d55c214d73a4e7be06f92cb4" "checksum typenum 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "612d636f949607bdf9b123b4a6f6d966dedf3ff669f7f045890d3a4a73948169" -"checksum unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "882386231c45df4700b275c7ff55b6f3698780a650026380e72dabe76fa46526" +"checksum unicode-width 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "7007dbd421b92cc6e28410fe7362e2e0a2503394908f417b68ec8d1c364c4e20" "checksum unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f860d7d29cf02cb2f3f359fd35991af3d30bac52c57d265a3c461074cb4dc" "checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" "checksum unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c" @@ -1900,11 +1900,11 @@ dependencies = [ "checksum vcpkg 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "33dd455d0f96e90a75803cfeb7f948768c08d70a6de9a8d2362461935698bf95" "checksum walkdir 2.2.9 (registry+https://github.com/rust-lang/crates.io-index)" = "9658c94fa8b940eab2250bd5a457f9c48b748420d71293b165c8cdbe2f55f71e" "checksum wasi 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fd5442abcac6525a045cc8c795aedb60da7a2e5e89c7bf18a0d5357849bb23c7" -"checksum wasm-bindgen 0.2.49 (registry+https://github.com/rust-lang/crates.io-index)" = "220f01bcb6b306c063e3283f97dd974bcab4e5affed2b654bae1a22d0d99c3aa" -"checksum wasm-bindgen-backend 0.2.49 (registry+https://github.com/rust-lang/crates.io-index)" = "8894c95e23cc5082786192ebbd2ac0e31e9f77a022132ba03e8b8de32a2323c6" -"checksum wasm-bindgen-macro 0.2.49 (registry+https://github.com/rust-lang/crates.io-index)" = "ec031a3190c51dda28c9f3623e2674e58c79f6d88c020c2157417fcf62298a3f" -"checksum wasm-bindgen-macro-support 0.2.49 (registry+https://github.com/rust-lang/crates.io-index)" = "3b7cad0ab0bb5fefbb770279f522dcebb6433585174d93ea648390f61db57401" -"checksum wasm-bindgen-shared 0.2.49 (registry+https://github.com/rust-lang/crates.io-index)" = "9142625bbb0d70710b3f2a6b20924c80fa182b05888b6bd21600ab9075673563" +"checksum wasm-bindgen 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)" = "dcddca308b16cd93c2b67b126c688e5467e4ef2e28200dc7dfe4ae284f2faefc" +"checksum wasm-bindgen-backend 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)" = "f805d9328b5fc7e5c6399960fd1889271b9b58ae17bdb2417472156cc9fafdd0" +"checksum wasm-bindgen-macro 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)" = "3ff88201a482abfc63921621f6cb18eb1efd74f136b05e5841e7f8ca434539e9" +"checksum wasm-bindgen-macro-support 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)" = "6a433d89ecdb9f77d46fcf00c8cf9f3467b7de9954d8710c175f61e2e245bb0e" +"checksum wasm-bindgen-shared 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)" = "d41fc1bc3570cdf8d108c15e014045fd45a95bb5eb36605f96a90461fc34027d" "checksum winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)" = "f10e386af2b13e47c89e7236a7a14a086791a2b88ebad6df9bf42040195cf770" "checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" "checksum winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7168bab6e1daee33b4557efd0e95d5ca70a03706d39fa5f3fe7a236f584b03c9" From e7a55ca9a912addbece2e11def37c12b2c719dcf Mon Sep 17 00:00:00 2001 From: "artem.ivanov" Date: Wed, 21 Aug 2019 12:59:50 +0300 Subject: [PATCH 279/320] IS-912: UX: Early static validation - in progress Signed-off-by: artem.ivanov --- libindy/src/api/anoncreds.rs | 8 +-- libindy/src/api/ledger.rs | 33 ++++++++-- libindy/src/api/pool.rs | 2 +- libindy/src/api/wallet.rs | 9 +-- libindy/src/commands/ledger.rs | 18 ++++-- libindy/src/domain/ledger/pool.rs | 2 + libindy/src/domain/ledger/request.rs | 4 ++ libindy/src/domain/wallet/mod.rs | 11 ++++ libindy/src/services/ledger/mod.rs | 92 ++++----------------------- libindy/src/services/pool/mod.rs | 4 -- libindy/src/services/wallet/mod.rs | 15 ++--- libindy/src/services/wallet/wallet.rs | 4 +- libindy/src/utils/ctypes.rs | 6 +- libindy/tests/ledger.rs | 14 ++++ 14 files changed, 103 insertions(+), 119 deletions(-) diff --git a/libindy/src/api/anoncreds.rs b/libindy/src/api/anoncreds.rs index cb7cba7a26..63f23d137d 100644 --- a/libindy/src/api/anoncreds.rs +++ b/libindy/src/api/anoncreds.rs @@ -73,7 +73,7 @@ pub extern fn indy_issuer_create_schema(command_handle: CommandHandle, check_useful_c_str!(issuer_did, ErrorCode::CommonInvalidParam2); check_useful_c_str!(name, ErrorCode::CommonInvalidParam3); check_useful_c_str!(version, ErrorCode::CommonInvalidParam4); - check_useful_validateable_json!(attrs, ErrorCode::CommonInvalidParam5, AttributeNames); + check_useful_validatable_json!(attrs, ErrorCode::CommonInvalidParam5, AttributeNames); check_useful_c_callback!(cb, ErrorCode::CommonInvalidParam6); trace!("indy_issuer_create_schema: entity >>> issuer_did: {:?}, name: {:?}, version: {:?}, attrs: {:?}", issuer_did, name, version, attrs); @@ -168,7 +168,7 @@ pub extern fn indy_issuer_create_and_store_credential_def(command_handle: Comman signature_type: {:?}, config_json: {:?}", wallet_handle, issuer_did, schema_json, tag, signature_type, config_json); check_useful_c_str!(issuer_did, ErrorCode::CommonInvalidParam3); - check_useful_validateable_json!(schema_json, ErrorCode::CommonInvalidParam4, Schema); + check_useful_validatable_json!(schema_json, ErrorCode::CommonInvalidParam4, Schema); check_useful_c_str!(tag, ErrorCode::CommonInvalidParam5); check_useful_opt_c_str!(signature_type, ErrorCode::CommonInvalidParam6); check_useful_opt_json!(config_json, ErrorCode::CommonInvalidParam7, CredentialDefinitionConfig); @@ -413,7 +413,7 @@ pub extern fn indy_issuer_create_and_store_revoc_reg(command_handle: CommandHand check_useful_opt_c_str!(revoc_def_type, ErrorCode::CommonInvalidParam4); check_useful_c_str!(tag, ErrorCode::CommonInvalidParam5); check_useful_c_str!(cred_def_id, ErrorCode::CommonInvalidParam6); - check_useful_validateable_json!(config_json, ErrorCode::CommonInvalidParam7, RevocationRegistryConfig); + check_useful_validatable_json!(config_json, ErrorCode::CommonInvalidParam7, RevocationRegistryConfig); check_useful_c_callback!(cb, ErrorCode::CommonInvalidParam9); trace!("indy_issuer_create_and_store_credential_def: entities >>> wallet_handle: {:?}, issuer_did: {:?}, revoc_def_type: {:?}, tag: {:?}, \ @@ -568,7 +568,7 @@ pub extern fn indy_issuer_create_credential(command_handle: CommandHandle, check_useful_json!(cred_offer_json, ErrorCode::CommonInvalidParam3, CredentialOffer); check_useful_json!(cred_req_json, ErrorCode::CommonInvalidParam4, CredentialRequest); - check_useful_validateable_json!(cred_values_json, ErrorCode::CommonInvalidParam5, CredentialValues); + check_useful_validatable_json!(cred_values_json, ErrorCode::CommonInvalidParam5, CredentialValues); check_useful_opt_c_str!(rev_reg_id, ErrorCode::CommonInvalidParam6); check_useful_c_callback!(cb, ErrorCode::CommonInvalidParam8); diff --git a/libindy/src/api/ledger.rs b/libindy/src/api/ledger.rs index 0f48af3211..a4fe0e9281 100644 --- a/libindy/src/api/ledger.rs +++ b/libindy/src/api/ledger.rs @@ -9,6 +9,7 @@ use domain::anoncreds::revocation_registry_delta::RevocationRegistryDelta; use domain::ledger::author_agreement::{GetTxnAuthorAgreementData, AcceptanceMechanisms}; use domain::ledger::node::NodeOperationData; use domain::ledger::auth_rule::{Constraint, AuthRules}; +use domain::ledger::pool::Schedule; use utils::ctypes; use utils::validation::Validatable; @@ -460,13 +461,17 @@ pub extern fn indy_build_attrib_request(command_handle: CommandHandle, check_useful_c_str!(submitter_did, ErrorCode::CommonInvalidParam2); check_useful_c_str!(target_did, ErrorCode::CommonInvalidParam3); check_useful_opt_c_str!(hash, ErrorCode::CommonInvalidParam4); - check_useful_opt_c_str!(raw, ErrorCode::CommonInvalidParam5); + check_useful_opt_json!(raw, ErrorCode::CommonInvalidParam5, serde_json::Value); check_useful_opt_c_str!(enc, ErrorCode::CommonInvalidParam6); check_useful_c_callback!(cb, ErrorCode::CommonInvalidParam7); trace!("indy_build_attrib_request: entities >>> submitter_did: {:?}, target_did: {:?}, hash: {:?}, raw: {:?}, enc: {:?}", submitter_did, target_did, hash, raw, enc); + if raw.is_none() && hash.is_none() && enc.is_none() { + return IndyError::from_msg(IndyErrorKind::InvalidStructure, "Either raw or hash or enc must be specified").into(); + } + let result = CommandExecutor::instance() .send(Command::Ledger(LedgerCommand::BuildAttribRequest( submitter_did, @@ -523,6 +528,10 @@ pub extern fn indy_build_get_attrib_request(command_handle: CommandHandle, trace!("indy_build_get_attrib_request: entities >>> submitter_did: {:?}, target_did: {:?}, hash: {:?}, raw: {:?}, enc: {:?}", submitter_did, target_did, hash, raw, enc); + if raw.is_none() && hash.is_none() && enc.is_none() { + return IndyError::from_msg(IndyErrorKind::InvalidStructure, "Either raw or hash or enc must be specified").into(); + } + let result = CommandExecutor::instance() .send(Command::Ledger(LedgerCommand::BuildGetAttribRequest( submitter_did, @@ -571,7 +580,7 @@ pub extern fn indy_build_schema_request(command_handle: CommandHandle, trace!("indy_build_schema_request: >>> submitter_did: {:?}, data: {:?}", submitter_did, data); check_useful_c_str!(submitter_did, ErrorCode::CommonInvalidParam2); - check_useful_validateable_json!(data, ErrorCode::CommonInvalidParam3, Schema); + check_useful_validatable_json!(data, ErrorCode::CommonInvalidParam3, Schema); check_useful_c_callback!(cb, ErrorCode::CommonInvalidParam4); trace!("indy_build_schema_request: entities >>> submitter_did: {:?}, data: {:?}", submitter_did, data); @@ -1024,7 +1033,7 @@ pub extern fn indy_build_pool_config_request(command_handle: CommandHandle, /// #Params /// command_handle: command handle to map callback to caller context. /// submitter_did: Identifier (DID) of the transaction author as base58-encoded string. -/// action: Action that pool has to do after received transaction. +/// action: Action that pool has to do after received transaction. Either `start` or `cancel`. /// datetime: Restart time in datetime format. Skip to restart as early as possible. /// cb: Callback that takes command result as parameter. /// @@ -1050,6 +1059,10 @@ pub extern fn indy_build_pool_restart_request(command_handle: CommandHandle, trace!("indy_build_pool_restart_request: entities >>> submitter_did: {:?}, action: {:?}, datetime: {:?}", submitter_did, action, datetime); + if action != "start" && action != "cancel" { + return IndyError::from_msg(IndyErrorKind::InvalidStructure, format!("Unsupported action: {}. Must be either `start` or `cancel`", action)).into(); + } + let result = CommandExecutor::instance() .send(Command::Ledger( LedgerCommand::BuildPoolRestartRequest( @@ -1118,7 +1131,7 @@ pub extern fn indy_build_pool_upgrade_request(command_handle: CommandHandle, check_useful_c_str!(version, ErrorCode::CommonInvalidParam4); check_useful_c_str!(action, ErrorCode::CommonInvalidParam5); check_useful_c_str!(sha256, ErrorCode::CommonInvalidParam6); - check_useful_opt_c_str!(schedule, ErrorCode::CommonInvalidParam8); + check_useful_opt_json!(schedule, ErrorCode::CommonInvalidParam8, Schedule); check_useful_opt_c_str!(justification, ErrorCode::CommonInvalidParam9); check_useful_opt_c_str!(package, ErrorCode::CommonInvalidParam12); check_useful_c_callback!(cb, ErrorCode::CommonInvalidParam13); @@ -1129,6 +1142,14 @@ pub extern fn indy_build_pool_upgrade_request(command_handle: CommandHandle, schedule: {:?}, justification: {:?}, reinstall: {:?}, force: {:?}, package: {:?}", submitter_did, name, version, action, sha256, timeout, schedule, justification, reinstall, force, package); + if action != "start" && action != "cancel" { + return IndyError::from_msg(IndyErrorKind::InvalidStructure, format!("Invalid action: {}", action)).into(); + } + + if action == "start" && schedule.is_none() { + return IndyError::from_msg(IndyErrorKind::InvalidStructure, format!("Schedule is required for `{}` action", action)).into(); + } + let result = CommandExecutor::instance() .send(Command::Ledger( LedgerCommand::BuildPoolUpgradeRequest( @@ -2016,7 +2037,7 @@ pub extern fn indy_build_get_txn_author_agreement_request(command_handle: Comman trace!("indy_build_get_txn_author_agreement_request: >>> submitter_did: {:?}, data: {:?}?", submitter_did, data); check_useful_opt_c_str!(submitter_did, ErrorCode::CommonInvalidParam2); - check_useful_opt_validateable_json!(data, ErrorCode::CommonInvalidParam3, GetTxnAuthorAgreementData); + check_useful_opt_validatable_json!(data, ErrorCode::CommonInvalidParam3, GetTxnAuthorAgreementData); check_useful_c_callback!(cb, ErrorCode::CommonInvalidParam4); trace!("indy_build_get_txn_author_agreement_request: entities >>> submitter_did: {:?}, data: {:?}", submitter_did, data); @@ -2073,7 +2094,7 @@ pub extern fn indy_build_acceptance_mechanisms_request(command_handle: CommandHa submitter_did, aml, version, aml_context); check_useful_c_str!(submitter_did, ErrorCode::CommonInvalidParam2); - check_useful_validateable_json!(aml, ErrorCode::CommonInvalidParam3, AcceptanceMechanisms); + check_useful_validatable_json!(aml, ErrorCode::CommonInvalidParam3, AcceptanceMechanisms); check_useful_c_str!(version, ErrorCode::CommonInvalidParam4); check_useful_opt_c_str!(aml_context, ErrorCode::CommonInvalidParam5); check_useful_c_callback!(cb, ErrorCode::CommonInvalidParam6); diff --git a/libindy/src/api/pool.rs b/libindy/src/api/pool.rs index 4b209616d6..77ba36b4a2 100755 --- a/libindy/src/api/pool.rs +++ b/libindy/src/api/pool.rs @@ -92,7 +92,7 @@ pub extern fn indy_open_pool_ledger(command_handle: CommandHandle, trace!("indy_open_pool_ledger: >>> config_name: {:?}, config: {:?}", config_name, config); check_useful_c_str!(config_name, ErrorCode::CommonInvalidParam2); - check_useful_opt_validateable_json!(config, ErrorCode::CommonInvalidParam3, PoolOpenConfig); + check_useful_opt_validatable_json!(config, ErrorCode::CommonInvalidParam3, PoolOpenConfig); check_useful_c_callback!(cb, ErrorCode::CommonInvalidParam4); trace!("indy_open_pool_ledger: entities >>> config_name: {:?}, config: {:?}", config_name, config); diff --git a/libindy/src/api/wallet.rs b/libindy/src/api/wallet.rs index 6193cdce94..37150738b0 100644 --- a/libindy/src/api/wallet.rs +++ b/libindy/src/api/wallet.rs @@ -5,6 +5,7 @@ use commands::wallet::WalletCommand; use domain::wallet::{Config, Credentials, ExportConfig, KeyConfig}; use errors::prelude::*; use utils::ctypes; +use utils::validation::Validatable; use serde_json; use libc::c_char; @@ -189,7 +190,7 @@ pub extern fn indy_create_wallet(command_handle: CommandHandle, trace!("indy_create_wallet: >>> command_handle: {:?}, config: {:?}, credentials: {:?}, cb: {:?}", command_handle, config, credentials, cb); - check_useful_json!(config, ErrorCode::CommonInvalidParam2, Config); + check_useful_validatable_json!(config, ErrorCode::CommonInvalidParam2, Config); check_useful_json!(credentials, ErrorCode::CommonInvalidParam3, Credentials); check_useful_c_callback!(cb, ErrorCode::CommonInvalidParam4); @@ -271,7 +272,7 @@ pub extern fn indy_open_wallet(command_handle: CommandHandle, trace!("indy_open_wallet: >>> command_handle: {:?}, config: {:?}, credentials: {:?}, cb: {:?}", command_handle, config, credentials, cb); - check_useful_json!(config, ErrorCode::CommonInvalidParam2, Config); + check_useful_validatable_json!(config, ErrorCode::CommonInvalidParam2, Config); check_useful_json!(credentials, ErrorCode::CommonInvalidParam3, Credentials); check_useful_c_callback!(cb, ErrorCode::CommonInvalidParam4); @@ -403,7 +404,7 @@ pub extern fn indy_import_wallet(command_handle: CommandHandle, trace!("indy_import_wallet: >>> command_handle: {:?}, config: {:?}, credentials: {:?}, import_config: {:?}, cb: {:?}", command_handle, config, credentials, import_config, cb); - check_useful_json!(config, ErrorCode::CommonInvalidParam2, Config); + check_useful_validatable_json!(config, ErrorCode::CommonInvalidParam2, Config); check_useful_json!(credentials, ErrorCode::CommonInvalidParam3, Credentials); check_useful_json!(import_config, ErrorCode::CommonInvalidParam4, ExportConfig); check_useful_c_callback!(cb, ErrorCode::CommonInvalidParam5); @@ -515,7 +516,7 @@ pub extern fn indy_delete_wallet(command_handle: CommandHandle, trace!("indy_delete_wallet: >>> command_handle: {:?}, config: {:?}, credentials: {:?}, cb: {:?}", command_handle, config, credentials, cb); - check_useful_json!(config, ErrorCode::CommonInvalidParam2, Config); + check_useful_validatable_json!(config, ErrorCode::CommonInvalidParam2, Config); check_useful_json!(credentials, ErrorCode::CommonInvalidParam3, Credentials); check_useful_c_callback!(cb, ErrorCode::CommonInvalidParam4); diff --git a/libindy/src/commands/ledger.rs b/libindy/src/commands/ledger.rs index 91be7ac08e..332ed18f66 100644 --- a/libindy/src/commands/ledger.rs +++ b/libindy/src/commands/ledger.rs @@ -15,6 +15,8 @@ use domain::crypto::key::Key; use domain::ledger::node::NodeOperationData; use domain::ledger::author_agreement::{GetTxnAuthorAgreementData, AcceptanceMechanisms}; use domain::ledger::auth_rule::{Constraint, AuthRules}; +use domain::ledger::request::Request; +use domain::ledger::pool::Schedule; use errors::prelude::*; use services::crypto::CryptoService; use services::ledger::LedgerService; @@ -74,7 +76,7 @@ pub enum LedgerCommand { String, // submitter did String, // target did Option, // hash - Option, // raw + Option, // raw Option, // enc Box) + Send>), BuildGetAttribRequest( @@ -140,7 +142,7 @@ pub enum LedgerCommand { String, // action String, // sha256 Option, // timeout - Option, // schedule + Option, // schedule Option, // justification bool, // reinstall bool, // force @@ -339,7 +341,7 @@ impl LedgerCommandExecutor { info!(target: "ledger_command_executor", "BuildAttribRequest command received"); cb(self.build_attrib_request(&submitter_did, &target_did, hash.as_ref().map(String::as_str), - raw.as_ref().map(String::as_str), + raw.as_ref(), enc.as_ref().map(String::as_str))); } LedgerCommand::BuildGetAttribRequest(submitter_did, target_did, raw, hash, enc, cb) => { @@ -400,7 +402,7 @@ impl LedgerCommandExecutor { LedgerCommand::BuildPoolUpgradeRequest(submitter_did, name, version, action, sha256, timeout, schedule, justification, reinstall, force, package, cb) => { info!(target: "ledger_command_executor", "BuildPoolUpgradeRequest command received"); cb(self.build_pool_upgrade_request(&submitter_did, &name, &version, &action, &sha256, timeout, - schedule.as_ref().map(String::as_str), + schedule, justification.as_ref().map(String::as_str), reinstall, force, package.as_ref().map(String::as_str))); } @@ -585,6 +587,10 @@ impl LedgerCommandExecutor { cb: Box) + Send>) { debug!("submit_request >>> handle: {:?}, request_json: {:?}", handle, request_json); + if let Err(err) = serde_json::from_str::>(&request_json){ + return cb(Err(IndyError::from_msg(IndyErrorKind::InvalidStructure, format!("Request is invalid json: {:?}", err)))); + } + let x: IndyResult = self.pool_service.send_tx(handle, request_json); match x { Ok(cmd_id) => { self.send_callbacks.borrow_mut().insert(cmd_id, cb); } @@ -678,7 +684,7 @@ impl LedgerCommandExecutor { submitter_did: &str, target_did: &str, hash: Option<&str>, - raw: Option<&str>, + raw: Option<&serde_json::Value>, enc: Option<&str>) -> IndyResult { debug!("build_attrib_request >>> submitter_did: {:?}, target_did: {:?}, hash: {:?}, raw: {:?}, enc: {:?}", submitter_did, target_did, hash, raw, enc); @@ -896,7 +902,7 @@ impl LedgerCommandExecutor { action: &str, sha256: &str, timeout: Option, - schedule: Option<&str>, + schedule: Option, justification: Option<&str>, reinstall: bool, force: bool, diff --git a/libindy/src/domain/ledger/pool.rs b/libindy/src/domain/ledger/pool.rs index 3b83333ed8..74689214d4 100644 --- a/libindy/src/domain/ledger/pool.rs +++ b/libindy/src/domain/ledger/pool.rs @@ -79,3 +79,5 @@ impl PoolUpgradeOperation { } } } + +pub type Schedule = HashMap; diff --git a/libindy/src/domain/ledger/request.rs b/libindy/src/domain/ledger/request.rs index 5fc476a0a8..73f777c5c5 100644 --- a/libindy/src/domain/ledger/request.rs +++ b/libindy/src/domain/ledger/request.rs @@ -1,6 +1,7 @@ use serde; use serde_json; use time; +use std::collections::HashMap; use std::sync::atomic::{AtomicUsize, Ordering}; @@ -44,6 +45,8 @@ pub struct Request { #[serde(skip_serializing_if = "Option::is_none")] pub signature: Option, #[serde(skip_serializing_if = "Option::is_none")] + pub signatures: Option>, + #[serde(skip_serializing_if = "Option::is_none")] pub taa_acceptance: Option, #[serde(skip_serializing_if = "Option::is_none")] pub endorser: Option @@ -57,6 +60,7 @@ impl Request { operation, protocol_version: Some(protocol_version), signature: None, + signatures: None, taa_acceptance: None, endorser: None, } diff --git a/libindy/src/domain/wallet/mod.rs b/libindy/src/domain/wallet/mod.rs index d4f2179ab4..d0722e5de9 100644 --- a/libindy/src/domain/wallet/mod.rs +++ b/libindy/src/domain/wallet/mod.rs @@ -3,6 +3,8 @@ pub mod export_import; use serde_json::value::Value; use std::collections::HashMap; +use utils::validation::Validatable; + #[derive(Debug, Serialize, Deserialize, Clone)] pub struct Config { pub id: String, @@ -74,3 +76,12 @@ pub struct KeyConfig { } pub type Tags = HashMap; + +impl Validatable for Config { + fn validate(&self) -> Result<(), String> { + if self.id.is_empty() { + return Err("Wallet id is empty".to_string()); + } + Ok(()) + } +} \ No newline at end of file diff --git a/libindy/src/services/ledger/mod.rs b/libindy/src/services/ledger/mod.rs index ae963b884c..76807e1d91 100644 --- a/libindy/src/services/ledger/mod.rs +++ b/libindy/src/services/ledger/mod.rs @@ -1,5 +1,3 @@ -use std::collections::HashMap; - use hex::FromHex; use ursa::cl::RevocationRegistryDelta as CryproRevocationRegistryDelta; use serde::de::DeserializeOwned; @@ -12,14 +10,14 @@ use domain::anoncreds::DELIMITER; use domain::anoncreds::revocation_registry::RevocationRegistry; use domain::anoncreds::revocation_registry_definition::{RevocationRegistryDefinition, RevocationRegistryDefinitionV1}; use domain::anoncreds::revocation_registry_delta::{RevocationRegistryDelta, RevocationRegistryDeltaV1}; -use domain::anoncreds::schema::{Schema, SchemaV1, MAX_ATTRIBUTES_COUNT}; +use domain::anoncreds::schema::{Schema, SchemaV1}; use domain::ledger::attrib::{AttribOperation, GetAttribOperation}; use domain::ledger::constants::{GET_VALIDATOR_INFO, NYM, POOL_RESTART, ROLE_REMOVE, STEWARD, ENDORSER, TRUSTEE, NETWORK_MONITOR, ROLES, txn_name_to_code}; use domain::ledger::cred_def::{CredDefOperation, GetCredDefOperation, GetCredDefReplyResult}; use domain::ledger::ddo::GetDdoOperation; use domain::ledger::node::{NodeOperation, NodeOperationData}; use domain::ledger::nym::GetNymOperation; -use domain::ledger::pool::{PoolConfigOperation, PoolRestartOperation, PoolUpgradeOperation}; +use domain::ledger::pool::{PoolConfigOperation, PoolRestartOperation, PoolUpgradeOperation, Schedule}; use domain::ledger::request::{TxnAuthrAgrmtAcceptanceData, Request}; use domain::ledger::response::{Message, Reply, ReplyType}; use domain::ledger::rev_reg::{GetRevocRegDeltaReplyResult, GetRevocRegReplyResult, GetRevRegDeltaOperation, GetRevRegOperation, RevRegEntryOperation}; @@ -53,30 +51,31 @@ impl LedgerService { #[logfn(Info)] pub fn build_nym_request(&self, identifier: &str, dest: &str, verkey: Option<&str>, alias: Option<&str>, role: Option<&str>) -> IndyResult { - let mut operation: Value = Value::Object(serde_json::map::Map::new()); - operation["type"] = Value::String(NYM.to_string()); - operation["dest"] = Value::String(dest.to_string()); + let mut operation = json!({ + "type": NYM, + "dest": dest, + }); if let Some(v) = verkey { - operation["verkey"] = Value::String(v.to_string()); + operation["verkey"] = json!(v); } if let Some(a) = alias { - operation["alias"] = Value::String(a.to_string()); + operation["alias"] = json!(a); } if let Some(r) = role { if r == ROLE_REMOVE { operation["role"] = Value::Null } else { - operation["role"] = Value::String(match r { + operation["role"] = json!(match r { "STEWARD" => STEWARD, "TRUSTEE" => TRUSTEE, "TRUST_ANCHOR" | "ENDORSER" => ENDORSER, "NETWORK_MONITOR" => NETWORK_MONITOR, role if ROLES.contains(&role) => role, role => return Err(err_msg(IndyErrorKind::InvalidStructure, format!("Invalid role: {}", role))) - }.to_string()) + }) } } @@ -98,41 +97,22 @@ impl LedgerService { #[logfn(Info)] pub fn build_attrib_request(&self, identifier: &str, dest: &str, hash: Option<&str>, - raw: Option<&str>, enc: Option<&str>) -> IndyResult { - if raw.is_none() && hash.is_none() && enc.is_none() { - return Err(err_msg(IndyErrorKind::InvalidStructure, "Either raw or hash or enc must be specified")); - } - - if let Some(ref raw) = raw { - serde_json::from_str::(raw) - .to_indy(IndyErrorKind::InvalidStructure, "Can not deserialize Raw Attribute")?; - } - + raw: Option<&serde_json::Value>, enc: Option<&str>) -> IndyResult { build_result!(AttribOperation, Some(identifier), dest.to_string(), hash.map(String::from), - raw.map(String::from), + raw.map(serde_json::Value::to_string), enc.map(String::from)) } #[logfn(Info)] pub fn build_get_attrib_request(&self, identifier: Option<&str>, dest: &str, raw: Option<&str>, hash: Option<&str>, enc: Option<&str>) -> IndyResult { - if raw.is_none() && hash.is_none() && enc.is_none() { - return Err(err_msg(IndyErrorKind::InvalidStructure, "Either raw or hash or enc must be specified")); - } - build_result!(GetAttribOperation, identifier, dest.to_string(), raw, hash, enc) } #[logfn(Info)] pub fn build_schema_request(&self, identifier: &str, schema: SchemaV1) -> IndyResult { - if schema.attr_names.len() > MAX_ATTRIBUTES_COUNT { - return Err(err_msg(IndyErrorKind::InvalidStructure, - format!("The number of Schema attributes {} cannot be greater than {}", schema.attr_names.len(), MAX_ATTRIBUTES_COUNT))); - } - let schema_data = SchemaOperationData::new(schema.name, schema.version, schema.attr_names); - build_result!(SchemaOperation, Some(identifier), schema_data) } @@ -213,31 +193,13 @@ impl LedgerService { #[logfn(Info)] pub fn build_pool_restart(&self, identifier: &str, action: &str, datetime: Option<&str>) -> IndyResult { - if action != "start" && action != "cancel" { - return Err(err_msg(IndyErrorKind::InvalidStructure, format!("Invalid action: {}", action))); - } - build_result!(PoolRestartOperation, Some(identifier),action, datetime.map(String::from)) } #[logfn(Info)] pub fn build_pool_upgrade(&self, identifier: &str, name: &str, version: &str, action: &str, - sha256: &str, timeout: Option, schedule: Option<&str>, + sha256: &str, timeout: Option, schedule: Option, justification: Option<&str>, reinstall: bool, force: bool, package: Option<&str>) -> IndyResult { - let schedule = match schedule { - Some(schedule) => Some(serde_json::from_str::>(schedule) - .to_indy(IndyErrorKind::InvalidStructure, "Can't deserialize schedule")?), - None => None - }; - - if action != "start" && action != "cancel" { - return Err(err_msg(IndyErrorKind::InvalidStructure, format!("Invalid action: {}", action))); - } - - if action == "start" && schedule.is_none() { - return Err(err_msg(IndyErrorKind::InvalidStructure, format!("Schedule is required for `{}` action", action))); - } - build_result!(PoolUpgradeOperation, Some(identifier), name, version, action, sha256, timeout, schedule, justification, reinstall, force, package) } @@ -475,7 +437,7 @@ impl LedgerService { #[logfn(Info)] pub fn validate_action(&self, request: &str) -> IndyResult<()> { let request: Request = serde_json::from_str(request) - .to_indy(IndyErrorKind::InvalidStructure, "Request is invalid json")?; + .map_err(|err| IndyError::from_msg(IndyErrorKind::InvalidStructure, format!("Request is invalid json: {:?}", err)))?; match request.operation["type"].as_str() { Some(POOL_RESTART) | Some(GET_VALIDATOR_INFO) => Ok(()), @@ -634,14 +596,6 @@ mod tests { check_request(&request, expected_result); } - #[test] - fn build_attrib_request_works_for_miss_attrib_field() { - let ledger_service = LedgerService::new(); - - let res = ledger_service.build_attrib_request(IDENTIFIER, DEST, None, None, None); - assert_kind!(IndyErrorKind::InvalidStructure, res); - } - #[test] fn build_attrib_request_works_for_hash_field() { let ledger_service = LedgerService::new(); @@ -726,24 +680,6 @@ mod tests { check_request(&request, expected_result); } - #[test] - fn build_schema_request_works_for_attrs_count_more_than_acceptable() { - let ledger_service = LedgerService::new(); - - let attr_names: AttributeNames = (0..MAX_ATTRIBUTES_COUNT + 1).map(|i| i.to_string()).collect(); - - let data = SchemaV1 { - id: Schema::schema_id(IDENTIFIER, "name", "1.0"), - name: "name".to_string(), - version: "1.0".to_string(), - attr_names, - seq_no: None, - }; - - let res = ledger_service.build_schema_request(IDENTIFIER, data); - assert_kind!(IndyErrorKind::InvalidStructure, res); - } - #[test] fn build_get_schema_request_works_for_invalid_id() { let ledger_service = LedgerService::new(); diff --git a/libindy/src/services/pool/mod.rs b/libindy/src/services/pool/mod.rs index d729a24fd1..701e58be26 100644 --- a/libindy/src/services/pool/mod.rs +++ b/libindy/src/services/pool/mod.rs @@ -149,10 +149,6 @@ impl PoolService { let config = config.unwrap_or_default(); - if config.number_read_nodes == 0 { - return Err(err_msg(IndyErrorKind::InvalidStructure, "The value of `number_read_nodes` must be greater than 0")) - } - let pool_handle: PoolHandle = next_pool_handle(); let mut new_pool = Pool::new(name, pool_handle, config); diff --git a/libindy/src/services/wallet/mod.rs b/libindy/src/services/wallet/mod.rs index 9beb14f683..9f6e872e0d 100644 --- a/libindy/src/services/wallet/mod.rs +++ b/libindy/src/services/wallet/mod.rs @@ -7,6 +7,7 @@ use std::rc::Rc; use named_type::NamedType; use serde_json; +use serde_json::Value as SValue; use api::wallet::*; @@ -118,10 +119,6 @@ impl WalletService { (key_data, master_key): (&KeyDerivationData, &MasterKey)) -> IndyResult { trace!("create_wallet >>> config: {:?}, credentials: {:?}", config, secret!(credentials)); - if config.id.is_empty() { - Err(err_msg(IndyErrorKind::InvalidStructure, "Wallet id is empty"))? - } - let storage_types = self.storage_types.borrow(); let (storage_type, storage_config, storage_credentials) = WalletService::_get_config_and_cred_for_storage(config, credentials, &storage_types)?; @@ -348,7 +345,7 @@ impl WalletService { }?; let record_value = record.get_value() - .ok_or(err_msg(IndyErrorKind::InvalidStructure, format!("{} not found for id: {:?}", type_, name)))?.to_string(); + .ok_or(err_msg(IndyErrorKind::InvalidState, format!("{} not found for id: {:?}", type_, name)))?.to_string(); Ok(record_value) } @@ -518,17 +515,13 @@ impl WalletService { .ok_or(err_msg(IndyErrorKind::UnknownWalletStorageType, "Unknown wallet storage type"))? }; - let storage_config = config.storage_config.as_ref().map(|value| value.to_string()); - let storage_credentials = credentials.storage_credentials.as_ref().map(|value| value.to_string()); + let storage_config = config.storage_config.as_ref().map(SValue::to_string); + let storage_credentials = credentials.storage_credentials.as_ref().map(SValue::to_string); Ok((storage_type, storage_config, storage_credentials)) } fn _is_id_from_config_not_used(&self, config: &Config) -> IndyResult<()> { - if config.id.is_empty() { - Err(err_msg(IndyErrorKind::InvalidStructure, "Wallet id is empty"))? - } - if self.wallets.borrow_mut().values().any(|ref wallet| wallet.get_id() == WalletService::_get_wallet_id(config)) { Err(err_msg(IndyErrorKind::WalletAlreadyOpened, format!("Wallet {} already opened", WalletService::_get_wallet_id(config))))? } diff --git a/libindy/src/services/wallet/wallet.rs b/libindy/src/services/wallet/wallet.rs index fd884fcdbb..0e861524b7 100644 --- a/libindy/src/services/wallet/wallet.rs +++ b/libindy/src/services/wallet/wallet.rs @@ -52,7 +52,7 @@ impl Keys { let mut decrypted = decrypt_merged(bytes, master_key)?; let keys: Keys = rmp_serde::from_slice(&decrypted) - .to_indy(IndyErrorKind::InvalidStructure, "Invalid bytes for Key")?; + .to_indy(IndyErrorKind::InvalidState, "Invalid bytes for Key")?; decrypted.zeroize(); Ok(keys) @@ -89,7 +89,7 @@ impl EncryptedValue { value_key_bytes.zeroize(); let res = String::from_utf8(decrypt_merged(&self.data, &value_key)?) - .to_indy(IndyErrorKind::InvalidStructure, "Invalid UTF8 string inside of value")?; // FIXME: review kind + .to_indy(IndyErrorKind::InvalidState, "Invalid UTF8 string inside of value")?; Ok(res) } diff --git a/libindy/src/utils/ctypes.rs b/libindy/src/utils/ctypes.rs index b7b2c48d63..f0a717b05b 100644 --- a/libindy/src/utils/ctypes.rs +++ b/libindy/src/utils/ctypes.rs @@ -75,20 +75,20 @@ macro_rules! check_useful_json { } } -macro_rules! check_useful_validateable_json { +macro_rules! check_useful_validatable_json { ($x:ident, $e:expr, $t:ty) => { check_useful_json!($x, $e, $t); match $x.validate() { Ok(ok) => ok, Err(err) => { - return err_msg($e.into(), err).into() + return err_msg(IndyErrorKind::InvalidStructure, err).into() } }; } } -macro_rules! check_useful_opt_validateable_json { +macro_rules! check_useful_opt_validatable_json { ($x:ident, $e:expr, $t:ty) => { let $x = match ctypes::c_str_to_string($x) { Ok(Some(val)) => Some(val), diff --git a/libindy/tests/ledger.rs b/libindy/tests/ledger.rs index c3ba2b32a5..f5cec13525 100644 --- a/libindy/tests/ledger.rs +++ b/libindy/tests/ledger.rs @@ -3136,6 +3136,20 @@ mod medium_cases { assert_code!(ErrorCode::CommonInvalidStructure, res); } + #[test] + #[cfg(feature = "local_nodes_pool")] + fn indy_build_schema_request_works_for_attrs_count_more_than_acceptable() { + use utils::domain::anoncreds::schema::MAX_ATTRIBUTES_COUNT; + + let mut schema = utils::anoncreds::gvt_schema(); + schema.attr_names = (0..MAX_ATTRIBUTES_COUNT + 1).map(|i| i.to_string()).collect(); + let schema = Schema::SchemaV1(schema); + let schema_json = serde_json::to_string(&schema).unwrap(); + + let res = ledger::build_schema_request(DID_TRUSTEE, &schema_json); + assert_code!(ErrorCode::CommonInvalidStructure, res); + } + #[test] #[cfg(feature = "local_nodes_pool")] fn indy_build_get_schema_requests_works_for_invalid_id() { From e4e8f370ac8f95f02d2b848f3f452fb115db8d56 Mon Sep 17 00:00:00 2001 From: Nikita Khateev Date: Wed, 21 Aug 2019 15:22:37 +0300 Subject: [PATCH 280/320] IS-1316 -- Integration Signed-off-by: Nikita Khateev --- libindy/src/services/pool/state_proof/mod.rs | 115 ++++++++++--------- 1 file changed, 61 insertions(+), 54 deletions(-) diff --git a/libindy/src/services/pool/state_proof/mod.rs b/libindy/src/services/pool/state_proof/mod.rs index 3e6d01cae2..cf03d6355b 100644 --- a/libindy/src/services/pool/state_proof/mod.rs +++ b/libindy/src/services/pool/state_proof/mod.rs @@ -568,9 +568,9 @@ fn _verify_merkle_tree(proof_nodes: &[u8], root_hash: &[u8], kvs: &[(String, Opt trace!("Value to hash: {}", value); let value = unwrap_or_return!(serde_json::from_str::(&value), false); - trace!("serde json success"); + trace!("serde json success: {:?}", value); let value = unwrap_or_return!(rmp_serde::to_vec(&value), false); - trace!("rmp serde success"); + trace!("rmp serde success: {:?}", value); let mut hash = match Hash::hash_leaf(&value) { Ok(hash) => hash, Err(err) => { @@ -769,15 +769,22 @@ fn _parse_reply_for_proof_value(json_msg: &SJsonValue, data: Option<&str>, parse match xtype { //TODO constants::GET_DDO => support DDO constants::GET_TXN => { - value = if !parsed_data["txn"].is_null() { - json!({ - "txn": parsed_data["txn"].clone(), - "txnMetadata": parsed_data["txnMetadata"].clone(), - "ver": parsed_data["ver"].clone(), - "reqSignature": parsed_data["reqSignature"].clone(), - }) - } else { - return Ok(None) + value = json!({}); + if parsed_data["txn"].is_null() && parsed_data["txnMetadata"].is_null() && + parsed_data["ver"].is_null() && parsed_data["reqSignature"].is_null() { + return Ok(None); + } + if !parsed_data["txn"].is_null() { + value["txn"] = parsed_data["txn"].clone(); + } + if !parsed_data["txnMetadata"].is_null() { + value["txnMetadata"] = parsed_data["txnMetadata"].clone(); + } + if !parsed_data["ver"].is_null() { + value["ver"] = parsed_data["ver"].clone(); + } + if !parsed_data["reqSignature"].is_null() { + value["reqSignature"] = parsed_data["reqSignature"].clone(); } } constants::GET_NYM => { @@ -881,14 +888,14 @@ mod tests { fn audit_proof_verify_works() { let nodes = json!( [ - "2ComdvG2GQbsGh6DntnUoxRFDCuWz6iSQdKfdd35jrUj", - "GfWc7bRJj7S4HpwCAzGCLXCftvyJzZkjFDS1cmrPnQFE", - "6bjZk9jK6G368qqpVog8A9JNj48EYZTrNszMzMkwRUho" + "Gf9aBhHCtBpTYbJXQWnt1DU8q33hwi6nN4f3NhnsBgMZ", + "68TGAdRjeQ29eNcuFYhsX5uLakGQLgKMKp5wSyPzt9Nq", + "25KLEkkyCEPSBj4qMFE3AcH87mFocyJEuPJ5xzPGwDgz" ] ).to_string(); - let kvs = vec![("3".to_string(), Some("3".to_string()))]; + let kvs = vec![(base64::encode("3"), Some(r#"{"3":"3"}"#.to_string()))]; let node_bytes = &nodes; - let root_hash = "G9QooEDKSmEtLGNyTwafQiPfGHMqw3A3Fjcj2eLRG4GS".from_base58().unwrap(); + let root_hash = "CrA5sqYe3ruf2uY7d8re7ePmyHqptHqANtMZcfZd4BvK".from_base58().unwrap(); assert!(_verify_merkle_tree(node_bytes.as_bytes(), root_hash.as_slice(), kvs.as_slice(), 5)); } @@ -896,14 +903,14 @@ mod tests { fn audit_proof_verify_works_for_invalid_proof() { let nodes = json!( [ - "2ComdvG2GQbsGh6DntnUoxRFDCuWz6iSQdKfdd35jrUa", // wrong hash in this value - "GfWc7bRJj7S4HpwCAzGCLXCftvyJzZkjFDS1cmrPnQFE", - "6bjZk9jK6G368qqpVog8A9JNj48EYZTrNszMzMkwRUho" + "Gf9aBhHCtBpTYbJXQWnt1DU8q33hwi6nN4f3NhnsBgM3", //wrong hash here + "68TGAdRjeQ29eNcuFYhsX5uLakGQLgKMKp5wSyPzt9Nq", + "25KLEkkyCEPSBj4qMFE3AcH87mFocyJEuPJ5xzPGwDgz" ] ).to_string(); - let kvs = vec![("3".to_string(), Some("3".to_string()))]; + let kvs = vec![(base64::encode("3"), Some(r#"{"3":"3"}"#.to_string()))]; let node_bytes = &nodes; - let root_hash = "G9QooEDKSmEtLGNyTwafQiPfGHMqw3A3Fjcj2eLRG4GS".from_base58().unwrap(); + let root_hash = "CrA5sqYe3ruf2uY7d8re7ePmyHqptHqANtMZcfZd4BvK".from_base58().unwrap(); assert!(!_verify_merkle_tree(node_bytes.as_bytes(), root_hash.as_slice(), kvs.as_slice(), 5)); } @@ -911,12 +918,12 @@ mod tests { fn audit_proof_verify_works_for_invalid_root_hash() { let nodes = json!( [ - "2ComdvG2GQbsGh6DntnUoxRFDCuWz6iSQdKfdd35jrUj", - "GfWc7bRJj7S4HpwCAzGCLXCftvyJzZkjFDS1cmrPnQFE", - "6bjZk9jK6G368qqpVog8A9JNj48EYZTrNszMzMkwRUho" + "Gf9aBhHCtBpTYbJXQWnt1DU8q33hwi6nN4f3NhnsBgMZ", + "68TGAdRjeQ29eNcuFYhsX5uLakGQLgKMKp5wSyPzt9Nq", + "25KLEkkyCEPSBj4qMFE3AcH87mFocyJEuPJ5xzPGwDgz" ] ).to_string(); - let kvs = vec![("3".to_string(), Some("3".to_string()))]; + let kvs = vec![(base64::encode("3"), Some(r#"{"3":"3"}"#.to_string()))]; let node_bytes = &nodes; let root_hash = "G9QooEDKSmEtLGNyTwafQiPfGHMqw3A3Fjcj2eLRG4G1".from_base58().unwrap(); assert!(!_verify_merkle_tree(node_bytes.as_bytes(), root_hash.as_slice(), kvs.as_slice(), 5)); @@ -926,14 +933,14 @@ mod tests { fn audit_proof_verify_works_for_invalid_ledger_length() { let nodes = json!( [ - "2ComdvG2GQbsGh6DntnUoxRFDCuWz6iSQdKfdd35jrUj", - "GfWc7bRJj7S4HpwCAzGCLXCftvyJzZkjFDS1cmrPnQFE", - "6bjZk9jK6G368qqpVog8A9JNj48EYZTrNszMzMkwRUho" + "Gf9aBhHCtBpTYbJXQWnt1DU8q33hwi6nN4f3NhnsBgMZ", + "68TGAdRjeQ29eNcuFYhsX5uLakGQLgKMKp5wSyPzt9Nq", + "25KLEkkyCEPSBj4qMFE3AcH87mFocyJEuPJ5xzPGwDgz" ] ).to_string(); - let kvs = vec![("3".to_string(), Some("3".to_string()))]; + let kvs = vec![(base64::encode("3"), Some(r#"{"3":"3"}"#.to_string()))]; let node_bytes = &nodes; - let root_hash = "G9QooEDKSmEtLGNyTwafQiPfGHMqw3A3Fjcj2eLRG4GS".from_base58().unwrap(); + let root_hash = "CrA5sqYe3ruf2uY7d8re7ePmyHqptHqANtMZcfZd4BvK".from_base58().unwrap(); assert!(!_verify_merkle_tree(node_bytes.as_bytes(), root_hash.as_slice(), kvs.as_slice(), 9)); } @@ -941,14 +948,14 @@ mod tests { fn audit_proof_verify_works_for_invalid_value() { let nodes = json!( [ - "2ComdvG2GQbsGh6DntnUoxRFDCuWz6iSQdKfdd35jrUj", - "GfWc7bRJj7S4HpwCAzGCLXCftvyJzZkjFDS1cmrPnQFE", - "6bjZk9jK6G368qqpVog8A9JNj48EYZTrNszMzMkwRUho" + "Gf9aBhHCtBpTYbJXQWnt1DU8q33hwi6nN4f3NhnsBgMZ", + "68TGAdRjeQ29eNcuFYhsX5uLakGQLgKMKp5wSyPzt9Nq", + "25KLEkkyCEPSBj4qMFE3AcH87mFocyJEuPJ5xzPGwDgz" ] ).to_string(); - let kvs = vec![("3".to_string(), Some("4".to_string()))]; + let kvs = vec![(base64::encode("3"), Some(r#"{"4":"4"}"#.to_string()))]; let node_bytes = &nodes; - let root_hash = "G9QooEDKSmEtLGNyTwafQiPfGHMqw3A3Fjcj2eLRG4GS".from_base58().unwrap(); + let root_hash = "CrA5sqYe3ruf2uY7d8re7ePmyHqptHqANtMZcfZd4BvK".from_base58().unwrap(); assert!(!_verify_merkle_tree(node_bytes.as_bytes(), root_hash.as_slice(), kvs.as_slice(), 5)); } @@ -956,14 +963,14 @@ mod tests { fn audit_proof_verify_works_for_invalid_seqno() { let nodes = json!( [ - "2ComdvG2GQbsGh6DntnUoxRFDCuWz6iSQdKfdd35jrUj", - "GfWc7bRJj7S4HpwCAzGCLXCftvyJzZkjFDS1cmrPnQFE", - "6bjZk9jK6G368qqpVog8A9JNj48EYZTrNszMzMkwRUho" + "Gf9aBhHCtBpTYbJXQWnt1DU8q33hwi6nN4f3NhnsBgMZ", + "68TGAdRjeQ29eNcuFYhsX5uLakGQLgKMKp5wSyPzt9Nq", + "25KLEkkyCEPSBj4qMFE3AcH87mFocyJEuPJ5xzPGwDgz" ] ).to_string(); - let kvs = vec![("4".to_string(), Some("3".to_string()))]; + let kvs = vec![(base64::encode("4"), Some(r#"{"3":"3"}"#.to_string()))]; let node_bytes = &nodes; - let root_hash = "G9QooEDKSmEtLGNyTwafQiPfGHMqw3A3Fjcj2eLRG4GS".from_base58().unwrap(); + let root_hash = "CrA5sqYe3ruf2uY7d8re7ePmyHqptHqANtMZcfZd4BvK".from_base58().unwrap(); assert!(!_verify_merkle_tree(node_bytes.as_bytes(), root_hash.as_slice(), kvs.as_slice(), 5)); } @@ -1461,9 +1468,9 @@ mod tests { let json_msg = &json!({ "type": constants::GET_TXN, "data": { - "audit_path": ["1", "2"], - "ledger_size": 2, - "root_hash": "123", + "auditPath": ["1", "2"], + "ledgerSize": 2, + "rootHash": "123", "txn": {"test1": "test2", "seqNo": 2}, "multi_signature": "ms" } @@ -1483,7 +1490,7 @@ mod tests { assert_eq!(parsed_sp.proof_nodes, nodes_str); assert_eq!(parsed_sp.kvs_to_verify, KeyValuesInSP::Simple(KeyValueSimpleData { - kvs: vec![(base64::encode("2"), Some(json!({"test1": "test2", "seqNo": 2}).to_string()))], + kvs: vec![(base64::encode("2"), Some(json!({"txn":{"test1": "test2", "seqNo": 2}}).to_string()))], verification_type: KeyValueSimpleDataVerificationType::MerkleTree(2), })); } @@ -1494,9 +1501,9 @@ mod tests { let json_msg = &json!({ "type": constants::GET_TXN, "data": { - "audit_path": ["1", "2"], - "ledger_size": 2, - "root_hash": "123", + "auditPath": ["1", "2"], + "ledgerSize": 2, + "rootHash": "123", "txn": {"test1": "test2", "seqNo": 2}, // "multi_signature": "ms" } @@ -1516,7 +1523,7 @@ mod tests { assert_eq!(parsed_sp.proof_nodes, nodes_str); assert_eq!(parsed_sp.kvs_to_verify, KeyValuesInSP::Simple(KeyValueSimpleData { - kvs: vec![(base64::encode("2"), Some(json!({"test1": "test2", "seqNo": 2}).to_string()))], + kvs: vec![(base64::encode("2"), Some(json!({"txn":{"test1": "test2", "seqNo": 2}}).to_string()))], verification_type: KeyValueSimpleDataVerificationType::MerkleTree(2), })); } @@ -1526,9 +1533,9 @@ mod tests { let json_msg = &json!({ "type": constants::GET_TXN, "data": { - "audit_path": ["1", "2"], -// "ledger_size": 2, - "root_hash": "123", + "auditPath": ["1", "2"], +// "ledgerSize": 2, + "rootHash": "123", "txn": {"test1": "test2", "seqNo": 2}, "multi_signature": "ms" } @@ -1544,9 +1551,9 @@ mod tests { let json_msg = &json!({ "type": constants::GET_TXN, "data": { - "audit_path": ["1", "2"], - "ledger_size": 2, - "root_hash": "123", + "auditPath": ["1", "2"], + "ledgerSize": 2, + "rootHash": "123", // "txn": {"test1": "test2", "seqNo": 2}, "multi_signature": "ms" } From c5a01254fd9d1daa637c6c88402aae215a77a8e1 Mon Sep 17 00:00:00 2001 From: "artem.ivanov" Date: Thu, 22 Aug 2019 17:12:23 +0300 Subject: [PATCH 281/320] IS-1356: Close pool after failed refresh Signed-off-by: artem.ivanov --- cli/src/commands/pool.rs | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/cli/src/commands/pool.rs b/cli/src/commands/pool.rs index a8eff38685..7579ad60d5 100644 --- a/cli/src/commands/pool.rs +++ b/cli/src/commands/pool.rs @@ -276,7 +276,12 @@ pub mod refresh_command { Ok(_) => { println_succ!("Pool \"{}\" has been refreshed", pool_name); Ok(()) - }, + } + Err(ref err) if err.error_code == ErrorCode::PoolLedgerTimeout => { + println_err!("Cannot refresh pool. Transaction response has not been received"); + close_pool(ctx, pool_handle, &pool_name) + .map(|_| println_err!("Pool \"{}\" has been disconnected", pool_name)) + } Err(err) => { handle_indy_error(err, None, None, None); Err(()) @@ -298,28 +303,27 @@ pub mod disconnect_command { fn execute(ctx: &CommandContext, params: &CommandParams) -> Result<(), ()> { trace!("execute >> ctx {:?} params {:?}", ctx, params); - let (handle, name) = if let Some(pool) = get_connected_pool(ctx) { - pool - } else { - println_err!("There is no connected pool now"); - return Err(()); - }; + let (handle, name) = ensure_connected_pool(ctx)?; + + let res = close_pool(ctx, handle, &name) + .map(|_| println_err!("Pool \"{}\" has been disconnected", name)); + + trace!("execute << {:?}", res); + res + } +} - let res = match Pool::close(handle) { +fn close_pool(ctx: &CommandContext, handle: i32, name: &str) -> Result<(), ()> { + match Pool::close(handle) { Ok(()) => { set_connected_pool(ctx, None); set_transaction_author_info(ctx, None); - println_succ!("Pool \"{}\" has been disconnected", name); Ok(()) } Err(err) => { handle_indy_error(err, None, Some(&name), None); Err(()) } - }; - - trace!("execute << {:?}", res); - res } } From 7d75c059a3dda335147c8b1689deaae2be66afca Mon Sep 17 00:00:00 2001 From: "artem.ivanov" Date: Wed, 21 Aug 2019 09:31:10 +0300 Subject: [PATCH 282/320] IS-1345: Run full testing on Ubuntu 18 Signed-off-by: artem.ivanov --- Jenkinsfile.cd | 4 ++-- Jenkinsfile.ci | 4 ++-- libindy/ci/ubuntu18.dockerfile | 9 +++++++++ 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/Jenkinsfile.cd b/Jenkinsfile.cd index 3eeaf3267e..e3285505c3 100644 --- a/Jenkinsfile.cd +++ b/Jenkinsfile.cd @@ -705,10 +705,10 @@ def ubuntuTesting() { stage('Ubuntu Test') { parallel([ "ubuntu:16.04": { - linuxTesting("ci/ubuntu.dockerfile ci", Ubuntu16, "pool_network", true, true) + linuxTesting("ci/ubuntu.dockerfile ci", Ubuntu16, "pool_network", true, false) }, "ubuntu:18.04": { - linuxTesting("ci/ubuntu18.dockerfile ci", Ubuntu18, "pool_network", true, false) + linuxTesting("ci/ubuntu18.dockerfile ci", Ubuntu18, "pool_network", true, true) } ]) } diff --git a/Jenkinsfile.ci b/Jenkinsfile.ci index 55cf298c77..aa26c6612b 100644 --- a/Jenkinsfile.ci +++ b/Jenkinsfile.ci @@ -345,10 +345,10 @@ def ubuntuTesting() { stage('Ubuntu Test') { parallel([ "ubuntu:16.04": { - linuxTesting("ci/ubuntu.dockerfile ci", Ubuntu16, "pool_network", true) + linuxTesting("ci/ubuntu.dockerfile ci", Ubuntu16, "pool_network", false) }, "ubuntu:18.04": { - linuxTesting("ci/ubuntu18.dockerfile ci", Ubuntu18, "pool_network", false) + linuxTesting("ci/ubuntu18.dockerfile ci", Ubuntu18, "pool_network", true) } ]) } diff --git a/libindy/ci/ubuntu18.dockerfile b/libindy/ci/ubuntu18.dockerfile index 27dca95c0f..c53285ebd0 100644 --- a/libindy/ci/ubuntu18.dockerfile +++ b/libindy/ci/ubuntu18.dockerfile @@ -29,6 +29,15 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ && gem install --no-ri --no-rdoc rake fpm \ && rm -rf /var/lib/apt/lists/* +# install java and maven +RUN apt-get update && apt-get install openjdk-8-jdk -y +ENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-amd64 +RUN apt-get update && apt-get install -y maven + +# install nodejs and npm +RUN curl -sL https://deb.nodesource.com/setup_8.x | bash - +RUN apt-get install -y nodejs + RUN useradd -ms /bin/bash -u $uid indy USER indy From 14dbadc1b30844302d4d323fd89aa5ba5cf77cc3 Mon Sep 17 00:00:00 2001 From: "artem.ivanov" Date: Wed, 21 Aug 2019 09:56:26 +0300 Subject: [PATCH 283/320] IS-1345: Run full testing for rc branch Signed-off-by: artem.ivanov --- Jenkinsfile.cd | 17 +++++++++++++---- Jenkinsfile.ci | 4 ++-- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/Jenkinsfile.cd b/Jenkinsfile.cd index e3285505c3..106c683a62 100644 --- a/Jenkinsfile.cd +++ b/Jenkinsfile.cd @@ -212,7 +212,9 @@ String getSrcVersion(folder) { } } -def linuxTesting(file, env_name, network_name, stashBuildResults, full_testing) { +def linuxTesting(file, env_name, network_name, stashBuildResults) { + def full_testing = runAllTests(env_name) + parallel([ failFast : true, "${env_name} Test: build and test libindy": { @@ -701,14 +703,21 @@ def windowsTesting() { } } +def runAllTests(env_name) { + if (env_name == Ubuntu16) { + return true + } + return (env.BRANCH_NAME == 'rc') +} + def ubuntuTesting() { stage('Ubuntu Test') { parallel([ "ubuntu:16.04": { - linuxTesting("ci/ubuntu.dockerfile ci", Ubuntu16, "pool_network", true, false) + linuxTesting("ci/ubuntu.dockerfile ci", Ubuntu16, "pool_network", true) }, "ubuntu:18.04": { - linuxTesting("ci/ubuntu18.dockerfile ci", Ubuntu18, "pool_network", true, true) + linuxTesting("ci/ubuntu18.dockerfile ci", Ubuntu18, "pool_network", true) } ]) } @@ -841,7 +850,7 @@ def buildIOSPod(packageName, targets) { def rhelTesting() { stage('RedHat Test') { - linuxTesting("ci/amazon.dockerfile ci", "RedHat", "pool_network", false, false) + linuxTesting("ci/amazon.dockerfile ci", "RedHat", "pool_network", false) } } diff --git a/Jenkinsfile.ci b/Jenkinsfile.ci index aa26c6612b..64cbc738ff 100644 --- a/Jenkinsfile.ci +++ b/Jenkinsfile.ci @@ -627,8 +627,8 @@ def linuxPythonTesting(env_name, network_name, testEnv) { echo "${env_name} Libindy Test: Test python wrapper" sh ''' - python3.5 -m pip install --user -e .[test] - LD_LIBRARY_PATH=./:${LD_LIBRARY_PATH} TEST_POOL_IP=10.0.0.2 python3.5 -m pytest + python3 -m pip install --user -e .[test] + LD_LIBRARY_PATH=./:${LD_LIBRARY_PATH} TEST_POOL_IP=10.0.0.2 python3 -m pytest ''' } } From cfae32db3d3499b39c92aeced2b18a3a22bfbf35 Mon Sep 17 00:00:00 2001 From: Sergey Minaev Date: Thu, 22 Aug 2019 13:24:52 +0300 Subject: [PATCH 284/320] Update nodejs to 10.x for ubuntu18.04 ci/cd Signed-off-by: Sergey Minaev --- libindy/ci/ubuntu18.dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libindy/ci/ubuntu18.dockerfile b/libindy/ci/ubuntu18.dockerfile index c53285ebd0..cca0db792b 100644 --- a/libindy/ci/ubuntu18.dockerfile +++ b/libindy/ci/ubuntu18.dockerfile @@ -35,7 +35,7 @@ ENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-amd64 RUN apt-get update && apt-get install -y maven # install nodejs and npm -RUN curl -sL https://deb.nodesource.com/setup_8.x | bash - +RUN curl -sL https://deb.nodesource.com/setup_10.x | bash - RUN apt-get install -y nodejs RUN useradd -ms /bin/bash -u $uid indy @@ -44,4 +44,4 @@ USER indy RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain 1.36.0 ENV PATH /home/indy/.cargo/bin:$PATH -WORKDIR /home/indy \ No newline at end of file +WORKDIR /home/indy From 7662c2aa7dee44efdf1785a0ad3c8b1111399b9c Mon Sep 17 00:00:00 2001 From: Sergey Minaev Date: Thu, 22 Aug 2019 13:38:46 +0300 Subject: [PATCH 285/320] Temporary disable amazonlinux testing in CI Signed-off-by: Sergey Minaev --- Jenkinsfile.ci | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile.ci b/Jenkinsfile.ci index 64cbc738ff..8202a8a5ee 100644 --- a/Jenkinsfile.ci +++ b/Jenkinsfile.ci @@ -20,7 +20,7 @@ def testing() { 'android-test': { androidTesting() }, 'macos-test' : { macosTesting() }, 'ios-test' : { iosTesting() }, - 'redhat-test' : { rhelTesting() }, + // 'redhat-test' : { rhelTesting() }, 'windows-test': { windowsTesting() } ]) } From 2f94dcd77ad8447ec43800d0cdeae78400294b7d Mon Sep 17 00:00:00 2001 From: "artem.ivanov" Date: Thu, 22 Aug 2019 15:10:22 +0300 Subject: [PATCH 286/320] IS-1345: Run python tests usuing python 3.6 Signed-off-by: artem.ivanov --- Jenkinsfile.ci | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile.ci b/Jenkinsfile.ci index 8202a8a5ee..600509877b 100644 --- a/Jenkinsfile.ci +++ b/Jenkinsfile.ci @@ -685,8 +685,8 @@ def linuxVcxPythonTesting(env_name, network_name, testEnv) { echo "${env_name} Vcx Test: Test python wrapper" sh ''' - python3.5 -m pip install --user pytest==3.6.4 pytest-asyncio - LD_LIBRARY_PATH=./:${LD_LIBRARY_PATH} python3.5 -m pytest -s + python3 -m pip install --user pytest==3.6.4 pytest-asyncio + LD_LIBRARY_PATH=./:${LD_LIBRARY_PATH} python3 -m pytest -s ''' } } From 82f96255872b2cd6eca02fd8fdbc6201236b41ba Mon Sep 17 00:00:00 2001 From: "artem.ivanov" Date: Thu, 22 Aug 2019 13:05:19 +0300 Subject: [PATCH 287/320] IS-912: UX: Early static validation - fixed broken test Signed-off-by: artem.ivanov --- vcx/wrappers/node/test/suite1/wallet.test.ts | 2 +- vcx/wrappers/python3/tests/test_wallet.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/vcx/wrappers/node/test/suite1/wallet.test.ts b/vcx/wrappers/node/test/suite1/wallet.test.ts index 1add694ab3..756f93cf6d 100644 --- a/vcx/wrappers/node/test/suite1/wallet.test.ts +++ b/vcx/wrappers/node/test/suite1/wallet.test.ts @@ -136,7 +136,7 @@ describe('Wallet:', () => { describe('import:', () => { it('throws: libindy error', async () => { - let config = '{"wallet_name":"","wallet_key":"","exported_wallet_path":"","backup_key":""}' + let config = '{"wallet_name":"name","wallet_key":"","exported_wallet_path":"","backup_key":""}' let error = await shouldThrow(async () => Wallet.import(config)) assert.equal(error.vcxCode, VCXCode.IO_ERROR) shutdownVcx(false) diff --git a/vcx/wrappers/python3/tests/test_wallet.py b/vcx/wrappers/python3/tests/test_wallet.py index 3171167d40..4c3e5a959e 100644 --- a/vcx/wrappers/python3/tests/test_wallet.py +++ b/vcx/wrappers/python3/tests/test_wallet.py @@ -108,7 +108,7 @@ async def test_import_wallet_failures(vcx_init_test_mode, cleanup): assert ErrorCode.InvalidJson == e.value.error_code cleanup(True) - config = {'wallet_name': '', 'wallet_key': '', 'exported_wallet_path': '', 'backup_key': ''} + config = {'wallet_name': 'IO_ERROR', 'wallet_key': '', 'exported_wallet_path': '', 'backup_key': ''} with pytest.raises(VcxError) as e: await Wallet.import_wallet(json.dumps(config)) assert ErrorCode.IOError == e.value.error_code From 1a690f66e6b88f2b8cffca912de9b40888b879d2 Mon Sep 17 00:00:00 2001 From: Axel Nennker Date: Fri, 23 Aug 2019 07:25:05 +0200 Subject: [PATCH 288/320] revert Cargo.lock to master version Signed-off-by: Axel Nennker --- libindy/Cargo.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libindy/Cargo.lock b/libindy/Cargo.lock index fed7c12414..25423d3332 100644 --- a/libindy/Cargo.lock +++ b/libindy/Cargo.lock @@ -116,7 +116,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "arrayref 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", "arrayvec 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", - "constant_time_eq 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "constant_time_eq 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -207,7 +207,7 @@ dependencies = [ [[package]] name = "constant_time_eq" -version = "0.1.4" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -1674,7 +1674,7 @@ dependencies = [ "checksum clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5067f5bb2d80ef5d68b4c87db81601f0b75bca627bc2ef76b141d7b846a3c6d9" "checksum clear_on_drop 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "97276801e127ffb46b66ce23f35cc96bd454fa311294bced4bbace7baa8b1d17" "checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" -"checksum constant_time_eq 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "995a44c877f9212528ccc74b21a232f66ad69001e40ede5bcee2ac9ef2657120" +"checksum constant_time_eq 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8ff012e225ce166d4422e0e78419d901719760f62ae2b7969ca6b564d1b54a9e" "checksum criterion 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "0363053954f3e679645fc443321ca128b7b950a6fe288cf5f9335cc22ee58394" "checksum criterion-plot 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "76f9212ddf2f4a9eb2d401635190600656a1f88a932ef53d06e7fa4c7e02fb8e" "checksum crossbeam-deque 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "05e44b8cf3e1a625844d1750e1f7820da46044ff6d28f4d43e455ba3e5bb2c13" From c84a96d5ab507c2d1ed81ee11b836a14620441ce Mon Sep 17 00:00:00 2001 From: "artem.ivanov" Date: Fri, 23 Aug 2019 08:27:16 +0300 Subject: [PATCH 289/320] Updated Indy Pool version Signed-off-by: artem.ivanov --- ci/indy-pool.dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ci/indy-pool.dockerfile b/ci/indy-pool.dockerfile index 3f958426a3..79b8cb7d3f 100644 --- a/ci/indy-pool.dockerfile +++ b/ci/indy-pool.dockerfile @@ -24,8 +24,8 @@ RUN echo "deb https://repo.sovrin.org/deb xenial $indy_stream" >> /etc/apt/sourc RUN useradd -ms /bin/bash -u $uid indy -ARG indy_plenum_ver=1.9.1~dev856 -ARG indy_node_ver=1.9.1~dev1043 +ARG indy_plenum_ver=1.9.2~dev871 +ARG indy_node_ver=1.9.2~dev1061 ARG python3_indy_crypto_ver=0.4.5 ARG indy_crypto_ver=0.4.5 From c55f4a2263eabfb7efa257307e34e5812e3b42f5 Mon Sep 17 00:00:00 2001 From: Axel Nennker Date: Fri, 23 Aug 2019 07:28:21 +0200 Subject: [PATCH 290/320] revert Cargo.lock to master version Signed-off-by: Axel Nennker --- cli/Cargo.lock | 636 +++++++++++++++++++++++-------------------------- 1 file changed, 295 insertions(+), 341 deletions(-) diff --git a/cli/Cargo.lock b/cli/Cargo.lock index 215ed61ddb..f2894356a3 100644 --- a/cli/Cargo.lock +++ b/cli/Cargo.lock @@ -7,18 +7,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "aho-corasick" -version = "0.6.10" +version = "0.6.9" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "aho-corasick" -version = "0.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -26,7 +18,7 @@ name = "ansi_term" version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -35,18 +27,17 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] -name = "arc-swap" -version = "0.3.11" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "arrayref" -version = "0.3.5" +name = "argon2rs" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", + "scoped_threadpool 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", +] [[package]] name = "arrayvec" -version = "0.4.11" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "nodrop 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", @@ -54,46 +45,35 @@ dependencies = [ [[package]] name = "atty" -version = "0.2.13" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "autocfg" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "backtrace" -version = "0.3.34" +version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "backtrace-sys 0.1.31 (registry+https://github.com/rust-lang/crates.io-index)", - "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "backtrace-sys 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-demangle 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-demangle 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "backtrace-sys" -version = "0.1.31" +version = "0.1.26" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cc 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "base64" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "bitflags" version = "0.4.0" @@ -101,51 +81,46 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "bitflags" -version = "1.1.0" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] -name = "blake2b_simd" -version = "0.5.6" +name = "blake2-rfc" +version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "arrayref 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", - "arrayvec 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", + "arrayvec 0.4.9 (registry+https://github.com/rust-lang/crates.io-index)", "constant_time_eq 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "build_const" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "byteorder" -version = "1.3.2" +version = "1.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "cc" -version = "1.0.40" +version = "1.0.27" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "cfg-if" -version = "0.1.9" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "chrono" -version = "0.4.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", - "num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "cloudabi" -version = "0.0.3" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "num-integer 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -154,45 +129,49 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] -name = "crc32fast" -version = "1.2.0" +name = "crc" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "build_const 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "crossbeam-utils" -version = "0.6.6" +name = "crc32fast" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "crossbeam" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "csv" version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)", "memchr 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "dirs" -version = "1.0.5" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_users 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_users 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "dtoa" -version = "0.4.4" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -202,33 +181,33 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "failure" -version = "0.1.5" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "backtrace 0.3.34 (registry+https://github.com/rust-lang/crates.io-index)", - "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "backtrace 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)", + "failure_derive 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "failure_derive" -version = "0.1.5" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)", - "synstructure 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.23 (registry+https://github.com/rust-lang/crates.io-index)", + "synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "flate2" -version = "1.0.11" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "crc32fast 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "crc32fast 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", - "miniz-sys 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", - "miniz_oxide 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "miniz-sys 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "miniz_oxide_c_api 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -237,13 +216,22 @@ version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] -name = "fuchsia-cprng" -version = "0.1.1" +name = "fuchsia-zircon" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "fuchsia-zircon-sys" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "futures" -version = "0.1.28" +version = "0.1.25" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -258,16 +246,16 @@ dependencies = [ name = "indy" version = "1.11.0" dependencies = [ - "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", + "failure 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", "indy-sys 1.11.0", "lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "num-derive 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "num-derive 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.97 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.97 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -276,21 +264,21 @@ name = "indy-cli" version = "1.11.0" dependencies = [ "ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", - "atty 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)", - "chrono 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", - "dirs 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", + "atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", + "chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "dirs 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", "indy 1.11.0", "lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", - "libloading 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libloading 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "linefeed 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "log4rs 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "log4rs 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "prettytable-rs 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", "regex 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "rpassword 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.97 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.97 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", "term 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "unescape 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -301,14 +289,14 @@ name = "indy-sys" version = "1.11.0" dependencies = [ "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", - "pkg-config 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "vcpkg 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "vcpkg 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "itoa" -version = "0.4.4" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -327,7 +315,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "lazy_static" -version = "1.3.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -337,11 +325,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "libloading" -version = "0.5.2" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cc 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -354,23 +342,23 @@ dependencies = [ "nix 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "ole32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "shell32-sys 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-normalization 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-normalization 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "linked-hash-map" -version = "0.5.2" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "log" -version = "0.4.8" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.97 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -380,26 +368,26 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "log4rs" -version = "0.8.3" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "antidote 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "arc-swap 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)", - "chrono 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", - "flate2 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)", + "chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "flate2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "humantime 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "log-mdc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.97 (registry+https://github.com/rust-lang/crates.io-index)", "serde-value 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.97 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_yaml 0.8.9 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_yaml 0.8.8 (registry+https://github.com/rust-lang/crates.io-index)", "thread-id 3.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "typemap 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -412,33 +400,49 @@ dependencies = [ [[package]] name = "memchr" -version = "2.2.1" +version = "2.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", + "version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", +] [[package]] name = "miniz-sys" -version = "0.1.12" +version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cc 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "miniz_oxide" -version = "0.3.2" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "adler32 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "miniz_oxide_c_api" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cc 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)", + "crc 1.8.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", + "miniz_oxide 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "nix" version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_version 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", "semver 0.1.20 (registry+https://github.com/rust-lang/crates.io-index)", @@ -452,30 +456,27 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "num-derive" -version = "0.2.5" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.23 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "num-integer" -version = "0.1.41" +version = "0.1.39" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "autocfg 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "num-traits" -version = "0.2.8" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "autocfg 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", -] [[package]] name = "ole32-sys" @@ -488,15 +489,15 @@ dependencies = [ [[package]] name = "ordered-float" -version = "1.0.2" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "pkg-config" -version = "0.3.15" +version = "0.3.14" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -504,7 +505,7 @@ name = "prettytable-rs" version = "0.6.7" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "atty 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)", + "atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "csv 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)", "encode_unicode 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", @@ -514,20 +515,12 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "0.4.30" +version = "0.4.24" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "proc-macro2" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "quick-error" version = "1.2.2" @@ -535,68 +528,44 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "quote" -version = "0.6.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "quote" -version = "1.0.1" +version = "0.6.10" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "rand_core" -version = "0.3.1" +name = "rand" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "rand_core" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "rand_os" -version = "0.1.3" +name = "redox_syscall" +version = "0.1.44" source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", - "rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", -] [[package]] -name = "rdrand" -version = "0.4.0" +name = "redox_termios" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "redox_syscall" -version = "0.1.56" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "redox_users" -version = "0.3.1" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_os 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)", - "rust-argon2 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "argon2rs 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", + "failure 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -604,22 +573,23 @@ name = "regex" version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "aho-corasick 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", - "memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "aho-corasick 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "regex-syntax 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", "thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", - "utf8-ranges 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "utf8-ranges 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "regex" -version = "1.2.1" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "aho-corasick 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)", - "memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-syntax 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", + "aho-corasick 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "regex-syntax 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", "thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "utf8-ranges 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -627,13 +597,16 @@ name = "regex-syntax" version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "ucd-util 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "ucd-util 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "regex-syntax" -version = "0.6.11" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "ucd-util 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", +] [[package]] name = "rpassword" @@ -651,19 +624,9 @@ name = "rprompt" version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "rust-argon2" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", - "blake2b_simd 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-utils 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "rustc-demangle" -version = "0.1.16" +version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -684,6 +647,11 @@ name = "ryu" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "scoped_threadpool" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "semver" version = "0.1.20" @@ -691,7 +659,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "serde" -version = "1.0.99" +version = "1.0.97" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -699,18 +667,18 @@ name = "serde-value" version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "ordered-float 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", + "ordered-float 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.97 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "serde_derive" -version = "1.0.99" +version = "1.0.97" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.23 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -718,20 +686,20 @@ name = "serde_json" version = "1.0.40" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", + "itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", "ryu 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.97 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "serde_yaml" -version = "0.8.9" +version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "dtoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", - "linked-hash-map 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", - "yaml-rust 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", + "dtoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", + "linked-hash-map 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.97 (registry+https://github.com/rust-lang/crates.io-index)", + "yaml-rust 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -743,39 +711,24 @@ dependencies = [ "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "smallvec" -version = "0.6.10" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "syn" -version = "0.15.44" +version = "0.15.23" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "syn" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "proc-macro2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "synstructure" -version = "0.10.2" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.23 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -788,14 +741,24 @@ dependencies = [ "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "termion" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "thread-id" version = "3.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -803,17 +766,17 @@ name = "thread_local" version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "time" -version = "0.1.42" +version = "0.1.41" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -831,7 +794,7 @@ dependencies = [ [[package]] name = "ucd-util" -version = "0.1.5" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -841,11 +804,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "unicode-normalization" -version = "0.1.8" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "smallvec 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", -] [[package]] name = "unicode-width" @@ -857,11 +817,6 @@ name = "unicode-xid" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "unicode-xid" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "unsafe-any" version = "0.4.2" @@ -872,12 +827,17 @@ dependencies = [ [[package]] name = "utf8-ranges" -version = "1.0.4" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "vcpkg" -version = "0.2.7" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "version_check" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -892,7 +852,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "winapi" -version = "0.3.7" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -916,124 +876,118 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "yaml-rust" -version = "0.4.3" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "linked-hash-map 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", + "linked-hash-map 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [metadata] "checksum adler32 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "7e522997b529f05601e05166c07ed17789691f562762c7f3b987263d2dedee5c" -"checksum aho-corasick 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)" = "81ce3d38065e618af2d7b77e10c5ad9a069859b4be3c2250f674af3840d9c8a5" -"checksum aho-corasick 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)" = "58fb5e95d83b38284460a5fda7d6470aa0b8844d283a0b614b8535e880800d2d" +"checksum aho-corasick 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)" = "1e9a933f4e58658d7b12defcf96dc5c720f20832deebe3e0a19efd3b6aaeeb9e" "checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" "checksum antidote 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "34fde25430d87a9388dadbe6e34d7f72a462c8b43ac8d309b42b0a8505d7e2a5" -"checksum arc-swap 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)" = "bc4662175ead9cd84451d5c35070517777949a2ed84551764129cedb88384841" -"checksum arrayref 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "0d382e583f07208808f6b1249e60848879ba3543f57c32277bf52d69c2f0f0ee" -"checksum arrayvec 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)" = "b8d73f9beda665eaa98ab9e4f7442bd4e7de6652587de55b2525e52e29c1b0ba" -"checksum atty 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)" = "1803c647a3ec87095e7ae7acfca019e98de5ec9a7d01343f611cf3152ed71a90" -"checksum autocfg 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "22130e92352b948e7e82a49cdb0aa94f2211761117f29e052dd397c1ac33542b" -"checksum backtrace 0.3.34 (registry+https://github.com/rust-lang/crates.io-index)" = "b5164d292487f037ece34ec0de2fcede2faa162f085dd96d2385ab81b12765ba" -"checksum backtrace-sys 0.1.31 (registry+https://github.com/rust-lang/crates.io-index)" = "82a830b4ef2d1124a711c71d263c5abdc710ef8e907bd508c88be475cebc422b" -"checksum base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0b25d992356d2eb0ed82172f5248873db5560c4721f564b13cb5193bda5e668e" +"checksum argon2rs 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "3f67b0b6a86dae6e67ff4ca2b6201396074996379fba2b92ff649126f37cb392" +"checksum arrayvec 0.4.9 (registry+https://github.com/rust-lang/crates.io-index)" = "d18513977c2d8261c448511c5c53dc66b26dfccbc3d4446672dea1e71a7d8a26" +"checksum atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "9a7d5b8723950951411ee34d271d99dddcc2035a16ab25310ea2c8cfd4369652" +"checksum backtrace 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)" = "18b65ea1161bfb2dd6da6fade5edd4dbd08fba85012123dd333d2fd1b90b2782" +"checksum backtrace-sys 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)" = "3fcce89e5ad5c8949caa9434501f7b55415b3e7ad5270cb88c75a8d35e8f1279" "checksum bitflags 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8dead7461c1127cf637931a1e50934eb6eee8bff2f74433ac7909e9afcee04a3" -"checksum bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3d155346769a6855b86399e9bc3814ab343cd3d62c7e985113d46a0ec3c281fd" -"checksum blake2b_simd 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "461f4b879a8eb70c1debf7d0788a9a5ff15f1ea9d25925fea264ef4258bed6b2" -"checksum byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a7c3dd8985a7111efc5c80b44e23ecdd8c007de8ade3b96595387e812b957cf5" -"checksum cc 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)" = "b548a4ee81fccb95919d4e22cfea83c7693ebfd78f0495493178db20b3139da7" -"checksum cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "b486ce3ccf7ffd79fdeb678eac06a9e6c09fc88d33836340becb8fffe87c5e33" -"checksum chrono 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)" = "77d81f58b7301084de3b958691458a53c3f7e0b1d702f77e550b6a88e3a88abe" -"checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" +"checksum bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "228047a76f468627ca71776ecdebd732a3423081fcf5125585bcd7c49886ce12" +"checksum blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)" = "5d6d530bdd2d52966a6d03b7a964add7ae1a288d25214066fd4b600f0f796400" +"checksum build_const 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "39092a32794787acd8525ee150305ff051b0aa6cc2abaf193924f5ab05425f39" +"checksum byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "94f88df23a25417badc922ab0f5716cc1330e87f71ddd9203b3a3ccd9cedf75d" +"checksum cc 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)" = "155ed195f7bd722d1dfeb30365b9d0c1f6a078fa7ca4014497e5935d90993d6f" +"checksum cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "082bb9b28e00d3c9d39cc03e64ce4cea0f1bb9b3fde493f0cbc008472d22bdf4" +"checksum chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "45912881121cb26fad7c38c17ba7daa18764771836b34fab7d3fbd93ed633878" "checksum constant_time_eq 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8ff012e225ce166d4422e0e78419d901719760f62ae2b7969ca6b564d1b54a9e" -"checksum crc32fast 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ba125de2af0df55319f41944744ad91c71113bf74a4646efff39afe1f6842db1" -"checksum crossbeam-utils 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)" = "04973fa96e96579258a5091af6003abde64af786b860f18622b82e026cca60e6" +"checksum crc 1.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d663548de7f5cca343f1e0a48d14dcfb0e9eb4e079ec58883b7251539fa10aeb" +"checksum crc32fast 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e91d5240c6975ef33aeb5f148f35275c25eda8e8a5f95abe421978b05b8bf192" +"checksum crossbeam 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "24ce9782d4d5c53674646a6a4c1863a21a8fc0cb649b3c94dfc16e45071dea19" "checksum csv 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7ef22b37c7a51c564a365892c012dc0271221fdcc64c69b19ba4d6fa8bd96d9c" -"checksum dirs 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "3fd78930633bd1c6e35c4b42b1df7b0cbc6bc191146e512bb3bedf243fcc3901" -"checksum dtoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "ea57b42383d091c85abcc2706240b94ab2a8fa1fc81c10ff23c4de06e2a90b5e" +"checksum dirs 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "88972de891f6118092b643d85a0b28e0678e0f948d7f879aa32f2d5aafe97d2a" +"checksum dtoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "6d301140eb411af13d3115f9a562c85cc6b541ade9dfa314132244aaee7489dd" "checksum encode_unicode 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "90b2c9496c001e8cb61827acdefad780795c42264c137744cae6f7d9e3450abd" -"checksum failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "795bd83d3abeb9220f257e597aa0080a508b27533824adf336529648f6abf7e2" -"checksum failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "ea1063915fd7ef4309e222a5a07cf9c319fb9c7836b1f89b85458672dbb127e1" -"checksum flate2 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)" = "2adaffba6388640136149e18ed080b77a78611c1e1d6de75aedcdf78df5d4682" +"checksum failure 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "6dd377bcc1b1b7ce911967e3ec24fa19c3224394ec05b54aa7b083d498341ac7" +"checksum failure_derive 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "64c2d913fe8ed3b6c6518eedf4538255b989945c14c2a7d5cbff62a5e2120596" +"checksum flate2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "2291c165c8e703ee54ef3055ad6188e3d51108e2ded18e9f2476e774fc5ad3d4" "checksum fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "2fad85553e09a6f881f739c29f0b00b0f01357c743266d478b68951ce23285f3" -"checksum fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" -"checksum futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)" = "45dc39533a6cae6da2b56da48edae506bb767ec07370f86f70fc062e9d435869" +"checksum fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" +"checksum fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" +"checksum futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)" = "49e7653e374fe0d0c12de4250f0bdb60680b8c80eed558c5c7538eec9c89e21b" "checksum humantime 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3ca7e5f2e110db35f93b837c81797f3714500b81d517bf20c431b16d3ca4f114" -"checksum itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "501266b7edd0174f8530248f87f99c88fbe60ca4ef3dd486835b8d8d53136f7f" +"checksum itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "1306f3464951f30e30d12373d31c79fbd52d236e5e896fd92f96ec7babbbe60b" "checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" "checksum lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "76f033c7ad61445c5b347c7382dd1237847eb1bce590fe50365dcb33d546be73" -"checksum lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bc5729f27f159ddd61f4df6228e827e86643d4d3e7c32183cb30a1c08f604a14" +"checksum lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a374c89b9db55895453a74c1e38861d9deec0b01b405a82516e9d5de4820dea1" "checksum libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)" = "d44e80633f007889c7eff624b709ab43c92d708caad982295768a7b13ca3b5eb" -"checksum libloading 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f2b111a074963af1d37a139918ac6d49ad1d0d5e47f72fd55388619691a7d753" +"checksum libloading 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9c3ad660d7cb8c5822cd83d10897b0f1f1526792737a179e73896152f85b88c2" "checksum linefeed 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "67deb656cfb06a63e4cb31e49609174db253fabaf019476ad505fc52a3302226" -"checksum linked-hash-map 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "ae91b68aebc4ddb91978b11a1b02ddd8602a05ec19002801c5666000e05e0f83" -"checksum log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)" = "14b6052be84e6b71ab17edffc2eeabf5c2c3ae1fdb464aae35ac50c67a44e1f7" +"checksum linked-hash-map 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "70fb39025bc7cdd76305867c4eccf2f2dcf6e9a57f5b21a93e1c2d86cd03ec9e" +"checksum log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c84ec4b527950aa83a329754b01dbe3f58361d1c5efacd1f6d68c494d08a17c6" "checksum log-mdc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a94d21414c1f4a51209ad204c1776a3d0765002c76c6abcb602a6f09f1e881c7" -"checksum log4rs 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)" = "100052474df98158c0738a7d3f4249c99978490178b5f9f68cd835ac57adbd1b" +"checksum log4rs 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "25e0fc8737a634116a2deb38d821e4400ed16ce9dcb0d628a978d399260f5902" "checksum memchr 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "148fab2e51b4f1cfc66da2a7c32981d1d3c083a803978268bb11fe4b86925e7a" -"checksum memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "88579771288728879b57485cc7d6b07d648c9f0141eb955f8ab7f9d45394468e" -"checksum miniz-sys 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)" = "1e9e3ae51cea1576ceba0dde3d484d30e6e5b86dee0b2d412fe3a16a15c98202" -"checksum miniz_oxide 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7108aff85b876d06f22503dcce091e29f76733b2bfdd91eebce81f5e68203a10" +"checksum memchr 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "db4c41318937f6e76648f42826b1d9ade5c09cafb5aef7e351240a70f39206e9" +"checksum miniz-sys 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "0300eafb20369952951699b68243ab4334f4b10a88f411c221d444b36c40e649" +"checksum miniz_oxide 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5ad30a47319c16cde58d0314f5d98202a80c9083b5f61178457403dfb14e509c" +"checksum miniz_oxide_c_api 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "28edaef377517fd9fe3e085c37d892ce7acd1fbeab9239c5a36eec352d8a8b7e" "checksum nix 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a0d95c5fa8b641c10ad0b8887454ebaafa3c92b5cd5350f8fc693adafd178e7b" "checksum nodrop 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "2f9667ddcc6cc8a43afc9b7917599d7216aa09c463919ea32c59ed6cac8bc945" -"checksum num-derive 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "eafd0b45c5537c3ba526f79d3e75120036502bebacbb3f3220914067ce39dbf2" -"checksum num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)" = "b85e541ef8255f6cf42bbfe4ef361305c6c135d10919ecc26126c4e5ae94bc09" -"checksum num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "6ba9a427cfca2be13aa6f6403b0b7e7368fe982bfa16fccc450ce74c46cd9b32" +"checksum num-derive 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8af1847c907c2f04d7bfd572fb25bbb4385c637fe5be163cf2f8c5d778fe1e7d" +"checksum num-integer 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)" = "e83d528d2677f0518c570baf2b7abdcf0cd2d248860b68507bdcb3e91d4c0cea" +"checksum num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0b3a5d7cc97d6d30d8b9bc8fa19bf45349ffe46241e8816f50f62f6d6aaabee1" "checksum ole32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5d2c49021782e5233cd243168edfa8037574afed4eba4bbaf538b3d8d1789d8c" -"checksum ordered-float 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "18869315e81473c951eb56ad5558bbc56978562d3ecfb87abb7a1e944cea4518" -"checksum pkg-config 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "a7c1d2cfa5a714db3b5f24f0915e74fcdf91d09d496ba61329705dda7774d2af" +"checksum ordered-float 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2f0015e9e8e28ee20c581cfbfe47c650cedeb9ed0721090e0b7ebb10b9cdbcc2" +"checksum pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)" = "676e8eb2b1b4c9043511a9b7bea0915320d7e502b0a079fb03f9635a5252b18c" "checksum prettytable-rs 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)" = "34dc1f4f6dddab3bf008ecfd4fd2a631b585fbf0af123f34c1324f51a034ff5f" -"checksum proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)" = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759" -"checksum proc-macro2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4c5c2380ae88876faae57698be9e9775e3544decad214599c3a6266cca6ac802" +"checksum proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)" = "77619697826f31a02ae974457af0b29b723e5619e113e9397b8b82c6bd253f09" "checksum quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9274b940887ce9addde99c4eee6b5c44cc494b182b97e73dc8ffdcb3397fd3f0" -"checksum quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)" = "6ce23b6b870e8f94f81fb0a363d65d86675884b34a09043c81e5562f11c1f8e1" -"checksum quote 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "49d77c41ca8767f2f41394c11a4eebccab83da25e7cc035387a3125f02be90a3" -"checksum rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b" -"checksum rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc" -"checksum rand_os 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "7b75f676a1e053fc562eafbb47838d67c84801e38fc1ba459e8f180deabd5071" -"checksum rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2" -"checksum redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)" = "2439c63f3f6139d1b57529d16bc3b8bb855230c8efcc5d3a896c8bea7c3b1e84" -"checksum redox_users 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4ecedbca3bf205f8d8f5c2b44d83cd0690e39ee84b951ed649e9f1841132b66d" +"checksum quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)" = "53fa22a1994bd0f9372d7a816207d8a2677ad0325b073f5c5332760f0fb62b5c" +"checksum rand 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8356f47b32624fef5b3301c1be97e5944ecdd595409cc5da11d05f211db6cfbd" +"checksum redox_syscall 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)" = "a84bcd297b87a545980a2d25a0beb72a1f490c31f0a9fde52fca35bfbb1ceb70" +"checksum redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76" +"checksum redox_users 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "214a97e49be64fd2c86f568dd0cb2c757d2cc53de95b273b6ad0a1c908482f26" "checksum regex 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "9329abc99e39129fcceabd24cf5d85b4671ef7c29c50e972bc5afe32438ec384" -"checksum regex 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "88c3d9193984285d544df4a30c23a4e62ead42edf70a4452ceb76dac1ce05c26" +"checksum regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "37e7cbbd370869ce2e8dff25c7018702d10b21a20ef7135316f8daecd6c25b7f" "checksum regex-syntax 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "7d707a4fa2637f2dca2ef9fd02225ec7661fe01a53623c1e6515b6916511f7a7" -"checksum regex-syntax 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)" = "b143cceb2ca5e56d5671988ef8b15615733e7ee16cd348e064333b251b89343f" +"checksum regex-syntax 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "4e47a2ed29da7a9e1960e1639e7a982e6edc6d49be308a3b02daf511504a16d1" "checksum rpassword 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b273c91bd242ca03ad6d71c143b6f17a48790e61f21a6c78568fa2b6774a24a4" "checksum rprompt 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "1601f32bc5858aae3cbfa1c645c96c4d820cc5c16be0194f089560c00b6eb625" -"checksum rust-argon2 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4ca4eaef519b494d1f2848fc602d18816fed808a981aedf4f1f00ceb7c9d32cf" -"checksum rustc-demangle 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "4c691c0e608126e00913e33f0ccf3727d5fc84573623b8d65b2df340b5201783" +"checksum rustc-demangle 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "01b90379b8664dd83460d59bdc5dd1fd3172b8913788db483ed1325171eab2f7" "checksum rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)" = "dcf128d1287d2ea9d80910b5f1120d0b8eede3fbf1abe91c40d39ea7d51e6fda" "checksum rustc_version 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "c5f5376ea5e30ce23c03eb77cbe4962b988deead10910c372b226388b594c084" "checksum ryu 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c92464b447c0ee8c4fb3824ecc8383b81717b9f1e74ba2e72540aef7b9f82997" +"checksum scoped_threadpool 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "1d51f5df5af43ab3f1360b429fa5e0152ac5ce8c0bd6485cae490332e96846a8" "checksum semver 0.1.20 (registry+https://github.com/rust-lang/crates.io-index)" = "d4f410fedcf71af0345d7607d246e7ad15faaadd49d240ee3b24e5dc21a820ac" -"checksum serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)" = "fec2851eb56d010dc9a21b89ca53ee75e6528bab60c11e89d38390904982da9f" +"checksum serde 1.0.97 (registry+https://github.com/rust-lang/crates.io-index)" = "d46b3dfedb19360a74316866cef04687cd4d6a70df8e6a506c63512790769b72" "checksum serde-value 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "7a663f873dedc4eac1a559d4c6bc0d0b2c34dc5ac4702e105014b8281489e44f" -"checksum serde_derive 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)" = "cb4dc18c61206b08dc98216c98faa0232f4337e1e1b8574551d5bad29ea1b425" +"checksum serde_derive 1.0.97 (registry+https://github.com/rust-lang/crates.io-index)" = "c22a0820adfe2f257b098714323563dd06426502abbbce4f51b72ef544c5027f" "checksum serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)" = "051c49229f282f7c6f3813f8286cc1e3323e8051823fce42c7ea80fe13521704" -"checksum serde_yaml 0.8.9 (registry+https://github.com/rust-lang/crates.io-index)" = "38b08a9a90e5260fe01c6480ec7c811606df6d3a660415808c3c3fa8ed95b582" +"checksum serde_yaml 0.8.8 (registry+https://github.com/rust-lang/crates.io-index)" = "0887a8e097a69559b56aa2526bf7aff7c3048cf627dff781f0b56a6001534593" "checksum shell32-sys 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9ee04b46101f57121c9da2b151988283b6beb79b34f5bb29a58ee48cb695122c" -"checksum smallvec 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)" = "ab606a9c5e214920bb66c458cd7be8ef094f813f20fe77a54cc7dbfff220d4b7" -"checksum syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)" = "9ca4b3b69a77cbe1ffc9e198781b7acb0c7365a883670e8f1c1bc66fba79a5c5" -"checksum syn 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "2ae5cd13590144ea968ba5d5520da7a4c08415861014399b5b349f74591c375f" -"checksum synstructure 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)" = "02353edf96d6e4dc81aea2d8490a7e9db177bf8acb0e951c24940bf866cb313f" +"checksum syn 0.15.23 (registry+https://github.com/rust-lang/crates.io-index)" = "9545a6a093a3f0bd59adb472700acc08cad3776f860f16a897dfce8c88721cbc" +"checksum synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "73687139bf99285483c96ac0add482c3776528beac1d97d444f6e91f203a2015" "checksum term 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "fa63644f74ce96fbeb9b794f66aff2a52d601cbd5e80f4b97123e3899f4570f1" +"checksum termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "689a3bdfaab439fd92bc87df5c4c78417d3cbe537487274e9b0b2dce76e92096" "checksum thread-id 3.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c7fbf4c9d56b320106cd64fd024dadfa0be7cb4706725fc44a7d7ce952d820c1" "checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b" -"checksum time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f" +"checksum time 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)" = "847da467bf0db05882a9e2375934a8a55cffdc9db0d128af1518200260ba1f6c" "checksum traitobject 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "efd1f82c56340fdf16f2a953d7bda4f8fdffba13d93b00844c25572110b26079" "checksum typemap 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "653be63c80a3296da5551e1bfd2cca35227e13cdd08c6668903ae2f4f77aa1f6" -"checksum ucd-util 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "fa9b3b49edd3468c0e6565d85783f51af95212b6fa3986a5500954f00b460874" +"checksum ucd-util 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "535c204ee4d8434478593480b8f86ab45ec9aae0e83c568ca81abf0fd0e88f86" "checksum unescape 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ccb97dac3243214f8d8507998906ca3e2e0b900bf9bf4870477f125b82e68f6e" -"checksum unicode-normalization 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "141339a08b982d942be2ca06ff8b076563cbe223d1befd5450716790d44e2426" +"checksum unicode-normalization 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "6a0180bc61fc5a987082bfa111f4cc95c4caff7f9799f3e46df09163a937aa25" "checksum unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "882386231c45df4700b275c7ff55b6f3698780a650026380e72dabe76fa46526" "checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" -"checksum unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c" "checksum unsafe-any 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f30360d7979f5e9c6e6cea48af192ea8fab4afb3cf72597154b8f08935bc9c7f" -"checksum utf8-ranges 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "b4ae116fef2b7fea257ed6440d3cfcff7f190865f170cdad00bb6465bf18ecba" -"checksum vcpkg 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "33dd455d0f96e90a75803cfeb7f948768c08d70a6de9a8d2362461935698bf95" +"checksum utf8-ranges 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "796f7e48bef87609f7ade7e06495a87d5cd06c7866e6a5cbfceffc558a243737" +"checksum vcpkg 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "def296d3eb3b12371b2c7d0e83bfe1403e4db2d7a0bba324a12b21c4ee13143d" +"checksum version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "914b1a6776c4c929a602fafd8bc742e06365d4bcbe48c30f9cca5824f70dc9dd" "checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" "checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" -"checksum winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)" = "f10e386af2b13e47c89e7236a7a14a086791a2b88ebad6df9bf42040195cf770" +"checksum winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "92c1eb33641e276cfa214a0522acad57be5c56b10cb348b3c5117db75f3ac4b0" "checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" "checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" "checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" -"checksum yaml-rust 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "65923dd1784f44da1d2c3dbbc5e822045628c590ba72123e1c73d3c230c4434d" +"checksum yaml-rust 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "95acf0db5515d07da9965ec0e0ba6cc2d825e2caeb7303b66ca441729801254e" From 05745a5675f9531369315d212f9928ff4e4dc639 Mon Sep 17 00:00:00 2001 From: "artem.ivanov" Date: Fri, 23 Aug 2019 10:54:41 +0300 Subject: [PATCH 291/320] IS-1359: Improve Indy SDK architecture overview Signed-off-by: artem.ivanov --- libindy/src/api/anoncreds.rs | 388 ++++++++++++++++++++++++++--------- libindy/src/api/ledger.rs | 5 +- 2 files changed, 290 insertions(+), 103 deletions(-) diff --git a/libindy/src/api/anoncreds.rs b/libindy/src/api/anoncreds.rs index d91722fa09..f17cb373f0 100644 --- a/libindy/src/api/anoncreds.rs +++ b/libindy/src/api/anoncreds.rs @@ -49,11 +49,19 @@ https://github.com/hyperledger/indy-hipe/blob/c761c583b1e01c1e9d3ceda2b03b35336f /// name: a name the schema /// version: a version of the schema /// attrs: a list of schema attributes descriptions (the number of attributes should be less or equal than 125) +/// `["attr1", "attr2"]` /// cb: Callback that takes command result as parameter /// /// #Returns /// schema_id: identifier of created schema -/// schema_json: schema as json +/// schema_json: schema as json: +/// { +/// id: identifier of schema +/// attrNames: array of attribute name strings +/// name: schema's name string +/// version: schema's version string, +/// ver: version of the Schema json +/// } /// /// #Errors /// Common* @@ -117,11 +125,18 @@ pub extern fn indy_issuer_create_schema(command_handle: CommandHandle, /// to generate new keys for an existing credential definition. /// /// #Params -/// wallet_handle: wallet handle (created by open_wallet). /// command_handle: command handle to map callback to user context. -/// issuer_did: a DID of the issuer signing cred_def transaction to the Ledger -/// schema_json: credential schema as a json -/// tag: allows to distinct between credential definitions for the same issuer and schema +/// wallet_handle: wallet handle (created by open_wallet). +/// issuer_did: a DID of the issuer +/// schema_json: credential schema as a json: { +/// id: identifier of schema +/// attrNames: array of attribute name strings +/// name: schema's name string +/// version: schema's version string, +/// seqNo: (Optional) schema's sequence number on the ledger, +/// ver: version of the Schema json +/// } +/// tag: any string that allows to distinguish between credential definitions for the same issuer and schema /// signature_type: credential definition type (optional, 'CL' by default) that defines credentials signature and revocation math. /// Supported signature types: /// - 'CL': Camenisch-Lysyanskaya credential signature type that is implemented according to the algorithm in this paper: @@ -130,7 +145,9 @@ pub extern fn indy_issuer_create_schema(command_handle: CommandHandle, /// https://github.com/hyperledger/indy-hipe/blob/c761c583b1e01c1e9d3ceda2b03b35336fdc8cc1/text/anoncreds-protocol/README.md /// config_json: (optional) type-specific configuration of credential definition as json: /// - 'CL': -/// - support_revocation: whether to request non-revocation credential (optional, default false) +/// { +/// "support_revocation" - bool (optional, default false) whether to request non-revocation credential +/// } /// cb: Callback that takes command result as parameter. /// /// #Returns @@ -217,11 +234,24 @@ pub extern fn indy_issuer_create_and_store_credential_def(command_handle: Comman /// cred_def_id: an identifier of created credential definition stored in the wallet /// config_json: (optional) type-specific configuration of credential definition as json: /// - 'CL': -/// - support_revocation: whether to request non-revocation credential (optional, default false) +/// { +/// "support_revocation" - bool (optional, default false) whether to request non-revocation credential +/// } /// cb: Callback that takes command result as parameter. /// /// #Returns /// cred_def_json: public part of temporary created credential definition +/// { +/// id: string - identifier of credential definition +/// schemaId: string - identifier of stored in ledger schema +/// type: string - type of the credential definition. CL is the only supported type now. +/// tag: string - allows to distinct between credential definitions for the same issuer and schema +/// value: Dictionary with Credential Definition's data is depended on the signature type: { +/// primary: primary credential public key, +/// Optional: revocation credential public key +/// }, - only this field differs from the original credential definition +/// ver: Version of the CredDef json +/// } /// /// Note: `primary` and `revocation` fields of credential definition are complex opaque types that contain data structures internal to Ursa. /// They should not be parsed and are likely to change in future versions. @@ -274,8 +304,8 @@ pub extern fn indy_issuer_rotate_credential_def_start(command_handle: CommandHan /// WARNING: Rotating the credential definitional keys will result in making all credentials issued under the previous keys unverifiable. /// /// #Params -/// wallet_handle: wallet handle (created by open_wallet). /// command_handle: command handle to map callback to user context. +/// wallet_handle: wallet handle (created by open_wallet). /// cred_def_id: an identifier of created credential definition stored in the wallet /// cb: Callback that takes command result as parameter. /// @@ -337,14 +367,14 @@ pub extern fn indy_issuer_rotate_credential_def_apply(command_handle: CommandHan /// This call requires access to pre-configured blob storage writer instance handle that will allow to write generated tails. /// /// #Params -/// wallet_handle: wallet handle (created by open_wallet). /// command_handle: command handle to map callback to user context. -/// issuer_did: a DID of the issuer signing transaction to the Ledger +/// wallet_handle: wallet handle (created by open_wallet). +/// issuer_did: a DID of the issuer /// revoc_def_type: revocation registry type (optional, default value depends on credential definition type). Supported types are: /// - 'CL_ACCUM': Type-3 pairing based accumulator implemented according to the algorithm in this paper: /// https://github.com/hyperledger/ursa/blob/master/libursa/docs/AnonCred.pdf /// This type is default for 'CL' credential definition type. -/// tag: allows to distinct between revocation registries for the same issuer and credential definition +/// tag: any string that allows to distinct between revocation registries for the same issuer and credential definition /// cred_def_id: id of stored in ledger credential definition /// config_json: type-specific configuration of revocation registry as json: /// - 'CL_ACCUM': { @@ -354,7 +384,7 @@ pub extern fn indy_issuer_rotate_credential_def_apply(command_handle: CommandHan /// 2) ISSUANCE_ON_DEMAND: nothing is issued initially accumulator is 1 (used by default); /// "max_cred_num": maximum number of credentials the new registry can process (optional, default 100000) /// } -/// tails_writer_handle: handle of blob storage to store tails +/// tails_writer_handle: handle of blob storage to store tails (returned by `indy_open_blob_storage_writer`). /// cb: Callback that takes command result as parameter. /// /// NOTE: @@ -463,9 +493,9 @@ pub extern fn indy_issuer_create_and_store_revoc_reg(command_handle: CommandHand /// #Returns /// credential offer json: /// { -/// "schema_id": string, -/// "cred_def_id": string, -/// // Fields below can depend on Cred Def type +/// "schema_id": string, - identifier of schema +/// "cred_def_id": string, - identifier of credential definition +/// // Fields below can depend on Credential Definition type /// "nonce": string, /// "key_correctness_proof" : key correctness proof for credential definition correspondent to cred_def_id /// (opaque type that contains data structures internal to Ursa. @@ -517,8 +547,8 @@ pub extern fn indy_issuer_create_credential_offer(command_handle: CommandHandle, /// Note that it is possible to accumulate deltas to reduce ledger load. /// /// #Params -/// wallet_handle: wallet handle (created by open_wallet). /// command_handle: command handle to map callback to user context. +/// wallet_handle: wallet handle (created by open_wallet). /// cred_offer_json: a cred offer created by indy_issuer_create_credential_offer /// cred_req_json: a credential request created by indy_prover_create_credential_req /// cred_values_json: a credential containing attribute values for each of requested attribute names. @@ -528,16 +558,16 @@ pub extern fn indy_issuer_create_credential_offer(command_handle: CommandHandle, /// "attr2" : {"raw": "value1", "encoded": "value1_as_int" } /// } /// rev_reg_id: id of revocation registry stored in the wallet -/// blob_storage_reader_handle: configuration of blob storage reader handle that will allow to read revocation tails +/// blob_storage_reader_handle: configuration of blob storage reader handle that will allow to read revocation tails (returned by `indy_open_blob_storage_reader`) /// cb: Callback that takes command result as parameter. /// /// #Returns /// cred_json: Credential json containing signed credential values /// { -/// "schema_id": string, -/// "cred_def_id": string, -/// "rev_reg_def_id", Optional, -/// "values": , +/// "schema_id": string, - identifier of schema +/// "cred_def_id": string, - identifier of credential definition +/// "rev_reg_def_id", Optional, - identifier of revocation registry +/// "values": , - credential values. /// // Fields below can depend on Cred Def type /// "signature": , /// (opaque type that contains data structures internal to Ursa. @@ -545,6 +575,12 @@ pub extern fn indy_issuer_create_credential_offer(command_handle: CommandHandle, /// "signature_correctness_proof": credential signature correctness proof /// (opaque type that contains data structures internal to Ursa. /// It should not be parsed and are likely to change in future versions). +/// "rev_reg" - (Optional) revocation registry accumulator value on the issuing moment. +/// (opaque type that contains data structures internal to Ursa. +/// It should not be parsed and are likely to change in future versions). +/// "witness" - (Optional) revocation related data +/// (opaque type that contains data structures internal to Ursa. +/// It should not be parsed and are likely to change in future versions). /// } /// cred_revoc_id: local id for revocation info (Can be used for revocation of this credential) /// revoc_reg_delta_json: Revocation registry delta json with a newly issued credential @@ -620,13 +656,21 @@ pub extern fn indy_issuer_create_credential(command_handle: CommandHandle, /// #Params /// command_handle: command handle to map callback to user context. /// wallet_handle: wallet handle (created by open_wallet). -/// blob_storage_reader_cfg_handle: configuration of blob storage reader handle that will allow to read revocation tails +/// blob_storage_reader_cfg_handle: configuration of blob storage reader handle that will allow to read revocation tails (returned by `indy_open_blob_storage_reader`). /// rev_reg_id: id of revocation registry stored in wallet -/// cred_revoc_id: local id for revocation info +/// cred_revoc_id: local id for revocation info related to issued credential /// cb: Callback that takes command result as parameter. /// /// #Returns /// revoc_reg_delta_json: Revocation registry delta json with a revoked credential +/// { +/// value: { +/// prevAccum: string - previous accumulator value. +/// accum: string - current accumulator value. +/// revoked: array an array of revoked indices. +/// }, +/// ver: string - version revocation registry delta json +/// } /// /// #Errors /// Anoncreds* @@ -679,13 +723,21 @@ pub extern fn indy_issuer_revoke_credential(command_handle: CommandHandle, /// #Params /// command_handle: command handle to map callback to user context. /// wallet_handle: wallet handle (created by open_wallet). -/// blob_storage_reader_cfg_handle: configuration of blob storage reader handle that will allow to read revocation tails +/// blob_storage_reader_cfg_handle: configuration of blob storage reader handle that will allow to read revocation tails (returned by `indy_open_blob_storage_reader`). /// rev_reg_id: id of revocation registry stored in wallet -/// cred_revoc_id: local id for revocation info +/// cred_revoc_id: local id for revocation info related to issued credential /// cb: Callback that takes command result as parameter. /// /// #Returns /// revoc_reg_delta_json: Revocation registry delta json with a recovered credential +/// { +/// value: { +/// prevAccum: string - previous accumulator value. +/// accum: string - current accumulator value. +/// issued: array an array of issued indices. +/// }, +/// ver: string - version revocation registry delta json +/// } /// /// #Errors /// Anoncreds* @@ -728,11 +780,30 @@ pub extern fn indy_issuer_recover_credential(command_handle: CommandHandle, /// #Params /// command_handle: command handle to map callback to user context. /// rev_reg_delta_json: revocation registry delta. -/// other_rev_reg_delta_json: revocation registry delta for which PrevAccum value is equal to current accum value of rev_reg_delta_json. +/// { +/// value: { +/// prevAccum: string - previous accumulator value. +/// accum: string - current accumulator value. +/// issued: array an array of issued indices. +/// revoked: array an array of revoked indices. +/// }, +/// ver: string - version revocation registry delta json +/// } +/// +/// other_rev_reg_delta_json: revocation registry delta for which PrevAccum value is equal to value of accum field of rev_reg_delta_json parameter. /// cb: Callback that takes command result as parameter. /// /// #Returns /// merged_rev_reg_delta: Merged revocation registry delta +/// { +/// value: { +/// prevAccum: string - previous accumulator value. +/// accum: string - current accumulator value. +/// issued: array an array of issued indices. +/// revoked: array an array of revoked indices. +/// }, +/// ver: string - version revocation registry delta json +/// } /// /// #Errors /// Anoncreds* @@ -774,8 +845,8 @@ pub extern fn indy_issuer_merge_revocation_registry_deltas(command_handle: Comma /// The id must be unique. /// /// #Params -/// wallet_handle: wallet handle (created by open_wallet). /// command_handle: command handle to map callback to user context. +/// wallet_handle: wallet handle (created by open_wallet). /// master_secret_id: (optional, if not present random one will be generated) new master id /// /// #Returns @@ -825,6 +896,13 @@ pub extern fn indy_prover_create_master_secret(command_handle: CommandHandle, /// wallet_handle: wallet handle (created by open_wallet) /// prover_did: a DID of the prover /// cred_offer_json: credential offer as a json containing information about the issuer and a credential +/// { +/// "schema_id": string, - identifier of schema +/// "cred_def_id": string, - identifier of credential definition +/// ... +/// Other fields that contains data structures internal to Ursa. +/// These fields should not be parsed and are likely to change in future versions. +/// } /// cred_def_json: credential definition json related to in /// master_secret_id: the id of the master secret stored in the wallet /// cb: Callback that takes command result as parameter. @@ -844,7 +922,8 @@ pub extern fn indy_prover_create_master_secret(command_handle: CommandHandle, /// "nonce": string /// } /// cred_req_metadata_json: Credential request metadata json for further processing of received form Issuer credential. -/// Note: cred_req_metadata_json mustn't be shared with Issuer. +/// Credential request metadata contains data structures internal to Ursa. +/// Credential request metadata mustn't be shared with Issuer. /// /// #Errors /// Anoncreds* @@ -1042,6 +1121,19 @@ pub extern fn indy_prover_get_credential_attr_tag_policy(command_handle: Command /// cred_id: (optional, default is a random one) identifier by which credential will be stored in the wallet /// cred_req_metadata_json: a credential request metadata created by indy_prover_create_credential_req /// cred_json: credential json received from issuer +/// { +/// "schema_id": string, - identifier of schema +/// "cred_def_id": string, - identifier of credential definition +/// "rev_reg_def_id", Optional, - identifier of revocation registry +/// "values": - credential values +/// { +/// "attr1" : {"raw": "value1", "encoded": "value1_as_int" }, +/// "attr2" : {"raw": "value1", "encoded": "value1_as_int" } +/// } +/// // Fields below can depend on Cred Def type +/// Other fields that contains data structures internal to Ursa. +/// These fields should not be parsed and are likely to change in future versions. +/// } /// cred_def_json: credential definition json related to in /// rev_reg_def_json: revocation registry definition json related to in /// cb: Callback that takes command result as parameter. @@ -1106,12 +1198,12 @@ pub extern fn indy_prover_store_credential(command_handle: CommandHandle, /// #Returns /// credential json: /// { -/// "referent": string, // cred_id in the wallet -/// "attrs": {"key1":"raw_value1", "key2":"raw_value2"}, -/// "schema_id": string, -/// "cred_def_id": string, -/// "rev_reg_id": Optional, -/// "cred_rev_id": Optional +/// "referent": string, - id of credential in the wallet +/// "attrs": {"key1":"raw_value1", "key2":"raw_value2"}, - credential attributes +/// "schema_id": string, - identifier of schema +/// "cred_def_id": string, - identifier of credential definition +/// "rev_reg_id": Optional, - identifier of revocation registry definition +/// "cred_rev_id": Optional - identifier of credential in the revocation registry definition /// } /// /// #Errors @@ -1214,12 +1306,12 @@ pub extern fn indy_prover_delete_credential(command_handle: CommandHandle, /// #Returns /// credentials json /// [{ -/// "referent": string, // cred_id in the wallet -/// "attrs": {"key1":"raw_value1", "key2":"raw_value2"}, -/// "schema_id": string, -/// "cred_def_id": string, -/// "rev_reg_id": Optional, -/// "cred_rev_id": Optional +/// "referent": string, - id of credential in the wallet +/// "attrs": {"key1":"raw_value1", "key2":"raw_value2"}, - credential attributes +/// "schema_id": string, - identifier of schema +/// "cred_def_id": string, - identifier of credential definition +/// "rev_reg_id": Optional, - identifier of revocation registry definition +/// "cred_rev_id": Optional - identifier of credential in the revocation registry definition /// }] /// /// #Errors @@ -1267,7 +1359,7 @@ pub extern fn indy_prover_get_credentials(command_handle: CommandHandle, /// #Params /// wallet_handle: wallet handle (created by open_wallet). /// query_json: Wql query filter for credentials searching based on tags. -/// where query: indy-sdk/docs/design/011-wallet-query-language/README.md +/// where query: indy-sdk/docs/design/011-wallet-query-language/README.md /// cb: Callback that takes command result as parameter. /// /// #Returns @@ -1322,12 +1414,12 @@ pub extern fn indy_prover_search_credentials(command_handle: CommandHandle, /// #Returns /// credentials_json: List of human readable credentials: /// [{ -/// "referent": string, // cred_id in the wallet -/// "attrs": {"key1":"raw_value1", "key2":"raw_value2"}, -/// "schema_id": string, -/// "cred_def_id": string, -/// "rev_reg_id": Optional, -/// "cred_rev_id": Optional +/// "referent": string, - id of credential in the wallet +/// "attrs": {"key1":"raw_value1", "key2":"raw_value2"}, - credential attributes +/// "schema_id": string, - identifier of schema +/// "cred_def_id": string, - identifier of credential definition +/// "rev_reg_id": Optional, - identifier of revocation registry definition +/// "cred_rev_id": Optional - identifier of credential in the revocation registry definition /// }] /// NOTE: The list of length less than the requested count means credentials search iterator is completed. /// @@ -1424,7 +1516,7 @@ pub extern fn indy_prover_close_credentials_search(command_handle: CommandHandl /// "non_revoked": Optional<>, // see below, /// // If specified prover must proof non-revocation /// // for date in this interval for each attribute -/// // (can be overridden on attribute level) +/// // (applies to every attribute and predicate but can be overridden on attribute level) /// } /// cb: Callback that takes command result as parameter. /// @@ -1433,7 +1525,7 @@ pub extern fn indy_prover_close_credentials_search(command_handle: CommandHandl /// attr_info: Describes requested attribute /// { /// "name": string, // attribute name, (case insensitive and ignore spaces) -/// "restrictions": Optional, // see above +/// "restrictions": Optional, // see below /// "non_revoked": Optional<>, // see below, /// // If specified prover must proof non-revocation /// // for date in this interval this attribute @@ -1443,9 +1535,9 @@ pub extern fn indy_prover_close_credentials_search(command_handle: CommandHandl /// predicate_info: Describes requested attribute predicate /// { /// "name": attribute name, (case insensitive and ignore spaces) -/// "p_type": predicate type (Currently ">=" only) +/// "p_type": predicate type (">=", ">", "<=", "<") /// "p_value": int predicate value -/// "restrictions": Optional, // see above +/// "restrictions": Optional, // see below /// "non_revoked": Optional<>, // see below, /// // If specified prover must proof non-revocation /// // for date in this interval this attribute @@ -1456,26 +1548,35 @@ pub extern fn indy_prover_close_credentials_search(command_handle: CommandHandl /// "from": Optional, // timestamp of interval beginning /// "to": Optional, // timestamp of interval ending /// } +/// filter_json: +/// { +/// "schema_id": string, (Optional) +/// "schema_issuer_did": string, (Optional) +/// "schema_name": string, (Optional) +/// "schema_version": string, (Optional) +/// "issuer_did": string, (Optional) +/// "cred_def_id": string, (Optional) +/// } /// /// #Returns /// credentials_json: json with credentials for the given proof request. /// { -/// "requested_attrs": { +/// "attrs": { /// "": [{ cred_info: , interval: Optional }], /// ..., /// }, -/// "requested_predicates": { +/// "predicates": { /// "requested_predicates": [{ cred_info: , timestamp: Optional }, { cred_info: , timestamp: Optional }], /// "requested_predicate_2_referent": [{ cred_info: , timestamp: Optional }] /// } -/// }, where credential is +/// }, where is /// { -/// "referent": , -/// "attrs": {"attr_name" : "attr_raw_value"}, -/// "schema_id": string, -/// "cred_def_id": string, -/// "rev_reg_id": Optional, -/// "cred_rev_id": Optional, +/// "referent": string, - id of credential in the wallet +/// "attrs": {"key1":"raw_value1", "key2":"raw_value2"}, - credential attributes +/// "schema_id": string, - identifier of schema +/// "cred_def_id": string, - identifier of credential definition +/// "rev_reg_id": Optional, - identifier of revocation registry definition +/// "cred_rev_id": Optional - identifier of credential in the revocation registry definition /// } /// /// #Errors @@ -1538,14 +1639,50 @@ pub extern fn indy_prover_get_credentials_for_proof_req(command_handle: CommandH /// "non_revoked": Optional<>, // see below, /// // If specified prover must proof non-revocation /// // for date in this interval for each attribute +/// // (applies to every attribute and predicate but can be overridden on attribute level) /// // (can be overridden on attribute level) /// } +/// attr_info: Describes requested attribute +/// { +/// "name": string, // attribute name, (case insensitive and ignore spaces) +/// "restrictions": Optional, // see below +/// "non_revoked": Optional<>, // see below, +/// // If specified prover must proof non-revocation +/// // for date in this interval this attribute +/// // (overrides proof level interval) +/// } +/// predicate_referent: Proof-request local identifier of requested attribute predicate +/// predicate_info: Describes requested attribute predicate +/// { +/// "name": attribute name, (case insensitive and ignore spaces) +/// "p_type": predicate type (">=", ">", "<=", "<") +/// "p_value": predicate value +/// "restrictions": Optional, // see below +/// "non_revoked": Optional<>, // see below, +/// // If specified prover must proof non-revocation +/// // for date in this interval this attribute +/// // (overrides proof level interval) +/// } +/// non_revoc_interval: Defines non-revocation interval +/// { +/// "from": Optional, // timestamp of interval beginning +/// "to": Optional, // timestamp of interval ending +/// } /// extra_query_json:(Optional) List of extra queries that will be applied to correspondent attribute/predicate: /// { /// "": , /// "": , /// } /// where wql query: indy-sdk/docs/design/011-wallet-query-language/README.md +/// The list of allowed fields: +/// "schema_id": , +/// "schema_issuer_did": , +/// "schema_name": , +/// "schema_version": , +/// "issuer_did": , +/// "cred_def_id": , +/// "rev_reg_id": , // "None" as string if not present +/// /// cb: Callback that takes command result as parameter. /// /// #Returns @@ -1611,12 +1748,12 @@ pub extern fn indy_prover_search_credentials_for_proof_req(command_handle: Comma /// where /// credential_info: /// { -/// "referent": , -/// "attrs": {"attr_name" : "attr_raw_value"}, -/// "schema_id": string, -/// "cred_def_id": string, -/// "rev_reg_id": Optional, -/// "cred_rev_id": Optional, +/// "referent": string, - id of credential in the wallet +/// "attrs": {"key1":"raw_value1", "key2":"raw_value2"}, - credential attributes +/// "schema_id": string, - identifier of schema +/// "cred_def_id": string, - identifier of credential definition +/// "rev_reg_id": Optional, - identifier of revocation registry definition +/// "cred_rev_id": Optional - identifier of credential in the revocation registry definition /// } /// non_revoc_interval: /// { @@ -1726,6 +1863,7 @@ pub extern fn indy_prover_close_credentials_search_for_proof_req(command_handle /// "non_revoked": Optional<>, // see below, /// // If specified prover must proof non-revocation /// // for date in this interval for each attribute +/// // (applies to every attribute and predicate but can be overridden on attribute level) /// // (can be overridden on attribute level) /// } /// requested_credentials_json: either a credential or self-attested attribute for each requested attribute @@ -1742,19 +1880,19 @@ pub extern fn indy_prover_close_credentials_search_for_proof_req(command_handle /// } /// } /// master_secret_id: the id of the master secret stored in the wallet -/// schemas_json: all schemas json participating in the proof request +/// schemas_json: all schemas participating in the proof request /// { -/// : , -/// : , -/// : , +/// : , +/// : , +/// : , /// } -/// credential_defs_json: all credential definitions json participating in the proof request +/// credential_defs_json: all credential definitions participating in the proof request /// { -/// "cred_def1_id": , -/// "cred_def2_id": , -/// "cred_def3_id": , +/// "cred_def1_id": , +/// "cred_def2_id": , +/// "cred_def3_id": , /// } -/// rev_states_json: all revocation states json participating in the proof request +/// rev_states_json: all revocation states participating in the proof request /// { /// "rev_reg_def1_id": { /// "timestamp1": , @@ -1770,12 +1908,11 @@ pub extern fn indy_prover_close_credentials_search_for_proof_req(command_handle /// cb: Callback that takes command result as parameter. /// /// where -/// where wql query: indy-sdk/docs/design/011-wallet-query-language/README.md /// attr_referent: Proof-request local identifier of requested attribute /// attr_info: Describes requested attribute /// { /// "name": string, // attribute name, (case insensitive and ignore spaces) -/// "restrictions": Optional, +/// "restrictions": Optional, // see below /// "non_revoked": Optional<>, // see below, /// // If specified prover must proof non-revocation /// // for date in this interval this attribute @@ -1785,9 +1922,9 @@ pub extern fn indy_prover_close_credentials_search_for_proof_req(command_handle /// predicate_info: Describes requested attribute predicate /// { /// "name": attribute name, (case insensitive and ignore spaces) -/// "p_type": predicate type (Currently >= only) +/// "p_type": predicate type (">=", ">", "<=", "<") /// "p_value": predicate value -/// "restrictions": Optional, +/// "restrictions": Optional, // see below /// "non_revoked": Optional<>, // see below, /// // If specified prover must proof non-revocation /// // for date in this interval this attribute @@ -1798,6 +1935,15 @@ pub extern fn indy_prover_close_credentials_search_for_proof_req(command_handle /// "from": Optional, // timestamp of interval beginning /// "to": Optional, // timestamp of interval ending /// } +/// where wql query: indy-sdk/docs/design/011-wallet-query-language/README.md +/// The list of allowed fields: +/// "schema_id": , +/// "schema_issuer_did": , +/// "schema_name": , +/// "schema_version": , +/// "issuer_did": , +/// "cred_def_id": , +/// "rev_reg_id": , // "None" as string if not present /// /// #Returns /// Proof json @@ -1817,7 +1963,7 @@ pub extern fn indy_prover_close_credentials_search_for_proof_req(command_handle /// "self_attested_attrs": { /// "requested_attr2_id": self_attested_value, /// }, -/// "requested_predicates": { +/// "predicates": { /// "requested_predicate_1_referent": {sub_proof_index: int}, /// "requested_predicate_2_referent": {sub_proof_index: int}, /// } @@ -1908,8 +2054,8 @@ pub extern fn indy_prover_create_proof(command_handle: CommandHandle, /// { /// "requested_proof": { /// "revealed_attrs": { -/// "requested_attr1_id": {sub_proof_index: number, raw: string, encoded: string}, -/// "requested_attr4_id": {sub_proof_index: number: string, encoded: string}, +/// "requested_attr1_id": {sub_proof_index: number, raw: string, encoded: string}, // NOTE: check that `encoded` value match to `raw` value on application level +/// "requested_attr4_id": {sub_proof_index: number: string, encoded: string}, // NOTE: check that `encoded` value match to `raw` value on application level /// }, /// "unrevealed_attrs": { /// "requested_attr3_id": {sub_proof_index: number} @@ -1928,25 +2074,25 @@ pub extern fn indy_prover_create_proof(command_handle: CommandHandle, /// } /// "identifiers": [{schema_id, cred_def_id, Optional, Optional}] /// } -/// schemas_json: all schema jsons participating in the proof +/// schemas_json: all schemas participating in the proof /// { -/// : , -/// : , -/// : , +/// : , +/// : , +/// : , /// } -/// credential_defs_json: all credential definitions json participating in the proof +/// credential_defs_json: all credential definitions participating in the proof /// { -/// "cred_def1_id": , -/// "cred_def2_id": , -/// "cred_def3_id": , +/// "cred_def1_id": , +/// "cred_def2_id": , +/// "cred_def3_id": , /// } -/// rev_reg_defs_json: all revocation registry definitions json participating in the proof +/// rev_reg_defs_json: all revocation registry definitions participating in the proof /// { -/// "rev_reg_def1_id": , -/// "rev_reg_def2_id": , -/// "rev_reg_def3_id": , +/// "rev_reg_def1_id": , +/// "rev_reg_def2_id": , +/// "rev_reg_def3_id": , /// } -/// rev_regs_json: all revocation registries json participating in the proof +/// rev_regs_json: all revocation registries participating in the proof /// { /// "rev_reg_def1_id": { /// "timestamp1": , @@ -1959,6 +2105,44 @@ pub extern fn indy_prover_create_proof(command_handle: CommandHandle, /// "timestamp4": /// }, /// } +/// where +/// attr_referent: Proof-request local identifier of requested attribute +/// attr_info: Describes requested attribute +/// { +/// "name": string, // attribute name, (case insensitive and ignore spaces) +/// "restrictions": Optional, // see below +/// "non_revoked": Optional<>, // see below, +/// // If specified prover must proof non-revocation +/// // for date in this interval this attribute +/// // (overrides proof level interval) +/// } +/// predicate_referent: Proof-request local identifier of requested attribute predicate +/// predicate_info: Describes requested attribute predicate +/// { +/// "name": attribute name, (case insensitive and ignore spaces) +/// "p_type": predicate type (">=", ">", "<=", "<") +/// "p_value": predicate value +/// "restrictions": Optional, // see below +/// "non_revoked": Optional<>, // see below, +/// // If specified prover must proof non-revocation +/// // for date in this interval this attribute +/// // (overrides proof level interval) +/// } +/// non_revoc_interval: Defines non-revocation interval +/// { +/// "from": Optional, // timestamp of interval beginning +/// "to": Optional, // timestamp of interval ending +/// } +/// where wql query: indy-sdk/docs/design/011-wallet-query-language/README.md +/// The list of allowed fields: +/// "schema_id": , +/// "schema_issuer_did": , +/// "schema_name": , +/// "schema_version": , +/// "issuer_did": , +/// "cred_def_id": , +/// "rev_reg_id": , // "None" as string if not present +/// /// cb: Callback that takes command result as parameter. /// /// #Returns @@ -2019,11 +2203,11 @@ pub extern fn indy_verifier_verify_proof(command_handle: CommandHandle, /// /// #Params /// command_handle: command handle to map callback to user context -/// blob_storage_reader_handle: configuration of blob storage reader handle that will allow to read revocation tails -/// rev_reg_def_json: revocation registry definition json +/// blob_storage_reader_handle: configuration of blob storage reader handle that will allow to read revocation tails (returned by `indy_open_blob_storage_reader`) +/// rev_reg_def_json: revocation registry definition json related to `rev_reg_id` in a credential /// rev_reg_delta_json: revocation registry definition delta json -/// timestamp: time represented as a total number of seconds from Unix Epoch -/// cred_rev_id: user credential revocation id in revocation registry +/// timestamp: time represented as a total number of seconds from Unix Epoch. +/// cred_rev_id: user credential revocation id in revocation registry (match to `cred_rev_id` in a credential) /// cb: Callback that takes command result as parameter /// /// #Returns @@ -2082,12 +2266,12 @@ pub extern fn indy_create_revocation_state(command_handle: CommandHandle, /// /// #Params /// command_handle: command handle to map callback to user context -/// blob_storage_reader_handle: configuration of blob storage reader handle that will allow to read revocation tails +/// blob_storage_reader_handle: configuration of blob storage reader handle that will allow to read revocation tails (returned by `indy_open_blob_storage_reader`) /// rev_state_json: revocation registry state json -/// rev_reg_def_json: revocation registry definition json +/// rev_reg_def_json: revocation registry definition json related to `rev_reg_id` in a credential /// rev_reg_delta_json: revocation registry definition delta json /// timestamp: time represented as a total number of seconds from Unix Epoch -/// cred_rev_id: user credential revocation id in revocation registry +/// cred_rev_id: user credential revocation id in revocation registry (match to `cred_rev_id` in a credential) /// cb: Callback that takes command result as parameter /// /// #Returns diff --git a/libindy/src/api/ledger.rs b/libindy/src/api/ledger.rs index d88a563397..53912d5ed6 100644 --- a/libindy/src/api/ledger.rs +++ b/libindy/src/api/ledger.rs @@ -428,6 +428,8 @@ pub extern fn indy_build_get_nym_request(command_handle: CommandHandle, /// Builds an ATTRIB request. Request to add attribute to a NYM record. /// +/// Note: one of the fields `hash`, `raw`, `enc` must be specified. +/// /// #Params /// command_handle: command handle to map callback to caller context. /// submitter_did: Identifier (DID) of the transaction author as base58-encoded string. @@ -485,6 +487,8 @@ pub extern fn indy_build_attrib_request(command_handle: CommandHandle, /// Builds a GET_ATTRIB request. Request to get information about an Attribute for the specified DID. /// +/// Note: one of the fields `hash`, `raw`, `enc` must be specified. +/// /// #Params /// command_handle: command handle to map callback to caller context. /// submitter_did: (Optional) DID of the read request sender (if not provided then default Libindy DID will be used). @@ -1333,7 +1337,6 @@ pub extern fn indy_parse_get_revoc_reg_def_response(command_handle: CommandHandl /// revoked: array an array of revoked indices. /// }, /// ver: string - version revocation registry entry json -/// /// } /// cb: Callback that takes command result as parameter. /// From 5fac675a4619c7d1526181d11655bbb9791a3ce4 Mon Sep 17 00:00:00 2001 From: "artem.ivanov" Date: Fri, 23 Aug 2019 11:02:55 +0300 Subject: [PATCH 292/320] Fixed affected tests Signed-off-by: artem.ivanov --- libindy/tests/ledger.rs | 3 +-- wrappers/nodejs/test/ledger.js | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/libindy/tests/ledger.rs b/libindy/tests/ledger.rs index c3ba2b32a5..59c602422e 100644 --- a/libindy/tests/ledger.rs +++ b/libindy/tests/ledger.rs @@ -1283,8 +1283,7 @@ mod high_cases { "metadata": {}, "role": "0", "constraint_id": "ROLE", - "need_to_be_owner": false, - "off_ledger_signature": false + "need_to_be_owner": false }"#; #[test] diff --git a/wrappers/nodejs/test/ledger.js b/wrappers/nodejs/test/ledger.js index 9e94ff8490..2054966680 100644 --- a/wrappers/nodejs/test/ledger.js +++ b/wrappers/nodejs/test/ledger.js @@ -162,7 +162,6 @@ test('ledger', async function (t) { 'role': '0', 'constraint_id': 'ROLE', 'need_to_be_owner': false, - 'off_ledger_signature': false } req = await indy.buildAuthRuleRequest(trusteeDid, 'NYM', 'ADD', 'role', null, '101', constraint) res = await indy.signAndSubmitRequest(pool.handle, wh, trusteeDid, req) From 542b6606317c3168c0caa9d51fe1d96e2be4dc5c Mon Sep 17 00:00:00 2001 From: "artem.ivanov" Date: Fri, 23 Aug 2019 13:30:56 +0300 Subject: [PATCH 293/320] Fixed broken tests Signed-off-by: artem.ivanov --- vcx/libvcx/src/utils/libindy/payments.rs | 2 +- wrappers/nodejs/test/ledger.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/vcx/libvcx/src/utils/libindy/payments.rs b/vcx/libvcx/src/utils/libindy/payments.rs index 89eb20da02..507510ddb0 100644 --- a/vcx/libvcx/src/utils/libindy/payments.rs +++ b/vcx/libvcx/src/utils/libindy/payments.rs @@ -543,7 +543,7 @@ pub fn add_new_did(role: Option<&str>) -> (String, String) { let institution_did = settings::get_config_value(settings::CONFIG_INSTITUTION_DID).unwrap(); let (did, verkey) = ::utils::libindy::signus::create_and_store_my_did(None).unwrap(); - let mut req_nym = ledger::build_nym_request(&institution_did, &did, Some(&verkey), None, Some("TRUSTEE")).wait().unwrap(); + let mut req_nym = ledger::build_nym_request(&institution_did, &did, Some(&verkey), None, role).wait().unwrap(); req_nym = append_txn_author_agreement_to_request(&req_nym).unwrap(); diff --git a/wrappers/nodejs/test/ledger.js b/wrappers/nodejs/test/ledger.js index 2054966680..887a1317fa 100644 --- a/wrappers/nodejs/test/ledger.js +++ b/wrappers/nodejs/test/ledger.js @@ -161,7 +161,7 @@ test('ledger', async function (t) { 'metadata': {}, 'role': '0', 'constraint_id': 'ROLE', - 'need_to_be_owner': false, + 'need_to_be_owner': false } req = await indy.buildAuthRuleRequest(trusteeDid, 'NYM', 'ADD', 'role', null, '101', constraint) res = await indy.signAndSubmitRequest(pool.handle, wh, trusteeDid, req) From dd12353b40190dff037a3761cb371e402652470d Mon Sep 17 00:00:00 2001 From: Andrew Whitehead Date: Wed, 14 Aug 2019 15:34:25 -0700 Subject: [PATCH 294/320] replace indy-crypto references with ursa Signed-off-by: Andrew Whitehead --- experimental/plugins/postgres_storage/Cargo.toml | 4 ++-- .../postgres_storage/src/errors/common.rs | 2 +- .../postgres_storage/src/errors/wallet.rs | 2 +- experimental/plugins/postgres_storage/src/lib.rs | 2 +- .../storage-postgres/src/errors/anoncreds.rs | 16 ++++++++-------- .../storage/storage-postgres/src/errors/pool.rs | 6 +++--- 6 files changed, 16 insertions(+), 16 deletions(-) diff --git a/experimental/plugins/postgres_storage/Cargo.toml b/experimental/plugins/postgres_storage/Cargo.toml index 9054fe0b15..1ee1e7f373 100644 --- a/experimental/plugins/postgres_storage/Cargo.toml +++ b/experimental/plugins/postgres_storage/Cargo.toml @@ -25,7 +25,7 @@ base64_rust_base64 = ["base64"] xsalsa20_sodium = ["sodiumoxide"] chacha20poly1305_ietf_sodium = ["sodiumoxide"] pwhash_argon2i13_sodium = ["sodiumoxide"] -pair_amcl = ["indy-crypto"] +pair_amcl = ["ursa"] hash_openssl = ["openssl"] local_nodes_pool = [] revocation_tests = [] @@ -40,7 +40,7 @@ fatal_warnings = [] [dependencies] #indy = { version="1.6.7", path="../../../wrappers/rust" } rust-libindy-wrapper = "0.2.13" -indy-crypto = { version = "=0.5.1", optional = true } +ursa = { version = "0.1.1", optional = true } int_traits = { version = "0.1.1", optional = true } digest = "0.7.0" env_logger = "0.5.10" diff --git a/experimental/plugins/postgres_storage/src/errors/common.rs b/experimental/plugins/postgres_storage/src/errors/common.rs index 3f491cbfc1..0783d39339 100644 --- a/experimental/plugins/postgres_storage/src/errors/common.rs +++ b/experimental/plugins/postgres_storage/src/errors/common.rs @@ -1,5 +1,5 @@ extern crate zmq; -extern crate indy_crypto; +extern crate ursa; extern crate log; use std::cell::{BorrowError, BorrowMutError}; diff --git a/experimental/plugins/postgres_storage/src/errors/wallet.rs b/experimental/plugins/postgres_storage/src/errors/wallet.rs index 57a6729f34..9ca552d966 100644 --- a/experimental/plugins/postgres_storage/src/errors/wallet.rs +++ b/experimental/plugins/postgres_storage/src/errors/wallet.rs @@ -1,4 +1,4 @@ -extern crate indy_crypto; +extern crate ursa; use std::error; use std::error::Error; diff --git a/experimental/plugins/postgres_storage/src/lib.rs b/experimental/plugins/postgres_storage/src/lib.rs index a7d2d63dd0..3a426959ba 100644 --- a/experimental/plugins/postgres_storage/src/lib.rs +++ b/experimental/plugins/postgres_storage/src/lib.rs @@ -19,7 +19,7 @@ extern crate serde_json; extern crate lazy_static; // Note that to use macroses from indy_common::util inside of other modules it must me loaded first! -extern crate indy_crypto; +extern crate ursa; extern crate libc; extern crate time; extern crate rand; diff --git a/samples/storage/storage-postgres/src/errors/anoncreds.rs b/samples/storage/storage-postgres/src/errors/anoncreds.rs index e479ce19e4..370493664a 100644 --- a/samples/storage/storage-postgres/src/errors/anoncreds.rs +++ b/samples/storage/storage-postgres/src/errors/anoncreds.rs @@ -1,5 +1,5 @@ extern crate serde_json; -extern crate indy_crypto; +extern crate ursa; use std::error; use std::fmt; @@ -9,7 +9,7 @@ use errors::prelude::*; use api::ErrorCode; use errors::ToErrorCode; -use self::indy_crypto::errors::IndyCryptoError; +use self::ursa::errors::UrsaCryptoError; #[derive(Debug)] pub enum AnoncredsError { @@ -82,13 +82,13 @@ impl From for AnoncredsError { } } -impl From for AnoncredsError { - fn from(err: indy_crypto::errors::IndyCryptoError) -> Self { +impl From for AnoncredsError { + fn from(err: ursa::errors::UrsaCryptoError) -> Self { match err { - IndyCryptoError::AnoncredsRevocationAccumulatorIsFull(err) => AnoncredsError::RevocationRegistryFull(err), - IndyCryptoError::AnoncredsProofRejected(err) => AnoncredsError::ProofRejected(err), - IndyCryptoError::AnoncredsInvalidRevocationAccumulatorIndex(err) => AnoncredsError::InvalidUserRevocId(err), - IndyCryptoError::AnoncredsCredentialRevoked(err) => AnoncredsError::CredentialRevoked(err), + UrsaCryptoError::AnoncredsRevocationAccumulatorIsFull(err) => AnoncredsError::RevocationRegistryFull(err), + UrsaCryptoError::AnoncredsProofRejected(err) => AnoncredsError::ProofRejected(err), + UrsaCryptoError::AnoncredsInvalidRevocationAccumulatorIndex(err) => AnoncredsError::InvalidUserRevocId(err), + UrsaCryptoError::AnoncredsCredentialRevoked(err) => AnoncredsError::CredentialRevoked(err), err => AnoncredsError::CommonError(CommonError::from(err)) } } diff --git a/samples/storage/storage-postgres/src/errors/pool.rs b/samples/storage/storage-postgres/src/errors/pool.rs index a09b27a852..c7555f6da5 100644 --- a/samples/storage/storage-postgres/src/errors/pool.rs +++ b/samples/storage/storage-postgres/src/errors/pool.rs @@ -1,6 +1,6 @@ extern crate zmq; extern crate serde_json; -extern crate indy_crypto; +extern crate ursa; use std::{error, fmt, io}; @@ -91,8 +91,8 @@ impl ToErrorCode for PoolError { } } -impl From for PoolError { - fn from(err: indy_crypto::errors::IndyCryptoError) -> Self { +impl From for PoolError { + fn from(err: ursa::errors::UrsaCryptoError) -> Self { PoolError::CommonError(CommonError::from(err)) } } From 11c10d0fa69c4ce1f65d31c689d43143d3991358 Mon Sep 17 00:00:00 2001 From: Andrew Whitehead Date: Thu, 15 Aug 2019 09:24:26 -0700 Subject: [PATCH 295/320] clean up compilation warnings Signed-off-by: Andrew Whitehead --- .../plugins/postgres_storage/src/postgres_storage.rs | 12 ++++++------ .../plugins/postgres_storage/src/utils/sequence.rs | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/experimental/plugins/postgres_storage/src/postgres_storage.rs b/experimental/plugins/postgres_storage/src/postgres_storage.rs index f88d45aaad..c1a505ffe2 100644 --- a/experimental/plugins/postgres_storage/src/postgres_storage.rs +++ b/experimental/plugins/postgres_storage/src/postgres_storage.rs @@ -897,13 +897,13 @@ impl WalletStorage for PostgresStorage { let mut tags = Vec::new(); // get all encrypted. - let mut rows = match query_qualifier { + let rows = match query_qualifier { Some(_) => { - let mut stmt = conn.prepare_cached("SELECT name, value FROM tags_encrypted WHERE item_id = $1 AND wallet_id = $2")?; + let stmt = conn.prepare_cached("SELECT name, value FROM tags_encrypted WHERE item_id = $1 AND wallet_id = $2")?; stmt.query(&[&item.0, &self.wallet_id])? }, None => { - let mut stmt = conn.prepare_cached("SELECT name, value FROM tags_encrypted WHERE item_id = $1")?; + let stmt = conn.prepare_cached("SELECT name, value FROM tags_encrypted WHERE item_id = $1")?; stmt.query(&[&item.0])? } }; @@ -917,13 +917,13 @@ impl WalletStorage for PostgresStorage { } // get all plain - let mut rows = match query_qualifier { + let rows = match query_qualifier { Some(_) => { - let mut stmt = conn.prepare_cached("SELECT name, value FROM tags_plaintext WHERE item_id = $1 AND wallet_id = $2")?; + let stmt = conn.prepare_cached("SELECT name, value FROM tags_plaintext WHERE item_id = $1 AND wallet_id = $2")?; stmt.query(&[&item.0, &self.wallet_id])? }, None => { - let mut stmt = conn.prepare_cached("SELECT name, value FROM tags_plaintext WHERE item_id = $1")?; + let stmt = conn.prepare_cached("SELECT name, value FROM tags_plaintext WHERE item_id = $1")?; stmt.query(&[&item.0])? } }; diff --git a/experimental/plugins/postgres_storage/src/utils/sequence.rs b/experimental/plugins/postgres_storage/src/utils/sequence.rs index 8e9e588259..6cb2b8e8e4 100644 --- a/experimental/plugins/postgres_storage/src/utils/sequence.rs +++ b/experimental/plugins/postgres_storage/src/utils/sequence.rs @@ -1,9 +1,9 @@ -use std::sync::atomic::{AtomicUsize, Ordering, ATOMIC_USIZE_INIT}; +use std::sync::atomic::{AtomicUsize, Ordering}; pub struct SequenceUtils {} lazy_static! { - static ref IDS_COUNTER: AtomicUsize = ATOMIC_USIZE_INIT; //TODO use AtomicI32 + static ref IDS_COUNTER: AtomicUsize = AtomicUsize::new(0); //TODO use AtomicI32 } impl SequenceUtils { From edecb0760ca94cd6d96c69b2fb65bc1986b01647 Mon Sep 17 00:00:00 2001 From: Andrew Whitehead Date: Sat, 17 Aug 2019 13:25:55 -0700 Subject: [PATCH 296/320] quote database name in create/drop database statements Signed-off-by: Andrew Whitehead --- experimental/plugins/postgres_storage/src/postgres_storage.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/experimental/plugins/postgres_storage/src/postgres_storage.rs b/experimental/plugins/postgres_storage/src/postgres_storage.rs index c1a505ffe2..08b36c56ad 100644 --- a/experimental/plugins/postgres_storage/src/postgres_storage.rs +++ b/experimental/plugins/postgres_storage/src/postgres_storage.rs @@ -114,7 +114,7 @@ const _PLAIN_TAGS_QUERY: &str = "SELECT name, value from tags_plaintext where it const _ENCRYPTED_TAGS_QUERY: &str = "SELECT name, value from tags_encrypted where item_id = $1"; const _PLAIN_TAGS_QUERY_MULTI: &str = "SELECT name, value from tags_plaintext where item_id = $1 and wallet_id = $2"; const _ENCRYPTED_TAGS_QUERY_MULTI: &str = "SELECT name, value from tags_encrypted where item_id = $1 and wallet_id = $2"; -const _CREATE_WALLET_DATABASE: &str = "CREATE DATABASE $1"; +const _CREATE_WALLET_DATABASE: &str = "CREATE DATABASE \"$1\""; const _CREATE_WALLETS_DATABASE: &str = "CREATE DATABASE wallets"; // Note: wallet id length was constrained before by postgres database name length to 64 characters, keeping the same restrictions const _CREATE_SCHEMA: [&str; 12] = [ @@ -206,7 +206,7 @@ const _CREATE_SCHEMA_MULTI: [&str; 14] = [ "CREATE INDEX IF NOT EXISTS ix_tags_plaintext_value ON tags_plaintext(wallet_id, value)", "CREATE INDEX IF NOT EXISTS ix_tags_plaintext_wallet_id_item_id ON tags_plaintext(wallet_id, item_id)" ]; -const _DROP_WALLET_DATABASE: &str = "DROP DATABASE $1"; +const _DROP_WALLET_DATABASE: &str = "DROP DATABASE \"$1\""; const _DROP_SCHEMA: [&str; 4] = [ "DROP TABLE tags_plaintext", "DROP TABLE tags_encrypted", From 6c705d3da89a8cfdce0805399289cc8eb2b7dfc8 Mon Sep 17 00:00:00 2001 From: Andrew Whitehead Date: Fri, 23 Aug 2019 22:19:27 -0700 Subject: [PATCH 297/320] clean up warnings in rust 1.37 Signed-off-by: Andrew Whitehead --- .../postgres_storage/src/errors/common.rs | 2 +- .../postgres_storage/src/errors/crypto.rs | 2 +- .../postgres_storage/src/errors/wallet.rs | 2 +- .../plugins/postgres_storage/src/lib.rs | 2 +- .../postgres_storage/src/libindy/wallet.rs | 2 +- .../postgres_storage/src/postgres_storage.rs | 8 ++--- .../postgres_storage/src/utils/callbacks.rs | 4 +-- .../postgres_storage/src/wql/language.rs | 4 +-- .../plugins/postgres_storage/src/wql/query.rs | 34 +++++++++---------- .../postgres_storage/src/wql/storage.rs | 4 +-- 10 files changed, 32 insertions(+), 32 deletions(-) diff --git a/experimental/plugins/postgres_storage/src/errors/common.rs b/experimental/plugins/postgres_storage/src/errors/common.rs index 0783d39339..abbd1fb592 100644 --- a/experimental/plugins/postgres_storage/src/errors/common.rs +++ b/experimental/plugins/postgres_storage/src/errors/common.rs @@ -81,7 +81,7 @@ impl Error for CommonError { } } - fn cause(&self) -> Option<&Error> { + fn cause(&self) -> Option<&dyn Error> { match *self { CommonError::InvalidParam1(_) | CommonError::InvalidParam2(_) | diff --git a/experimental/plugins/postgres_storage/src/errors/crypto.rs b/experimental/plugins/postgres_storage/src/errors/crypto.rs index 58e943833e..67eeb16089 100644 --- a/experimental/plugins/postgres_storage/src/errors/crypto.rs +++ b/experimental/plugins/postgres_storage/src/errors/crypto.rs @@ -32,7 +32,7 @@ impl error::Error for CryptoError { } } - fn cause(&self) -> Option<&error::Error> { + fn cause(&self) -> Option<&dyn error::Error> { match *self { CryptoError::UnknownCryptoError(_) => None, CryptoError::CommonError(ref err) => Some(err) diff --git a/experimental/plugins/postgres_storage/src/errors/wallet.rs b/experimental/plugins/postgres_storage/src/errors/wallet.rs index 9ca552d966..6b72277df8 100644 --- a/experimental/plugins/postgres_storage/src/errors/wallet.rs +++ b/experimental/plugins/postgres_storage/src/errors/wallet.rs @@ -78,7 +78,7 @@ impl error::Error for WalletError { } } - fn cause(&self) -> Option<&error::Error> { + fn cause(&self) -> Option<&dyn error::Error> { match *self { WalletError::InvalidHandle(_) => None, WalletError::UnknownType(_) => None, diff --git a/experimental/plugins/postgres_storage/src/lib.rs b/experimental/plugins/postgres_storage/src/lib.rs index 3a426959ba..d1534f887c 100644 --- a/experimental/plugins/postgres_storage/src/lib.rs +++ b/experimental/plugins/postgres_storage/src/lib.rs @@ -911,7 +911,7 @@ fn _storagerecord_to_postgresrecord(in_rec: &StorageRecord) -> Result) -> Result, ErrorCode> { +fn _iterator_to_record_set(mut iter: Box) -> Result, ErrorCode> { let mut search_continue: bool = true; let mut search_records = Vec::new(); while search_continue { diff --git a/experimental/plugins/postgres_storage/src/libindy/wallet.rs b/experimental/plugins/postgres_storage/src/libindy/wallet.rs index e65273d9b2..f1b0a7c88e 100644 --- a/experimental/plugins/postgres_storage/src/libindy/wallet.rs +++ b/experimental/plugins/postgres_storage/src/libindy/wallet.rs @@ -353,7 +353,7 @@ pub fn register_wallet_storage( ) -> ErrorCode { let (sender, receiver) = channel(); - let closure: Box = Box::new(move |err| { + let closure: Box = Box::new(move |err| { sender.send(err).unwrap(); }); diff --git a/experimental/plugins/postgres_storage/src/postgres_storage.rs b/experimental/plugins/postgres_storage/src/postgres_storage.rs index 08b36c56ad..f721bfa07c 100644 --- a/experimental/plugins/postgres_storage/src/postgres_storage.rs +++ b/experimental/plugins/postgres_storage/src/postgres_storage.rs @@ -292,7 +292,7 @@ struct PostgresStorageIterator { impl PostgresStorageIterator { fn new(stmt: Option>, Box>>>, - args: &[&postgres::types::ToSql], + args: &[&dyn postgres::types::ToSql], options: RecordOptions, tag_retriever: Option, total_count: Option) -> Result { @@ -789,7 +789,7 @@ impl WalletStrategy for MultiWalletMultiTableStrategy { } } -static mut SELECTED_STRATEGY: &WalletStrategy = &DatabasePerWalletStrategy{}; +static mut SELECTED_STRATEGY: &dyn WalletStrategy = &DatabasePerWalletStrategy{}; impl PostgresStorageType { pub fn new() -> PostgresStorageType { @@ -1409,7 +1409,7 @@ impl WalletStorage for PostgresStorage { } } - fn get_all(&self) -> Result, WalletStorageError> { + fn get_all(&self) -> Result, WalletStorageError> { let query_qualifier = unsafe { SELECTED_STRATEGY.query_qualifier() }; @@ -1435,7 +1435,7 @@ impl WalletStorage for PostgresStorage { Ok(Box::new(storage_iterator)) } - fn search(&self, type_: &[u8], query: &language::Operator, options: Option<&str>) -> Result, WalletStorageError> { + fn search(&self, type_: &[u8], query: &language::Operator, options: Option<&str>) -> Result, WalletStorageError> { let type_ = type_.to_vec(); // FIXME let search_options = match options { diff --git a/experimental/plugins/postgres_storage/src/utils/callbacks.rs b/experimental/plugins/postgres_storage/src/utils/callbacks.rs index 989d31b35e..02767701ae 100644 --- a/experimental/plugins/postgres_storage/src/utils/callbacks.rs +++ b/experimental/plugins/postgres_storage/src/utils/callbacks.rs @@ -6,9 +6,9 @@ use std::collections::HashMap; use std::ffi::CStr; use std::sync::Mutex; -type EcClosure = Box; +type EcClosure = Box; type EcCallback = Option; -type EcStringClosure = Box; +type EcStringClosure = Box; type EcStringCallback = Option; pub fn closure_to_cb_ec(closure: EcClosure) -> (i32, EcCallback) { diff --git a/experimental/plugins/postgres_storage/src/wql/language.rs b/experimental/plugins/postgres_storage/src/wql/language.rs index 239ab11c3d..79d882429d 100644 --- a/experimental/plugins/postgres_storage/src/wql/language.rs +++ b/experimental/plugins/postgres_storage/src/wql/language.rs @@ -80,7 +80,7 @@ pub enum Operator { #[allow(dead_code)] impl Operator { - pub fn transform(self, f: &Fn(Operator) -> Result) -> Result { + pub fn transform(self, f: &dyn Fn(Operator) -> Result) -> Result { match self { Operator::And(operators) => Ok(Operator::And(Operator::transform_list_operators(operators, f)?)), Operator::Or(operators) => Ok(Operator::Or(Operator::transform_list_operators(operators, f)?)), @@ -89,7 +89,7 @@ impl Operator { } } - fn transform_list_operators(operators: Vec, f: &Fn(Operator) -> Result) -> Result, WalletQueryError> { + fn transform_list_operators(operators: Vec, f: &dyn Fn(Operator) -> Result) -> Result, WalletQueryError> { let mut transformed = Vec::new(); for operator in operators { diff --git a/experimental/plugins/postgres_storage/src/wql/query.rs b/experimental/plugins/postgres_storage/src/wql/query.rs index dd74e2d4e8..97866f8706 100644 --- a/experimental/plugins/postgres_storage/src/wql/query.rs +++ b/experimental/plugins/postgres_storage/src/wql/query.rs @@ -7,8 +7,8 @@ use language::{Operator,TagName,TargetValue}; // Translates Wallet Query Language to SQL // WQL input is provided as a reference to a top level Operator // Result is a tuple of query string and query arguments -pub fn wql_to_sql<'a>(class: &'a Vec, op: &'a Operator, _options: Option<&str>) -> Result<(String, Vec<&'a ToSql>), WalletQueryError> { - let mut arguments: Vec<&ToSql> = Vec::new(); +pub fn wql_to_sql<'a>(class: &'a Vec, op: &'a Operator, _options: Option<&str>) -> Result<(String, Vec<&'a dyn ToSql>), WalletQueryError> { + let mut arguments: Vec<&dyn ToSql> = Vec::new(); arguments.push(class); let clause_string = operator_to_sql(op, &mut arguments)?; let mut query_string = "SELECT i.id, i.name, i.value, i.key, i.type FROM items as i WHERE i.type = $$".to_string(); @@ -20,8 +20,8 @@ pub fn wql_to_sql<'a>(class: &'a Vec, op: &'a Operator, _options: Option<&st } -pub fn wql_to_sql_count<'a>(class: &'a Vec, op: &'a Operator) -> Result<(String, Vec<&'a ToSql>), WalletQueryError> { - let mut arguments: Vec<&ToSql> = Vec::new(); +pub fn wql_to_sql_count<'a>(class: &'a Vec, op: &'a Operator) -> Result<(String, Vec<&'a dyn ToSql>), WalletQueryError> { + let mut arguments: Vec<&dyn ToSql> = Vec::new(); arguments.push(class); let clause_string = operator_to_sql(op, &mut arguments)?; let mut query_string = "SELECT count(*) FROM items as i WHERE i.type = $$".to_string(); @@ -43,7 +43,7 @@ fn convert_query_to_psql_args(query: &str) -> String { s } -fn operator_to_sql<'a>(op: &'a Operator, arguments: &mut Vec<&'a ToSql>) -> Result { +fn operator_to_sql<'a>(op: &'a Operator, arguments: &mut Vec<&'a dyn ToSql>) -> Result { match *op { Operator::Eq(ref tag_name, ref target_value) => eq_to_sql(tag_name, target_value, arguments), Operator::Neq(ref tag_name, ref target_value) => neq_to_sql(tag_name, target_value, arguments), @@ -60,7 +60,7 @@ fn operator_to_sql<'a>(op: &'a Operator, arguments: &mut Vec<&'a ToSql>) -> Resu } -fn eq_to_sql<'a>(name: &'a TagName, value: &'a TargetValue, arguments: &mut Vec<&'a ToSql>) -> Result { +fn eq_to_sql<'a>(name: &'a TagName, value: &'a TargetValue, arguments: &mut Vec<&'a dyn ToSql>) -> Result { match (name, value) { (&TagName::PlainTagName(ref queried_name), &TargetValue::Unencrypted(ref queried_value)) => { arguments.push(queried_name); @@ -77,7 +77,7 @@ fn eq_to_sql<'a>(name: &'a TagName, value: &'a TargetValue, arguments: &mut Vec< } -fn neq_to_sql<'a>(name: &'a TagName, value: &'a TargetValue, arguments: &mut Vec<&'a ToSql>) -> Result { +fn neq_to_sql<'a>(name: &'a TagName, value: &'a TargetValue, arguments: &mut Vec<&'a dyn ToSql>) -> Result { match (name, value) { (&TagName::PlainTagName(ref queried_name), &TargetValue::Unencrypted(ref queried_value)) => { arguments.push(queried_name); @@ -94,7 +94,7 @@ fn neq_to_sql<'a>(name: &'a TagName, value: &'a TargetValue, arguments: &mut Vec } -fn gt_to_sql<'a>(name: &'a TagName, value: &'a TargetValue, arguments: &mut Vec<&'a ToSql>) -> Result { +fn gt_to_sql<'a>(name: &'a TagName, value: &'a TargetValue, arguments: &mut Vec<&'a dyn ToSql>) -> Result { match (name, value) { (&TagName::PlainTagName(ref queried_name), &TargetValue::Unencrypted(ref queried_value)) => { arguments.push(queried_name); @@ -106,7 +106,7 @@ fn gt_to_sql<'a>(name: &'a TagName, value: &'a TargetValue, arguments: &mut Vec< } -fn gte_to_sql<'a>(name: &'a TagName, value: &'a TargetValue, arguments: &mut Vec<&'a ToSql>) -> Result { +fn gte_to_sql<'a>(name: &'a TagName, value: &'a TargetValue, arguments: &mut Vec<&'a dyn ToSql>) -> Result { match (name, value) { (&TagName::PlainTagName(ref queried_name), &TargetValue::Unencrypted(ref queried_value)) => { arguments.push(queried_name); @@ -118,7 +118,7 @@ fn gte_to_sql<'a>(name: &'a TagName, value: &'a TargetValue, arguments: &mut Vec } -fn lt_to_sql<'a>(name: &'a TagName, value: &'a TargetValue, arguments: &mut Vec<&'a ToSql>) -> Result { +fn lt_to_sql<'a>(name: &'a TagName, value: &'a TargetValue, arguments: &mut Vec<&'a dyn ToSql>) -> Result { match (name, value) { (&TagName::PlainTagName(ref queried_name), &TargetValue::Unencrypted(ref queried_value)) => { arguments.push(queried_name); @@ -130,7 +130,7 @@ fn lt_to_sql<'a>(name: &'a TagName, value: &'a TargetValue, arguments: &mut Vec< } -fn lte_to_sql<'a>(name: &'a TagName, value: &'a TargetValue, arguments: &mut Vec<&'a ToSql>) -> Result { +fn lte_to_sql<'a>(name: &'a TagName, value: &'a TargetValue, arguments: &mut Vec<&'a dyn ToSql>) -> Result { match (name, value) { (&TagName::PlainTagName(ref queried_name), &TargetValue::Unencrypted(ref queried_value)) => { arguments.push(queried_name); @@ -142,7 +142,7 @@ fn lte_to_sql<'a>(name: &'a TagName, value: &'a TargetValue, arguments: &mut Vec } -fn like_to_sql<'a>(name: &'a TagName, value: &'a TargetValue, arguments: &mut Vec<&'a ToSql>) -> Result { +fn like_to_sql<'a>(name: &'a TagName, value: &'a TargetValue, arguments: &mut Vec<&'a dyn ToSql>) -> Result { match (name, value) { (&TagName::PlainTagName(ref queried_name), &TargetValue::Unencrypted(ref queried_value)) => { arguments.push(queried_name); @@ -154,7 +154,7 @@ fn like_to_sql<'a>(name: &'a TagName, value: &'a TargetValue, arguments: &mut Ve } -fn in_to_sql<'a>(name: &'a TagName, values: &'a Vec, arguments: &mut Vec<&'a ToSql>) -> Result { +fn in_to_sql<'a>(name: &'a TagName, values: &'a Vec, arguments: &mut Vec<&'a dyn ToSql>) -> Result { let mut in_string = String::new(); match name { &TagName::PlainTagName(ref queried_name) => { @@ -198,23 +198,23 @@ fn in_to_sql<'a>(name: &'a TagName, values: &'a Vec, arguments: &mu } -fn and_to_sql<'a>(suboperators: &'a [Operator], arguments: &mut Vec<&'a ToSql>) -> Result { +fn and_to_sql<'a>(suboperators: &'a [Operator], arguments: &mut Vec<&'a dyn ToSql>) -> Result { join_operators(suboperators, " AND ", arguments) } -fn or_to_sql<'a>(suboperators: &'a [Operator], arguments: &mut Vec<&'a ToSql>) -> Result { +fn or_to_sql<'a>(suboperators: &'a [Operator], arguments: &mut Vec<&'a dyn ToSql>) -> Result { join_operators(suboperators, " OR ", arguments) } -fn not_to_sql<'a>(suboperator: &'a Operator, arguments: &mut Vec<&'a ToSql>) -> Result { +fn not_to_sql<'a>(suboperator: &'a Operator, arguments: &mut Vec<&'a dyn ToSql>) -> Result { let suboperator_string = operator_to_sql(suboperator, arguments)?; Ok("NOT (".to_string() + &suboperator_string + ")") } -fn join_operators<'a>(operators: &'a [Operator], join_str: &str, arguments: &mut Vec<&'a ToSql>) -> Result { +fn join_operators<'a>(operators: &'a [Operator], join_str: &str, arguments: &mut Vec<&'a dyn ToSql>) -> Result { let mut s = String::new(); if operators.len() > 0 { s.push('('); diff --git a/experimental/plugins/postgres_storage/src/wql/storage.rs b/experimental/plugins/postgres_storage/src/wql/storage.rs index 96c4000b89..b8ecb765f7 100644 --- a/experimental/plugins/postgres_storage/src/wql/storage.rs +++ b/experimental/plugins/postgres_storage/src/wql/storage.rs @@ -86,7 +86,7 @@ pub trait WalletStorage { fn delete(&self, type_: &[u8], id: &[u8]) -> Result<(), WalletStorageError>; fn get_storage_metadata(&self) -> Result, WalletStorageError>; fn set_storage_metadata(&self, metadata: &[u8]) -> Result<(), WalletStorageError>; - fn get_all(&self) -> Result, WalletStorageError>; - fn search(&self, type_: &[u8], query: &language::Operator, options: Option<&str>) -> Result, WalletStorageError>; + fn get_all(&self) -> Result, WalletStorageError>; + fn search(&self, type_: &[u8], query: &language::Operator, options: Option<&str>) -> Result, WalletStorageError>; fn close(&mut self) -> Result<(), WalletStorageError>; } From 6470fdd2c9583510c4a36449ec3c6274baf3ca0b Mon Sep 17 00:00:00 2001 From: Axel Nennker Date: Sat, 24 Aug 2019 08:59:45 +0200 Subject: [PATCH 298/320] manually resolving merge conflicts Signed-off-by: Axel Nennker --- libindy/Cargo.lock | 430 +++++++++++++++++++++++++++++---------------- libindy/Cargo.toml | 47 ++--- 2 files changed, 298 insertions(+), 179 deletions(-) diff --git a/libindy/Cargo.lock b/libindy/Cargo.lock index 26f5384d0a..4a2e765c6a 100644 --- a/libindy/Cargo.lock +++ b/libindy/Cargo.lock @@ -28,15 +28,6 @@ dependencies = [ "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "argon2rs" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", - "scoped_threadpool 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "arrayref" version = "0.3.5" @@ -61,7 +52,7 @@ dependencies = [ [[package]] name = "autocfg" -version = "0.1.5" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -72,7 +63,7 @@ dependencies = [ "backtrace-sys 0.1.30 (registry+https://github.com/rust-lang/crates.io-index)", "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-demangle 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-demangle 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -87,11 +78,10 @@ dependencies = [ [[package]] name = "base64" -version = "0.6.0" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "safemem 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -111,12 +101,13 @@ dependencies = [ ] [[package]] -name = "blake2-rfc" -version = "0.2.18" +name = "blake2b_simd" +version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ + "arrayref 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", "arrayvec 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", - "constant_time_eq 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "constant_time_eq 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -140,18 +131,18 @@ dependencies = [ [[package]] name = "bstr" -version = "0.2.6" +version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "regex-automata 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.98 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "bumpalo" -version = "2.5.0" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -164,6 +155,15 @@ name = "byteorder" version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "c2-chacha" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "ppv-lite86 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "cast" version = "0.2.2" @@ -186,7 +186,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-width 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -207,7 +207,7 @@ dependencies = [ [[package]] name = "constant_time_eq" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -229,8 +229,8 @@ dependencies = [ "rand_xoshiro 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "rayon 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "rayon-core 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.98 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.98 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", "tinytemplate 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", "walkdir 2.2.9 (registry+https://github.com/rust-lang/crates.io-index)", @@ -299,11 +299,11 @@ name = "csv" version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "bstr 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", + "bstr 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)", "csv-core 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", "ryu 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.98 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -316,7 +316,7 @@ dependencies = [ [[package]] name = "curve25519-dalek" -version = "1.2.2" +version = "1.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -345,7 +345,7 @@ dependencies = [ "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", "strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.42 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -355,7 +355,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "darling_core 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.42 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -365,7 +365,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.42 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -378,11 +378,21 @@ dependencies = [ [[package]] name = "dirs" -version = "1.0.5" +version = "2.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ + "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "dirs-sys 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "dirs-sys" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_users 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_users 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -392,7 +402,7 @@ version = "1.0.0-pre.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "clear_on_drop 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "curve25519-dalek 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "curve25519-dalek 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", "sha2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -420,6 +430,18 @@ dependencies = [ "termcolor 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "env_logger" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "atty 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)", + "humantime 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "termcolor 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "errno" version = "0.2.4" @@ -476,7 +498,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.42 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)", "synstructure 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -536,6 +558,16 @@ dependencies = [ "typenum 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "getrandom" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", + "wasi 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "hex" version = "0.3.2" @@ -561,13 +593,13 @@ dependencies = [ "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", "indy-sys 1.11.0", - "lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "num-derive 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.98 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.98 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -625,12 +657,12 @@ version = "1.11.0" dependencies = [ "android_logger 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", "backtrace 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)", - "base64 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "criterion 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "derivative 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "dirs 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", - "env_logger 0.5.13 (registry+https://github.com/rust-lang/crates.io-index)", + "dirs 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "env_logger 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", "errno 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", "etcommon-rlp 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -644,16 +676,16 @@ dependencies = [ "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "log-derive 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "log-panics 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "named_type 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "named_type_derive 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "named_type 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "named_type_derive 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "openssl 0.10.24 (registry+https://github.com/rust-lang/crates.io-index)", "owning_ref 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "rmp-serde 0.13.7 (registry+https://github.com/rust-lang/crates.io-index)", - "rusqlite 0.19.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rusqlite 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)", "rust-base58 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.98 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.98 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", "sha2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "sha3 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -661,9 +693,9 @@ dependencies = [ "threadpool 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", "ursa 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "uuid 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "uuid 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)", "zeroize 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)", - "zmq 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", + "zmq 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -677,7 +709,7 @@ dependencies = [ [[package]] name = "libsqlite3-sys" -version = "0.15.0" +version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cc 1.0.26 (registry+https://github.com/rust-lang/crates.io-index)", @@ -707,7 +739,7 @@ dependencies = [ "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.42 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -757,9 +789,14 @@ name = "named_type" version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "named_type" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "named_type_derive" -version = "0.1.6" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "named_type 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -799,7 +836,7 @@ name = "num-complex" version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "autocfg 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -810,7 +847,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.42 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -818,7 +855,7 @@ name = "num-integer" version = "0.1.41" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "autocfg 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -827,7 +864,7 @@ name = "num-iter" version = "0.1.39" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "autocfg 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -837,7 +874,7 @@ name = "num-rational" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "autocfg 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "num-bigint 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", @@ -856,7 +893,7 @@ name = "num-traits" version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "autocfg 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -882,15 +919,15 @@ dependencies = [ "foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl-sys 0.9.48 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl-sys 0.9.49 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "openssl-sys" -version = "0.9.48" +version = "0.9.49" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "autocfg 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "cc 1.0.26 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", @@ -910,6 +947,11 @@ name = "pkg-config" version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "ppv-lite86" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "proc-macro2" version = "0.4.30" @@ -918,6 +960,14 @@ dependencies = [ "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "proc-macro2" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "quick-error" version = "1.2.2" @@ -937,12 +987,11 @@ dependencies = [ ] [[package]] -name = "rand" -version = "0.3.23" +name = "quote" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -962,7 +1011,7 @@ name = "rand" version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "autocfg 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", "rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -975,15 +1024,36 @@ dependencies = [ "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "rand" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "getrandom 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_chacha 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_hc 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "rand_chacha" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "autocfg 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "rand_chacha" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "c2-chacha 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "rand_core" version = "0.3.1" @@ -997,6 +1067,14 @@ name = "rand_core" version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "rand_core" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "getrandom 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "rand_hc" version = "0.1.0" @@ -1005,6 +1083,14 @@ dependencies = [ "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "rand_hc" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rand_core 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "rand_isaac" version = "0.1.1" @@ -1033,7 +1119,7 @@ dependencies = [ "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1042,7 +1128,7 @@ name = "rand_pcg" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "autocfg 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1100,13 +1186,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "redox_users" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "argon2rs 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "rand_os 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)", + "rust-argon2 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1149,23 +1235,33 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "rmp 0.8.7 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.98 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rusqlite" -version = "0.19.0" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "fallible-iterator 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "fallible-streaming-iterator 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", - "libsqlite3-sys 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libsqlite3-sys 0.16.0 (registry+https://github.com/rust-lang/crates.io-index)", "lru-cache 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "rust-argon2" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", + "blake2b_simd 0.5.7 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "rust-base58" version = "0.0.4" @@ -1176,7 +1272,7 @@ dependencies = [ [[package]] name = "rustc-demangle" -version = "0.1.15" +version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -1192,11 +1288,6 @@ name = "ryu" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "safemem" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "same-file" version = "1.0.5" @@ -1205,11 +1296,6 @@ dependencies = [ "winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "scoped_threadpool" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "scopeguard" version = "1.0.0" @@ -1222,7 +1308,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cc 1.0.26 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.98 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1240,17 +1326,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "serde" -version = "1.0.98" +version = "1.0.99" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "serde_derive" -version = "1.0.98" +version = "1.0.99" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.42 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1260,7 +1346,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", "ryu 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.98 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1293,7 +1379,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", "libsodium-sys 0.0.16 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.98 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1328,7 +1414,7 @@ dependencies = [ [[package]] name = "syn" -version = "0.15.42" +version = "0.15.44" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1336,6 +1422,16 @@ dependencies = [ "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "syn" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "synom" version = "0.11.3" @@ -1351,7 +1447,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.42 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1360,7 +1456,7 @@ name = "termcolor" version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "wincolor 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "wincolor 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1368,7 +1464,7 @@ name = "textwrap" version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-width 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1402,7 +1498,7 @@ name = "tinytemplate" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "serde 1.0.98 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1418,7 +1514,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "unicode-width" -version = "0.1.5" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -1431,6 +1527,11 @@ name = "unicode-xid" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "unicode-xid" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "ursa" version = "0.1.1" @@ -1450,8 +1551,8 @@ dependencies = [ "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", "rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "secp256k1 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.98 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.98 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", "sha2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "sha3 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1461,10 +1562,10 @@ dependencies = [ [[package]] name = "uuid" -version = "0.5.1" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "rand 0.3.23 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1482,52 +1583,58 @@ dependencies = [ "winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "wasi" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "wasm-bindgen" -version = "0.2.48" +version = "0.2.50" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "wasm-bindgen-macro 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-macro 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "wasm-bindgen-backend" -version = "0.2.48" +version = "0.2.50" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "bumpalo 2.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "bumpalo 2.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.42 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-shared 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-shared 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "wasm-bindgen-macro" -version = "0.2.48" +version = "0.2.50" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-macro-support 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-macro-support 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.48" +version = "0.2.50" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.42 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-backend 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-shared 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-backend 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-shared 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.48" +version = "0.2.50" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -1559,7 +1666,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "wincolor" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1586,24 +1693,23 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.42 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)", "synstructure 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "zmq" -version = "0.9.1" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "zmq-sys 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", + "zmq-sys 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "zmq-sys" -version = "0.9.1" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1615,30 +1721,30 @@ dependencies = [ "checksum amcl 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee5cca1ddc8b9dceb55b7f1272a9d1e643d73006f350a20ab4926d24e33f0f0d" "checksum android_log-sys 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b8052e2d8aabbb8d556d6abbcce2a22b9590996c5f849b9c7ce4544a2e3b984e" "checksum android_logger 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "86983875e7c3a202e31471cc6d60fcc18f30e194f1729cfff3bfb43d646ffced" -"checksum argon2rs 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "3f67b0b6a86dae6e67ff4ca2b6201396074996379fba2b92ff649126f37cb392" "checksum arrayref 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "0d382e583f07208808f6b1249e60848879ba3543f57c32277bf52d69c2f0f0ee" "checksum arrayvec 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)" = "b8d73f9beda665eaa98ab9e4f7442bd4e7de6652587de55b2525e52e29c1b0ba" "checksum atty 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)" = "1803c647a3ec87095e7ae7acfca019e98de5ec9a7d01343f611cf3152ed71a90" -"checksum autocfg 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "22130e92352b948e7e82a49cdb0aa94f2211761117f29e052dd397c1ac33542b" +"checksum autocfg 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "b671c8fb71b457dd4ae18c4ba1e59aa81793daacc361d82fcd410cef0d491875" "checksum backtrace 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)" = "18b65ea1161bfb2dd6da6fade5edd4dbd08fba85012123dd333d2fd1b90b2782" "checksum backtrace-sys 0.1.30 (registry+https://github.com/rust-lang/crates.io-index)" = "5b3a000b9c543553af61bc01cbfc403b04b5caa9e421033866f2e98061eb3e61" -"checksum base64 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "96434f987501f0ed4eb336a411e0631ecd1afa11574fe148587adc4ff96143c9" +"checksum base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0b25d992356d2eb0ed82172f5248873db5560c4721f564b13cb5193bda5e668e" "checksum bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3d155346769a6855b86399e9bc3814ab343cd3d62c7e985113d46a0ec3c281fd" "checksum blake2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "91721a6330935673395a0607df4d49a9cb90ae12d259f1b3e0a3f6e1d486872e" -"checksum blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)" = "5d6d530bdd2d52966a6d03b7a964add7ae1a288d25214066fd4b600f0f796400" +"checksum blake2b_simd 0.5.7 (registry+https://github.com/rust-lang/crates.io-index)" = "bf775a81bb2d464e20ff170ac20316c7b08a43d11dbc72f0f82e8e8d3d6d0499" "checksum block-buffer 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c0940dc441f31689269e10ac70eb1002a3a1d3ad1390e030043662eb7fe4688b" "checksum block-padding 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "6d4dc3af3ee2e12f3e5d224e5e1e3d73668abbeb69e566d361f7d5563a4fdf09" -"checksum bstr 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "e0a692f1c740e7e821ca71a22cf99b9b2322dfa94d10f71443befb1797b3946a" -"checksum bumpalo 2.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2cd43d82f27d68911e6ee11ee791fb248f138f5d69424dc02e098d4f152b0b05" +"checksum bstr 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "94cdf78eb7e94c566c1f5dbe2abf8fc70a548fc902942a48c4b3a98b48ca9ade" +"checksum bumpalo 2.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ad807f2fc2bf185eeb98ff3a901bd46dc5ad58163d0fa4577ba0d25674d71708" "checksum byte-tools 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7" "checksum byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a7c3dd8985a7111efc5c80b44e23ecdd8c007de8ade3b96595387e812b957cf5" +"checksum c2-chacha 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7d64d04786e0f528460fc884753cf8dddcc466be308f6026f8e355c41a0e4101" "checksum cast 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "926013f2860c46252efceabb19f4a6b308197505082c609025aa6706c011d427" "checksum cc 1.0.26 (registry+https://github.com/rust-lang/crates.io-index)" = "389803e36973d242e7fecb092b2de44a3d35ac62524b3b9339e51d577d668e02" "checksum cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "b486ce3ccf7ffd79fdeb678eac06a9e6c09fc88d33836340becb8fffe87c5e33" "checksum clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5067f5bb2d80ef5d68b4c87db81601f0b75bca627bc2ef76b141d7b846a3c6d9" "checksum clear_on_drop 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "97276801e127ffb46b66ce23f35cc96bd454fa311294bced4bbace7baa8b1d17" "checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" -"checksum constant_time_eq 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8ff012e225ce166d4422e0e78419d901719760f62ae2b7969ca6b564d1b54a9e" +"checksum constant_time_eq 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "995a44c877f9212528ccc74b21a232f66ad69001e40ede5bcee2ac9ef2657120" "checksum criterion 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "0363053954f3e679645fc443321ca128b7b950a6fe288cf5f9335cc22ee58394" "checksum criterion-plot 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "76f9212ddf2f4a9eb2d401635190600656a1f88a932ef53d06e7fa4c7e02fb8e" "checksum crossbeam-deque 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "05e44b8cf3e1a625844d1750e1f7820da46044ff6d28f4d43e455ba3e5bb2c13" @@ -1648,17 +1754,19 @@ dependencies = [ "checksum crypto-mac 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4434400df11d95d556bac068ddfedd482915eb18fe8bea89bc80b6e4b1c179e5" "checksum csv 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "37519ccdfd73a75821cac9319d4fce15a81b9fcf75f951df5b9988aa3a0af87d" "checksum csv-core 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "9b5cadb6b25c77aeff80ba701712494213f4a8418fcda2ee11b6560c3ad0bf4c" -"checksum curve25519-dalek 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "019779982f8518304cfbabd515e77ad6372a9a28a57d22d39478164c5e2b32ee" +"checksum curve25519-dalek 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8b7dcd30ba50cdf88b55b033456138b7c0ac4afdc436d82e1b79f370f24cc66d" "checksum darling 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fcfbcb0c5961907597a7d1148e3af036268f2b773886b8bb3eeb1e1281d3d3d6" "checksum darling_core 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6afc018370c3bff3eb51f89256a6bdb18b4fdcda72d577982a14954a7a0b402c" "checksum darling_macro 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c6d8dac1c6f1d29a41c4712b4400f878cb4fcc4c7628f298dd75038e024998d1" "checksum derivative 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6073e9676dbebdddeabaeb63e3b7cefd23c86f5c41d381ee1237cc77b1079898" "checksum digest 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5" -"checksum dirs 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "3fd78930633bd1c6e35c4b42b1df7b0cbc6bc191146e512bb3bedf243fcc3901" +"checksum dirs 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "13aea89a5c93364a98e9b37b2fa237effbb694d5cfe01c5b70941f7eb087d5e3" +"checksum dirs-sys 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "afa0b23de8fd801745c471deffa6e12d248f962c9fd4b4c33787b055599bde7b" "checksum ed25519-dalek 1.0.0-pre.1 (registry+https://github.com/rust-lang/crates.io-index)" = "81956bcf7ef761fb4e1d88de3fa181358a0d26cbcb9755b587a08f9119824b86" "checksum either 1.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "5527cfe0d098f36e3f8839852688e63c8fff1c90b2b405aef730615f9a7bcf7b" "checksum elastic-array-plus 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "562cc8504a01eb20c10fb154abd7c4baeb9beba2329cf85838ee2bd48a468b18" "checksum env_logger 0.5.13 (registry+https://github.com/rust-lang/crates.io-index)" = "15b0a4d2e39f8420210be8b27eeda28029729e2fd4291019455016c348240c38" +"checksum env_logger 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "aafcde04e90a5226a6443b7aabdb016ba2f8307c847d524724bd9b346dd1a2d3" "checksum errno 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "c2a071601ed01b988f896ab14b95e67335d1eeb50190932a1320f7fe3cadc84e" "checksum errno-dragonfly 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "14ca354e36190500e1e1fb267c647932382b54053c50b14970856c0b00a35067" "checksum error-chain 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d9435d864e017c3c6afeac1654189b06cdb491cf2ff73dbf0d73b0f292f42ff8" @@ -1676,6 +1784,7 @@ dependencies = [ "checksum futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)" = "45dc39533a6cae6da2b56da48edae506bb767ec07370f86f70fc062e9d435869" "checksum gcc 0.3.55 (registry+https://github.com/rust-lang/crates.io-index)" = "8f5f3913fa0bfe7ee1fd8248b6b9f42a5af4b9d65ec2dd2c3c26132b950ecfc2" "checksum generic-array 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c68f0274ae0e023facc3c97b2e00f076be70e254bc851d972503b328db79b2ec" +"checksum getrandom 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "6171a6cc63fbabbe27c2b5ee268e8b7fe5dc1eb0dd2dfad537c1dfed6f69117e" "checksum hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "805026a5d0141ffc30abb3be3173848ad46a1b1664fe632428479619a3644d77" "checksum humantime 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3ca7e5f2e110db35f93b837c81797f3714500b81d517bf20c431b16d3ca4f114" "checksum ident_case 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" @@ -1687,7 +1796,7 @@ dependencies = [ "checksum lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bc5729f27f159ddd61f4df6228e827e86643d4d3e7c32183cb30a1c08f604a14" "checksum libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)" = "d44e80633f007889c7eff624b709ab43c92d708caad982295768a7b13ca3b5eb" "checksum libsodium-sys 0.0.16 (registry+https://github.com/rust-lang/crates.io-index)" = "fcbd1beeed8d44caa8a669ebaa697c313976e242c03cc9fb23d88bf1656f5542" -"checksum libsqlite3-sys 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)" = "72b1e07fcc60484f42e246f0cf1f133940c98117c81b2cefcdf71be288069680" +"checksum libsqlite3-sys 0.16.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5e5b95e89c330291768dc840238db7f9e204fd208511ab6319b56193a7f2ae25" "checksum linked-hash-map 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "ae91b68aebc4ddb91978b11a1b02ddd8602a05ec19002801c5666000e05e0f83" "checksum log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)" = "14b6052be84e6b71ab17edffc2eeabf5c2c3ae1fdb464aae35ac50c67a44e1f7" "checksum log-derive 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "90b7e153f2d4bf69d46a9e640e2c96573940fca671d275bf6f7687f6bab803fc" @@ -1697,7 +1806,8 @@ dependencies = [ "checksum memoffset 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ce6075db033bbbb7ee5a0bbd3a3186bbae616f57fb001c485c7ff77955f8177f" "checksum metadeps 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "73b122901b3a675fac8cecf68dcb2f0d3036193bc861d1ac0e1c337f7d5254c2" "checksum named_type 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c39ac6c5ee13bf558879a82198b0afe84989cf3f7fb7592b56d73eb1a50c9e66" -"checksum named_type_derive 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "651d7e408d728ded66748986dc046156dbc7bd25add9ea334bcf762c7a83e14a" +"checksum named_type 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3a9b45469f7e8314cd4a0791e914c5b65c02ba6451c0662eeb29ccc1714013d7" +"checksum named_type_derive 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c13c91ae49fb502a04f2e993e63e06a28fc5a1ecff01eaa09448735c7ad1243b" "checksum nodrop 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "2f9667ddcc6cc8a43afc9b7917599d7216aa09c463919ea32c59ed6cac8bc945" "checksum num 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "cf4825417e1e1406b3782a8ce92f4d53f26ec055e3622e1881ca8e9f5f9e08db" "checksum num-bigint 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "57450397855d951f1a41305e54851b1a7b8f5d2e349543a02a2effe25459f718" @@ -1711,20 +1821,26 @@ dependencies = [ "checksum num_cpus 1.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "bcef43580c035376c0705c42792c294b66974abbfd2789b511784023f71f3273" "checksum opaque-debug 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c" "checksum openssl 0.10.24 (registry+https://github.com/rust-lang/crates.io-index)" = "8152bb5a9b5b721538462336e3bef9a539f892715e5037fda0f984577311af15" -"checksum openssl-sys 0.9.48 (registry+https://github.com/rust-lang/crates.io-index)" = "b5ba300217253bcc5dc68bed23d782affa45000193866e025329aa8a7a9f05b8" +"checksum openssl-sys 0.9.49 (registry+https://github.com/rust-lang/crates.io-index)" = "f4fad9e54bd23bd4cbbe48fdc08a1b8091707ac869ef8508edea2fec77dcc884" "checksum owning_ref 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "49a4b8ea2179e6a2e27411d3bca09ca6dd630821cf6894c6c7c8467a8ee7ef13" "checksum pkg-config 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "a7c1d2cfa5a714db3b5f24f0915e74fcdf91d09d496ba61329705dda7774d2af" +"checksum ppv-lite86 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "e3cbf9f658cdb5000fcf6f362b8ea2ba154b9f146a61c7a20d647034c6b6561b" "checksum proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)" = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759" +"checksum proc-macro2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4c5c2380ae88876faae57698be9e9775e3544decad214599c3a6266cca6ac802" "checksum quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9274b940887ce9addde99c4eee6b5c44cc494b182b97e73dc8ffdcb3397fd3f0" "checksum quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a" "checksum quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)" = "6ce23b6b870e8f94f81fb0a363d65d86675884b34a09043c81e5562f11c1f8e1" -"checksum rand 0.3.23 (registry+https://github.com/rust-lang/crates.io-index)" = "64ac302d8f83c0c1974bf758f6b041c6c8ada916fbb44a609158ca8b064cc76c" +"checksum quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "053a8c8bcc71fcce321828dc897a98ab9760bef03a4fc36693c231e5b3216cfe" "checksum rand 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "552840b97013b1a26992c11eac34bdd778e464601a4c2054b5f0bff7c6761293" "checksum rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "6d71dacdc3c88c1fde3885a3be3fbab9f35724e6ce99467f7d9c5026132184ca" +"checksum rand 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d47eab0e83d9693d40f825f86948aa16eff6750ead4bdffc4ab95b8b3a7f052c" "checksum rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "556d3a1ca6600bfcbab7c7c91ccb085ac7fbbcd70e008a98742e7847f4f7bcef" +"checksum rand_chacha 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "03a2a90da8c7523f554344f921aa97283eadf6ac484a6d2a7d0212fa7f8d6853" "checksum rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b" "checksum rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc" +"checksum rand_core 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "615e683324e75af5d43d8f7a39ffe3ee4a9dc42c5c701167a71dc59c3a493aca" "checksum rand_hc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7b40677c7be09ae76218dc623efbf7b18e34bced3f38883af07bb75630a21bc4" +"checksum rand_hc 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" "checksum rand_isaac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ded997c9d5f13925be2a6fd7e66bf1872597f759fd9dd93513dd7e92e5a5ee08" "checksum rand_jitter 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "1166d5c91dc97b88d1decc3285bb0a99ed84b05cfd0bc2341bdf2d43fc41e39b" "checksum rand_os 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "7b75f676a1e053fc562eafbb47838d67c84801e38fc1ba459e8f180deabd5071" @@ -1735,26 +1851,25 @@ dependencies = [ "checksum rayon-core 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ebbe0df8435ac0c397d467b6cad6d25543d06e8a019ef3f6af3c384597515bd2" "checksum rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2" "checksum redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)" = "2439c63f3f6139d1b57529d16bc3b8bb855230c8efcc5d3a896c8bea7c3b1e84" -"checksum redox_users 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3fe5204c3a17e97dde73f285d49be585df59ed84b50a872baf416e73b62c3828" +"checksum redox_users 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4ecedbca3bf205f8d8f5c2b44d83cd0690e39ee84b951ed649e9f1841132b66d" "checksum regex 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "88c3d9193984285d544df4a30c23a4e62ead42edf70a4452ceb76dac1ce05c26" "checksum regex-automata 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "92b73c2a1770c255c240eaa4ee600df1704a38dc3feaa6e949e7fcd4f8dc09f9" "checksum regex-syntax 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)" = "b143cceb2ca5e56d5671988ef8b15615733e7ee16cd348e064333b251b89343f" "checksum rmp 0.8.7 (registry+https://github.com/rust-lang/crates.io-index)" = "a3d45d7afc9b132b34a2479648863aa95c5c88e98b32285326a6ebadc80ec5c9" "checksum rmp-serde 0.13.7 (registry+https://github.com/rust-lang/crates.io-index)" = "011e1d58446e9fa3af7cdc1fb91295b10621d3ac4cb3a85cc86385ee9ca50cd3" -"checksum rusqlite 0.19.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6ebca2e7e3deb7241b7fa5929c088548c590728b1b740c479594c23f813eb8a7" +"checksum rusqlite 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2a194373ef527035645a1bc21b10dc2125f73497e6e155771233eb187aedd051" +"checksum rust-argon2 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4ca4eaef519b494d1f2848fc602d18816fed808a981aedf4f1f00ceb7c9d32cf" "checksum rust-base58 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "b313b91fcdc6719ad41fa2dad2b7e810b03833fae4bf911950e15529a5f04439" -"checksum rustc-demangle 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)" = "a7f4dccf6f4891ebcc0c39f9b6eb1a83b9bf5d747cb439ec6fba4f3b977038af" +"checksum rustc-demangle 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "4c691c0e608126e00913e33f0ccf3727d5fc84573623b8d65b2df340b5201783" "checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" "checksum ryu 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c92464b447c0ee8c4fb3824ecc8383b81717b9f1e74ba2e72540aef7b9f82997" -"checksum safemem 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e27a8b19b835f7aea908818e871f5cc3a5a186550c30773be987e155e8163d8f" "checksum same-file 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "585e8ddcedc187886a30fa705c47985c3fa88d06624095856b36ca0b82ff4421" -"checksum scoped_threadpool 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "1d51f5df5af43ab3f1360b429fa5e0152ac5ce8c0bd6485cae490332e96846a8" "checksum scopeguard 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b42e15e59b18a828bbf5c58ea01debb36b9b096346de35d941dcb89009f24a0d" "checksum secp256k1 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)" = "bfaccd3a23619349e0878d9a241f34b1982343cdf67367058cd7d078d326b63e" "checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" "checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" -"checksum serde 1.0.98 (registry+https://github.com/rust-lang/crates.io-index)" = "7fe5626ac617da2f2d9c48af5515a21d5a480dbd151e01bb1c355e26a3e68113" -"checksum serde_derive 1.0.98 (registry+https://github.com/rust-lang/crates.io-index)" = "01e69e1b8a631f245467ee275b8c757b818653c6d704cdbcaeb56b56767b529c" +"checksum serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)" = "fec2851eb56d010dc9a21b89ca53ee75e6528bab60c11e89d38390904982da9f" +"checksum serde_derive 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)" = "cb4dc18c61206b08dc98216c98faa0232f4337e1e1b8574551d5bad29ea1b425" "checksum serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)" = "051c49229f282f7c6f3813f8286cc1e3323e8051823fce42c7ea80fe13521704" "checksum sha2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7b4d8bfd0e469f417657573d8451fb33d16cfe0989359b93baf3a1ffc639543d" "checksum sha3 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dd26bc0e7a2e3a7c959bc494caf58b72ee0c71d67704e9520f736ca7e4853ecf" @@ -1764,7 +1879,8 @@ dependencies = [ "checksum subtle 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2d67a5a62ba6e01cb2192ff309324cb4875d0c451d55fe2319433abe7a05a8ee" "checksum subtle 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "01f40907d9ffc762709e4ff3eb4a6f6b41b650375a3f09ac92b641942b7fb082" "checksum syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)" = "d3b891b9015c88c576343b9b3e41c2c11a51c219ef067b264bd9c8aa9b441dad" -"checksum syn 0.15.42 (registry+https://github.com/rust-lang/crates.io-index)" = "eadc09306ca51a40555dd6fc2b415538e9e18bc9f870e47b1a524a79fe2dcf5e" +"checksum syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)" = "9ca4b3b69a77cbe1ffc9e198781b7acb0c7365a883670e8f1c1bc66fba79a5c5" +"checksum syn 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "158521e6f544e7e3dcfc370ac180794aa38cb34a1b1e07609376d4adcf429b93" "checksum synom 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a393066ed9010ebaed60b9eafa373d4b1baac186dd7e008555b0f702b51945b6" "checksum synstructure 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)" = "02353edf96d6e4dc81aea2d8490a7e9db177bf8acb0e951c24940bf866cb313f" "checksum termcolor 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "96d6098003bde162e4277c70665bd87c326f5a0c3f3fbfb285787fa482d54e6e" @@ -1775,25 +1891,27 @@ dependencies = [ "checksum tinytemplate 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4574b75faccaacddb9b284faecdf0b544b80b6b294f3d062d325c5726a209c20" "checksum toml 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "736b60249cb25337bc196faa43ee12c705e426f3d55c214d73a4e7be06f92cb4" "checksum typenum 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "612d636f949607bdf9b123b4a6f6d966dedf3ff669f7f045890d3a4a73948169" -"checksum unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "882386231c45df4700b275c7ff55b6f3698780a650026380e72dabe76fa46526" +"checksum unicode-width 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "7007dbd421b92cc6e28410fe7362e2e0a2503394908f417b68ec8d1c364c4e20" "checksum unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f860d7d29cf02cb2f3f359fd35991af3d30bac52c57d265a3c461074cb4dc" "checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" +"checksum unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c" "checksum ursa 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9081683a6861bee60c4005c280dafd50c6ee9c2ffd14935865f72658e5f2d9f8" -"checksum uuid 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "bcc7e3b898aa6f6c08e5295b6c89258d1331e9ac578cc992fb818759951bdc22" +"checksum uuid 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)" = "90dbc611eb48397705a6b0f6e917da23ae517e4d127123d2cf7674206627d32a" "checksum vcpkg 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "33dd455d0f96e90a75803cfeb7f948768c08d70a6de9a8d2362461935698bf95" "checksum walkdir 2.2.9 (registry+https://github.com/rust-lang/crates.io-index)" = "9658c94fa8b940eab2250bd5a457f9c48b748420d71293b165c8cdbe2f55f71e" -"checksum wasm-bindgen 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)" = "4de97fa1806bb1a99904216f6ac5e0c050dc4f8c676dc98775047c38e5c01b55" -"checksum wasm-bindgen-backend 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)" = "5d82c170ef9f5b2c63ad4460dfcee93f3ec04a9a36a4cc20bc973c39e59ab8e3" -"checksum wasm-bindgen-macro 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)" = "f07d50f74bf7a738304f6b8157f4a581e1512cd9e9cdb5baad8c31bbe8ffd81d" -"checksum wasm-bindgen-macro-support 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)" = "95cf8fe77e45ba5f91bc8f3da0c3aa5d464b3d8ed85d84f4d4c7cc106436b1d7" -"checksum wasm-bindgen-shared 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)" = "d9c2d4d4756b2e46d3a5422e06277d02e4d3e1d62d138b76a4c681e925743623" +"checksum wasi 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fd5442abcac6525a045cc8c795aedb60da7a2e5e89c7bf18a0d5357849bb23c7" +"checksum wasm-bindgen 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)" = "dcddca308b16cd93c2b67b126c688e5467e4ef2e28200dc7dfe4ae284f2faefc" +"checksum wasm-bindgen-backend 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)" = "f805d9328b5fc7e5c6399960fd1889271b9b58ae17bdb2417472156cc9fafdd0" +"checksum wasm-bindgen-macro 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)" = "3ff88201a482abfc63921621f6cb18eb1efd74f136b05e5841e7f8ca434539e9" +"checksum wasm-bindgen-macro-support 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)" = "6a433d89ecdb9f77d46fcf00c8cf9f3467b7de9954d8710c175f61e2e245bb0e" +"checksum wasm-bindgen-shared 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)" = "d41fc1bc3570cdf8d108c15e014045fd45a95bb5eb36605f96a90461fc34027d" "checksum winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)" = "f10e386af2b13e47c89e7236a7a14a086791a2b88ebad6df9bf42040195cf770" "checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" "checksum winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7168bab6e1daee33b4557efd0e95d5ca70a03706d39fa5f3fe7a236f584b03c9" "checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" -"checksum wincolor 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "561ed901ae465d6185fa7864d63fbd5720d0ef718366c9a4dc83cf6170d7e9ba" +"checksum wincolor 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "96f5016b18804d24db43cebf3c77269e7569b8954a8464501c216cc5e070eaa9" "checksum zeroize 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "8ddfeb6eee2fb3b262ef6e0898a52b7563bb8e0d5955a313b3cf2f808246ea14" "checksum zeroize 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)" = "45af6a010d13e4cf5b54c94ba5a2b2eba5596b9e46bf5875612d332a1f2b3f86" "checksum zeroize_derive 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)" = "080616bd0e31f36095288bb0acdf1f78ef02c2fa15527d7e993f2a6c7591643e" -"checksum zmq 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1bcd76da382c5297efdaac2afa2525bdcdcf2898a7eb8f2b6ddddf2b8be6bfcb" -"checksum zmq-sys 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "efcfb0bbd805a8a88f1625e601ea445e33dab4fa7a58c4a19b00b225700bea25" +"checksum zmq 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8ff1c5e9ff4ac9c2847b2e72ada1c1eb3e188adb49fe3f1dd3bbcdc47f414d17" +"checksum zmq-sys 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)" = "4b770cf495ad41e920ab25c465f35b7eec09d0ce8d7c892a7c8334a5e0de037c" diff --git a/libindy/Cargo.toml b/libindy/Cargo.toml index 740465fad6..96f65e99c6 100644 --- a/libindy/Cargo.toml +++ b/libindy/Cargo.toml @@ -39,62 +39,63 @@ sodium_static = [] hmacsha256_sodium = ["sodiumoxide"] memzero_sodium = ["sodiumoxide"] randombytes_sodium = ["sodiumoxide"] +only_high_cases = [] # Causes the build to fail on all warnings fatal_warnings = [] [dependencies] int_traits = { version = "0.1.1", optional = true } -env_logger = "0.5.10" -errno = "0.2.3" -etcommon-rlp = "0.2.3" -failure = "0.1.3" +env_logger = "0.6.2" +errno = "0.2.4" +etcommon-rlp = "0.2.4" +failure = "0.1.5" hex = "0.3.2" libc = "0.2.60" -log = "0.4.1" +log = "0.4.8" log-derive = "0.3.0" -derivative = "1.0.0" -dirs = "1.0.4" +derivative = "1.0.2" +dirs = "2.0.2" openssl = { version = "0.10", optional = true } backtrace = "=0.3.11" owning_ref = "0.4" -rand = "0.6.5" -rusqlite = "0.19" # Make sure rusqlite for android is also bumped with this. Rusqlite for android is at the bottom of this document. +rand = "0.7.0" +rusqlite = "0.20" # Make sure rusqlite for android is also bumped with this. Rusqlite for android is at the bottom of this document. rust-base58 = {version = "0.0.4", optional = true} -base64 = {version = "0.6.0", optional = true} -serde = "1.0.97" +base64 = {version = "0.10.1", optional = true} +serde = "1.0.99" serde_json = "1.0.40" -serde_derive = "1.0.97" +serde_derive = "1.0.99" sha2 = "0.8" sha3 = "0.8" -rmp-serde = "0.13.6" +rmp-serde = "0.13.7" sodiumoxide = {version = "0.0.16", optional = true} -time = "0.1.36" +time = "0.1.42" threadpool = "1.7.1" -zmq = "0.9.1" -lazy_static = "1.0" -named_type = "0.1.3" -named_type_derive = "0.1.3" -byteorder = "1.0.0" +zmq = "0.8.2" +lazy_static = "1.3" +named_type = "0.2.1" +named_type_derive = "0.2.1" +byteorder = "1.3.2" log-panics = "2.0.0" -zeroize = "0.9.1" +zeroize = "0.9.3" ursa = { version = "0.1.1", optional = true } [dependencies.uuid] -version = "0.5.0" +version = "0.7.4" default-features = false features = ["v4"] [target.'cfg(target_os = "android")'.dependencies] android_logger = "0.5" [target.'cfg(any(target_os = "android", target_os = "ios"))'.dependencies] -rusqlite = { version = "0.19", features=["bundled"] } +rusqlite = { version = "0.20", features=["bundled"] } [dev-dependencies] criterion = "0.2" indy = { path = "../wrappers/rust" } indy-sys = { path = "../wrappers/rust/indy-sys" } -futures = "0.1.24" +futures = "0.1.28" [[bench]] name = "wallet" From 1d33deed40bf5729ab2821aa837ccb78e3584b7b Mon Sep 17 00:00:00 2001 From: Axel Nennker Date: Sat, 24 Aug 2019 15:39:18 +0200 Subject: [PATCH 299/320] zmq 0.9.1 Signed-off-by: Axel Nennker --- libindy/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libindy/Cargo.toml b/libindy/Cargo.toml index 96f65e99c6..a5db4f564b 100644 --- a/libindy/Cargo.toml +++ b/libindy/Cargo.toml @@ -72,7 +72,7 @@ rmp-serde = "0.13.7" sodiumoxide = {version = "0.0.16", optional = true} time = "0.1.42" threadpool = "1.7.1" -zmq = "0.8.2" +zmq = "0.9.1" lazy_static = "1.3" named_type = "0.2.1" named_type_derive = "0.2.1" From ad41ef52a487de3ec9f36e43876339685f473aca Mon Sep 17 00:00:00 2001 From: Axel Nennker Date: Sat, 24 Aug 2019 15:59:34 +0200 Subject: [PATCH 300/320] zmq 0.9.1 Signed-off-by: Axel Nennker --- libindy/Cargo.lock | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/libindy/Cargo.lock b/libindy/Cargo.lock index 4a2e765c6a..e542445ea8 100644 --- a/libindy/Cargo.lock +++ b/libindy/Cargo.lock @@ -695,7 +695,7 @@ dependencies = [ "ursa 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "uuid 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)", "zeroize 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)", - "zmq 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)", + "zmq 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1699,17 +1699,18 @@ dependencies = [ [[package]] name = "zmq" -version = "0.8.3" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ + "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "zmq-sys 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)", + "zmq-sys 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "zmq-sys" -version = "0.8.3" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1913,5 +1914,5 @@ dependencies = [ "checksum zeroize 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "8ddfeb6eee2fb3b262ef6e0898a52b7563bb8e0d5955a313b3cf2f808246ea14" "checksum zeroize 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)" = "45af6a010d13e4cf5b54c94ba5a2b2eba5596b9e46bf5875612d332a1f2b3f86" "checksum zeroize_derive 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)" = "080616bd0e31f36095288bb0acdf1f78ef02c2fa15527d7e993f2a6c7591643e" -"checksum zmq 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8ff1c5e9ff4ac9c2847b2e72ada1c1eb3e188adb49fe3f1dd3bbcdc47f414d17" -"checksum zmq-sys 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)" = "4b770cf495ad41e920ab25c465f35b7eec09d0ce8d7c892a7c8334a5e0de037c" +"checksum zmq 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1bcd76da382c5297efdaac2afa2525bdcdcf2898a7eb8f2b6ddddf2b8be6bfcb" +"checksum zmq-sys 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "efcfb0bbd805a8a88f1625e601ea445e33dab4fa7a58c4a19b00b225700bea25" From 8f86729566f3bbcc924393e596a31931b7f46ac4 Mon Sep 17 00:00:00 2001 From: Axel Nennker Date: Sun, 25 Aug 2019 21:57:29 +0200 Subject: [PATCH 301/320] type Nodes = HashMap> Signed-off-by: Axel Nennker --- libindy/src/services/pool/mod.rs | 3 +++ libindy/src/services/pool/pool.rs | 18 ++++++------- libindy/src/services/pool/request_handler.rs | 27 ++++++++++---------- libindy/src/services/pool/state_proof/mod.rs | 5 ++-- 4 files changed, 28 insertions(+), 25 deletions(-) diff --git a/libindy/src/services/pool/mod.rs b/libindy/src/services/pool/mod.rs index 35c000c620..23a5ff96f6 100644 --- a/libindy/src/services/pool/mod.rs +++ b/libindy/src/services/pool/mod.rs @@ -31,6 +31,7 @@ use services::pool::pool::{Pool, ZMQPool}; use utils::environment; use services::pool::events::{COMMAND_EXIT, COMMAND_CONNECT, COMMAND_REFRESH}; use api::{CommandHandle, next_command_handle, PoolHandle, next_pool_handle}; +use ursa::bls::VerKey; mod catchup; mod commander; @@ -46,6 +47,8 @@ lazy_static! { static ref REGISTERED_SP_PARSERS: Mutex> = Mutex::new(HashMap::new()); } +type Nodes = HashMap>; + pub struct PoolService { open_pools: RefCell>, pending_pools: RefCell>, diff --git a/libindy/src/services/pool/pool.rs b/libindy/src/services/pool/pool.rs index 47c67bbb37..9e17de15e1 100644 --- a/libindy/src/services/pool/pool.rs +++ b/libindy/src/services/pool/pool.rs @@ -18,7 +18,7 @@ use errors::prelude::*; use services::ledger::merkletree::merkletree::MerkleTree; use services::pool::commander::Commander; use services::pool::events::*; -use services::pool::merkle_tree_factory; +use services::pool::{merkle_tree_factory, Nodes}; use services::pool::networker::{Networker, ZMQNetworker}; use services::pool::request_handler::{RequestHandler, RequestHandlerImpl}; use rust_base58::{FromBase58, ToBase58}; @@ -68,7 +68,7 @@ struct GettingCatchupTargetState> { struct ActiveState> { networker: Rc>, request_handlers: HashMap, - nodes: HashMap>, + nodes: Nodes, } struct SyncCatchupState> { @@ -132,8 +132,8 @@ impl From> for TerminatedState { } } -impl> From<(InitializationState, HashMap>)> for ActiveState { - fn from((state, nodes): (InitializationState, HashMap>)) -> ActiveState { +impl> From<(InitializationState, Nodes)> for ActiveState { + fn from((state, nodes): (InitializationState, Nodes)) -> ActiveState { trace!("PoolSM: from init to active"); ActiveState { networker: state.networker, @@ -157,8 +157,8 @@ impl> From<(R, GettingCatchupTargetState> From<(GettingCatchupTargetState, HashMap>)> for ActiveState { - fn from((state, nodes): (GettingCatchupTargetState, HashMap>)) -> Self { +impl> From<(GettingCatchupTargetState, Nodes)> for ActiveState { + fn from((state, nodes): (GettingCatchupTargetState, Nodes)) -> Self { ActiveState { networker: state.networker, request_handlers: HashMap::new(), @@ -219,8 +219,8 @@ impl> From> for ClosedState // transitions from SyncCatchup -impl> From<(SyncCatchupState, HashMap>)> for ActiveState { - fn from((state, nodes): (SyncCatchupState, HashMap>)) -> Self { +impl> From<(SyncCatchupState, Nodes)> for ActiveState { + fn from((state, nodes): (SyncCatchupState, Nodes)) -> Self { trace!("PoolSM: from sync catchup to active"); ActiveState { networker: state.networker, @@ -646,7 +646,7 @@ fn _ledger_status(merkle: &MerkleTree) -> LedgerStatus { } } -fn _get_nodes_and_remotes(merkle: &MerkleTree) -> IndyResult<(HashMap>, Vec)> { +fn _get_nodes_and_remotes(merkle: &MerkleTree) -> IndyResult<(Nodes, Vec)> { let nodes = merkle_tree_factory::build_node_state(merkle)?; Ok(nodes.iter().map(|(_, txn)| { diff --git a/libindy/src/services/pool/request_handler.rs b/libindy/src/services/pool/request_handler.rs index e40a36b9c2..b6225f1363 100644 --- a/libindy/src/services/pool/request_handler.rs +++ b/libindy/src/services/pool/request_handler.rs @@ -20,7 +20,7 @@ use services::pool::catchup::{build_catchup_req, CatchupProgress, check_cons_pro use services::pool::events::NetworkerEvent; use services::pool::events::PoolEvent; use services::pool::events::RequestEvent; -use services::pool::get_last_signed_time; +use services::pool::{get_last_signed_time, Nodes}; use services::pool::merkle_tree_factory; use services::pool::networker::Networker; use services::pool::state_proof; @@ -28,7 +28,6 @@ use services::pool::types::CatchupRep; use services::pool::types::HashableValue; use super::ursa::bls::Generator; -use super::ursa::bls::VerKey; use std::hash::{Hash, Hasher}; use log_derive::logfn; @@ -38,7 +37,7 @@ use rust_base58::FromBase58; struct RequestSM { f: usize, cmd_ids: Vec, - nodes: HashMap>, + nodes: Nodes, generator: Generator, pool_name: String, timeout: i64, @@ -71,7 +70,7 @@ impl RequestSM { pub fn new(networker: Rc>, f: usize, cmd_ids: &[CommandHandle], - nodes: &HashMap>, + nodes: &Nodes, pool_name: &str, timeout: i64, extended_timeout: i64, number_read_nodes: u8) -> Self { let generator: Generator = Generator::from_bytes(&DEFAULT_GENERATOR.from_base58().unwrap()).unwrap(); RequestSM { @@ -91,7 +90,7 @@ impl RequestSM { pub fn step(f: usize, cmd_ids: Vec, - nodes: HashMap>, + nodes: Nodes, generator: Generator, pool_name: String, timeout: i64, @@ -524,7 +523,7 @@ impl RequestSM { fn _full_request_handle_consensus_state(mut state: FullState, req_id: String, node_alias: String, node_result: String, cmd_ids: &[CommandHandle], - nodes: &HashMap>) -> RequestState { + nodes: &Nodes) -> RequestState { let is_first_resp = state.accum_reply.is_none(); if is_first_resp { state.accum_reply = Some(HashableValue { @@ -555,7 +554,7 @@ impl RequestSM { fn _catchup_target_handle_consensus_state(mut state: CatchupConsensusState, mt_root: String, sz: usize, cons_proof: Option>, node_alias: String, req_id: String, - f: usize, nodes: &HashMap>, + f: usize, nodes: &Nodes, pool_name: &str) -> (RequestState, Option) { let (finished, result) = RequestSM::_process_catchup_target(mt_root, sz, cons_proof, &node_alias, &mut state, f, nodes, pool_name); @@ -582,7 +581,7 @@ impl RequestSM { node_alias: &str, state: &mut CatchupConsensusState, f: usize, - nodes: &HashMap>, + nodes: &Nodes, pool_name: &str) -> (bool, Option) { let key = (merkle_root, txn_seq_no, hashes); let contains = state.replies.get_mut(&key) @@ -609,7 +608,7 @@ impl RequestSM { } pub trait RequestHandler { - fn new(networker: Rc>, f: usize, cmd_ids: &[CommandHandle], nodes: &HashMap>, pool_name: &str, timeout: i64, extended_timeout: i64, number_read_nodes: u8) -> Self; + fn new(networker: Rc>, f: usize, cmd_ids: &[CommandHandle], nodes: &Nodes, pool_name: &str, timeout: i64, extended_timeout: i64, number_read_nodes: u8) -> Self; fn process_event(&mut self, ore: Option) -> Option; fn is_terminal(&self) -> bool; } @@ -619,7 +618,7 @@ pub struct RequestHandlerImpl { } impl RequestHandler for RequestHandlerImpl { - fn new(networker: Rc>, f: usize, cmd_ids: &[CommandHandle], nodes: &HashMap>, pool_name: &str, timeout: i64, extended_timeout: i64, number_read_nodes: u8) -> Self { + fn new(networker: Rc>, f: usize, cmd_ids: &[CommandHandle], nodes: &Nodes, pool_name: &str, timeout: i64, extended_timeout: i64, number_read_nodes: u8) -> Self { RequestHandlerImpl { request_wrapper: Some(RequestSM::new(networker, f, cmd_ids, nodes, pool_name, timeout, extended_timeout, number_read_nodes)), } @@ -737,7 +736,7 @@ fn _get_msg_result_without_state_proof(msg: &str) -> IndyResult<(SJsonValue, SJs Ok((msg_result, msg_result_without_proof)) } -fn _check_state_proof(msg_result: &SJsonValue, f: usize, gen: &Generator, bls_keys: &HashMap>, raw_msg: &str, sp_key: Option<&[u8]>, requested_timestamps: (Option, Option), last_write_time: u64) -> bool { +fn _check_state_proof(msg_result: &SJsonValue, f: usize, gen: &Generator, bls_keys: &Nodes, raw_msg: &str, sp_key: Option<&[u8]>, requested_timestamps: (Option, Option), last_write_time: u64) -> bool { debug!("TransactionHandler::process_reply: Try to verify proof and signature >>"); let proof_checking_res = match state_proof::parse_generic_reply_for_proof_checking(&msg_result, raw_msg, sp_key) { @@ -859,7 +858,7 @@ pub mod tests { pub struct MockRequestHandler {} impl RequestHandler for MockRequestHandler { - fn new(_networker: Rc>, _f: usize, _cmd_ids: &[CommandHandle], _nodes: &HashMap>, _pool_name: &str, _timeout: i64, _extended_timeout: i64, _number_read_nodes: u8) -> Self { + fn new(_networker: Rc>, _f: usize, _cmd_ids: &[CommandHandle], _nodes: &Nodes, _pool_name: &str, _timeout: i64, _extended_timeout: i64, _number_read_nodes: u8) -> Self { MockRequestHandler {} } @@ -923,11 +922,11 @@ pub mod tests { fn _request_handler(pool_name: &str, f: usize, nodes_cnt: usize) -> RequestHandlerImpl { let networker = Rc::new(RefCell::new(MockNetworker::new(0, 0, vec![]))); - let mut default_nodes: HashMap> = HashMap::new(); + let mut default_nodes: Nodes = HashMap::new(); default_nodes.insert(NODE.to_string(), None); let node_names = vec![NODE, NODE_2, "n3", "n4"]; - let mut nodes: HashMap> = HashMap::new(); + let mut nodes: Nodes = HashMap::new(); for i in 0..nodes_cnt { nodes.insert(node_names[i].to_string(), None); diff --git a/libindy/src/services/pool/state_proof/mod.rs b/libindy/src/services/pool/state_proof/mod.rs index 2ffba147d0..8131ac3a54 100644 --- a/libindy/src/services/pool/state_proof/mod.rs +++ b/libindy/src/services/pool/state_proof/mod.rs @@ -24,6 +24,7 @@ use self::log_derive::logfn; use ursa::bls::{Bls, Generator, MultiSignature, VerKey}; use self::node::{Node, TrieDB}; use rust_base58::FromBase58; +use services::pool::Nodes; mod node; @@ -75,7 +76,7 @@ pub fn parse_generic_reply_for_proof_checking(json_msg: &SJsonValue, raw_msg: &s } pub fn verify_parsed_sp(parsed_sps: Vec, - nodes: &HashMap>, + nodes: &Nodes, f: usize, gen: &Generator) -> bool { for parsed_sp in parsed_sps { @@ -703,7 +704,7 @@ fn _verify_proof_range(proofs_rlp: &[u8], fn _verify_proof_signature(signature: &str, participants: &[&str], value: &[u8], - nodes: &HashMap>, + nodes: &Nodes, f: usize, gen: &Generator) -> IndyResult { trace!("verify_proof_signature: >>> signature: {:?}, participants: {:?}, pool_state_root: {:?}", signature, participants, value); From ce1af9ae6d19355510e8a5760164ff90ec2dae2c Mon Sep 17 00:00:00 2001 From: Sergey Minaev Date: Mon, 26 Aug 2019 16:54:12 +0300 Subject: [PATCH 302/320] Workaround for compatibility between different version of zmq on client and node side. Signed-off-by: Sergey Minaev --- libindy/src/services/pool/networker.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libindy/src/services/pool/networker.rs b/libindy/src/services/pool/networker.rs index 4fe6a4115e..e745e1028f 100644 --- a/libindy/src/services/pool/networker.rs +++ b/libindy/src/services/pool/networker.rs @@ -340,7 +340,7 @@ impl PoolConnection { impl RemoteNode { fn connect(&self, ctx: &zmq::Context, key_pair: &zmq::CurveKeyPair) -> IndyResult { let s = ctx.socket(zmq::SocketType::DEALER)?; - s.set_identity(&key_pair.public_key)?; + s.set_identity(base64::encode(&key_pair.public_key).as_bytes())?; s.set_curve_secretkey(&key_pair.secret_key)?; s.set_curve_publickey(&key_pair.public_key)?; s.set_curve_serverkey(zmq::z85_encode(self.public_key.as_slice()) From f91a602402b9c9a0ae12a4dfc7c13b758fd0fbae Mon Sep 17 00:00:00 2001 From: Mark Spanbroek Date: Mon, 19 Aug 2019 13:17:10 +0200 Subject: [PATCH 303/320] Remove dependency on errno (wasn't used anyway) Co-authored-by: svdo Signed-off-by: Mark Spanbroek --- .../plugins/postgres_storage/Cargo.toml | 1 - libindy/Cargo.lock | 28 ------------------- libindy/Cargo.toml | 1 - .../utils/crypto/pwhash_argon2i13/sodium.rs | 1 - 4 files changed, 31 deletions(-) diff --git a/experimental/plugins/postgres_storage/Cargo.toml b/experimental/plugins/postgres_storage/Cargo.toml index 1ee1e7f373..5419e769ee 100644 --- a/experimental/plugins/postgres_storage/Cargo.toml +++ b/experimental/plugins/postgres_storage/Cargo.toml @@ -44,7 +44,6 @@ ursa = { version = "0.1.1", optional = true } int_traits = { version = "0.1.1", optional = true } digest = "0.7.0" env_logger = "0.5.10" -errno = "0.2.3" etcommon-rlp = "0.2.3" generic-array = "0.9.0" hex = "0.2.0" diff --git a/libindy/Cargo.lock b/libindy/Cargo.lock index 4a2e765c6a..864e683f6c 100644 --- a/libindy/Cargo.lock +++ b/libindy/Cargo.lock @@ -442,25 +442,6 @@ dependencies = [ "termcolor 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "errno" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "errno-dragonfly 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "errno-dragonfly" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "gcc 0.3.55 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "error-chain" version = "0.10.0" @@ -545,11 +526,6 @@ name = "futures" version = "0.1.28" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "gcc" -version = "0.3.55" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "generic-array" version = "0.12.3" @@ -663,7 +639,6 @@ dependencies = [ "derivative 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", "dirs 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", - "errno 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", "etcommon-rlp 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1767,8 +1742,6 @@ dependencies = [ "checksum elastic-array-plus 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "562cc8504a01eb20c10fb154abd7c4baeb9beba2329cf85838ee2bd48a468b18" "checksum env_logger 0.5.13 (registry+https://github.com/rust-lang/crates.io-index)" = "15b0a4d2e39f8420210be8b27eeda28029729e2fd4291019455016c348240c38" "checksum env_logger 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "aafcde04e90a5226a6443b7aabdb016ba2f8307c847d524724bd9b346dd1a2d3" -"checksum errno 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "c2a071601ed01b988f896ab14b95e67335d1eeb50190932a1320f7fe3cadc84e" -"checksum errno-dragonfly 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "14ca354e36190500e1e1fb267c647932382b54053c50b14970856c0b00a35067" "checksum error-chain 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d9435d864e017c3c6afeac1654189b06cdb491cf2ff73dbf0d73b0f292f42ff8" "checksum etcommon-hexutil 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "20b4d1933bf88b806ba2d9189880b1b4ef205e42df9573b65716f2a50818024c" "checksum etcommon-rlp 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "804a932fed78022b8ec25c06576c57f683a6646dfae22f93dcc5d23470aafe85" @@ -1782,7 +1755,6 @@ dependencies = [ "checksum foreign-types-shared 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" "checksum fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" "checksum futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)" = "45dc39533a6cae6da2b56da48edae506bb767ec07370f86f70fc062e9d435869" -"checksum gcc 0.3.55 (registry+https://github.com/rust-lang/crates.io-index)" = "8f5f3913fa0bfe7ee1fd8248b6b9f42a5af4b9d65ec2dd2c3c26132b950ecfc2" "checksum generic-array 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c68f0274ae0e023facc3c97b2e00f076be70e254bc851d972503b328db79b2ec" "checksum getrandom 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "6171a6cc63fbabbe27c2b5ee268e8b7fe5dc1eb0dd2dfad537c1dfed6f69117e" "checksum hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "805026a5d0141ffc30abb3be3173848ad46a1b1664fe632428479619a3644d77" diff --git a/libindy/Cargo.toml b/libindy/Cargo.toml index 96f65e99c6..be01218f6a 100644 --- a/libindy/Cargo.toml +++ b/libindy/Cargo.toml @@ -47,7 +47,6 @@ fatal_warnings = [] [dependencies] int_traits = { version = "0.1.1", optional = true } env_logger = "0.6.2" -errno = "0.2.4" etcommon-rlp = "0.2.4" failure = "0.1.5" hex = "0.3.2" diff --git a/libindy/src/utils/crypto/pwhash_argon2i13/sodium.rs b/libindy/src/utils/crypto/pwhash_argon2i13/sodium.rs index a7f8d7d112..8d13e9aeb2 100644 --- a/libindy/src/utils/crypto/pwhash_argon2i13/sodium.rs +++ b/libindy/src/utils/crypto/pwhash_argon2i13/sodium.rs @@ -1,4 +1,3 @@ -extern crate errno; extern crate serde; extern crate sodiumoxide; From ee187201748f2e9107c048d54e85542ba17c5a78 Mon Sep 17 00:00:00 2001 From: dappsec Date: Mon, 26 Aug 2019 16:46:27 -0700 Subject: [PATCH 304/320] Fixing capitalization of C language Signed-off-by: dappsec --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ae99fd86a2..f6fe79408e 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ ![logo](https://raw.githubusercontent.com/hyperledger/indy-node/master/collateral/logos/indy-logo.png) This is the official SDK for [Hyperledger Indy](https://www.hyperledger.org/projects), which provides a distributed-ledger-based foundation for [self-sovereign identity](https://sovrin.org). Indy provides a software ecosystem for private, secure, and powerful identity, and the Indy SDK enables clients for it. -The major artifact of the SDK is a c-callable +The major artifact of the SDK is a C-callable library; there are also convenience wrappers for various programming languages and Indy CLI tool. All bugs, stories, and backlog for this project are managed through [Hyperledger's Jira](https://jira.hyperledger.org/secure/RapidBoard.jspa) From f451da467d4e859bd439954209d954b4732cc6fa Mon Sep 17 00:00:00 2001 From: "artem.ivanov" Date: Tue, 27 Aug 2019 08:24:16 +0300 Subject: [PATCH 305/320] IS-1319: Updated Ursa version Signed-off-by: artem.ivanov --- libindy/Cargo.lock | 19 ++++++++++++++++--- libindy/Cargo.toml | 2 +- libindy/src/services/anoncreds/verifier.rs | 2 +- vcx/libvcx/src/proof.rs | 7 ++++--- 4 files changed, 22 insertions(+), 8 deletions(-) diff --git a/libindy/Cargo.lock b/libindy/Cargo.lock index fe9f6154ed..f85ef73d89 100644 --- a/libindy/Cargo.lock +++ b/libindy/Cargo.lock @@ -498,6 +498,17 @@ name = "fallible-streaming-iterator" version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "ffi-support" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "fnv" version = "1.0.6" @@ -667,7 +678,7 @@ dependencies = [ "sodiumoxide 0.0.16 (registry+https://github.com/rust-lang/crates.io-index)", "threadpool 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", - "ursa 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "ursa 0.2.0-dev-1 (registry+https://github.com/rust-lang/crates.io-index)", "uuid 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)", "zeroize 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)", "zmq 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1509,7 +1520,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "ursa" -version = "0.1.1" +version = "0.2.0-dev-1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "amcl 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1518,6 +1529,7 @@ dependencies = [ "ed25519-dalek 1.0.0-pre.1 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.5.13 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "ffi-support 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", "generic-array 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)", "int_traits 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1751,6 +1763,7 @@ dependencies = [ "checksum fake-simd 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" "checksum fallible-iterator 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4443176a9f2c162692bd3d352d745ef9413eec5782a80d8fd6f8a1ac692a07f7" "checksum fallible-streaming-iterator 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "7360491ce676a36bf9bb3c56c1aa791658183a54d2744120f27285738d90465a" +"checksum ffi-support 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "efee06d8ac3e85a6e9759a0ed2682235a70832ebe10953849b92cdced8688660" "checksum fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "2fad85553e09a6f881f739c29f0b00b0f01357c743266d478b68951ce23285f3" "checksum foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" "checksum foreign-types-shared 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" @@ -1868,7 +1881,7 @@ dependencies = [ "checksum unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f860d7d29cf02cb2f3f359fd35991af3d30bac52c57d265a3c461074cb4dc" "checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" "checksum unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c" -"checksum ursa 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9081683a6861bee60c4005c280dafd50c6ee9c2ffd14935865f72658e5f2d9f8" +"checksum ursa 0.2.0-dev-1 (registry+https://github.com/rust-lang/crates.io-index)" = "ebc1074340884021ef4114dcdd02b6dbd382627ea357ae2187b8712f4cc23750" "checksum uuid 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)" = "90dbc611eb48397705a6b0f6e917da23ae517e4d127123d2cf7674206627d32a" "checksum vcpkg 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "33dd455d0f96e90a75803cfeb7f948768c08d70a6de9a8d2362461935698bf95" "checksum walkdir 2.2.9 (registry+https://github.com/rust-lang/crates.io-index)" = "9658c94fa8b940eab2250bd5a457f9c48b748420d71293b165c8cdbe2f55f71e" diff --git a/libindy/Cargo.toml b/libindy/Cargo.toml index 8fc4993978..18326c4d57 100644 --- a/libindy/Cargo.toml +++ b/libindy/Cargo.toml @@ -78,7 +78,7 @@ named_type_derive = "0.2.1" byteorder = "1.3.2" log-panics = "2.0.0" zeroize = "0.9.3" -ursa = { version = "0.1.1", optional = true } +ursa = { version = "0.2.0-dev-1", optional = true } [dependencies.uuid] version = "0.7.4" diff --git a/libindy/src/services/anoncreds/verifier.rs b/libindy/src/services/anoncreds/verifier.rs index 83ca84f9a7..7d341d9130 100644 --- a/libindy/src/services/anoncreds/verifier.rs +++ b/libindy/src/services/anoncreds/verifier.rs @@ -51,7 +51,7 @@ impl Verifier { &received_self_attested_attrs, &received_predicates)?; - Verifier::_verify_revealed_attributes(&proof_req, &full_proof)?; + Verifier::_verify_revealed_attribute_values(&proof_req, &full_proof)?; Verifier::_verify_requested_restrictions(&proof_req, schemas, diff --git a/vcx/libvcx/src/proof.rs b/vcx/libvcx/src/proof.rs index 1325ef785a..3a8d88cfd1 100644 --- a/vcx/libvcx/src/proof.rs +++ b/vcx/libvcx/src/proof.rs @@ -69,9 +69,10 @@ impl Proof { let proof: Value = serde_json::from_str(proof_json) .map_err(|err| VcxError::from_msg(VcxErrorKind::InvalidJson, format!("Cannot deserialize liibndy proof: {}", err)))?; - let revealed_attrs = proof["requested_proof"]["revealed_attrs"] - .as_object() - .ok_or(VcxError::from_msg(VcxErrorKind::InvalidProof, "Cannot get Proof revealed attribute"))?; + let revealed_attrs = match proof["requested_proof"]["revealed_attrs"].as_object() { + Some(revealed_attrs) => revealed_attrs, + None => return Ok(()) + }; for (attr1_referent, info) in revealed_attrs.iter() { let raw = info["raw"].as_str().ok_or(VcxError::from_msg(VcxErrorKind::InvalidProof, format!("Cannot get raw value for \"{}\" attribute", attr1_referent)))?; From 66d8efc7d48051d912ef3736e44e5e052a59f107 Mon Sep 17 00:00:00 2001 From: "artem.ivanov" Date: Tue, 27 Aug 2019 13:28:58 +0300 Subject: [PATCH 306/320] IS-1319: Ingnore case and spaceces for getting encoded value from CryptoProof Signed-off-by: artem.ivanov --- libindy/src/services/anoncreds/verifier.rs | 7 ++++--- libindy/tests/anoncreds.rs | 13 +++++++++++++ 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/libindy/src/services/anoncreds/verifier.rs b/libindy/src/services/anoncreds/verifier.rs index 7d341d9130..6a7fe5c709 100644 --- a/libindy/src/services/anoncreds/verifier.rs +++ b/libindy/src/services/anoncreds/verifier.rs @@ -315,9 +315,10 @@ impl Verifier { .get(sub_proof_index) .ok_or(IndyError::from_msg(IndyErrorKind::ProofRejected, format!("CryptoProof not found by index \"{}\"", sub_proof_index)))? .revealed_attrs()? - .get(attr_name) - .ok_or(IndyError::from_msg(IndyErrorKind::ProofRejected, format!("Attribute with name \"{}\" not found in CryptoProof", attr_name)))? - .to_string(); + .iter() + .find(|(key, _)|attr_common_view(&attr_name) == attr_common_view(&key)) + .map(|(_, val)| val.to_string()) + .ok_or(IndyError::from_msg(IndyErrorKind::ProofRejected, format!("Attribute with name \"{}\" not found in CryptoProof", attr_name)))?; if reveal_attr_encoded != crypto_proof_encoded { return Err(IndyError::from_msg(IndyErrorKind::ProofRejected, diff --git a/libindy/tests/anoncreds.rs b/libindy/tests/anoncreds.rs index d0df91390e..c49d60ec17 100644 --- a/libindy/tests/anoncreds.rs +++ b/libindy/tests/anoncreds.rs @@ -2986,6 +2986,19 @@ mod high_cases { "{}"); assert_code!(ErrorCode::AnoncredsProofRejected, res); } + + #[test] + fn verifier_verify_proof_works_for_revealed_attr_case_insensitive() { + let proof_req_json = anoncreds::proof_request_attr().replace(r#""name":"name""#, r#""name":"NAME""#); + + let valid = anoncreds::verifier_verify_proof(&proof_req_json, + &anoncreds::proof_json(), + &anoncreds::schemas_for_proof(), + &anoncreds::cred_defs_for_proof(), + "{}", + "{}").unwrap(); + assert!(valid); + } } mod verifier_verify_proof_with_proof_req_restrictions { From dbf7acb8c4a6568c660ba90f7d5ef4768e267cb9 Mon Sep 17 00:00:00 2001 From: Nikita Khateev Date: Tue, 27 Aug 2019 16:59:46 +0300 Subject: [PATCH 307/320] IS-1318 -- Fix spec for build from binaries Signed-off-by: Nikita Khateev --- libindy/ci/amazon.dockerfile | 2 +- libindy/ci/indy-sdk.spec.in | 15 ++++++--------- libindy/ci/libindy-rpm-build-and-upload.sh | 2 ++ 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/libindy/ci/amazon.dockerfile b/libindy/ci/amazon.dockerfile index 92c43730a9..880022883b 100755 --- a/libindy/ci/amazon.dockerfile +++ b/libindy/ci/amazon.dockerfile @@ -1,4 +1,4 @@ -FROM amazonlinux:2017.03 +FROM centos:7 ARG uid=1000 diff --git a/libindy/ci/indy-sdk.spec.in b/libindy/ci/indy-sdk.spec.in index 755fbca846..34d24e9f4b 100644 --- a/libindy/ci/indy-sdk.spec.in +++ b/libindy/ci/indy-sdk.spec.in @@ -1,12 +1,12 @@ -%global commit @commit@ +%global __os_install_post %{nil} Summary: Official SDK for Hyperledger Indy Name: libindy -Version: @version@.%{commit} +Version: @version@ Release: 1%{?dist} License: Apache License 2.0 Group: System Environment/Libraries -Source: https://github.com/hyperledger/indy-sdk/archive/%{commit}.tar.gz +Source: https://github.com/hyperledger/indy-sdk/ URL: https://github.com/hyperledger/indy-sdk/ BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) Requires: sqlite openssl libsodium @@ -40,20 +40,17 @@ in the INDY project instead...). Also, join us on Jira's Rocket.Chat at #indy-sdk to discuss. %prep -%autosetup -n %{name}-%{commit} %build -cd libindy -cargo build --release %install rm -rf ${RPM_BUILD_ROOT} install -dm0755 $RPM_BUILD_ROOT/%{_includedir}/indy install -dm0755 $RPM_BUILD_ROOT/%{_libdir} -cp -a libindy/include/*.h $RPM_BUILD_ROOT/%{_includedir}/indy/ -install -Dm0644 libindy/target/release/libindy.a $RPM_BUILD_ROOT/%{_libdir}/libindy.a -install -Dm0644 libindy/target/release/libindy.so $RPM_BUILD_ROOT/%{_libdir}/libindy.so +cp -a @dir@/include/*.h $RPM_BUILD_ROOT/%{_includedir}/indy/ +install -Dm0644 @dir@/target/release/libindy.a $RPM_BUILD_ROOT/%{_libdir}/libindy.a +install -Dm0644 @dir@/target/release/libindy.so $RPM_BUILD_ROOT/%{_libdir}/libindy.so %clean rm -rf ${RPM_BUILD_ROOT} diff --git a/libindy/ci/libindy-rpm-build-and-upload.sh b/libindy/ci/libindy-rpm-build-and-upload.sh index ae90b4ea95..173c36cae5 100755 --- a/libindy/ci/libindy-rpm-build-and-upload.sh +++ b/libindy/ci/libindy-rpm-build-and-upload.sh @@ -9,6 +9,7 @@ version="$1" key="$2" type="$3" number="$4" +dir=$LIBINDY_DIR [ -z $version ] && exit 1 [ -z $key ] && exit 2 @@ -20,6 +21,7 @@ mkdir -p /usr/src/rpm/SOURCES/ sed \ -e "s|@commit@|$commit|g" \ -e "s|@version@|$version.$commit|g" \ + -e "s|@dir@|$dir|g" \ ci/indy-sdk.spec.in >indy-sdk.spec chown root.root indy-sdk.spec From 81f72d34c09a4919da8b2d5829593ef347659af8 Mon Sep 17 00:00:00 2001 From: "artem.ivanov" Date: Tue, 27 Aug 2019 17:55:07 +0300 Subject: [PATCH 308/320] IS-1318 -- Initial version of CD pipleine Signed-off-by: artem.ivanov --- Jenkinsfile.cd | 185 +++++++++++++-------- ci/rpm-build-and-upload.sh | 38 +++++ libindy/ci/libindy-rpm-build-and-upload.sh | 38 ----- libindy/ci/libindy.spec.in | 71 ++++++++ 4 files changed, 227 insertions(+), 105 deletions(-) create mode 100644 ci/rpm-build-and-upload.sh delete mode 100755 libindy/ci/libindy-rpm-build-and-upload.sh create mode 100644 libindy/ci/libindy.spec.in diff --git a/Jenkinsfile.cd b/Jenkinsfile.cd index 106c683a62..bde05b3a0b 100644 --- a/Jenkinsfile.cd +++ b/Jenkinsfile.cd @@ -16,10 +16,10 @@ properties([ Ubuntu16 = "Ubuntu 16.04" Ubuntu18 = "Ubuntu 18.04" -RedHat = "RedHat" +Centos = "Centos" -libindyBuildFinished = [(Ubuntu16): false, (Ubuntu18): false, (RedHat): false] -libvcxBuildFinished = [(Ubuntu16): false, (Ubuntu18): false, (RedHat): false] +libindyBuildFinished = [(Ubuntu16): false, (Ubuntu18): false, (Centos): false] +libvcxBuildFinished = [(Ubuntu16): false, (Ubuntu18): false, (Centos): false] ubuntuPakageTypes = [(Ubuntu16): "xenial", (Ubuntu18): "bionic"] gitHubUserCredId = env.GITHUB_BOT_USER ?: 'sovbot-github' @@ -46,7 +46,7 @@ def testing() { stage('Testing') { parallel([ 'ubuntu-test' : { ubuntuTesting() }, - 'redhat-test' : { rhelTesting() }, + 'centos-test' : { centosTesting() }, 'android-test': { androidTesting() }, 'windows-test': { windowsTesting() }, 'ios-test' : { iosTesting() }, @@ -59,7 +59,7 @@ def publishing() { stage('Publishing') { echo "${env.BRANCH_NAME}: start publishing" publishedVersions = parallel([ - //FIXME fix and restore 'rhel-files' : { rhelPublishing() }, IS-307 + 'centos-files' : { centosPublishing() }, 'ubuntu-files' : { ubuntuPublishing() }, 'windows-files': { windowsPublishing() }, 'android-files': { androidPublishing() }, @@ -212,14 +212,14 @@ String getSrcVersion(folder) { } } -def linuxTesting(file, env_name, network_name, stashBuildResults) { +def linuxTesting(file, env_name, network_name) { def full_testing = runAllTests(env_name) parallel([ failFast : true, "${env_name} Test: build and test libindy": { node('ubuntu') { - linuxLibindyBuild(file, env_name, network_name, stashBuildResults, full_testing) + linuxLibindyBuild(file, env_name, network_name, full_testing) } }, "${env_name} Test: test other components" : { @@ -228,24 +228,24 @@ def linuxTesting(file, env_name, network_name, stashBuildResults) { } def jobs = [ "${env_name}-cli-test": { - linuxModuleTesting(file, env_name, network_name, this.&linuxCLITesting, stashBuildResults) + linuxModuleTesting(file, env_name, network_name, this.&linuxCLITesting) }, "${env_name}-vcx-test": { - vcxTesting(file, env_name, network_name, stashBuildResults, full_testing) + vcxTesting(file, env_name, network_name, full_testing) } ] if (full_testing) { jobs["${env_name}-rust-test"] = { - linuxModuleTesting(file, env_name, network_name, this.&linuxRustTesting, stashBuildResults) + linuxModuleTesting(file, env_name, network_name, this.&linuxRustTesting) } jobs["${env_name}-java-test"] = { - linuxModuleTesting(file, env_name, network_name, this.&linuxJavaTesting, stashBuildResults) + linuxModuleTesting(file, env_name, network_name, this.&linuxJavaTesting) } jobs["${env_name}-python-test"] = { - linuxModuleTesting(file, env_name, network_name, this.&linuxPythonTesting, stashBuildResults) + linuxModuleTesting(file, env_name, network_name, this.&linuxPythonTesting) } jobs["${env_name}-nodejs-test"] = { - linuxModuleTesting(file, env_name, network_name, this.&linuxNodejsTesting, stashBuildResults) + linuxModuleTesting(file, env_name, network_name, this.&linuxNodejsTesting) } } parallel(jobs) @@ -253,12 +253,12 @@ def linuxTesting(file, env_name, network_name, stashBuildResults) { ]) } -def vcxTesting(file, env_name, network_name, stashBuildResults, full_testing) { +def vcxTesting(file, env_name, network_name, full_testing) { parallel([ failFast : true, "${env_name} Test: build and test libvcx" : { node('ubuntu') { - linuxVcxBuild(file, env_name, network_name, stashBuildResults) + linuxVcxBuild(file, env_name, network_name) } }, "${env_name} Test: test other vcx components": { @@ -269,13 +269,13 @@ def vcxTesting(file, env_name, network_name, stashBuildResults, full_testing) { def jobs = [ "${env_name}-vcx-nodejs-test": { - linuxModuleTesting(file, env_name, network_name, this.&linuxVcxNodejsTesting, stashBuildResults) + linuxModuleTesting(file, env_name, network_name, this.&linuxVcxNodejsTesting) }, "${env_name}-vcx-java-test" : { - linuxModuleTesting(file, env_name, network_name, this.&linuxVcxJavaTesting, stashBuildResults) + linuxModuleTesting(file, env_name, network_name, this.&linuxVcxJavaTesting) }, "${env_name}-vcx-python-test": { - linuxModuleTesting(file, env_name, network_name, this.&linuxVcxPythonTesting, stashBuildResults) + linuxModuleTesting(file, env_name, network_name, this.&linuxVcxPythonTesting) } ] parallel(jobs) @@ -284,7 +284,7 @@ def vcxTesting(file, env_name, network_name, stashBuildResults, full_testing) { ]) } -def linuxLibindyBuild(file, env_name, network_name, stashBuildResults, full_testing) { +def linuxLibindyBuild(file, env_name, network_name, full_testing) { def poolInst try { echo "${env_name} Test: Checkout csm" @@ -301,9 +301,7 @@ def linuxLibindyBuild(file, env_name, network_name, stashBuildResults, full_test cargo build --release --features "fatal_warnings sodium_static" ''' - if (stashBuildResults) { - stash includes: 'libindy/target/release/libindy.so,libindy/target/release/libindy.a', name: "LibindyBuildResult${env_name}" - } + stash includes: 'libindy/target/release/libindy.so,libindy/target/release/libindy.a', name: "LibindyBuildResult${env_name}" } sh "cp libindy/target/release/libindy.so wrappers/java/lib" @@ -325,9 +323,8 @@ def linuxLibindyBuild(file, env_name, network_name, stashBuildResults, full_test LIBRARY_PATH=./ RUST_BACKTRACE=1 cargo build --release ''' - if (stashBuildResults) { - stash includes: 'libnullpay/target/release/libnullpay.so', name: "LibnullpayBuildResult${env_name}" - } + stash includes: 'libnullpay/target/release/libnullpay.so', name: "LibnullpayBuildResult${env_name}" + } sh "cp libnullpay/target/release/libnullpay.so cli" @@ -357,7 +354,9 @@ def linuxLibindyBuild(file, env_name, network_name, stashBuildResults, full_test sh """ cd libindy RUST_BACKTRACE=1 cargo test --release --no-run ${features_args} - RUST_BACKTRACE=1 RUST_LOG=indy::=debug,zmq=trace RUST_TEST_THREADS=1 TEST_POOL_IP=10.0.0.2 cargo test --release ${features_args} + RUST_BACKTRACE=1 RUST_LOG=indy::=debug,zmq=trace RUST_TEST_THREADS=1 TEST_POOL_IP=10.0.0.2 cargo test --release ${ + features_args + } """ } @@ -376,7 +375,7 @@ def linuxLibindyBuild(file, env_name, network_name, stashBuildResults, full_test } } -def linuxVcxBuild(file, env_name, network_name, stashBuildResults) { +def linuxVcxBuild(file, env_name, network_name) { def poolInst try { echo "${env_name} Test: Checkout csm" @@ -394,9 +393,9 @@ def linuxVcxBuild(file, env_name, network_name, stashBuildResults) { cd vcx/libvcx LIBRARY_PATH=./ cargo build --release --features fatal_warnings ''' - if (stashBuildResults) { - stash includes: 'vcx/libvcx/target/release/libvcx.so', name: "LibvcxBuildResult${env_name}" - } + + stash includes: 'vcx/libvcx/target/release/libvcx.so', name: "LibvcxBuildResult${env_name}" + } sh "cp vcx/libvcx/target/release/libvcx.so vcx/wrappers/node" @@ -443,7 +442,7 @@ def linuxVcxBuild(file, env_name, network_name, stashBuildResults) { } } -def linuxJavaTesting(env_name, network_name, testEnv, stashBuildResults) { +def linuxJavaTesting(env_name, network_name, testEnv) { unstash name: "LibindyJavaSO${env_name}" dir('wrappers/java') { testEnv.inside("--ip=\"10.0.0.3\" --network=${network_name}") { @@ -454,7 +453,7 @@ def linuxJavaTesting(env_name, network_name, testEnv, stashBuildResults) { } } -def linuxPythonTesting(env_name, network_name, testEnv, stashBuildResults) { +def linuxPythonTesting(env_name, network_name, testEnv) { unstash name: "LibindyPythonSO${env_name}" dir('wrappers/python') { testEnv.inside("--ip=\"10.0.0.3\" --network=${network_name}") { @@ -468,7 +467,7 @@ def linuxPythonTesting(env_name, network_name, testEnv, stashBuildResults) { } } -def linuxCLITesting(env_name, network_name, testEnv, stashBuildResults) { +def linuxCLITesting(env_name, network_name, testEnv) { unstash name: "LibindyCliSO${env_name}" unstash name: "LibnullpayCliSO${env_name}" @@ -480,13 +479,13 @@ def linuxCLITesting(env_name, network_name, testEnv, stashBuildResults) { LIBRARY_PATH=./ RUST_BACKTRACE=1 cargo test --release --features "nullpay_plugin" --no-run LD_LIBRARY_PATH=./:${LD_LIBRARY_PATH} RUST_BACKTRACE=1 RUST_LOG=indy::=debug RUST_TEST_THREADS=1 TEST_POOL_IP=10.0.0.2 cargo test --release --features "nullpay_plugin" ''' - if (stashBuildResults) { - stash includes: 'cli/target/release/indy-cli', name: "IndyCliBuildResult${env_name}" - } + + stash includes: 'cli/target/release/indy-cli', name: "IndyCliBuildResult${env_name}" + } } -def linuxRustTesting(env_name, network_name, testEnv, stashBuildResults) { +def linuxRustTesting(env_name, network_name, testEnv) { unstash name: "LibindyRustSO${env_name}" dir('wrappers/rust') { @@ -500,7 +499,7 @@ def linuxRustTesting(env_name, network_name, testEnv, stashBuildResults) { } } -def linuxNodejsTesting(env_name, network_name, testEnv, stashBuildResults) { +def linuxNodejsTesting(env_name, network_name, testEnv) { unstash name: "LibindyNodejsSO${env_name}" testEnv.inside("--network=${network_name}") { echo "${env_name} Libindy Test: Test nodejs wrapper" @@ -514,7 +513,7 @@ def linuxNodejsTesting(env_name, network_name, testEnv, stashBuildResults) { } } -def linuxVcxNodejsTesting(env_name, network_name, testEnv, stashBuildResults) { +def linuxVcxNodejsTesting(env_name, network_name, testEnv) { unstash name: "VcxNodeLibvcxSO${env_name}" unstash name: "VcxNodeLibindyAndLibnullpaySO${env_name}" @@ -529,7 +528,7 @@ def linuxVcxNodejsTesting(env_name, network_name, testEnv, stashBuildResults) { } } -def linuxVcxJavaTesting(env_name, network_name, testEnv, stashBuildResults) { +def linuxVcxJavaTesting(env_name, network_name, testEnv) { unstash name: "VcxJavaLibvcxSO${env_name}" unstash name: "VcxJavaLibindyAndLibnullpaySO${env_name}" @@ -542,7 +541,7 @@ def linuxVcxJavaTesting(env_name, network_name, testEnv, stashBuildResults) { } } -def linuxVcxPythonTesting(env_name, network_name, testEnv, stashBuildResults) { +def linuxVcxPythonTesting(env_name, network_name, testEnv) { unstash name: "VcxPythonLibvcxSO${env_name}" unstash name: "VcxPythonLibindyAndLibnullpaySO${env_name}" @@ -714,10 +713,10 @@ def ubuntuTesting() { stage('Ubuntu Test') { parallel([ "ubuntu:16.04": { - linuxTesting("ci/ubuntu.dockerfile ci", Ubuntu16, "pool_network", true) + linuxTesting("ci/ubuntu.dockerfile ci", Ubuntu16, "pool_network") }, "ubuntu:18.04": { - linuxTesting("ci/ubuntu18.dockerfile ci", Ubuntu18, "pool_network", true) + linuxTesting("ci/ubuntu18.dockerfile ci", Ubuntu18, "pool_network") } ]) } @@ -848,9 +847,9 @@ def buildIOSPod(packageName, targets) { sh "ci/ios-build.sh $packageName $targets" } -def rhelTesting() { - stage('RedHat Test') { - linuxTesting("ci/amazon.dockerfile ci", "RedHat", "pool_network", false) +def centosTesting() { + stage('Centos Test') { + linuxTesting("ci/amazon.dockerfile ci", "Centos", "pool_network") } } @@ -906,33 +905,28 @@ def macosModuleTesting(library) { } } -def rhelPublishing() { - def libindyVersion; +def centosPublishing() { + def libindyVersion + + def env_name = Centos node('ubuntu') { - stage('Publish Libindy RPM Files') { + stage("Publish ${env_name} Files") { try { - echo 'Publish Rpm files: Checkout csm' + echo "Publish ${env_name} files: Checkout scm" checkout scm libindyVersion = getSrcVersion("libindy") - dir('libindy') { - echo 'Publish Rpm: Build docker image' - def testEnv = dockerHelpers.build('indy-sdk', 'ci/amazon.dockerfile ci') - - testEnv.inside('-u 0:0') { + echo "Publish ${env_name}: Build docker image" + def testEnv = dockerHelpers.build('indy-sdk', 'ci/amazon.dockerfile ci') - sh 'chmod -R 777 ci' - - withCredentials([file(credentialsId: 'EvernymRepoSSHKey', variable: 'repo_key')]) { - sh "./ci/libindy-rpm-build-and-upload.sh $version $repo_key $env.BRANCH_NAME $env.BUILD_NUMBER" - } - } - } + libindyRpmPublishing(testEnv, libindyVersion, env_name) + libnullpayRpmPublishing(testEnv, env_name) + libvcxRpmPublishing(testEnv, env_name) } finally { - echo 'Publish RPM: Cleanup' + echo "Publish ${env_name} files: Cleanup" step([$class: 'WsCleanup']) } } @@ -940,6 +934,38 @@ def rhelPublishing() { return libindyVersion } +def libindyRpmPublishing(testEnv, version, env_name) { + echo 'Publish Libindy rpm files' + + rpmPublishing(testEnv, "libindy", "libindy", version, "LibindyBuildResult${env_name}") +} + +def libnullpayRpmPublishing(testEnv, env_name) { + echo 'Publish Libnullpay rpm files' + def libnullpayVersion = getSrcVersion("vcx/libvcx") + + rpmPublishing(testEnv, "libnullpay", "libnullpay", libnullpayVersion, "LibindyBuildResult${env_name}") +} + +def libvcxRpmPublishing(testEnv, env_name) { + echo 'Publish Libvcx rpm files' + def libvcxVersion = getSrcVersion("vcx/libvcx") + + rpmPublishing(testEnv, "vcx/libvcx", "libvcx", libvcxVersion, "LibindyBuildResult${env_name}") +} + +def rpmPublishing(testEnv, directory, packageName, version, inStashName){ + testEnv.inside('-u 0:0') { // TODO: AVOID ROOT + sh "cp ci/rpm-build-and-upload.sh $directory && chmod -R 755 $directory/*.sh" + + unstash name: inStashName + + withCredentials([file(credentialsId: 'EvernymRepoSSHKey', variable: 'repo_key')]) { + sh "cd $directory && ./rpm-build-and-upload.sh $version $repo_key $env.BRANCH_NAME $env.BUILD_NUMBER $packageName" + } + } +} + def ubuntuPublishing() { stage('Ubuntu Publishing') { def libindyVersion = linuxPublishing("ci/ubuntu.dockerfile ci", Ubuntu16, true) @@ -1458,6 +1484,15 @@ def publishingRCtoStable() { echo "Moving ${env_name} RC artifacts to Stable: libvcx" publishLibvcxDebRCtoStable(testEnv, env_name) + echo 'Moving Centos RC artifacts to Stable: libindy' + publishLibindyCentosFilesRCtoStable(libindyVersion) + + echo 'Moving Centos RC artifacts to Stable: libnullapy' + publishLibnullapyCentosFilesRCtoStable(libnullpayVersion) + + echo 'Moving Centos RC artifacts to Stable: libvcx' + publishLibvcxCentosFilesRCtoStable(libvcxVersion) + } finally { echo 'Moving RC artifacts to Stable: Cleanup' step([$class: 'WsCleanup']) @@ -1466,6 +1501,22 @@ def publishingRCtoStable() { } } +def publishLibindyCentosFilesRCtoStable(version) { + publishCentosFilesRCtoStable("libindy", version) +} + +def publishLibnullapyCentosFilesRCtoStable(version) { + publishCentosFilesRCtoStable("libnullapy", version) +} + +def publishLibvcxCentosFilesRCtoStable(version) { + publishCentosFilesRCtoStable("libvcx", version) +} + +def publishCentosFilesRCtoStable(packageName, version) { + copyRcFilesToStable("centos", packageName, version) +} + def publishLibindyWindowsFilesRCtoStable(version) { publishWindowsFilesRCtoStable("libindy", version) } @@ -1734,11 +1785,11 @@ def androidPublishArtifact(buildEnv, arch, packageVersion, artifact) { } } -def linuxModuleTesting(file, env_name, network_name, module_tester, stashBuildResults) { - linuxModuleTesting(file, env_name, network_name, module_tester, stashBuildResults, 'ubuntu') +def linuxModuleTesting(file, env_name, network_name, module_tester) { + linuxModuleTesting(file, env_name, network_name, module_tester, 'ubuntu') } -def linuxModuleTesting(file, env_name, network_name, module_tester, stashBuildResults, node_label) { +def linuxModuleTesting(file, env_name, network_name, module_tester, node_label) { node(node_label) { def poolInst try { @@ -1749,7 +1800,7 @@ def linuxModuleTesting(file, env_name, network_name, module_tester, stashBuildRe def testEnv = buildTestEnv(file, env_name) - module_tester(env_name, network_name, testEnv, stashBuildResults) + module_tester(env_name, network_name, testEnv) } finally { closePool(env_name, network_name, poolInst) } diff --git a/ci/rpm-build-and-upload.sh b/ci/rpm-build-and-upload.sh new file mode 100644 index 0000000000..ff08431791 --- /dev/null +++ b/ci/rpm-build-and-upload.sh @@ -0,0 +1,38 @@ +#!/bin/bash -xe + +if [ "$1" = "--help" ] ; then + echo "Usage: " + return +fi + +version="$1" +key="$2" +type="$3" +number="$4" +package="$5" +dir=$(pwd) + +[ -z $version ] && exit 1 +[ -z $key ] && exit 2 +[ -z $type ] && exit 3 +[ -z $number ] && exit 4 +[ -z $package ] && exit 5 + +mkdir -p /usr/src/rpm/SOURCES/ + +sed \ + -e "s|@version@|$version|g" \ + -e "s|@dir@|$dir|g" \ + ci/${package}.spec.in > ${package}.spec + +mkdir rpms + +spectool -R ${package}.spec || exit 6 +rpmbuild -ba ${package}.spec || exit 7 + +cat < " - return -fi - -version="$1" -key="$2" -type="$3" -number="$4" -dir=$LIBINDY_DIR - -[ -z $version ] && exit 1 -[ -z $key ] && exit 2 -[ -z $type ] && exit 3 -[ -z $number ] && exit 4 - -mkdir -p /usr/src/rpm/SOURCES/ - -sed \ - -e "s|@commit@|$commit|g" \ - -e "s|@version@|$version.$commit|g" \ - -e "s|@dir@|$dir|g" \ - ci/indy-sdk.spec.in >indy-sdk.spec - -chown root.root indy-sdk.spec - -spectool -g -R indy-sdk.spec || exit 4 -rpmbuild -ba indy-sdk.spec || exit 5 - -cat < Date: Tue, 27 Aug 2019 18:09:58 +0300 Subject: [PATCH 309/320] IS-1318 - spec files for nullpay and vcx Signed-off-by: artem.ivanov --- ci/rpm-build-and-upload.sh | 2 +- libindy/ci/indy-sdk.spec.in | 71 ----------------------------- libindy/{ci => rpm}/libindy.spec.in | 0 libnullpay/rpm/libnullpay.spec.in | 39 ++++++++++++++++ vcx/libvcx/rpm/libvcx.spec.in | 39 ++++++++++++++++ 5 files changed, 79 insertions(+), 72 deletions(-) delete mode 100644 libindy/ci/indy-sdk.spec.in rename libindy/{ci => rpm}/libindy.spec.in (100%) create mode 100644 libnullpay/rpm/libnullpay.spec.in create mode 100644 vcx/libvcx/rpm/libvcx.spec.in diff --git a/ci/rpm-build-and-upload.sh b/ci/rpm-build-and-upload.sh index ff08431791..e10b98ea00 100644 --- a/ci/rpm-build-and-upload.sh +++ b/ci/rpm-build-and-upload.sh @@ -23,7 +23,7 @@ mkdir -p /usr/src/rpm/SOURCES/ sed \ -e "s|@version@|$version|g" \ -e "s|@dir@|$dir|g" \ - ci/${package}.spec.in > ${package}.spec + rpm/${package}.spec.in > ${package}.spec mkdir rpms diff --git a/libindy/ci/indy-sdk.spec.in b/libindy/ci/indy-sdk.spec.in deleted file mode 100644 index 34d24e9f4b..0000000000 --- a/libindy/ci/indy-sdk.spec.in +++ /dev/null @@ -1,71 +0,0 @@ -%global __os_install_post %{nil} - -Summary: Official SDK for Hyperledger Indy -Name: libindy -Version: @version@ -Release: 1%{?dist} -License: Apache License 2.0 -Group: System Environment/Libraries -Source: https://github.com/hyperledger/indy-sdk/ -URL: https://github.com/hyperledger/indy-sdk/ -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) -Requires: sqlite openssl libsodium -BuildRequires: sqlite-devel openssl-devel libsodium-devel - -%description -This is the official SDK for Hyperledger Indy, which provides a -distributed-ledger-based foundation for self-sovereign identity. -The major artifact of the SDK is a c-callable library; there are -also convenience wrappers for various programming languages. - -All bugs, stories, and backlog for this project are managed through -Hyperledger's Jira in project IS (note that regular Indy tickets are -in the INDY project instead...). Also, join us on Jira's Rocket.Chat -at #indy-sdk to discuss. - -%package devel -Summary: Development files for Hyperledger Indy -Group: Development/Libraries -Requires: %{name} = %{version}-%{release} - -%description devel -This is the official SDK for Hyperledger Indy, which provides a -distributed-ledger-based foundation for self-sovereign identity. -The major artifact of the SDK is a c-callable library; there are -also convenience wrappers for various programming languages. - -All bugs, stories, and backlog for this project are managed through -Hyperledger's Jira in project IS (note that regular Indy tickets are -in the INDY project instead...). Also, join us on Jira's Rocket.Chat -at #indy-sdk to discuss. - -%prep - -%build - -%install -rm -rf ${RPM_BUILD_ROOT} - -install -dm0755 $RPM_BUILD_ROOT/%{_includedir}/indy -install -dm0755 $RPM_BUILD_ROOT/%{_libdir} -cp -a @dir@/include/*.h $RPM_BUILD_ROOT/%{_includedir}/indy/ -install -Dm0644 @dir@/target/release/libindy.a $RPM_BUILD_ROOT/%{_libdir}/libindy.a -install -Dm0644 @dir@/target/release/libindy.so $RPM_BUILD_ROOT/%{_libdir}/libindy.so - -%clean -rm -rf ${RPM_BUILD_ROOT} - -%post -p /sbin/ldconfig - -%postun -p /sbin/ldconfig - -%files -%defattr(-,root,root) -%{_libdir}/libindy.so* - -%files devel -%defattr(-,root,root) -%{_libdir}/libindy.a -%{_includedir}/indy/*.h - -%changelog diff --git a/libindy/ci/libindy.spec.in b/libindy/rpm/libindy.spec.in similarity index 100% rename from libindy/ci/libindy.spec.in rename to libindy/rpm/libindy.spec.in diff --git a/libnullpay/rpm/libnullpay.spec.in b/libnullpay/rpm/libnullpay.spec.in new file mode 100644 index 0000000000..1cb360a3e2 --- /dev/null +++ b/libnullpay/rpm/libnullpay.spec.in @@ -0,0 +1,39 @@ +%global __os_install_post %{nil} +%define _rpmdir @dir@/rpms + +Summary: Null Payment Plugin for Indy SDK +Name: libnullpay +Version: @version@ +Release: 1%{?dist} +License: Apache License 2.0 +Group: System Environment/Libraries +Source: https://github.com/hyperledger/indy-sdk/ +URL: https://github.com/hyperledger/indy-sdk/ +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) +Requires: libindy +BuildRequires: libindy + +%description +This is a simple plugin that can be used for development of applications that use Payments API of Indy SDK. + +%prep +%build + +%install +rm -rf ${RPM_BUILD_ROOT} + +install -dm0755 $RPM_BUILD_ROOT/%{_libdir} +install -Dm0644 @dir@/target/release/libnullpay.so $RPM_BUILD_ROOT/%{_libdir}/libnullpay.so + +%clean +rm -rf ${RPM_BUILD_ROOT} + +%post -p /sbin/ldconfig + +%postun -p /sbin/ldconfig + +%files +%defattr(-,root,root) +%{_libdir}/libnullpay.so* + +%changelog diff --git a/vcx/libvcx/rpm/libvcx.spec.in b/vcx/libvcx/rpm/libvcx.spec.in new file mode 100644 index 0000000000..16be93e287 --- /dev/null +++ b/vcx/libvcx/rpm/libvcx.spec.in @@ -0,0 +1,39 @@ +%global __os_install_post %{nil} +%define _rpmdir @dir@/rpms + +Summary: Verifiable credential exchange +Name: libvcx +Version: @version@ +Release: 1%{?dist} +License: Apache License 2.0 +Group: System Environment/Libraries +Source: https://github.com/hyperledger/indy-sdk/ +URL: https://github.com/hyperledger/indy-sdk/ +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) +Requires: libindy +BuildRequires: libindy + +%description +This is a library on top of Libindy which fully implements the credentials exchange. + +%prep +%build + +%install +rm -rf ${RPM_BUILD_ROOT} + +install -dm0755 $RPM_BUILD_ROOT/%{_libdir} +install -Dm0644 @dir@/target/release/libvcx.so $RPM_BUILD_ROOT/%{_libdir}/libvcx.so + +%clean +rm -rf ${RPM_BUILD_ROOT} + +%post -p /sbin/ldconfig + +%postun -p /sbin/ldconfig + +%files +%defattr(-,root,root) +%{_libdir}/libvcx.so* + +%changelog From 740a7f3bdd880ae5773d13598c2707de0bf1d146 Mon Sep 17 00:00:00 2001 From: "artem.ivanov" Date: Tue, 27 Aug 2019 18:41:49 +0300 Subject: [PATCH 310/320] IS-1318 - renaed file Signed-off-by: artem.ivanov --- Jenkinsfile.cd | 4 ++-- Jenkinsfile.ci | 6 +++--- ci/rpm-build-and-upload.sh | 12 +++++++++--- libindy/ci/{amazon.dockerfile => centos.dockerfile} | 0 4 files changed, 14 insertions(+), 8 deletions(-) rename libindy/ci/{amazon.dockerfile => centos.dockerfile} (100%) diff --git a/Jenkinsfile.cd b/Jenkinsfile.cd index bde05b3a0b..b779055b87 100644 --- a/Jenkinsfile.cd +++ b/Jenkinsfile.cd @@ -849,7 +849,7 @@ def buildIOSPod(packageName, targets) { def centosTesting() { stage('Centos Test') { - linuxTesting("ci/amazon.dockerfile ci", "Centos", "pool_network") + linuxTesting("ci/centos.dockerfile ci", "Centos", "pool_network") } } @@ -919,7 +919,7 @@ def centosPublishing() { libindyVersion = getSrcVersion("libindy") echo "Publish ${env_name}: Build docker image" - def testEnv = dockerHelpers.build('indy-sdk', 'ci/amazon.dockerfile ci') + def testEnv = dockerHelpers.build('indy-sdk', 'ci/centos.dockerfile ci') libindyRpmPublishing(testEnv, libindyVersion, env_name) libnullpayRpmPublishing(testEnv, env_name) diff --git a/Jenkinsfile.ci b/Jenkinsfile.ci index 600509877b..08351b8b59 100644 --- a/Jenkinsfile.ci +++ b/Jenkinsfile.ci @@ -20,7 +20,7 @@ def testing() { 'android-test': { androidTesting() }, 'macos-test' : { macosTesting() }, 'ios-test' : { iosTesting() }, - // 'redhat-test' : { rhelTesting() }, + // 'centos-test' : { centosTesting() }, 'windows-test': { windowsTesting() } ]) } @@ -354,9 +354,9 @@ def ubuntuTesting() { } } -def rhelTesting() { +def centosTesting() { stage('RedHat Test') { - linuxTesting("ci/amazon.dockerfile ci", "RedHat", "pool_network", false) + linuxTesting("ci/centos.dockerfile ci", "RedHat", "pool_network", false) } } diff --git a/ci/rpm-build-and-upload.sh b/ci/rpm-build-and-upload.sh index e10b98ea00..c2542db677 100644 --- a/ci/rpm-build-and-upload.sh +++ b/ci/rpm-build-and-upload.sh @@ -31,8 +31,14 @@ spectool -R ${package}.spec || exit 6 rpmbuild -ba ${package}.spec || exit 7 cat < Date: Wed, 28 Aug 2019 11:53:32 +0300 Subject: [PATCH 311/320] Added test on different predicate types. Updated anoncreds related documentation Signed-off-by: artem.ivanov --- libindy/src/api/anoncreds.rs | 2 + libindy/tests/anoncreds_demos.rs | 105 ++++ .../libindy-pod/Indy/Wrapper/IndyAnoncreds.h | 429 ++++++++++------ .../indy/sdk/anoncreds/Anoncreds.java | 259 ++++++---- wrappers/python/indy/anoncreds.py | 476 +++++++++++------- 5 files changed, 843 insertions(+), 428 deletions(-) diff --git a/libindy/src/api/anoncreds.rs b/libindy/src/api/anoncreds.rs index ac21459b23..471ac25a72 100644 --- a/libindy/src/api/anoncreds.rs +++ b/libindy/src/api/anoncreds.rs @@ -1639,6 +1639,8 @@ pub extern fn indy_prover_get_credentials_for_proof_req(command_handle: CommandH /// // (applies to every attribute and predicate but can be overridden on attribute level) /// // (can be overridden on attribute level) /// } +/// +/// where /// attr_info: Describes requested attribute /// { /// "name": string, // attribute name, (case insensitive and ignore spaces) diff --git a/libindy/tests/anoncreds_demos.rs b/libindy/tests/anoncreds_demos.rs index 3748b189c6..d080fc8fa5 100644 --- a/libindy/tests/anoncreds_demos.rs +++ b/libindy/tests/anoncreds_demos.rs @@ -2656,4 +2656,109 @@ mod demos { wallet::close_and_delete_wallet(issuer_wallet_handle, &issuer_wallet_config).unwrap(); wallet::close_and_delete_wallet(prover_wallet_handle, &prover_wallet_config).unwrap(); } + + + #[test] + fn anoncreds_works_for_different_predicate_types() { + Setup::empty(); + + //1. Create Issuer wallet, gets wallet handle + let (issuer_wallet_handle, issuer_wallet_config) = wallet::create_and_open_default_wallet("anoncreds_works_for_single_issuer_single_prover").unwrap(); + + //2. Create Prover wallet, gets wallet handle + let (prover_wallet_handle, prover_wallet_config) = wallet::create_and_open_default_wallet("anoncreds_works_for_single_issuer_single_prover").unwrap(); + + let schema_attributes = r#"["age", "height", "weight", "salary"]"#; + + //3. Issuer creates Schema and Credential Definition + let (schema_id, schema_json, cred_def_id, cred_def_json) = anoncreds::multi_steps_issuer_preparation(issuer_wallet_handle, + ISSUER_DID, + GVT_SCHEMA_NAME, + schema_attributes); + + //4. Prover creates Master Secret + anoncreds::prover_create_master_secret(prover_wallet_handle, COMMON_MASTER_SECRET).unwrap(); + + let cred_values = json!({ + "age": {"raw": "28", "encoded": "28"}, + "height": {"raw": "175", "encoded": "175"}, + "weight": {"raw": "78", "encoded": "78"}, + "salary": {"raw": "2000", "encoded": "2000"} + }).to_string(); + + //5. Issuance credential for Prover + anoncreds::multi_steps_create_credential(COMMON_MASTER_SECRET, + prover_wallet_handle, + issuer_wallet_handle, + CREDENTIAL1_ID, + &cred_values, + &cred_def_id, + &cred_def_json); + + //6. Proof request + let nonce = anoncreds::generate_nonce().unwrap(); + let proof_req_json = json!({ + "nonce": nonce, + "name":"proof_req_1", + "version":"0.1", + "requested_attributes":{}, + "requested_predicates":{ + "predicate1_referent":{ + "name":"age","p_type":">=","p_value":18 + }, + "predicate2_referent":{ + "name":"height","p_type":">","p_value":170 + }, + "predicate3_referent":{ + "name":"weight","p_type":"<","p_value":90 + }, + "predicate4_referent":{ + "name":"salary","p_type":"<=","p_value":2000 + } + } + }).to_string(); + + //7. Prover gets Credentials for Proof Request + let credentials_json = anoncreds::prover_get_credentials_for_proof_req(prover_wallet_handle, &proof_req_json).unwrap(); + let credential = anoncreds::get_credential_for_predicate_referent(&credentials_json, "predicate1_referent"); + + //8. Prover creates Proof + let requested_credentials_json =json!({ + "self_attested_attributes": {}, + "requested_attributes": {}, + "requested_predicates": { + "predicate1_referent": {"cred_id": credential.referent}, + "predicate2_referent": {"cred_id": credential.referent}, + "predicate3_referent": {"cred_id": credential.referent}, + "predicate4_referent": {"cred_id": credential.referent} + }, + }).to_string(); + + let schemas_json = json!({schema_id: serde_json::from_str::(&schema_json).unwrap()}).to_string(); + let cred_defs_json = json!({cred_def_id: serde_json::from_str::(&cred_def_json).unwrap()}).to_string(); + let rev_states_json = json!({}).to_string(); + + let proof_json = anoncreds::prover_create_proof(prover_wallet_handle, + &proof_req_json, + &requested_credentials_json, + COMMON_MASTER_SECRET, + &schemas_json, + &cred_defs_json, + &rev_states_json).unwrap(); + + //9. Verifier verifies proof + let rev_reg_defs_json = json!({}).to_string(); + let rev_regs_json = json!({}).to_string(); + + let valid = anoncreds::verifier_verify_proof(&proof_req_json, + &proof_json, + &schemas_json, + &cred_defs_json, + &rev_reg_defs_json, + &rev_regs_json).unwrap(); + assert!(valid); + + wallet::close_and_delete_wallet(issuer_wallet_handle, &issuer_wallet_config).unwrap(); + wallet::close_and_delete_wallet(prover_wallet_handle, &prover_wallet_config).unwrap(); + } } diff --git a/wrappers/ios/libindy-pod/Indy/Wrapper/IndyAnoncreds.h b/wrappers/ios/libindy-pod/Indy/Wrapper/IndyAnoncreds.h index 9c31100b66..1168de2b07 100644 --- a/wrappers/ios/libindy-pod/Indy/Wrapper/IndyAnoncreds.h +++ b/wrappers/ios/libindy-pod/Indy/Wrapper/IndyAnoncreds.h @@ -422,12 +422,12 @@ And is documented in this HIPE: @param completion Callback that takes command result as parameter. Returns credential json: { - "referent": string, // cred_id in the wallet - "attrs": {"key1":"raw_value1", "key2":"raw_value2"}, - "schema_id": string, - "cred_def_id": string, - "rev_reg_id": Optional, - "cred_rev_id": Optional + "referent": string, - id of credential in the wallet + "attrs": {"key1":"raw_value1", "key2":"raw_value2"}, - credential attributes + "schema_id": string, - identifier of schema + "cred_def_id": string, - identifier of credential definition + "rev_reg_id": Optional, - identifier of revocation registry definition + "cred_rev_id": Optional - identifier of credential in the revocation registry definition } */ @@ -456,12 +456,12 @@ And is documented in this HIPE: @param completion Callback that takes command result as parameter. Returns credentials json. [{ - "referent": string, // cred_id in the wallet - "attrs": {"key1":"raw_value1", "key2":"raw_value2"}, - "schema_id": string, - "cred_def_id": string, - "rev_reg_id": Optional, - "cred_rev_id": Optional + "referent": string, - id of credential in the wallet + "attrs": {"key1":"raw_value1", "key2":"raw_value2"}, - credential attributes + "schema_id": string, - identifier of schema + "cred_def_id": string, - identifier of credential definition + "rev_reg_id": Optional, - identifier of revocation registry definition + "cred_rev_id": Optional - identifier of credential in the revocation registry definition }] */ @@ -499,12 +499,12 @@ And is documented in this HIPE: Returns credentialsJson: List of human readable credentials: [{ - "referent": string, // cred_id in the wallet - "attrs": {"key1":"raw_value1", "key2":"raw_value2"}, - "schema_id": string, - "cred_def_id": string, - "rev_reg_id": Optional, - "cred_rev_id": Optional + "referent": string, - id of credential in the wallet + "attrs": {"key1":"raw_value1", "key2":"raw_value2"}, - credential attributes + "schema_id": string, - identifier of schema + "cred_def_id": string, - identifier of credential definition + "rev_reg_id": Optional, - identifier of revocation registry definition + "cred_rev_id": Optional - identifier of credential in the revocation registry definition }] NOTE: The list of length less than the requested count means credentials search iterator is completed. @@ -533,7 +533,7 @@ And is documented in this HIPE: { "name": string, "version": string, - "nonce": string, - a big number represented as a string (use `generateNonce` function to generate 80-bit number) + "nonce": string, - a big number represented as a string (use `indy_generate_nonce` function to generate 80-bit number) "requested_attributes": { // set of requested attributes "": , // see below ..., @@ -545,14 +545,13 @@ And is documented in this HIPE: "non_revoked": Optional<>, // see below, // If specified prover must proof non-revocation // for date in this interval for each attribute - // (can be overridden on attribute level) + // (applies to every attribute and predicate but can be overridden on attribute level) } - where attr_referent: Proof-request local identifier of requested attribute attr_info: Describes requested attribute { "name": string, // attribute name, (case insensitive and ignore spaces) - "restrictions": Optional, // see above + "restrictions": Optional, // see below "non_revoked": Optional<>, // see below, // If specified prover must proof non-revocation // for date in this interval this attribute @@ -562,9 +561,9 @@ And is documented in this HIPE: predicate_info: Describes requested attribute predicate { "name": attribute name, (case insensitive and ignore spaces) - "p_type": predicate type (Currently ">=" only) + "p_type": predicate type (">=", ">", "<=", "<") "p_value": int predicate value - "restrictions": Optional, // see above, + "restrictions": Optional, // see below "non_revoked": Optional<>, // see below, // If specified prover must proof non-revocation // for date in this interval this attribute @@ -575,25 +574,35 @@ And is documented in this HIPE: "from": Optional, // timestamp of interval beginning "to": Optional, // timestamp of interval ending } + filter_json: + { + "schema_id": string, (Optional) + "schema_issuer_did": string, (Optional) + "schema_name": string, (Optional) + "schema_version": string, (Optional) + "issuer_did": string, (Optional) + "cred_def_id": string, (Optional) + } + @param walletHandle Wallet handler (created by IndyWallet::openWalletWithNam). @param completion Callback that takes command result as parameter. Returns json with credentials for the given proof request. { - "requested_attrs": { + "attrs": { "": [{ cred_info: , interval: Optional }], ..., }, - "requested_predicates": { + "predicates": { "requested_predicates": [{ cred_info: , timestamp: Optional }, { cred_info: , timestamp: Optional }], "requested_predicate_2_referent": [{ cred_info: , timestamp: Optional }] } - }, where credential is + }, where is { - "referent": , - "attrs": [{"attr_name" : "attr_raw_value"}], - "schema_id": string, - "cred_def_id": string, - "rev_reg_id": Optional, - "cred_rev_id": Optional, + "referent": string, - id of credential in the wallet + "attrs": {"key1":"raw_value1", "key2":"raw_value2"}, - credential attributes + "schema_id": string, - identifier of schema + "cred_def_id": string, - identifier of credential definition + "rev_reg_id": Optional, - identifier of revocation registry definition + "cred_rev_id": Optional - identifier of credential in the revocation registry definition } */ + (void)proverGetCredentialsForProofReq:(NSString *)proofReqJSON @@ -610,28 +619,70 @@ And is documented in this HIPE: @param walletHandle Wallet handler (created by IndyWallet::openWalletWithName). @param proofReqJSON: proof request json { - "name": string, - "version": string, - "nonce": string, - a big number represented as a string (use `generateNonce` funciton to generate 80-bit number) - "requested_attributes": { // set of requested attributes - "": , // see above - ..., - }, - "requested_predicates": { // set of requested predicates - "": , // see above - ..., + "name": string, + "version": string, + "nonce": string, - a big number represented as a string (use `indy_generate_nonce` function to generate 80-bit number) + "requested_attributes": { // set of requested attributes + "": , // see below + ..., }, - "non_revoked": Optional<>, // see above, - // If specified prover must proof non-revocation - // for date in this interval for each attribute - // (can be overridden on attribute level) + "requested_predicates": { // set of requested predicates + "": , // see below + ..., + }, + "non_revoked": Optional<>, // see below, + // If specified prover must proof non-revocation + // for date in this interval for each attribute + // (applies to every attribute and predicate but can be overridden on attribute level) + // (can be overridden on attribute level) } @param extraQueryJSON: (Optional) List of extra queries that will be applied to correspondent attribute/predicate: { "": , "": , } + + attr_info: Describes requested attribute + { + "name": string, // attribute name, (case insensitive and ignore spaces) + "restrictions": Optional, // see below + "non_revoked": Optional<>, // see below, + // If specified prover must proof non-revocation + // for date in this interval this attribute + // (overrides proof level interval) + } + predicate_referent: Proof-request local identifier of requested attribute predicate + predicate_info: Describes requested attribute predicate + { + "name": attribute name, (case insensitive and ignore spaces) + "p_type": predicate type (">=", ">", "<=", "<") + "p_value": predicate value + "restrictions": Optional, // see below + "non_revoked": Optional<>, // see below, + // If specified prover must proof non-revocation + // for date in this interval this attribute + // (overrides proof level interval) + } + non_revoc_interval: Defines non-revocation interval + { + "from": Optional, // timestamp of interval beginning + "to": Optional, // timestamp of interval ending + } + extra_query_json:(Optional) List of extra queries that will be applied to correspondent attribute/predicate: + { + "": , + "": , + } where wql query: indy-sdk/docs/design/011-wallet-query-language/README.md + The list of allowed fields: + "schema_id": , + "schema_issuer_did": , + "schema_name": , + "schema_version": , + "issuer_did": , + "cred_def_id": , + "rev_reg_id": , // "None" as string if not present + @param completion Callback that takes command result as parameter. Returns searchHandle: Search handle that can be used later to fetch records by small batches (with proverFetchCredentialsForProofReqItemReferent) @@ -657,12 +708,12 @@ And is documented in this HIPE: where credential_info: { - "referent": , - "attrs": {"attr_name" : "attr_raw_value"}, - "schema_id": string, - "cred_def_id": string, - "rev_reg_id": Optional, - "cred_rev_id": Optional, + "referent": string, - id of credential in the wallet + "attrs": {"key1":"raw_value1", "key2":"raw_value2"}, - credential attributes + "schema_id": string, - identifier of schema + "cred_def_id": string, - identifier of credential definition + "rev_reg_id": Optional, - identifier of revocation registry definition + "cred_rev_id": Optional - identifier of credential in the revocation registry definition } non_revoc_interval: { @@ -699,23 +750,24 @@ And is documented in this HIPE: The proof contains either proof or self-attested attribute value for each requested attribute. @param proofReqJSON: proof request json - { - "name": string, - "version": string, - "nonce": string, - a big number represented as a string (use `generateNonce` function to generate 80-bit number) - "requested_attributes": { // set of requested attributes - "": , // see below - ..., - }, - "requested_predicates": { // set of requested predicates - "": , // see below - ..., + { + "name": string, + "version": string, + "nonce": string, - a big number represented as a string (use `indy_generate_nonce` function to generate 80-bit number) + "requested_attributes": { // set of requested attributes + "": , // see below + ..., }, - "non_revoked": Optional<>, // see below, - // If specified prover must proof non-revocation - // for date in this interval for each attribute - // (can be overridden on attribute level) - } + "requested_predicates": { // set of requested predicates + "": , // see below + ..., + }, + "non_revoked": Optional<>, // see below, + // If specified prover must proof non-revocation + // for date in this interval for each attribute + // (applies to every attribute and predicate but can be overridden on attribute level) + // (can be overridden on attribute level) + } @param requestedCredentialsJSON: either a credential or self-attested attribute for each requested attribute { "self_attested_attributes": { @@ -732,15 +784,15 @@ And is documented in this HIPE: @param masterSecretID: the id of the master secret stored in the wallet @param schemasJSON: all schemas json participating in the proof request { - : , - : , - : , + : , + : , + : , } @param credentialDefsJSON: all credential definitions json participating in the proof request { - "cred_def1_id": , - "cred_def2_id": , - "cred_def3_id": , + "cred_def1_id": , + "cred_def2_id": , + "cred_def3_id": , } @param revocStatesJSON: all revocation states json participating in the proof request { @@ -755,6 +807,44 @@ And is documented in this HIPE: "timestamp4": }, } + + where + attr_referent: Proof-request local identifier of requested attribute + attr_info: Describes requested attribute + { + "name": string, // attribute name, (case insensitive and ignore spaces) + "restrictions": Optional, // see below + "non_revoked": Optional<>, // see below, + // If specified prover must proof non-revocation + // for date in this interval this attribute + // (overrides proof level interval) + } + predicate_referent: Proof-request local identifier of requested attribute predicate + predicate_info: Describes requested attribute predicate + { + "name": attribute name, (case insensitive and ignore spaces) + "p_type": predicate type (">=", ">", "<=", "<") + "p_value": predicate value + "restrictions": Optional, // see below + "non_revoked": Optional<>, // see below, + // If specified prover must proof non-revocation + // for date in this interval this attribute + // (overrides proof level interval) + } + non_revoc_interval: Defines non-revocation interval + { + "from": Optional, // timestamp of interval beginning + "to": Optional, // timestamp of interval ending + } + where wql query: indy-sdk/docs/design/011-wallet-query-language/README.md + The list of allowed fields: + "schema_id": , + "schema_issuer_did": , + "schema_name": , + "schema_version": , + "issuer_did": , + "cred_def_id": , + "rev_reg_id": , // "None" as string if not present @param walletHandle Wallet handler (created by IndyWallet::openWalletWithNam). @@ -764,30 +854,31 @@ And is documented in this HIPE: self-attested attribute value is provided. Each proof is associated with a credential and corresponding schema_id, cred_def_id, rev_reg_id and timestamp. There is also aggregated proof part common for all credential proofs. - { - "requested_proof": { - "revealed_attrs": { - "requested_attr1_id": {sub_proof_index: number, raw: string, encoded: string}, - "requested_attr4_id": {sub_proof_index: number: string, encoded: string}, - }, - "unrevealed_attrs": { - "requested_attr3_id": {sub_proof_index: number} - }, - "self_attested_attrs": { - "requested_attr2_id": self_attested_value, - }, - "requested_predicates": { - "requested_predicate_1_referent": {sub_proof_index: int}, - "requested_predicate_2_referent": {sub_proof_index: int}, - } - } - "proof": { - "proofs": [ , , ], - "aggregated_proof": - } - (opaque type that contains data structures internal to Ursa. - It should not be parsed and are likely to change in future versions). - "identifiers": [{schema_id, cred_def_id, Optional, Optional}] - } + { + "requested_proof": { + "revealed_attrs": { + "requested_attr1_id": {sub_proof_index: number, raw: string, encoded: string}, + "requested_attr4_id": {sub_proof_index: number: string, encoded: string}, + }, + "unrevealed_attrs": { + "requested_attr3_id": {sub_proof_index: number} + }, + "self_attested_attrs": { + "requested_attr2_id": self_attested_value, + }, + "predicates": { + "requested_predicate_1_referent": {sub_proof_index: int}, + "requested_predicate_2_referent": {sub_proof_index: int}, + } + } + "proof": { + "proofs": [ , , ], + "aggregated_proof": + } (opaque type that contains data structures internal to Ursa. + It should not be parsed and are likely to change in future versions). + "identifiers": [{schema_id, cred_def_id, Optional, Optional}] + } +/// */ + (void)proverCreateProofForRequest:(NSString *)proofRequestJSON requestedCredentialsJSON:(NSString *)requestedCredentialsJSON @@ -803,64 +894,64 @@ And is documented in this HIPE: All required schemas, public keys and revocation registries must be provided. @param proofRequestJson: proof request json - { - "name": string, - "version": string, - "nonce": string, - a big number represented as a string (use `generateNonce` function to generate 80-bit number) - "requested_attributes": { // set of requested attributes - "": , // see below - ..., - }, - "requested_predicates": { // set of requested predicates - "": , // see below - ..., + { + "name": string, + "version": string, + "nonce": string, - a big number represented as a string (use `indy_generate_nonce` function to generate 80-bit number) + "requested_attributes": { // set of requested attributes + "": , // see below + ..., }, - "non_revoked": Optional<>, // see below, - // If specified prover must proof non-revocation - // for date in this interval for each attribute - // (can be overridden on attribute level) - } + "requested_predicates": { // set of requested predicates + "": , // see below + ..., + }, + "non_revoked": Optional<>, // see below, + // If specified prover must proof non-revocation + // for date in this interval for each attribute + // (can be overridden on attribute level) + } @param proofJSON: proof json - { - "requested_proof": { - "revealed_attrs": { - "requested_attr1_id": {sub_proof_index: number, raw: string, encoded: string}, - "requested_attr4_id": {sub_proof_index: number: string, encoded: string}, - }, - "unrevealed_attrs": { - "requested_attr3_id": {sub_proof_index: number} - }, - "self_attested_attrs": { - "requested_attr2_id": self_attested_value, - }, - "requested_predicates": { - "requested_predicate_1_referent": {sub_proof_index: int}, - "requested_predicate_2_referent": {sub_proof_index: int}, - } - } - "proof": { - "proofs": [ , , ], - "aggregated_proof": - } - "identifiers": [{schema_id, cred_def_id, Optional, Optional}] - } + { + "requested_proof": { + "revealed_attrs": { + "requested_attr1_id": {sub_proof_index: number, raw: string, encoded: string}, // NOTE: check that `encoded` value match to `raw` value on application level + "requested_attr4_id": {sub_proof_index: number: string, encoded: string}, // NOTE: check that `encoded` value match to `raw` value on application level + }, + "unrevealed_attrs": { + "requested_attr3_id": {sub_proof_index: number} + }, + "self_attested_attrs": { + "requested_attr2_id": self_attested_value, + }, + "requested_predicates": { + "requested_predicate_1_referent": {sub_proof_index: int}, + "requested_predicate_2_referent": {sub_proof_index: int}, + } + } + "proof": { + "proofs": [ , , ], + "aggregated_proof": + } + "identifiers": [{schema_id, cred_def_id, Optional, Optional}] + } @param schemasJSON: all schemas json participating in the proof request { - : , - : , - : , + : , + : , + : , } @param credentialDefsJSON: all credential definitions json participating in the proof request { - "cred_def1_id": , - "cred_def2_id": , - "cred_def3_id": , + "cred_def1_id": , + "cred_def2_id": , + "cred_def3_id": , } @param revocRegDefsJSON: all revocation registry definitions json participating in the proof { - "rev_reg_def1_id": , - "rev_reg_def2_id": , - "rev_reg_def3_id": , + "rev_reg_def1_id": , + "rev_reg_def2_id": , + "rev_reg_def3_id": , } @param revocRegsJSON: all revocation registries json participating in the proof { @@ -875,6 +966,44 @@ And is documented in this HIPE: "timestamp4": }, } + + where + attr_referent: Proof-request local identifier of requested attribute + attr_info: Describes requested attribute + { + "name": string, // attribute name, (case insensitive and ignore spaces) + "restrictions": Optional, // see below + "non_revoked": Optional<>, // see below, + // If specified prover must proof non-revocation + // for date in this interval this attribute + // (overrides proof level interval) + } + predicate_referent: Proof-request local identifier of requested attribute predicate + predicate_info: Describes requested attribute predicate + { + "name": attribute name, (case insensitive and ignore spaces) + "p_type": predicate type (">=", ">", "<=", "<") + "p_value": predicate value + "restrictions": Optional, // see below + "non_revoked": Optional<>, // see below, + // If specified prover must proof non-revocation + // for date in this interval this attribute + // (overrides proof level interval) + } + non_revoc_interval: Defines non-revocation interval + { + "from": Optional, // timestamp of interval beginning + "to": Optional, // timestamp of interval ending + } + where wql query: indy-sdk/docs/design/011-wallet-query-language/README.md + The list of allowed fields: + "schema_id": , + "schema_issuer_did": , + "schema_name": , + "schema_version": , + "issuer_did": , + "cred_def_id": , + "rev_reg_id": , // "None" as string if not present @param completion Callback that takes command result as parameter. Returns result flag: valid: true - if signature is valid, false - otherwise. @@ -899,7 +1028,8 @@ And is documented in this HIPE: Returns result revocation state json: { "rev_reg": , - "witness": , + "witness": , (opaque type that contains data structures internal to Ursa. + It should not be parsed and are likely to change in future versions). "timestamp" : integer } */ @@ -923,7 +1053,8 @@ And is documented in this HIPE: Returns result revocation state json: { "rev_reg": , - "witness": , + "witness": , (opaque type that contains data structures internal to Ursa. + It should not be parsed and are likely to change in future versions). "timestamp" : integer } */ diff --git a/wrappers/java/src/main/java/org/hyperledger/indy/sdk/anoncreds/Anoncreds.java b/wrappers/java/src/main/java/org/hyperledger/indy/sdk/anoncreds/Anoncreds.java index aae7412b8e..693d187237 100644 --- a/wrappers/java/src/main/java/org/hyperledger/indy/sdk/anoncreds/Anoncreds.java +++ b/wrappers/java/src/main/java/org/hyperledger/indy/sdk/anoncreds/Anoncreds.java @@ -187,10 +187,18 @@ public void callback(int xcommand_handle, int err) { * @param issuerDid The DID of the issuer. * @param name Human-readable name of schema. * @param version Version of schema. - * @param attrs: List of schema attributes descriptions (the number of attributes should be less or equal than 125) + * @param attrs: list of schema attributes descriptions (the number of attributes should be less or equal than 125) + * `["attr1", "attr2"]` * @return A future resolving to IssuerCreateSchemaResult object containing: * schemaId: identifier of created schema * schemaJson: schema as json + * { + * id: identifier of schema + * attrNames: array of attribute name strings + * name: schema's name string + * version: schema's version string, + * ver: version of the Schema json + * } * @throws IndyException Thrown if an error occurs when calling the underlying SDK. */ public static CompletableFuture issuerCreateSchema( @@ -235,7 +243,14 @@ public static CompletableFuture issuerCreateSchema( * * @param wallet The wallet. * @param issuerDid DID of the issuer signing cred_def transaction to the Ledger - * @param schemaJson Сredential schema as a json + * @param schemaJson Credential schema as a json: { + * id: identifier of schema + * attrNames: array of attribute name strings + * name: schema's name string + * version: schema's version string, + * seqNo: (Optional) schema's sequence number on the ledger, + * ver: version of the Schema json + * } * @param tag Allows to distinct between credential definitions for the same issuer and schema * @param signatureType Credential definition signatureType (optional, 'CL' by default) that defines credentials signature and revocation math. * Supported types are: @@ -245,7 +260,9 @@ public static CompletableFuture issuerCreateSchema( * https://github.com/hyperledger/indy-hipe/blob/c761c583b1e01c1e9d3ceda2b03b35336fdc8cc1/text/anoncreds-protocol/README.md * @param configJson (optional) Type-specific configuration of credential definition as json: * - 'CL': - * - revocationSupport: whether to request non-revocation credential (optional, default false) + * { + * "support_revocation" - bool (optional, default false) whether to request non-revocation credential + * } * @return A future resolving to IssuerCreateAndStoreCredentialDefResult containing:. * credDefId: identifier of created credential definition. * credDefJson: public part of created credential definition @@ -309,7 +326,9 @@ public static CompletableFuture issuerC * @param credDefId An identifier of created credential definition stored in the wallet * @param configJson (optional) Type-specific configuration of credential definition as json: * - 'CL': - * - revocationSupport: whether to request non-revocation credential (optional, default false) + * { + * "support_revocation" - bool (optional, default false) whether to request non-revocation credential + * } * * @return A future resolving to IssuerCreateAndStoreCredentialDefResult containing:. * credDefJson: public part of temporary created credential definition @@ -562,6 +581,12 @@ public static CompletableFuture issuerCreateCredentialOffer( * "signature_correctness_proof": {signature_correctness_proof} * (opaque type that contains data structures internal to Ursa. * It should not be parsed and are likely to change in future versions). + * "rev_reg" - (Optional) revocation registry accumulator value on the issuing moment. + * (opaque type that contains data structures internal to Ursa. + * It should not be parsed and are likely to change in future versions). + * "witness" - (Optional) revocation related data + * (opaque type that contains data structures internal to Ursa. + * It should not be parsed and are likely to change in future versions). * } * credRevocId: local id for revocation info (Can be used for revocation of this cred) * revocRegDeltaJson: Revocation registry delta json with a newly issued credential @@ -758,6 +783,13 @@ public static CompletableFuture proverCreateMasterSecret( * @param wallet A wallet. * @param proverDid The DID of the prover. * @param credentialOfferJson Credential offer as a json containing information about the issuer and a credential + * { + * "schema_id": string, - identifier of schema + * "cred_def_id": string, - identifier of credential definition + * ... + * Other fields that contains data structures internal to Ursa. + * These fields should not be parsed and are likely to change in future versions. + * } * @param credentialDefJson Credential definition json realted to cred_def_id in credentialOfferJson * @param masterSecretId The id of the master secret stored in the wallet * @return A future that resolves to: @@ -774,8 +806,9 @@ public static CompletableFuture proverCreateMasterSecret( * It should not be parsed and are likely to change in future versions). * "nonce": string * } - * credReqMetadataJson: Credential request metadata json for processing of received form Issuer credential. - * Note: credReqMetadataJson mustn't be shared with Issuer. + * credReqMetadataJson: Credential request metadata json for further processing of received form Issuer credential. + * Credential request metadata contains data structures internal to Ursa. + * Credential request metadata mustn't be shared with Issuer. * @throws IndyException Thrown if an error occurs when calling the underlying SDK. */ public static CompletableFuture proverCreateCredentialReq( @@ -889,12 +922,12 @@ public static CompletableFuture proverStoreCredential( * } * @return A future that resolves to a credentials json * [{ - * "referent": string, // cred_id in the wallet - * "attrs": {"key1":"raw_value1", "key2":"raw_value2"}, - * "schema_id": string, - * "cred_def_id": string, - * "rev_reg_id": Optional[string], - * "cred_rev_id": Optional[string] + * "referent": string, - id of credential in the wallet + * "attrs": {"key1":"raw_value1", "key2":"raw_value2"}, - credential attributes + * "schema_id": string, - identifier of schema + * "cred_def_id": string, - identifier of credential definition + * "rev_reg_id": Optional, - identifier of revocation registry definition + * "cred_rev_id": Optional - identifier of credential in the revocation registry definition * }] * @throws IndyException Thrown if an error occurs when calling the underlying SDK. */ @@ -928,12 +961,12 @@ public static CompletableFuture proverGetCredentials( * @param credId Identifier by which requested credential is stored in the wallet * @return credential json * { - * "referent": string, // cred_id in the wallet - * "attrs": {"key1":"raw_value1", "key2":"raw_value2"}, - * "schema_id": string, - * "cred_def_id": string, - * "rev_reg_id": Optional[string], - * "cred_rev_id": Optional[string] + * "referent": string, - id of credential in the wallet + * "attrs": {"key1":"raw_value1", "key2":"raw_value2"}, - credential attributes + * "schema_id": string, - identifier of schema + * "cred_def_id": string, - identifier of credential definition + * "rev_reg_id": Optional, - identifier of revocation registry definition + * "cred_rev_id": Optional - identifier of credential in the revocation registry definition * } * @throws IndyException Thrown if an error occurs when calling the underlying SDK. */ @@ -1001,67 +1034,78 @@ public static CompletableFuture proverDeleteCredential( * { * "name": string, * "version": string, - * "nonce": string, - a big number represented as a string (use `generateNonce` function to generate 80-bit number) + * "nonce": string, - a big number represented as a string (use `indy_generate_nonce` function to generate 80-bit number) * "requested_attributes": { // set of requested attributes - * "attr_referent": {attr_info}, // see below + * "": , // see below * ..., * }, * "requested_predicates": { // set of requested predicates - * "predicate_referent": {predicate_info}, // see below + * "": , // see below * ..., * }, - * "non_revoked": Optional[{non_revoc_interval}], // see below, + * "non_revoked": Optional<>, // see below, * // If specified prover must proof non-revocation * // for date in this interval for each attribute - * // (can be overridden on attribute level) + * // (applies to every attribute and predicate but can be overridden on attribute level) * } - * where - * attr_referent: Describes requested attribute + * where + * attr_referent: Proof-request local identifier of requested attribute + * attr_info: Describes requested attribute * { * "name": string, // attribute name, (case insensitive and ignore spaces) - * "restrictions": Optional[{filter}], // see filter above - * // if specified, credential must satisfy to one of the given restriction. - * "non_revoked": Optional[{non_revoc_interval}], // see below, + * "restrictions": Optional, // see below + * "non_revoked": Optional<>, // see below, * // If specified prover must proof non-revocation * // for date in this interval this attribute * // (overrides proof level interval) * } - * predicate_referent: Describes requested attribute predicate + * predicate_referent: Proof-request local identifier of requested attribute predicate + * predicate_info: Describes requested attribute predicate * { * "name": attribute name, (case insensitive and ignore spaces) - * "p_type": predicate type (Currently {@code ">=" } only) - * "p_value": predicate value - * "restrictions": Optional[{filter}], // see filter above - * // if specified, credential must satisfy to one of the given restriction. - * "non_revoked": Optional[{non_revoc_interval}], // see below, + * "p_type": predicate type (">=", ">", "<=", "<") + * "p_value": int predicate value + * "restrictions": Optional, // see below + * "non_revoked": Optional<>, // see below, * // If specified prover must proof non-revocation * // for date in this interval this attribute * // (overrides proof level interval) * } - * non_revoc_interval: Defines non-revocation interval + * non_revoc_interval: Defines non-revocation interval + * { + * "from": Optional, // timestamp of interval beginning + * "to": Optional, // timestamp of interval ending + * } + * filter_json: * { - * "from": Optional[int], // timestamp of interval beginning - * "to": Optional[int], // timestamp of interval ending + * "schema_id": string, (Optional) + * "schema_issuer_did": string, (Optional) + * "schema_name": string, (Optional) + * "schema_version": string, (Optional) + * "issuer_did": string, (Optional) + * "cred_def_id": string, (Optional) * } + * * @return A future that resolves to a json with credentials for the given proof request. * { - * "requested_attrs": { - * "attr_referent": [{ cred_info: {credential_info}, interval: Optional[{non_revoc_interval}] }], + * "attrs": { + * "": [{ cred_info: , interval: Optional }], * ..., * }, - * "requested_predicates": { - * "requested_predicates": [{ cred_info: {credential_info}, timestamp: Optional[int] }, { cred_info: {credential_2_info}, timestamp: Optional[int] }], - * "requested_predicate_2_referent": [{ cred_info: {credential_2_info}, timestamp: Optional[int] }] + * "predicates": { + * "requested_predicates": [{ cred_info: , timestamp: Optional }, { cred_info: , timestamp: Optional }], + * "requested_predicate_2_referent": [{ cred_info: , timestamp: Optional }] * } - * }, where credential is + * }, where is * { - * "referent": "string", - * "attrs": [{"attr_name" : "attr_raw_value"}], - * "schema_id": string, - * "cred_def_id": string, - * "rev_reg_id": Optional[int], - * "cred_rev_id": Optional[int], + * "referent": string, - id of credential in the wallet + * "attrs": {"key1":"raw_value1", "key2":"raw_value2"}, - credential attributes + * "schema_id": string, - identifier of schema + * "cred_def_id": string, - identifier of credential definition + * "rev_reg_id": Optional, - identifier of revocation registry definition + * "cred_rev_id": Optional - identifier of credential in the revocation registry definition * } + * * @throws IndyException Thrown if an error occurs when calling the underlying SDK. */ public static CompletableFuture proverGetCredentialsForProofReq( @@ -1097,16 +1141,17 @@ public static CompletableFuture proverGetCredentialsForProofReq( * "version": string, * "nonce": string, - a big number represented as a string (use `generateNonce` function to generate 80-bit number) * "requested_attributes": { // set of requested attributes - * "attr_referent": {attr_info}, // see below + * "": , // see below * ..., * }, * "requested_predicates": { // set of requested predicates - * "predicate_referent": {predicate_info}, // see below + * "": , // see below * ..., * }, - * "non_revoked": Optional[{non_revoc_interval}], // see below, + * "non_revoked": Optional<>, // see below, * // If specified prover must proof non-revocation * // for date in this interval for each attribute + * // (applies to every attribute and predicate but can be overridden on attribute level) * // (can be overridden on attribute level) * } * @param requestedCredentials either a credential or self-attested attribute for each requested attribute @@ -1114,26 +1159,26 @@ public static CompletableFuture proverGetCredentialsForProofReq( * "self_attested_attributes": { * "self_attested_attribute_referent": string * }, - * "requested_attributes": { - * "requested_attribute_referent_1": {"cred_id": string, "timestamp": Optional[int], revealed: bool }}, - * "requested_attribute_referent_2": {"cred_id": string, "timestamp": Optional[int], revealed: bool }} + * "requested_attributes": { + * "requested_attribute_referent_1": {"cred_id": string, "timestamp": Optional, revealed: }}, + * "requested_attribute_referent_2": {"cred_id": string, "timestamp": Optional, revealed: }} * }, * "requested_predicates": { - * "requested_predicates_referent_1": {"cred_id": string, "timestamp": Optional[int] }}, + * "requested_predicates_referent_1": {"cred_id": string, "timestamp": Optional }}, * } * } * @param masterSecret Id of the master secret stored in the wallet * @param schemas All schemas json participating in the proof request * { - * "schema1_id": {schema1_json}, - * "schema2_id": {schema2_json}, - * "schema3_id": {schema3_json}, + * "schema1_id": {schema1}, + * "schema2_id": {schema2}, + * "schema3_id": {schema3}, * } * @param credentialDefs All credential definitions json participating in the proof request * { - * "cred_def1_id": {credential_def1_json}, - * "cred_def2_id": {credential_def2_json}, - * "cred_def3_id": {credential_def3_json}, + * "cred_def1_id": {credential_def1}, + * "cred_def2_id": {credential_def2}, + * "cred_def3_id": {credential_def3}, * } * @param revStates All revocation states json participating in the proof request * { @@ -1148,6 +1193,44 @@ public static CompletableFuture proverGetCredentialsForProofReq( * "timestamp4": {rev_state4} * }, * } + * where + * attr_referent: Proof-request local identifier of requested attribute + * attr_info: Describes requested attribute + * { + * "name": string, // attribute name, (case insensitive and ignore spaces) + * "restrictions": Optional, // see below + * "non_revoked": Optional<>, // see below, + * // If specified prover must proof non-revocation + * // for date in this interval this attribute + * // (overrides proof level interval) + * } + * predicate_referent: Proof-request local identifier of requested attribute predicate + * predicate_info: Describes requested attribute predicate + * { + * "name": attribute name, (case insensitive and ignore spaces) + * "p_type": predicate type (">=", ">", "<=", "<") + * "p_value": predicate value + * "restrictions": Optional, // see below + * "non_revoked": Optional<>, // see below, + * // If specified prover must proof non-revocation + * // for date in this interval this attribute + * // (overrides proof level interval) + * } + * non_revoc_interval: Defines non-revocation interval + * { + * "from": Optional, // timestamp of interval beginning + * "to": Optional, // timestamp of interval ending + * } + * where wql query: indy-sdk/docs/design/011-wallet-query-language/README.md + * The list of allowed fields: + * "schema_id": , + * "schema_issuer_did": , + * "schema_name": , + * "schema_version": , + * "issuer_did": , + * "cred_def_id": , + * "rev_reg_id": , // "None" as string if not present + * * @return A future resolving to a Proof json * For each requested attribute either a proof (with optionally revealed attribute value) or * self-attested attribute value is provided. @@ -1165,16 +1248,17 @@ public static CompletableFuture proverGetCredentialsForProofReq( * "self_attested_attrs": { * "requested_attr2_id": self_attested_value, * }, - * "requested_predicates": { + * "predicates": { * "requested_predicate_1_referent": {sub_proof_index: int}, * "requested_predicate_2_referent": {sub_proof_index: int}, * } * } * "proof": { - * "proofs": [ {credential_proof}, {credential_proof}, {credential_proof} ], - * "aggregated_proof": {aggregated_proof} - * } - * "identifiers": [{schema_id, cred_def_id, Optional["rev_reg_id"], Optional[timestamp]}] + * "proofs": [ , , ], + * "aggregated_proof": + * } (opaque type that contains data structures internal to Ursa. + * It should not be parsed and are likely to change in future versions). + * "identifiers": [{schema_id, cred_def_id, Optional, Optional}] * } * @throws IndyException Thrown if an error occurs when calling the underlying SDK. */ @@ -1226,24 +1310,24 @@ public static CompletableFuture proverCreateProof( * "version": string, * "nonce": string, - a big number represented as a string (use `generateNonce` function to generate 80-bit number) * "requested_attributes": { // set of requested attributes - * "attr_referent": {attr_info}, // see below + * "": , // see below * ..., * }, * "requested_predicates": { // set of requested predicates - * "predicate_referent": {predicate_info}, // see below + * "": , // see below * ..., * }, - * "non_revoked": Optional[non_revoc_interval], // see below, + * "non_revoked": Optional<>, // see below, * // If specified prover must proof non-revocation * // for date in this interval for each attribute * // (can be overridden on attribute level) * } - * @param proof Proof json - { { + * @param proof Proof json + * { * "requested_proof": { * "revealed_attrs": { - * "requested_attr1_id": {sub_proof_index: number, raw: string, encoded: string}, - * "requested_attr4_id": {sub_proof_index: number: string, encoded: string}, + * "requested_attr1_id": {sub_proof_index: number, raw: string, encoded: string}, // NOTE: check that `encoded` value match to `raw` value on application level + * "requested_attr4_id": {sub_proof_index: number: string, encoded: string}, // NOTE: check that `encoded` value match to `raw` value on application level * }, * "unrevealed_attrs": { * "requested_attr3_id": {sub_proof_index: number} @@ -1257,29 +1341,28 @@ public static CompletableFuture proverCreateProof( * } * } * "proof": { - * "proofs": [ {credential_proof}, {credential_proof}, {credential_proof} ], - * "aggregated_proof": {aggregated_proof} - * } (opaque type that contains data structures internal to Ursa. - * It should not be parsed and are likely to change in future versions). - * "identifiers": [{schema_id, cred_def_id, Optional["rev_reg_id"], Optional[timestamp]}] + * "proofs": [ , , ], + * "aggregated_proof": + * } + * "identifiers": [{schema_id, cred_def_id, Optional, Optional}] * } * @param schemas All schemas json participating in the proof request * { - * "schema1_id": {schema1_json}, - * "schema2_id": {schema2_json}, - * "schema3_id": {schema3_json}, + * "schema1_id": {schema1}, + * "schema2_id": {schema2}, + * "schema3_id": {schema3}, * } * @param credentialDefs All credential definitions json participating in the proof request * { - * "cred_def1_id": {credential_def1_json}, - * "cred_def2_id": {credential_def2_json}, - * "cred_def3_id": {credential_def3_json}, + * "cred_def1_id": {credential_def1}, + * "cred_def2_id": {credential_def2}, + * "cred_def3_id": {credential_def3}, * } * @param revocRegDefs All revocation registry definitions json participating in the proof * { - * "rev_reg_def1_id": {rev_reg_def1_json}, - * "rev_reg_def2_id": {rev_reg_def2_json}, - * "rev_reg_def3_id": {rev_reg_def3_json}, + * "rev_reg_def1_id": {rev_reg_def1}, + * "rev_reg_def2_id": {rev_reg_def2}, + * "rev_reg_def3_id": {rev_reg_def3}, * } * @param revocRegs all revocation registries json participating in the proof * { diff --git a/wrappers/python/indy/anoncreds.py b/wrappers/python/indy/anoncreds.py index de64488590..c6e8846d3e 100644 --- a/wrappers/python/indy/anoncreds.py +++ b/wrappers/python/indy/anoncreds.py @@ -34,9 +34,17 @@ async def issuer_create_schema(issuer_did: str, :param name: a name the schema :param version: a version of the schema :param attrs: a list of schema attributes descriptions (the number of attributes should be less or equal than 125) + `["attr1", "attr2"]` :return: schema_id: identifier of created schema schema_json: schema as json + { + id: identifier of schema + attrNames: array of attribute name strings + name: schema's name string + version: schema's version string, + ver: version of the Schema json + } """ logger = logging.getLogger(__name__) @@ -88,7 +96,15 @@ async def issuer_create_and_store_credential_def(wallet_handle: int, :param wallet_handle: wallet handle (created by open_wallet). :param issuer_did: a DID of the issuer signing cred_def transaction to the Ledger - :param schema_json: credential schema as a json + :param schema_json: credential schema as a json + { + id: identifier of schema + attrNames: array of attribute name strings + name: schema's name string + version: schema's version string, + seqNo: (Optional) schema's sequence number on the ledger, + ver: version of the Schema json + } :param tag: allows to distinct between credential definitions for the same issuer and schema :param signature_type: credential definition type (optional, 'CL' by default) that defines credentials signature and revocation math. Supported types are: @@ -98,7 +114,9 @@ async def issuer_create_and_store_credential_def(wallet_handle: int, https://github.com/hyperledger/indy-hipe/blob/c761c583b1e01c1e9d3ceda2b03b35336fdc8cc1/text/anoncreds-protocol/README.md :param config_json: (optional) type-specific configuration of credential definition as json: - 'CL': - - support_revocation: whether to request non-revocation credential (optional, default false) + { + "support_revocation" - bool (optional, default false) whether to request non-revocation credential + } :return: cred_def_id: identifier of created credential definition cred_def_json: public part of created credential definition @@ -164,7 +182,9 @@ async def issuer_rotate_credential_def_start(wallet_handle: int, :param cred_def_id: an identifier of created credential definition stored in the wallet :param config_json: (optional) type-specific configuration of credential definition as json: - 'CL': - - support_revocation: whether to request non-revocation credential (optional, default false) + { + "support_revocation" - bool (optional, default false) whether to request non-revocation credential + } :return: cred_def_json: public part of temporary created credential definition """ @@ -352,8 +372,8 @@ async def issuer_create_credential_offer(wallet_handle: int, :param cred_def_id: id of credential definition stored in the wallet :return:credential offer json: { - "schema_id": string, - "cred_def_id": string, + "schema_id": string, - identifier of schema + "cred_def_id": string, - identifier of credential definition // Fields below can depend on Cred Def type "nonce": string, "key_correctness_proof" : key correctness proof for credential definition correspondent to cred_def_id @@ -428,6 +448,12 @@ async def issuer_create_credential(wallet_handle: int, "signature_correctness_proof": credential signature correctness proof (opaque type that contains data structures internal to Ursa. It should not be parsed and are likely to change in future versions). + "rev_reg" - (Optional) revocation registry accumulator value on the issuing moment. + (opaque type that contains data structures internal to Ursa. + It should not be parsed and are likely to change in future versions). + "witness" - (Optional) revocation related data + (opaque type that contains data structures internal to Ursa. + It should not be parsed and are likely to change in future versions). } cred_revoc_id: local id for revocation info (Can be used for revocation of this cred) revoc_reg_delta_json: Revocation registry delta json with a newly issued credential @@ -652,6 +678,13 @@ async def prover_create_credential_req(wallet_handle: int, :param wallet_handle: wallet handle (created by open_wallet). :param prover_did: a DID of the prover :param cred_offer_json: credential offer as a json containing information about the issuer and a credential + { + "schema_id": string, - identifier of schema + "cred_def_id": string, - identifier of credential definition + ... + Other fields that contains data structures internal to Ursa. + These fields should not be parsed and are likely to change in future versions. + } :param cred_def_json: credential definition json related to in :param master_secret_id: the id of the master secret stored in the wallet :return: @@ -668,8 +701,9 @@ async def prover_create_credential_req(wallet_handle: int, It should not be parsed and are likely to change in future versions). "nonce": string } - cred_req_metadata_json: Credential request metadata json for processing of received form Issuer credential. - Note: cred_req_metadata_json mustn't be shared with Issuer. + cred_req_metadata_json: Credential request metadata json for further processing of received form Issuer credential. + Credential request metadata contains data structures internal to Ursa. + Credential request metadata mustn't be shared with Issuer. """ logger = logging.getLogger(__name__) @@ -861,12 +895,12 @@ async def prover_get_credential(wallet_handle: int, :param cred_id: Identifier by which requested credential is stored in the wallet :return: credential json { - "referent": string, // cred_id in the wallet - "attrs": {"key1":"raw_value1", "key2":"raw_value2"}, - "schema_id": string, - "cred_def_id": string, - "rev_reg_id": Optional, - "cred_rev_id": Optional + "referent": string, - id of credential in the wallet + "attrs": {"key1":"raw_value1", "key2":"raw_value2"}, - credential attributes + "schema_id": string, - identifier of schema + "cred_def_id": string, - identifier of credential definition + "rev_reg_id": Optional, - identifier of revocation registry definition + "cred_rev_id": Optional - identifier of credential in the revocation registry definition } """ @@ -943,12 +977,12 @@ async def prover_get_credentials(wallet_handle: int, } :return: credentials json [{ - "referent": string, // cred_id in the wallet - "attrs": {"key1":"raw_value1", "key2":"raw_value2"}, - "schema_id": string, - "cred_def_id": string, - "rev_reg_id": Optional, - "cred_rev_id": Optional + "referent": string, - id of credential in the wallet + "attrs": {"key1":"raw_value1", "key2":"raw_value2"}, - credential attributes + "schema_id": string, - identifier of schema + "cred_def_id": string, - identifier of credential definition + "rev_reg_id": Optional, - identifier of revocation registry definition + "cred_rev_id": Optional - identifier of credential in the revocation registry definition }] """ @@ -1022,12 +1056,12 @@ async def prover_fetch_credentials(search_handle: int, :param count: Count of records to fetch :return: credentials_json: List of credentials: [{ - "referent": string, // cred_id in the wallet - "attrs": {"key1":"raw_value1", "key2":"raw_value2"}, - "schema_id": string, - "cred_def_id": string, - "rev_reg_id": Optional, - "cred_rev_id": Optional + "referent": string, - id of credential in the wallet + "attrs": {"key1":"raw_value1", "key2":"raw_value2"}, - credential attributes + "schema_id": string, - identifier of schema + "cred_def_id": string, - identifier of credential definition + "rev_reg_id": Optional, - identifier of revocation registry definition + "cred_rev_id": Optional - identifier of credential in the revocation registry definition }] NOTE: The list of length less than the requested count means credentials search iterator is completed. """ @@ -1093,7 +1127,7 @@ async def prover_get_credentials_for_proof_req(wallet_handle: int, { "name": string, "version": string, - "nonce": string, - a big number represented as a string (use `generate_nonce` function to generate 80-bit number) + "nonce": string, - a big number represented as a string (use `indy_generate_nonce` function to generate 80-bit number) "requested_attributes": { // set of requested attributes "": , // see below ..., @@ -1105,57 +1139,65 @@ async def prover_get_credentials_for_proof_req(wallet_handle: int, "non_revoked": Optional<>, // see below, // If specified prover must proof non-revocation // for date in this interval for each attribute - // (can be overridden on attribute level) + // (applies to every attribute and predicate but can be overridden on attribute level) + } + where + attr_referent: Proof-request local identifier of requested attribute + attr_info: Describes requested attribute + { + "name": string, // attribute name, (case insensitive and ignore spaces) + "restrictions": Optional, // see below + "non_revoked": Optional<>, // see below, + // If specified prover must proof non-revocation + // for date in this interval this attribute + // (overrides proof level interval) } - where: - attr_referent: Proof-request local identifier of requested attribute - attr_info: Describes requested attribute - { - "name": string, // attribute name, (case insensitive and ignore spaces) - "restrictions": Optional<[]>, // see above - // if specified, credential must satisfy to one of the given restriction. - "non_revoked": Optional<>, // see below, - // If specified prover must proof non-revocation - // for date in this interval this attribute - // (overrides proof level interval) - } - predicate_referent: Proof-request local identifier of requested attribute predicate - predicate_info: Describes requested attribute predicate - { - "name": attribute name, (case insensitive and ignore spaces) - "p_type": predicate type (Currently >= only) - "p_value": predicate value - "restrictions": Optional<[]>, // see above - // if specified, credential must satisfy to one of the given restriction. - "non_revoked": Optional<>, // see below, - // If specified prover must proof non-revocation - // for date in this interval this attribute - // (overrides proof level interval) - } - non_revoc_interval: Defines non-revocation interval - { - "from": Optional, // timestamp of interval beginning - "to": Optional, // timestamp of interval ending - } + predicate_referent: Proof-request local identifier of requested attribute predicate + predicate_info: Describes requested attribute predicate + { + "name": attribute name, (case insensitive and ignore spaces) + "p_type": predicate type (">=", ">", "<=", "<") + "p_value": int predicate value + "restrictions": Optional, // see below + "non_revoked": Optional<>, // see below, + // If specified prover must proof non-revocation + // for date in this interval this attribute + // (overrides proof level interval) + } + non_revoc_interval: Defines non-revocation interval + { + "from": Optional, // timestamp of interval beginning + "to": Optional, // timestamp of interval ending + } + filter_json: + { + "schema_id": string, (Optional) + "schema_issuer_did": string, (Optional) + "schema_name": string, (Optional) + "schema_version": string, (Optional) + "issuer_did": string, (Optional) + "cred_def_id": string, (Optional) + } + :return: json with credentials for the given proof request. - { - "requested_attrs": { - "": [{ cred_info: , interval: Optional }], - ..., - }, - "requested_predicates": { - "requested_predicates": [{ cred_info: , timestamp: Optional }, { cred_info: , timestamp: Optional }], - "requested_predicate_2_referent": [{ cred_info: , timestamp: Optional }] - } - }, where credential is - { - "referent": , - "attrs": [{"attr_name" : "attr_raw_value"}], - "schema_id": string, - "cred_def_id": string, - "rev_reg_id": Optional, - "cred_rev_id": Optional, - } + { + "attrs": { + "": [{ cred_info: , interval: Optional }], + ..., + }, + "predicates": { + "requested_predicates": [{ cred_info: , timestamp: Optional }, { cred_info: , timestamp: Optional }], + "requested_predicate_2_referent": [{ cred_info: , timestamp: Optional }] + } + }, where is + { + "referent": string, - id of credential in the wallet + "attrs": {"key1":"raw_value1", "key2":"raw_value2"}, - credential attributes + "schema_id": string, - identifier of schema + "cred_def_id": string, - identifier of credential definition + "rev_reg_id": Optional, - identifier of revocation registry definition + "cred_rev_id": Optional - identifier of credential in the revocation registry definition + } """ logger = logging.getLogger(__name__) @@ -1194,7 +1236,7 @@ async def prover_search_credentials_for_proof_req(wallet_handle: int, { "name": string, "version": string, - "nonce": string, - a big number represented as a string (use `generate_nonce` function to generate 80-bit number) + "nonce": string, - a big number represented as a string (use `indy_generate_nonce` function to generate 80-bit number) "requested_attributes": { // set of requested attributes "": , // see below ..., @@ -1206,6 +1248,7 @@ async def prover_search_credentials_for_proof_req(wallet_handle: int, "non_revoked": Optional<>, // see below, // If specified prover must proof non-revocation // for date in this interval for each attribute + // (applies to every attribute and predicate but can be overridden on attribute level) // (can be overridden on attribute level) } :param extra_query_json:(Optional) List of extra queries that will be applied to correspondent attribute/predicate: @@ -1213,7 +1256,50 @@ async def prover_search_credentials_for_proof_req(wallet_handle: int, "": , "": , } - where wql query: indy-sdk/docs/design/011-wallet-query-language/README.md + + + where + attr_info: Describes requested attribute + { + "name": string, // attribute name, (case insensitive and ignore spaces) + "restrictions": Optional, // see below + "non_revoked": Optional<>, // see below, + // If specified prover must proof non-revocation + // for date in this interval this attribute + // (overrides proof level interval) + } + predicate_referent: Proof-request local identifier of requested attribute predicate + predicate_info: Describes requested attribute predicate + { + "name": attribute name, (case insensitive and ignore spaces) + "p_type": predicate type (">=", ">", "<=", "<") + "p_value": predicate value + "restrictions": Optional, // see below + "non_revoked": Optional<>, // see below, + // If specified prover must proof non-revocation + // for date in this interval this attribute + // (overrides proof level interval) + } + non_revoc_interval: Defines non-revocation interval + { + "from": Optional, // timestamp of interval beginning + "to": Optional, // timestamp of interval ending + } + extra_query_json:(Optional) List of extra queries that will be applied to correspondent attribute/predicate: + { + "": , + "": , + } + where wql query: indy-sdk/docs/design/011-wallet-query-language/README.md + The list of allowed fields: + "schema_id": , + "schema_issuer_did": , + "schema_name": , + "schema_version": , + "issuer_did": , + "cred_def_id": , + "rev_reg_id": , // "None" as string if not present + :return: search_handle: Search handle that can be used later to fetch records by small batches (with prover_fetch_credentials_for_proof_req) """ @@ -1258,12 +1344,12 @@ async def prover_fetch_credentials_for_proof_req(search_handle: int, }] where credential_info is { - "referent": , - "attrs": [{"attr_name" : "attr_raw_value"}], - "schema_id": string, - "cred_def_id": string, - "rev_reg_id": Optional, - "cred_rev_id": Optional, + "referent": string, - id of credential in the wallet + "attrs": {"key1":"raw_value1", "key2":"raw_value2"}, - credential attributes + "schema_id": string, - identifier of schema + "cred_def_id": string, - identifier of credential definition + "rev_reg_id": Optional, - identifier of revocation registry definition + "cred_rev_id": Optional - identifier of credential in the revocation registry definition } NOTE: The list of length less than the requested count means that search iterator correspondent to the requested is completed. """ @@ -1352,6 +1438,7 @@ async def prover_create_proof(wallet_handle: int, "non_revoked": Optional<>, // see below, // If specified prover must proof non-revocation // for date in this interval for each attribute + // (applies to every attribute and predicate but can be overridden on attribute level) // (can be overridden on attribute level) } :param requested_credentials_json: either a credential or self-attested attribute for each requested attribute @@ -1370,15 +1457,15 @@ async def prover_create_proof(wallet_handle: int, :param master_secret_name: the id of the master secret stored in the wallet :param schemas_json: all schemas json participating in the proof request { - : , - : , - : , + : , + : , + : , } :param credential_defs_json: all credential definitions json participating in the proof request { - "cred_def1_id": , - "cred_def2_id": , - "cred_def3_id": , + "cred_def1_id": , + "cred_def2_id": , + "cred_def3_id": , } :param rev_states_json: all revocation states json participating in the proof request { @@ -1393,67 +1480,74 @@ async def prover_create_proof(wallet_handle: int, "timestamp4": }, } + where - wql query: indy-sdk/docs/design/011-wallet-query-language/README.md - attr_referent: Proof-request local identifier of requested attribute - attr_info: Describes requested attribute - { - "name": string, // attribute name, (case insensitive and ignore spaces) - "restrictions": Optional<[]>, - // if specified, credential must satisfy to one of the given restriction. - "non_revoked": Optional<>, // see below, - // If specified prover must proof non-revocation - // for date in this interval this attribute - // (overrides proof level interval) - } - predicate_referent: Proof-request local identifier of requested attribute predicate - predicate_info: Describes requested attribute predicate - { - "name": attribute name, (case insensitive and ignore spaces) - "p_type": predicate type (Currently >= only) - "p_value": predicate value - "restrictions": Optional<[]>, - // if specified, credential must satisfy to one of the given restriction. - "non_revoked": Optional<>, // see below, - // If specified prover must proof non-revocation - // for date in this interval this attribute - // (overrides proof level interval) - } - non_revoc_interval: Defines non-revocation interval - { - "from": Optional, // timestamp of interval beginning - "to": Optional, // timestamp of interval ending - } + attr_referent: Proof-request local identifier of requested attribute + attr_info: Describes requested attribute + { + "name": string, // attribute name, (case insensitive and ignore spaces) + "restrictions": Optional, // see below + "non_revoked": Optional<>, // see below, + // If specified prover must proof non-revocation + // for date in this interval this attribute + // (overrides proof level interval) + } + predicate_referent: Proof-request local identifier of requested attribute predicate + predicate_info: Describes requested attribute predicate + { + "name": attribute name, (case insensitive and ignore spaces) + "p_type": predicate type (">=", ">", "<=", "<") + "p_value": predicate value + "restrictions": Optional, // see below + "non_revoked": Optional<>, // see below, + // If specified prover must proof non-revocation + // for date in this interval this attribute + // (overrides proof level interval) + } + non_revoc_interval: Defines non-revocation interval + { + "from": Optional, // timestamp of interval beginning + "to": Optional, // timestamp of interval ending + } + where wql query: indy-sdk/docs/design/011-wallet-query-language/README.md + The list of allowed fields: + "schema_id": , + "schema_issuer_did": , + "schema_name": , + "schema_version": , + "issuer_did": , + "cred_def_id": , + "rev_reg_id": , // "None" as string if not present :return: Proof json For each requested attribute either a proof (with optionally revealed attribute value) or self-attested attribute value is provided. Each proof is associated with a credential and corresponding schema_id, cred_def_id, rev_reg_id and timestamp. There is also aggregated proof part common for all credential proofs. - { - "requested_proof": { - "revealed_attrs": { - "requested_attr1_id": {sub_proof_index: number, raw: string, encoded: string}, - "requested_attr4_id": {sub_proof_index: number: string, encoded: string}, - }, - "unrevealed_attrs": { - "requested_attr3_id": {sub_proof_index: number} - }, - "self_attested_attrs": { - "requested_attr2_id": self_attested_value, - }, - "requested_predicates": { - "requested_predicate_1_referent": {sub_proof_index: int}, - "requested_predicate_2_referent": {sub_proof_index: int}, - } - } - "proof": { - "proofs": [ , , ], - "aggregated_proof": - } (opaque type that contains data structures internal to Ursa. - It should not be parsed and are likely to change in future versions). - "identifiers": [{schema_id, cred_def_id, Optional, Optional}] - } + { + "requested_proof": { + "revealed_attrs": { + "requested_attr1_id": {sub_proof_index: number, raw: string, encoded: string}, + "requested_attr4_id": {sub_proof_index: number: string, encoded: string}, + }, + "unrevealed_attrs": { + "requested_attr3_id": {sub_proof_index: number} + }, + "self_attested_attrs": { + "requested_attr2_id": self_attested_value, + }, + "predicates": { + "requested_predicate_1_referent": {sub_proof_index: int}, + "requested_predicate_2_referent": {sub_proof_index: int}, + } + } + "proof": { + "proofs": [ , , ], + "aggregated_proof": + } (opaque type that contains data structures internal to Ursa. + It should not be parsed and are likely to change in future versions). + "identifiers": [{schema_id, cred_def_id, Optional, Optional}] + } """ logger = logging.getLogger(__name__) @@ -1505,64 +1599,64 @@ async def verifier_verify_proof(proof_request_json: str, All required schemas, public keys and revocation registries must be provided. :param proof_request_json: - { - "name": string, - "version": string, - "nonce": string, - a big number represented as a string (use `generate_nonce` function to generate 80-bit number) - "requested_attributes": { // set of requested attributes - "": , // see below - ..., + { + "name": string, + "version": string, + "nonce": string, - a big number represented as a string (use `generate_nonce` function to generate 80-bit number) + "requested_attributes": { // set of requested attributes + "": , // see below + ..., + }, + "requested_predicates": { // set of requested predicates + "": , // see below + ..., }, - "requested_predicates": { // set of requested predicates - "": , // see below - ..., - }, - "non_revoked": Optional<>, // see below, - // If specified prover must proof non-revocation - // for date in this interval for each attribute - // (can be overridden on attribute level) - } + "non_revoked": Optional<>, // see below, + // If specified prover must proof non-revocation + // for date in this interval for each attribute + // (can be overridden on attribute level) + } :param proof_json: created for request proof json - { - "requested_proof": { - "revealed_attrs": { - "requested_attr1_id": {sub_proof_index: number, raw: string, encoded: string}, - "requested_attr4_id": {sub_proof_index: number: string, encoded: string}, - }, - "unrevealed_attrs": { - "requested_attr3_id": {sub_proof_index: number} - }, - "self_attested_attrs": { - "requested_attr2_id": self_attested_value, - }, - "requested_predicates": { - "requested_predicate_1_referent": {sub_proof_index: int}, - "requested_predicate_2_referent": {sub_proof_index: int}, - } - } - "proof": { - "proofs": [ , , ], - "aggregated_proof": - } - "identifiers": [{schema_id, cred_def_id, Optional, Optional}] - } + { + "requested_proof": { + "revealed_attrs": { + "requested_attr1_id": {sub_proof_index: number, raw: string, encoded: string}, // NOTE: check that `encoded` value match to `raw` value on application level + "requested_attr4_id": {sub_proof_index: number: string, encoded: string}, // NOTE: check that `encoded` value match to `raw` value on application level + }, + "unrevealed_attrs": { + "requested_attr3_id": {sub_proof_index: number} + }, + "self_attested_attrs": { + "requested_attr2_id": self_attested_value, + }, + "requested_predicates": { + "requested_predicate_1_referent": {sub_proof_index: int}, + "requested_predicate_2_referent": {sub_proof_index: int}, + } + } + "proof": { + "proofs": [ , , ], + "aggregated_proof": + } + "identifiers": [{schema_id, cred_def_id, Optional, Optional}] + } :param schemas_json: all schema jsons participating in the proof { - : , - : , - : , + : , + : , + : , } :param credential_defs_json: all credential definitions json participating in the proof { - "cred_def1_id": , - "cred_def2_id": , - "cred_def3_id": , + "cred_def1_id": , + "cred_def2_id": , + "cred_def3_id": , } :param rev_reg_defs_json: all revocation registry definitions json participating in the proof { - "rev_reg_def1_id": , - "rev_reg_def2_id": , - "rev_reg_def3_id": , + "rev_reg_def1_id": , + "rev_reg_def2_id": , + "rev_reg_def3_id": , } :param rev_regs_json: all revocation registries json participating in the proof { From 3204cf95c0b2a859e1560ba963d984c224404eea Mon Sep 17 00:00:00 2001 From: Anthony Voutas Date: Wed, 28 Aug 2019 10:37:03 -0700 Subject: [PATCH 312/320] Update README.md * Change links http -> https * Fix formatting in Additional Instructions section Signed-off-by: Anthony Voutas --- docs/README.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/docs/README.md b/docs/README.md index c82c6c62a9..890125c7b0 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1,7 +1,7 @@ # Documentation README -Check out the docs at http://hyperledger-indy.readthedocs.io/projects/sdk +Check out the docs at https://hyperledger-indy.readthedocs.io/projects/sdk -Learn more about how our docs are built and maintained at http://hyperledger-indy.readthedocs.io/en/latest/docs.html +Learn more about how our docs are built and maintained at https://hyperledger-indy.readthedocs.io/en/latest/docs.html This `docs/` directory should contain all of the documents associated with the repository, with the exception of README files that describe technical details with the directories of code. @@ -47,8 +47,9 @@ make html This will generate all the html files in `docs/_build/html` which you can then browse locally in your browser. Every time you make a change to the documentation you will need to rerun `make html`. ## Additional Instructions -This section is to be used for repo maintainers to add additional documentation guidelines or instructions. +This section is to be used for repo maintainers to add additional documentation guidelines or instructions. + **TODO: Build the respective code API's into the readthedocs website** **TODO: Add table support for markdown files** -* This link may help: https://github.com/ryanfox/sphinx-markdown-tables \ No newline at end of file +* This link may help: https://github.com/ryanfox/sphinx-markdown-tables From 8e932fddaec59062aa8e7c782ef5bf9da4250b62 Mon Sep 17 00:00:00 2001 From: John Bayne Date: Wed, 28 Aug 2019 16:32:28 -0700 Subject: [PATCH 313/320] Fix link to /ianco/indy-sdk postgres extension tests Signed-off-by: John Bayne --- experimental/plugins/postgres_storage/README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/experimental/plugins/postgres_storage/README.md b/experimental/plugins/postgres_storage/README.md index 659a7cf482..90087829f2 100644 --- a/experimental/plugins/postgres_storage/README.md +++ b/experimental/plugins/postgres_storage/README.md @@ -146,14 +146,15 @@ pub fn load_storage_library(_stg_type: &str, library: &str, initializer: &str, c This module contains some stand-alone unit tests, however there are also capabilities to run some of the general indy-sdk unit tests using the postgres plug-in (in both database-per-wallet and multi-wallet modes). -The code is on this branch, as it has not been accepted into the indy-sdk: https://github.com/ianco/indy-sdk/tree/plugin_storage_tests +The code is on this branch, as it has not been accepted into the indy-sdk: https://github.com/ianco/indy-sdk/tree/plugin_storage_tests/experimental/plugins/postgres_storage To run the tests: ```bash git clone https://github.com/ianco/indy-sdk.git +cd indy-sdk git checkout plugin_storage_tests -cd indy-sdk/libindy +cd libindy ``` ... or merge the code from this branch into a branch of your own fork of the indy-sdk repo. From 1c90279512157fa35972f48a836a40a2a9cca963 Mon Sep 17 00:00:00 2001 From: "artem.ivanov" Date: Wed, 28 Aug 2019 08:13:35 +0300 Subject: [PATCH 314/320] IS-1318 - indy cli spec file Signed-off-by: artem.ivanov --- Jenkinsfile.cd | 44 ++++++++++++++++++++++--------- ci/rpm-build-and-upload.sh | 19 +++++-------- cli/rpm/indy-cli.spec.in | 37 ++++++++++++++++++++++++++ libindy/rpm/libindy.spec.in | 10 +++---- libnullpay/rpm/libnullpay.spec.in | 6 ++--- vcx/libvcx/rpm/libvcx.spec.in | 6 ++--- 6 files changed, 83 insertions(+), 39 deletions(-) create mode 100644 cli/rpm/indy-cli.spec.in diff --git a/Jenkinsfile.cd b/Jenkinsfile.cd index b779055b87..d2900f90be 100644 --- a/Jenkinsfile.cd +++ b/Jenkinsfile.cd @@ -255,8 +255,8 @@ def linuxTesting(file, env_name, network_name) { def vcxTesting(file, env_name, network_name, full_testing) { parallel([ - failFast : true, - "${env_name} Test: build and test libvcx" : { + failFast : true, + "${env_name} Test: build and test libvcx": { node('ubuntu') { linuxVcxBuild(file, env_name, network_name) } @@ -919,11 +919,12 @@ def centosPublishing() { libindyVersion = getSrcVersion("libindy") echo "Publish ${env_name}: Build docker image" - def testEnv = dockerHelpers.build('indy-sdk', 'ci/centos.dockerfile ci') + def testEnv = dockerHelpers.build('indy-sdk', 'libindy/ci/centos.dockerfile ci') libindyRpmPublishing(testEnv, libindyVersion, env_name) libnullpayRpmPublishing(testEnv, env_name) libvcxRpmPublishing(testEnv, env_name) + indyCliRpmPublishing(testEnv, env_name) } finally { echo "Publish ${env_name} files: Cleanup" @@ -942,25 +943,33 @@ def libindyRpmPublishing(testEnv, version, env_name) { def libnullpayRpmPublishing(testEnv, env_name) { echo 'Publish Libnullpay rpm files' - def libnullpayVersion = getSrcVersion("vcx/libvcx") + def libnullpayVersion = getSrcVersion("libnullpay") - rpmPublishing(testEnv, "libnullpay", "libnullpay", libnullpayVersion, "LibindyBuildResult${env_name}") + rpmPublishing(testEnv, "libnullpay", "libnullpay", libnullpayVersion, "LibnullpayBuildResult${env_name}") } def libvcxRpmPublishing(testEnv, env_name) { echo 'Publish Libvcx rpm files' def libvcxVersion = getSrcVersion("vcx/libvcx") - rpmPublishing(testEnv, "vcx/libvcx", "libvcx", libvcxVersion, "LibindyBuildResult${env_name}") + rpmPublishing(testEnv, "vcx/libvcx", "libvcx", libvcxVersion, "LibvcxBuildResult${env_name}") } -def rpmPublishing(testEnv, directory, packageName, version, inStashName){ - testEnv.inside('-u 0:0') { // TODO: AVOID ROOT +def indyCliRpmPublishing(testEnv, env_name) { + echo 'Publish Indy Cli rpm files' + def indyCliVersion = getSrcVersion("cli") + + rpmPublishing(testEnv, "cli", "indy-cli", indyCliVersion, "IndyCliBuildResult${env_name}") +} + +def rpmPublishing(testEnv, directory, packageName, version, inStashName) { + echo 'Publish rpm files' + testEnv.inside("-u 0:0") { sh "cp ci/rpm-build-and-upload.sh $directory && chmod -R 755 $directory/*.sh" unstash name: inStashName - withCredentials([file(credentialsId: 'EvernymRepoSSHKey', variable: 'repo_key')]) { + withCredentials([file(credentialsId: 'SovrinRepoSSHKey', variable: 'repo_key')]) { sh "cd $directory && ./rpm-build-and-upload.sh $version $repo_key $env.BRANCH_NAME $env.BUILD_NUMBER $packageName" } } @@ -1484,15 +1493,20 @@ def publishingRCtoStable() { echo "Moving ${env_name} RC artifacts to Stable: libvcx" publishLibvcxDebRCtoStable(testEnv, env_name) - echo 'Moving Centos RC artifacts to Stable: libindy' + env_name = Centos + + echo 'Moving ${env_name} RC artifacts to Stable: libindy' publishLibindyCentosFilesRCtoStable(libindyVersion) - echo 'Moving Centos RC artifacts to Stable: libnullapy' + echo 'Moving ${env_name} RC artifacts to Stable: libnullapy' publishLibnullapyCentosFilesRCtoStable(libnullpayVersion) - echo 'Moving Centos RC artifacts to Stable: libvcx' + echo 'Moving ${env_name} RC artifacts to Stable: libvcx' publishLibvcxCentosFilesRCtoStable(libvcxVersion) + echo 'Moving ${env_name} RC artifacts to Stable: indy-cli' + publishIndyCliCentosFilesRCtoStable(libindyVersion) + } finally { echo 'Moving RC artifacts to Stable: Cleanup' step([$class: 'WsCleanup']) @@ -1513,8 +1527,12 @@ def publishLibvcxCentosFilesRCtoStable(version) { publishCentosFilesRCtoStable("libvcx", version) } +def publishIndyCliCentosFilesRCtoStable(version) { + publishCentosFilesRCtoStable("indy-cli", version) +} + def publishCentosFilesRCtoStable(packageName, version) { - copyRcFilesToStable("centos", packageName, version) + copyRcFilesToStable("rpm", packageName, version) } def publishLibindyWindowsFilesRCtoStable(version) { diff --git a/ci/rpm-build-and-upload.sh b/ci/rpm-build-and-upload.sh index c2542db677..4c9ae98dee 100644 --- a/ci/rpm-build-and-upload.sh +++ b/ci/rpm-build-and-upload.sh @@ -11,6 +11,7 @@ type="$3" number="$4" package="$5" dir=$(pwd) +result_dir=$(pwd)/rpms [ -z $version ] && exit 1 [ -z $key ] && exit 2 @@ -18,27 +19,21 @@ dir=$(pwd) [ -z $number ] && exit 4 [ -z $package ] && exit 5 -mkdir -p /usr/src/rpm/SOURCES/ - sed \ -e "s|@version@|$version|g" \ -e "s|@dir@|$dir|g" \ + -e "s|@result_dir@|$result_dir|g" \ rpm/${package}.spec.in > ${package}.spec -mkdir rpms +chown root.root ${package}.spec + +mkdir ${result_dir} -spectool -R ${package}.spec || exit 6 -rpmbuild -ba ${package}.spec || exit 7 +rpmbuild -ba ${package}.spec --nodeps || exit 7 cat < Date: Thu, 29 Aug 2019 08:43:21 +0300 Subject: [PATCH 315/320] IS-1318 - try to use fakeroot Signed-off-by: artem.ivanov --- Jenkinsfile.cd | 2 +- ci/rpm-build-and-upload.sh | 7 +++---- cli/rpm/indy-cli.spec.in | 3 ++- libindy/ci/centos.dockerfile | 2 ++ libindy/rpm/libindy.spec.in | 3 ++- libnullpay/rpm/libnullpay.spec.in | 3 ++- vcx/libvcx/rpm/libvcx.spec.in | 3 ++- 7 files changed, 14 insertions(+), 9 deletions(-) diff --git a/Jenkinsfile.cd b/Jenkinsfile.cd index d2900f90be..601fe6948f 100644 --- a/Jenkinsfile.cd +++ b/Jenkinsfile.cd @@ -964,7 +964,7 @@ def indyCliRpmPublishing(testEnv, env_name) { def rpmPublishing(testEnv, directory, packageName, version, inStashName) { echo 'Publish rpm files' - testEnv.inside("-u 0:0") { + testEnv.inside { sh "cp ci/rpm-build-and-upload.sh $directory && chmod -R 755 $directory/*.sh" unstash name: inStashName diff --git a/ci/rpm-build-and-upload.sh b/ci/rpm-build-and-upload.sh index 4c9ae98dee..d7b99aa543 100644 --- a/ci/rpm-build-and-upload.sh +++ b/ci/rpm-build-and-upload.sh @@ -22,18 +22,17 @@ result_dir=$(pwd)/rpms sed \ -e "s|@version@|$version|g" \ -e "s|@dir@|$dir|g" \ + -e "s|@release@|$number|g" \ -e "s|@result_dir@|$result_dir|g" \ rpm/${package}.spec.in > ${package}.spec -chown root.root ${package}.spec - mkdir ${result_dir} -rpmbuild -ba ${package}.spec --nodeps || exit 7 +fakeroot rpmbuild -ba ${package}.spec --nodeps || exit 7 cat < Date: Thu, 29 Aug 2019 11:49:42 +0300 Subject: [PATCH 316/320] Fix formatting in CD Signed-off-by: Sergey Minaev --- Jenkinsfile.cd | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Jenkinsfile.cd b/Jenkinsfile.cd index 601fe6948f..d7649cc5cb 100644 --- a/Jenkinsfile.cd +++ b/Jenkinsfile.cd @@ -354,9 +354,7 @@ def linuxLibindyBuild(file, env_name, network_name, full_testing) { sh """ cd libindy RUST_BACKTRACE=1 cargo test --release --no-run ${features_args} - RUST_BACKTRACE=1 RUST_LOG=indy::=debug,zmq=trace RUST_TEST_THREADS=1 TEST_POOL_IP=10.0.0.2 cargo test --release ${ - features_args - } + RUST_BACKTRACE=1 RUST_LOG=indy::=debug,zmq=trace RUST_TEST_THREADS=1 TEST_POOL_IP=10.0.0.2 cargo test --release ${features_args} """ } From 22756cdd6d3bae3edea5d2879ba2aaa55f160aaa Mon Sep 17 00:00:00 2001 From: "artem.ivanov" Date: Thu, 29 Aug 2019 12:28:14 +0300 Subject: [PATCH 317/320] CD Pipeline - test wrappers on ubuntu 18 Signed-off-by: artem.ivanov --- Jenkinsfile.cd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile.cd b/Jenkinsfile.cd index d7649cc5cb..67ce897ea6 100644 --- a/Jenkinsfile.cd +++ b/Jenkinsfile.cd @@ -701,7 +701,7 @@ def windowsTesting() { } def runAllTests(env_name) { - if (env_name == Ubuntu16) { + if (env_name == Ubuntu18) { return true } return (env.BRANCH_NAME == 'rc') From 47022058d9b980f73dcbe781bfa50ca1262a0073 Mon Sep 17 00:00:00 2001 From: "artem.ivanov" Date: Thu, 29 Aug 2019 15:33:14 +0300 Subject: [PATCH 318/320] CD Pipeline - use python6 Signed-off-by: artem.ivanov --- Jenkinsfile.cd | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/Jenkinsfile.cd b/Jenkinsfile.cd index 67ce897ea6..1e4fa22dab 100644 --- a/Jenkinsfile.cd +++ b/Jenkinsfile.cd @@ -458,8 +458,8 @@ def linuxPythonTesting(env_name, network_name, testEnv) { echo "${env_name} Libindy Test: Test python wrapper" sh ''' - python3.5 -m pip install --user -e .[test] - LD_LIBRARY_PATH=./:${LD_LIBRARY_PATH} RUST_LOG=indy::=debug TEST_POOL_IP=10.0.0.2 python3.5 -m pytest + python3 -m pip install --user -e .[test] + LD_LIBRARY_PATH=./:${LD_LIBRARY_PATH} RUST_LOG=indy::=debug TEST_POOL_IP=10.0.0.2 python3 -m pytest ''' } } @@ -548,8 +548,8 @@ def linuxVcxPythonTesting(env_name, network_name, testEnv) { echo "${env_name} Vcx Test: Test python wrapper" sh ''' - python3.5 -m pip install --user pytest==3.6.4 pytest-asyncio - LD_LIBRARY_PATH=./:${LD_LIBRARY_PATH} python3.5 -m pytest -s + python3 -m pip install --user pytest==3.6.4 pytest-asyncio + LD_LIBRARY_PATH=./:${LD_LIBRARY_PATH} python3 -m pytest -s ''' } } @@ -701,10 +701,11 @@ def windowsTesting() { } def runAllTests(env_name) { - if (env_name == Ubuntu18) { - return true - } - return (env.BRANCH_NAME == 'rc') + return env_name == Ubuntu18 +// if (env_name == Ubuntu18) { TODO: FIXME install python in Ubuntu 16.04? +// return true +// } +// return (env.BRANCH_NAME == 'rc') } def ubuntuTesting() { @@ -721,7 +722,7 @@ def ubuntuTesting() { } -def linuxAndroidOnEmulatorTesting(env_name, network_name, testEnv, stashBuildResult) { +def linuxAndroidOnEmulatorTesting(env_name, network_name, testEnv) { sh 'chmod -R 755 libindy/ci/*.sh' sh 'chmod -R 755 libindy/*.sh' @@ -1300,8 +1301,8 @@ def pythonWrapperPublishing(testEnv, isRelease, directory, base_library) { withCredentials([file(credentialsId: 'pypi_credentials', variable: 'credentialsFile')]) { sh 'cp $credentialsFile ./' - sh "PACKAGE_VERSION=$version$suffix python3.5 setup.py sdist" - sh "python3.5 -m twine upload dist/* --config-file .pypirc" + sh "PACKAGE_VERSION=$version$suffix python3 setup.py sdist" + sh "python3 -m twine upload dist/* --config-file .pypirc" } } @@ -1828,7 +1829,7 @@ def androidTesting() { network_name = "pool_network" parallel([ "${env_name}-android-test" : { - linuxModuleTesting("ci/ubuntu.dockerfile ci", env_name, network_name, this.&linuxAndroidOnEmulatorTesting, false, 'android') + linuxModuleTesting("ci/ubuntu.dockerfile ci", env_name, network_name, this.&linuxAndroidOnEmulatorTesting, 'android') }, "${env_name}-android-building": { androidBuildAsTesting() } ]) From d00c10181e71d402427f0c512b7c0524b64327cf Mon Sep 17 00:00:00 2001 From: "artem.ivanov" Date: Thu, 22 Aug 2019 16:10:26 +0300 Subject: [PATCH 319/320] Release 1.11.1 - preparation Signed-off-by: artem.ivanov --- CHANGELOG.md | 22 ++++++ README.md | 11 +++ Specs/libindy/1.11.1/libindy.podspec.json | 23 ++++++ cli/Cargo.lock | 10 +-- cli/Cargo.toml | 4 +- cli/debian/changelog | 9 ++- .../migration-guide-1.10.0-1.11.0.md | 79 +++++++++++++++++++ libindy/Cargo.lock | 2 +- libindy/Cargo.toml | 2 +- libindy/debian/changelog | 10 ++- libnullpay/Cargo.lock | 10 +-- libnullpay/Cargo.toml | 4 +- libnullpay/debian/changelog | 2 +- vcx/docs/migration-guide-0.3.x-0.4.0.md | 51 +++++++++++- vcx/libvcx/Cargo.lock | 12 +-- vcx/libvcx/Cargo.toml | 6 +- vcx/libvcx/debian/changelog | 13 ++- vcx/wrappers/java/build.gradle | 2 +- vcx/wrappers/node/package.json | 2 +- vcx/wrappers/python3/setup.py | 2 +- wrappers/java/pom.xml | 2 +- wrappers/nodejs/package.json | 2 +- wrappers/python/setup.py | 2 +- wrappers/rust/Cargo.toml | 4 +- wrappers/rust/indy-sys/Cargo.toml | 2 +- 25 files changed, 249 insertions(+), 39 deletions(-) create mode 100644 Specs/libindy/1.11.1/libindy.podspec.json diff --git a/CHANGELOG.md b/CHANGELOG.md index 610abe5e6a..f07689f207 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,27 @@ # Changelog +## 1.11.1 - 2019-08-30 +* Supported endorsing of transactions in Indy-CLI and Libvcx. + * CLI: + * added `endorser` parameter into `nym`, `attrib`, `ledger`, `cred def` commands to set endorser for transaction. + * added `ledger endorse` command to endorse a transaction to the ledger. + * Libvcx: + * added `vcx_*_prepare_for_endorser` - functions for `schema` and `credentialdef` which build transaction and crete internal object in differed state. + * added `vcx_*_update_state` - functions to update state of `schema`/`credentialdef` internal object (checks if it is published on the ledger). + * added `vcx_*_get_state` - functions to get state of `schema`/`credentialdef` internal object. + * added `vcx_endorse_transaction` - function to endorse a transaction to the ledger. +* Added new functions to Anoncreds API to rotate credential definition: + `indy_issuer_rotate_credential_def_start` - to generate temporary keys for an existing Credential Definition. + `indy_issuer_rotate_credential_def_apply` - to apply temporary keys as the main for an existing Credential Definition in the wallet. +* Added sign/verify with payment address functions to Libvcx. +* Supported state proof verification for GET_TXN request. +* Extended `config` parameter of `indy_open_pool_ledger` function to accept `number_read_nodes` value. This value set the number of nodes to send read requests. +* Extended Libvcx initialization config to accept pool configuration. +* Supported new platforms Ubuntu 18.04 and Centos: + * Updated CI pipeline to run tests. + * Updated CD pipeline to build and to publish artifacts. +* Bugfixes + ## 1.11.0 - 2019-08-2 * Updated `indy_append_txn_author_agreement_acceptance_to_request` Libindy function to discard the time portion of `acceptance time` on appending TAA metadata into request. It was done cause too much time precision can lead to privacy risk. diff --git a/README.md b/README.md index f6fe79408e..957713f231 100644 --- a/README.md +++ b/README.md @@ -180,6 +180,17 @@ that may be need for your applications. * `libindy.a` - This is a static library, which is compiled with NDK. +### Centos + +1. Go to https://repo.sovrin.org/rpm/{library}/{release-channel}. +2. Download the last version of library. +3. Install with `rpm -i library-version.rpm`. + +{library} must be replaced with libindy, libnullpay, libvcx, indy-cli to define corresponded library. + +{release channel} must be replaced with master, rc or stable to define corresponded release channel. +See section "Release channels" for more details. + [How to use instructions.](https://github.com/hyperledger/indy-sdk/blob/master/docs/android-build.md#usage) {release channel} must be replaced with rc or stable to define corresponded release channel. diff --git a/Specs/libindy/1.11.1/libindy.podspec.json b/Specs/libindy/1.11.1/libindy.podspec.json new file mode 100644 index 0000000000..ecb77148b9 --- /dev/null +++ b/Specs/libindy/1.11.1/libindy.podspec.json @@ -0,0 +1,23 @@ +{ + "name": "libindy", + "version": "1.11.1", + "summary": "Summary TODO.", + "description": "Description TODO.", + "homepage": "TODO", + "license": { + "type": "Apache License 2.0", + "file": "LICENSE" + }, + "authors": { + "Daniel Hardman": "daniel.hardman@evernym.com" + }, + "platforms": { + "ios": "10.0" + }, + "source": { + "http": "https://repo.sovrin.org/ios/libindy/stable/libindy-core/1.11.1/libindy.tar.gz" + }, + "source_files": "*.h", + "vendored_libraries": "*.a", + "requires_arc": false +} diff --git a/cli/Cargo.lock b/cli/Cargo.lock index f2894356a3..80f9be0478 100644 --- a/cli/Cargo.lock +++ b/cli/Cargo.lock @@ -244,11 +244,11 @@ dependencies = [ [[package]] name = "indy" -version = "1.11.0" +version = "1.11.1" dependencies = [ "failure 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", - "indy-sys 1.11.0", + "indy-sys 1.11.1", "lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -261,13 +261,13 @@ dependencies = [ [[package]] name = "indy-cli" -version = "1.11.0" +version = "1.11.1" dependencies = [ "ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "dirs 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "indy 1.11.0", + "indy 1.11.1", "lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", "libloading 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -286,7 +286,7 @@ dependencies = [ [[package]] name = "indy-sys" -version = "1.11.0" +version = "1.11.1" dependencies = [ "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/cli/Cargo.toml b/cli/Cargo.toml index e2854af23a..48ae6c8495 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "indy-cli" -version = "1.11.0" +version = "1.11.1" authors = ["Vyacheslav Gudkov "] [features] @@ -28,4 +28,4 @@ serde_json = "1.0.40" serde_derive = "1.0.97" term = "0.4.6" rpassword = "1.0.0" -indy = { version = "1.11.0", path = "../wrappers/rust/" } +indy = { version = "1.11.1", path = "../wrappers/rust/" } diff --git a/cli/debian/changelog b/cli/debian/changelog index bb05b563fc..79addb2a43 100644 --- a/cli/debian/changelog +++ b/cli/debian/changelog @@ -1,7 +1,14 @@ -indy-cli (1.11.0) unstable; urgency=medium +indy-cli (1.11.1) unstable; urgency=medium [ Hyperledger ] +## 1.11.1 +* Supported endorsing of transactions: + * added `endorser` parameter into `nym`, `attrib`, `ledger`, `cred def` command to set endorser for transaction. + * added `ledger endorse` command to endorse a transaction. +* Added optional `number-read-nodes` parameter into `pool connect` to set a number of nodes to send read requests. +* Bugfixes + ## 1.11.0 * Added new `payment-address sign/verify` commands to sign/verify a message with a payment address. * Updated Indy CLI behavior to complete values for the following parameters: wallet names, pool names, dids, payment addresses. diff --git a/docs/migration-guides/migration-guide-1.10.0-1.11.0.md b/docs/migration-guides/migration-guide-1.10.0-1.11.0.md index fc7e784b8b..a4eb1f51e4 100644 --- a/docs/migration-guides/migration-guide-1.10.0-1.11.0.md +++ b/docs/migration-guides/migration-guide-1.10.0-1.11.0.md @@ -21,6 +21,9 @@ version you can check migration guides history: * [Payment API](#payment-api) * [Anoncreds API](#anoncreds-api) * [Ledger API](#ledger-api) +* [Libindy 1.11.0 to 1.11.1 migration](#libindy-1110-to-1111-migration-guide) + * [Ledger API 1.11.1](#ledger-api-1111) + * [Anoncreds API 1.11.1](#ledger-api-1111) ## Notes @@ -246,3 +249,79 @@ It was done cause too much time precision can lead to privacy risk. It allows writing transactions to the ledger with preserving an original author but by different Endorser. An example flow can be found [here](../configuration.md) An example test can be found here: `indy-sdk/libindy/tests/ledger.rs/indy_send_request_by_endorser_works` + +## Libindy 1.11.0 to 1.11.1 migration Guide + +### Ledger API 1.11.1 + +* Extended `config` parameter of `indy_open_pool_ledger` function to accept `number_read_nodes` value. +This value set the number of nodes to send read requests. + +### Anoncreds API 1.11.1 + +The main idea of changes performed in Anoncreds API is to provide a way to rotate the key of a Credential Definition stored into the wallet. + +**WARNING**: Rotating the credential definitional keys will result in making all credentials issued under the previous keys unverifiable. + + + + + + + + + + + + + + + + + + + + +
v1.11.0 - Anoncreds APIv1.11.1 - Anoncreds API
+ + Generate temporary credential definitional keys for an existing one (owned by the caller of the library). + +
+ NEW + +
+indy_issuer_rotate_credential_def_start(command_handle: i32,
+                                        wallet_handle: WalletHandle,
+                                        cred_def_id: *const c_char,
+                                        config_json: *const c_char,
+                                           cb: Option)
+          
+
+ + Apply temporary keys as main for an existing Credential Definition (owned by the caller of the library). + +
+ NEW + +
+indy_issuer_rotate_credential_def_apply(command_handle: i32,
+                                        wallet_handle: WalletHandle,
+                                        cred_def_id: *const c_char,
+                                        cb: Option)
+          
+
+ +#### Workflow +``` +cred_def_id, cred_def_json = indy_issuer_create_and_store_credential_def(...) +indy_sign_and_submit_request(cred_def_json) +... +... +temp_cred_def_json = indy_issuer_rotate_credential_def_start(cred_def_id) +indy_sign_and_submit_request(temp_cred_def_json) +indy_issuer_rotate_credential_def_apply(cred_def_id) + +``` \ No newline at end of file diff --git a/libindy/Cargo.lock b/libindy/Cargo.lock index f85ef73d89..6fb07c0dea 100644 --- a/libindy/Cargo.lock +++ b/libindy/Cargo.lock @@ -640,7 +640,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "libindy" -version = "1.11.0" +version = "1.11.1" dependencies = [ "android_logger 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", "backtrace 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/libindy/Cargo.toml b/libindy/Cargo.toml index 18326c4d57..f22007cfbe 100644 --- a/libindy/Cargo.toml +++ b/libindy/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "libindy" -version = "1.11.0" +version = "1.11.1" authors = [ "Sergej Pupykin ", "Vyacheslav Gudkov ", diff --git a/libindy/debian/changelog b/libindy/debian/changelog index 90335fb331..6eccbcd879 100644 --- a/libindy/debian/changelog +++ b/libindy/debian/changelog @@ -1,7 +1,15 @@ -libindy (1.11.0) unstable; urgency=medium +libindy (1.11.1) unstable; urgency=medium [ Hyperledger ] +## 1.11.1 +* Added new functions to Anoncreds API to rotate credential definition: + `indy_issuer_rotate_credential_def_start` - to generate temporary keys for an existing Credential Definition. + `indy_issuer_rotate_credential_def_apply` - to apply temporary keys as the main for an existing Credential Definition in the wallet. +* Supported state proof verification for GET_TXN request. +* Extended `config` parameter of `indy_open_pool_ledger` function to accept `number_read_nodes` value. This value set the number of nodes to send read requests. +* Bugfixes + ## 1.11.0 * Updated `indy_append_txn_author_agreement_acceptance_to_request` function to discard the time portion of `acceptance time` on appending TAA metadata into request. It was done cause too much time precision can lead to privacy risk. diff --git a/libnullpay/Cargo.lock b/libnullpay/Cargo.lock index c8542cfddc..be03dcb8d6 100644 --- a/libnullpay/Cargo.lock +++ b/libnullpay/Cargo.lock @@ -259,11 +259,11 @@ dependencies = [ [[package]] name = "indy" -version = "1.11.0" +version = "1.11.1" dependencies = [ "failure 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", - "indy-sys 1.11.0", + "indy-sys 1.11.1", "lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -276,7 +276,7 @@ dependencies = [ [[package]] name = "indy-sys" -version = "1.11.0" +version = "1.11.1" dependencies = [ "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", @@ -337,12 +337,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "null-payment-method" -version = "1.11.0" +version = "1.11.1" dependencies = [ "android_logger 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", "dirs 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.5.13 (registry+https://github.com/rust-lang/crates.io-index)", - "indy 1.11.0", + "indy 1.11.1", "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/libnullpay/Cargo.toml b/libnullpay/Cargo.toml index 7f65468b71..7c36371192 100644 --- a/libnullpay/Cargo.toml +++ b/libnullpay/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "null-payment-method" -version = "1.11.0" +version = "1.11.1" authors = ["Nikita Khateev "] build = "build.rs" @@ -26,7 +26,7 @@ serde_derive = "1.0.97" [dev-dependencies] dirs = "1.0.4" -indy = { version="1.11.0", path="../wrappers/rust" } +indy = { version="1.11.1", path="../wrappers/rust" } [target.'cfg(target_os = "android")'.dependencies] android_logger = "0.5" diff --git a/libnullpay/debian/changelog b/libnullpay/debian/changelog index 4da4ca9bdd..40056f4516 100644 --- a/libnullpay/debian/changelog +++ b/libnullpay/debian/changelog @@ -1,4 +1,4 @@ -libnullpay (1.11.0) unstable; urgency=medium +libnullpay (1.11.1) unstable; urgency=medium [ Hyperledger ] * Initial release diff --git a/vcx/docs/migration-guide-0.3.x-0.4.0.md b/vcx/docs/migration-guide-0.3.x-0.4.0.md index 7c37f74862..774eb048cb 100644 --- a/vcx/docs/migration-guide-0.3.x-0.4.0.md +++ b/vcx/docs/migration-guide-0.3.x-0.4.0.md @@ -13,6 +13,8 @@ to simplify their transition to LibVCX 0.4 from LibVCX 0.3.x. * [Disclosed Proof API](#disclosed-proof-api) * [Issuer Credential API](#issuer-credential-api) * [Proof API](#proof-api) +* [Libvcx 0.4.0 to 0.4.1 migration](#libvcx-040-to-041-migration-guide) + ### API @@ -54,4 +56,51 @@ This removes the dependency on an agency/cloud-agent and allows the user of the #### Proof API -`vcx_proof_get_request_msg` - Get the proof request message. \ No newline at end of file +`vcx_proof_get_request_msg` - Get the proof request message. + + +## Libvcx 0.4.0 to 0.4.1 migration Guide + +#### Endorse a transaction + +* In the current state, Libvcx provides functionality for the publishing of 2 types of entities that can be endorsed: +* Schema +* Credential Definition + +The set of new similar functions was added to provide a way how these entities (`schema`, `credentialdef`) can be endorsered. + * `vcx_*_prepare_for_endorser` - build transaction and crete internal object in differed state. + * `vcx_*_update_state` - functions to update state of internal object. + * `vcx_*_get_state` - functions to get state of internal object. + * `vcx_endorse_transaction` - function to endorse a transaction to the ledger. + +``` +let (schema_hsndle, schema_json) = vcx_schema_prepare_for_endorser(...) +vcx_schema_get_state(schema_hsndle) == Built +vcx_endorse_transaction(schema_json) +vcx_schema_update_state(schema_hsndle) +vcx_schema_get_state(schema_hsndle) == Published +``` + +#### Sign with Address + +Supported sign/verify with payment address functionality: + * `vcx_wallet_sign_with_address` - to sign a message with a payment address. + * `vcx_wallet_verify_with_address` - to verify a signature with a payment address. + +#### Vcx init + +Extended Libvcx initialization config to accept pool configuration. +``` +{ + ... + "pool_config": "{ + "timeout": int (optional) - specifies the maximum number of seconds to wait for pool response (ACK, REPLY). + "extended_timeout": int (optional), an additional number of seconds to wait for REPLY in case ACK has been received. + "preordered_nodes": array - (optional), names of nodes which will have priority during request sending. + This can be useful if a user prefers querying specific nodes. + Note: Nodes not specified will be placed randomly. + "number_read_nodes": int (optional) - the number of nodes to send read requests (2 by default) + }" + +} +``` \ No newline at end of file diff --git a/vcx/libvcx/Cargo.lock b/vcx/libvcx/Cargo.lock index 8e14215a39..206f394e9c 100644 --- a/vcx/libvcx/Cargo.lock +++ b/vcx/libvcx/Cargo.lock @@ -504,11 +504,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "indy" -version = "1.11.0" +version = "1.11.1" dependencies = [ "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)", - "indy-sys 1.11.0", + "indy-sys 1.11.1", "lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -521,7 +521,7 @@ dependencies = [ [[package]] name = "indy-sys" -version = "1.11.0" +version = "1.11.1" dependencies = [ "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", @@ -583,7 +583,7 @@ dependencies = [ [[package]] name = "libvcx" -version = "0.4.0" +version = "0.4.1" dependencies = [ "android_logger 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", "base64 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -592,8 +592,8 @@ dependencies = [ "env_logger 0.5.13 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)", - "indy 1.11.0", - "indy-sys 1.11.0", + "indy 1.11.1", + "indy-sys 1.11.1", "json 0.11.13 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/vcx/libvcx/Cargo.toml b/vcx/libvcx/Cargo.toml index 9a083c6c3b..014c0039de 100644 --- a/vcx/libvcx/Cargo.toml +++ b/vcx/libvcx/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "libvcx" -version = "0.4.0" +version = "0.4.1" authors = [ "Evernym Inc." ] publish = false description = "This is the official SDK for Evernym's VCX" @@ -46,8 +46,8 @@ rmp-serde = "0.13.7" base64 = "0.8.0" openssl = "0.10" num-traits = "0.2.0" -indy = { version = "1.11.0", path = "../../wrappers/rust/" } -indy-sys = { version = "1.11.0", path = "../../wrappers/rust/indy-sys/" } +indy = { version = "1.11.1", path = "../../wrappers/rust/" } +indy-sys = { version = "1.11.1", path = "../../wrappers/rust/indy-sys/" } log-panics = "2.0.0" tokio-threadpool = "0.1.6" futures = "0.1.23" diff --git a/vcx/libvcx/debian/changelog b/vcx/libvcx/debian/changelog index 41f009c37c..cda1ab0fdd 100644 --- a/vcx/libvcx/debian/changelog +++ b/vcx/libvcx/debian/changelog @@ -1,7 +1,18 @@ -libvcx (0.4.0) unstable; urgency=medium +libvcx (0.4.1) unstable; urgency=medium [ Hyperledger ] +## 0.4.1 +* Supported endorsing of transactions in Libvcx. + * `vcx_*_prepare_for_endorser` - functions for `schema` and `credentialdef` which build transaction and crete internal object in differed state. + * `vcx_*_update_state` and `vcx_*_get_state` - functions to update/get state of `schema`/`credentialdef` internal object. + * `vcx_endorse_transaction` - function to endorse a transaction. +* Supported sign/verify with payment address functionality in Libvcx. + * `vcx_wallet_sign_with_address` - to sign a message with a payment address. + * `vcx_wallet_verify_with_address` - to verify a signature with a payment address. +* Extended Libvcx initialization config to accept pool configuration. +* Bugfixes + * 0.4.0 * Added a set of new APIs around credentials and proofs that work with messages that should be exchanged without handling the transport of those messages. This removes the dependency on an agency/cloud-agent and allows the user of the SDK to transport those messages themselves. diff --git a/vcx/wrappers/java/build.gradle b/vcx/wrappers/java/build.gradle index 96d4f48f3a..17cf39d96e 100755 --- a/vcx/wrappers/java/build.gradle +++ b/vcx/wrappers/java/build.gradle @@ -25,7 +25,7 @@ test { } static def versionMajor() { - return '0.4.0' + return '0.4.1' } static def version() { diff --git a/vcx/wrappers/node/package.json b/vcx/wrappers/node/package.json index 6c6f30713d..1facfcef59 100644 --- a/vcx/wrappers/node/package.json +++ b/vcx/wrappers/node/package.json @@ -20,7 +20,7 @@ "url": "git+https://github.com/evernym/vcx.git", "type": "git" }, - "version": "0.4.0", + "version": "0.4.1", "dependencies": { "@types/ffi": "0.0.19", "@types/node": "^8.0.47", diff --git a/vcx/wrappers/python3/setup.py b/vcx/wrappers/python3/setup.py index 4b095f0416..14d59906a0 100755 --- a/vcx/wrappers/python3/setup.py +++ b/vcx/wrappers/python3/setup.py @@ -1,7 +1,7 @@ from setuptools import setup, find_packages import os -PKG_VERSION = os.environ.get('PACKAGE_VERSION') or '0.4.0' +PKG_VERSION = os.environ.get('PACKAGE_VERSION') or '0.4.1' PKG_NAME = os.environ.get('PACKAGE_NAME') or 'python3-wrapper-vcx' setup( diff --git a/wrappers/java/pom.xml b/wrappers/java/pom.xml index 4e1bdd4bc9..f51c333b7c 100644 --- a/wrappers/java/pom.xml +++ b/wrappers/java/pom.xml @@ -5,7 +5,7 @@ org.hyperledger indy jar - 1.11.0 + 1.11.1 indy This is the official SDK for Hyperledger Indy (https://www.hyperledger.org/projects), which provides a distributed-ledger-based foundation for self-sovereign identity (https://sovrin.org). diff --git a/wrappers/nodejs/package.json b/wrappers/nodejs/package.json index d3d2b86698..5e5a50916d 100644 --- a/wrappers/nodejs/package.json +++ b/wrappers/nodejs/package.json @@ -1,6 +1,6 @@ { "name": "indy-sdk", - "version": "1.11.0", + "version": "1.11.1", "description": "Native bindings for hyperledger indy", "author": "hyperledger", "license": "Apache-2.0", diff --git a/wrappers/python/setup.py b/wrappers/python/setup.py index 4b96e44d44..fd8ed10356 100644 --- a/wrappers/python/setup.py +++ b/wrappers/python/setup.py @@ -1,7 +1,7 @@ from distutils.core import setup import os -PKG_VERSION = os.environ.get('PACKAGE_VERSION') or '1.11.0' +PKG_VERSION = os.environ.get('PACKAGE_VERSION') or '1.11.1' TEST_DEPS = [ 'pytest<3.7', 'pytest-asyncio', 'base58' diff --git a/wrappers/rust/Cargo.toml b/wrappers/rust/Cargo.toml index 85e3ca1707..da7e99dc48 100644 --- a/wrappers/rust/Cargo.toml +++ b/wrappers/rust/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "indy" -version = "1.11.0" +version = "1.11.1" description = "A library for assisting developers using LibIndy API" authors = ["Mike Lodder ", "Matt Raffel ", @@ -29,7 +29,7 @@ lazy_static = "1.3" log = { version = "0.4.1", features = ["std"] } num-traits = "0.2" num-derive = "0.2" -indy-sys = { path ="indy-sys", version = "=1.11.0" } +indy-sys = { path ="indy-sys", version = "=1.11.1" } libc = "=0.2.60" serde_json = "1.0.40" serde_derive = "1.0.97" diff --git a/wrappers/rust/indy-sys/Cargo.toml b/wrappers/rust/indy-sys/Cargo.toml index 41143a8b8e..608980703e 100644 --- a/wrappers/rust/indy-sys/Cargo.toml +++ b/wrappers/rust/indy-sys/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "indy-sys" description = "FFI bindings to Libindy C API" -version = "1.11.0" +version = "1.11.1" authors = ["Mike Lodder "] build = "build.rs" links = "indy" From f4afee1d992058627f37706889f7d434e98581d5 Mon Sep 17 00:00:00 2001 From: Sergey Minaev Date: Thu, 29 Aug 2019 23:54:18 +0300 Subject: [PATCH 320/320] Revert "Merge pull request #1585 from AxelNennker/libsodium-1.0.17" This reverts commit c9a16f839887c28573ebe16062678e5f4723033a, reversing changes made to 61232def24209845c6dcf85c1d38244c268bf600. Signed-off-by: Sergey Minaev --- docs/build-guides/rhel-build.md | 6 +++--- docs/build-guides/ubuntu-build.md | 10 +++++----- docs/build-guides/windows-build.md | 2 +- libindy/ci/centos.dockerfile | 6 +++--- libindy/ci/ubuntu.dockerfile | 26 +++++--------------------- 5 files changed, 17 insertions(+), 33 deletions(-) diff --git a/docs/build-guides/rhel-build.md b/docs/build-guides/rhel-build.md index c470491966..1ae8bf8a34 100644 --- a/docs/build-guides/rhel-build.md +++ b/docs/build-guides/rhel-build.md @@ -42,12 +42,12 @@ dnf install -y \ For Amazon Linux 2017.03 or other distributions without `libsodium` available in system repositories: ``` cd /tmp -curl https://download.libsodium.org/libsodium/releases/libsodium-1.0.18.tar.gz | tar -xz -cd /tmp/libsodium-1.0.18 +curl https://download.libsodium.org/libsodium/releases/old/libsodium-1.0.14.tar.gz | tar -xz +cd /tmp/libsodium-1.0.14 ./configure make make install -rm -rf /tmp/libsodium-1.0.18 +rm -rf /tmp/libsodium-1.0.14 export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib diff --git a/docs/build-guides/ubuntu-build.md b/docs/build-guides/ubuntu-build.md index 9f152c3221..3ad424ff42 100644 --- a/docs/build-guides/ubuntu-build.md +++ b/docs/build-guides/ubuntu-build.md @@ -15,16 +15,16 @@ libncursesw5-dev ``` -1. `libindy` requires the modern `1.0.18` version of `libsodium` but Ubuntu 16.04 does not support installation it's from `apt` repository. +1. `libindy` requires the modern `1.0.14` version of `libsodium` but Ubuntu 16.04 does not support installation it's from `apt` repository. Because of this, it requires to build and install `libsodium` from source: ``` cd /tmp && \ - curl https://download.libsodium.org/libsodium/releases/libsodium-1.0.18.tar.gz | tar -xz && \ - cd /tmp/libsodium-1.0.18 && \ - ./configure && \ + curl https://download.libsodium.org/libsodium/releases/old/libsodium-1.0.14.tar.gz | tar -xz && \ + cd /tmp/libsodium-1.0.14 && \ + ./configure --disable-shared && \ make && \ make install && \ - rm -rf /tmp/libsodium-1.0.18 + rm -rf /tmp/libsodium-1.0.14 ``` 1. Build `libindy` diff --git a/docs/build-guides/windows-build.md b/docs/build-guides/windows-build.md index 2ce820528f..f9b00e43f8 100644 --- a/docs/build-guides/windows-build.md +++ b/docs/build-guides/windows-build.md @@ -43,7 +43,7 @@ git clone https://github.com/hyperledger/indy-sdk.git ### Binary deps - https://www.npcglib.org/~stathis/downloads/openssl-1.0.2k-vs2017.7z -- https://download.libsodium.org/libsodium/releases/libsodium-1.0.18-msvc.zip +- https://download.libsodium.org/libsodium/releases/old/libsodium-1.0.14-msvc.zip ### Source deps diff --git a/libindy/ci/centos.dockerfile b/libindy/ci/centos.dockerfile index e1e5d14c59..62c8d0c959 100755 --- a/libindy/ci/centos.dockerfile +++ b/libindy/ci/centos.dockerfile @@ -22,12 +22,12 @@ RUN curl --silent --location https://rpm.nodesource.com/setup_8.x | bash - RUN yum -y install nodejs RUN cd /tmp && \ - curl https://download.libsodium.org/libsodium/releases/libsodium-1.0.18.tar.gz | tar -xz && \ - cd /tmp/libsodium-1.0.18 && \ + curl https://download.libsodium.org/libsodium/releases/old/libsodium-1.0.14.tar.gz | tar -xz && \ + cd /tmp/libsodium-1.0.14 && \ ./configure && \ make && \ make install && \ - rm -rf /tmp/libsodium-1.0.18 + rm -rf /tmp/libsodium-1.0.14 ENV PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib diff --git a/libindy/ci/ubuntu.dockerfile b/libindy/ci/ubuntu.dockerfile index 7fd5f99057..ed09c20921 100755 --- a/libindy/ci/ubuntu.dockerfile +++ b/libindy/ci/ubuntu.dockerfile @@ -9,9 +9,6 @@ RUN apt-get update && \ libgmp3-dev \ curl \ build-essential \ - autoconf \ - automake \ - libtool \ libsqlite3-dev \ cmake \ git \ @@ -24,6 +21,7 @@ RUN apt-get update && \ wget \ devscripts \ libncursesw5-dev \ + libzmq3-dev \ zip \ unzip \ jq @@ -40,27 +38,13 @@ RUN pip3 install -U \ plumbum \ deb-pkg-tools -ARG LIBSODIUM_VERSION=1.0.18 - -RUN cd /tmp && \ - curl https://download.libsodium.org/libsodium/releases/libsodium-$LIBSODIUM_VERSION.tar.gz | tar -xz && \ - cd /tmp/libsodium-$LIBSODIUM_VERSION && \ - ./configure && \ - make && \ - make install && \ - rm -rf /tmp/libsodium-$LIBSODIUM_VERSION && \ - ldconfig -n /usr/local/lib - -ARG LIBZEROMQ_VERSION=4.3.1 - RUN cd /tmp && \ - curl https://codeload.github.com/zeromq/libzmq/tar.gz/v$LIBZEROMQ_VERSION | tar -xz && \ - cd /tmp/libzmq-$LIBZEROMQ_VERSION && \ - ./autogen.sh && ./configure && \ + curl https://download.libsodium.org/libsodium/releases/old/libsodium-1.0.14.tar.gz | tar -xz && \ + cd /tmp/libsodium-1.0.14 && \ + ./configure --disable-shared && \ make && \ make install && \ - rm -rf /tmp/libzmq-$LIBZEROMQ_VERSION && \ - ldconfig -n /usr/local/lib + rm -rf /tmp/libsodium-1.0.14 RUN apt-get update && apt-get install openjdk-8-jdk -y ENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-amd64