By default, the Indy SDK stores wallet data in an embedded SQLite database. It also provides an API for plugging in various types of wallet storage backends.
This project provides an Indy wallet storage plugin that allows the use of a MySQL compatible database.
Operating System | Version | Architecture | |
---|---|---|---|
i386 | amd64 | ||
Ubuntu | 18.04 LTS (Bionic Beaver) | ✖ | ✔ |
It has been used with:
- MySQL 5.7, MySQL 8.0
- MariaDB
- AWS RDS
- Azure Database for MySQL
- Install the Debian package provided by Evernym support,
- Setup an empty database with credentials that can be used by the application,
- Use the database tools to setup the schema using this SQL script.
- Then follow the instructions for the method you use to interact with the wallet.
If you are using LibVCX you need to set these config values in vcx_init
.
"wallet_type": "mysql"
"storage_config": "{
db_name: "<database name>",
port: "<mysql db port>",
write_host: "<mysql db write hostname>",
read_host: "<mysql db read hostname>", // in most usecases this is the same host
}"
"storage_credentials": "{
user: "<db username>",
pass: "<db user password>"
}"
You then need to call the mysql_storage_init
function from your application code to register the plugin to libindy. You can then access the wallet as normal.
To use libIndy directly, you need to call the mysql_storage_init
function from your application code to register the plugin to libindy.
Then, when you call libindy wallet functions such as create_wallet
or open_wallet
, you pass in the wallet configuration and database credentials as parameters:
config: {
storage_type: "mysql",
storage_config: {
db_name: "<database name>",
port: "<mysql db port>",
write_host: "<mysql db write hostname>",
read_host: "<mysql db read hostname>", // usually the same as the write_host
}
}
credentials: {
storage_credentials: {
user: "<db username>",
pass: "<db user password>"
}
}
There is a migration script available for moving from the SQLite wallet storage to MySQL. See the migration subdirectory.
- Install dependencies
- Git
- C compiler -- gcc, clang...
- Rust and Cargo -- https://rustup.rs/
libindy
library on yourLD_LIBRARY_PATH
-
Clone the code repository
-
From the
libmysqlstorage
directory, run the following command:
cargo build
After this you will have library artifacts in libmysqlstorage/target/debug/
directory.
libmysqlstorage/target/debug/libmysqlstorage.d
libmysqlstorage/target/debug/libmysqlstorage.rlib
libmysqlstorage/target/debug/libmysqlstorage.so
Before starting tests you need to configure DB connection parameters.
This is done by setting the appropriate ENV variables in your execution environment, and is controlled by the code located in the test_env file.
Variables that need to be set are:
DB_USER
DB_PASS
DB_WRITE_HOST
DB_READ_HOST
DB_PORT
DB_NAME
In order to run functional tests go to libmysqlstorage
directory and run the following command:
cargo test
For more info take a look at libmysqlstorage/tests/api.rs
.
There are two different kinds of performance tests:
These performance tests allows you to test the code against real world load.
For more info take a look at libmysqlstorage/tests/performance_tests.rs
.
In order to run these performance tests go to libmysqlstorage
directory and run the following command:
cargo test --package mysqlstorage --test performance_tests performance -- --ignored
These performance tests are useful for getting a general feel of performance/regression of API methods, but they are not testing effects of a real world load.
For more info take a look at libmysqlstorage/tests/chained_perf_test.rs
.
In order to run these performance tests go to libmysqlstorage
directory and run the following command:
cargo test --package mysqlstorage --test chained_perf_test chaned_perf_test::perf_runner -- --exact --ignored
As this library depends on libindy
we created Integration tests using Indy SDK Java Wrapper.
More information about these tests can be found in the integration tests README.md
Information on how CI/CD pipelines work can be found in the following Readme.md