diff options
author | Katharina Fey <kookie@spacekookie.de> | 2018-06-09 22:26:38 +0200 |
---|---|---|
committer | Katharina Fey <kookie@spacekookie.de> | 2018-06-09 22:26:38 +0200 |
commit | c541913c19467563ed55169f1756070b18fd43d4 (patch) | |
tree | 9b23b6c258b2056b3daabf0d0841427b8b97307c | |
parent | 6e34f8294138db7efc5975d5af4a4d2e4cb101a9 (diff) |
Tweaking the documentation for lockchain-http
-rw-r--r-- | Cargo.lock | 66 | ||||
-rw-r--r-- | lockchain-http/src/lib.rs | 26 | ||||
-rw-r--r-- | lockchain-http/src/model.rs | 10 | ||||
-rw-r--r-- | lockchain-server/Cargo.toml | 3 | ||||
-rw-r--r-- | lockchain-server/src/main.rs | 21 |
5 files changed, 87 insertions, 39 deletions
@@ -330,6 +330,14 @@ dependencies = [ ] [[package]] +name = "cloudabi" +version = "0.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] name = "cmac" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -715,6 +723,16 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] +name = "insult" +version = "2.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "failure 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "xdg 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] name = "iovec" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -783,12 +801,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" name = "lockchain-client" version = "0.0.0" dependencies = [ - "lockchain-core 0.7.1", + "lockchain-core 0.7.2", ] [[package]] name = "lockchain-core" -version = "0.7.1" +version = "0.7.2" dependencies = [ "base64 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "bcrypt 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -804,7 +822,7 @@ dependencies = [ name = "lockchain-crypto" version = "0.7.0" dependencies = [ - "lockchain-core 0.7.1", + "lockchain-core 0.7.2", "miscreant 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.66 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.66 (registry+https://github.com/rust-lang/crates.io-index)", @@ -812,20 +830,20 @@ dependencies = [ [[package]] name = "lockchain-files" -version = "0.7.0" +version = "0.7.1" dependencies = [ - "lockchain-core 0.7.1", + "lockchain-core 0.7.2", ] [[package]] name = "lockchain-http" -version = "0.1.1" +version = "0.2.0" dependencies = [ "actix 0.5.8 (registry+https://github.com/rust-lang/crates.io-index)", "actix-web 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)", - "lockchain-core 0.7.1", + "lockchain-core 0.7.2", "serde 1.0.66 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.66 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -835,9 +853,10 @@ name = "lockchain-server" version = "0.1.0" dependencies = [ "clap 2.31.2 (registry+https://github.com/rust-lang/crates.io-index)", - "lockchain-core 0.7.1", - "lockchain-files 0.7.0", - "lockchain-http 0.1.1", + "insult 2.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "lockchain-core 0.7.2", + "lockchain-files 0.7.1", + "lockchain-http 0.2.0", ] [[package]] @@ -1132,6 +1151,23 @@ dependencies = [ ] [[package]] +name = "rand" +version = "0.5.1" +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-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rand_core" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] name = "rayon" version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1802,6 +1838,11 @@ dependencies = [ "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "xdg" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [metadata] "checksum actix 0.5.8 (registry+https://github.com/rust-lang/crates.io-index)" = "7f0b2daad36916ccd2b162dbc5a04a74df642a29391b1a341c8ee3e82026cb16" "checksum actix-web 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)" = "39511e3e552addb839a2db972f5a8096d43c1c4699cd1fa83e39f664c969a033" @@ -1835,6 +1876,7 @@ dependencies = [ "checksum chrono 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1cce36c92cb605414e9b824f866f5babe0a0368e39ea07393b9b63cf3844c0e6" "checksum clap 2.31.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f0f16b89cbb9ee36d87483dc939fe9f1e13c05898d56d7b230a0d4dff033a536" "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 cmac 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "44f175b5f76aa82ebe4c7e85ef95b23e9293c5618db28461cb10ee929e0f6e2f" "checksum constant_time_eq 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8ff012e225ce166d4422e0e78419d901719760f62ae2b7969ca6b564d1b54a9e" "checksum cookie 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "746858cae4eae40fff37e1998320068df317bc247dc91a67c6cfa053afdc2abb" @@ -1881,6 +1923,7 @@ dependencies = [ "checksum humantime 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0484fda3e7007f2a4a0d9c3a703ca38c71c54c55602ce4660c419fd32e188c9e" "checksum idna 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "014b298351066f1512874135335d62a789ffe78a9974f94b43ed5621951eaf7d" "checksum indexmap 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "08173ba1e906efb6538785a8844dd496f5d34f0a2d88038e95195172fc667220" +"checksum insult 2.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "301fff6df3e54de1f65861fd574371e572588a96045a76bb909a3587c66ef4d9" "checksum iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dbe6e417e7d0975db6512b90796e8ce223145ac4e33c377e4a42882a0e88bb08" "checksum ipconfig 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "9ec4e18c0a0d4340870c14284293632d8421f419008371422dd327892b88877c" "checksum itoa 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c069bbec61e1ca5a596166e55dfe4773ff745c3d16b700013bcaff9a6df2c682" @@ -1925,6 +1968,8 @@ dependencies = [ "checksum quote 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e44651a0dc4cdd99f71c83b561e221f714912d11af1a4dff0631f923d53af035" "checksum rand 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)" = "15a732abf9d20f0ad8eeb6f909bf6868722d9a06e1e50802b6a70351f40b4eb1" "checksum rand 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "eba5f8cb59cc50ed56be8880a5c7b496bfd9bd26394e176bc67884094145c2c5" +"checksum rand 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "482c45f965103f2433002a0c4d908599f38d1b8c1375e66e801a24c1c6cadc03" +"checksum rand_core 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "edecf0f94da5551fc9b492093e30b041a891657db7940ee221f9d2f66e82eef2" "checksum rayon 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b614fe08b6665cb9a231d07ac1364b0ef3cb3698f1239ee0c4c3a88a524f54c8" "checksum rayon-core 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9d24ad214285a7729b174ed6d3bcfcb80177807f959d95fafd5bfc5c4f201ac8" "checksum redox_syscall 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)" = "c214e91d3ecf43e9a4e41e578973adeb14b474f2bee858742d127af75a0112b1" @@ -2006,3 +2051,4 @@ dependencies = [ "checksum winreg 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a27a759395c1195c4cc5cda607ef6f8f6498f64e78f7900f5de0a127a424704a" "checksum winutil 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7daf138b6b14196e3830a588acf1e86966c694d3e8fb026fb105b8b5dca07e6e" "checksum ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e" +"checksum xdg 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a66b7c2281ebde13cf4391d70d4c7e5946c3c25e72a7b859ca8f677dcd0b0c61" diff --git a/lockchain-http/src/lib.rs b/lockchain-http/src/lib.rs index 2a640c3..5192de2 100644 --- a/lockchain-http/src/lib.rs +++ b/lockchain-http/src/lib.rs @@ -1,15 +1,15 @@ -// //! A plug and play http interface layer for various lockchain components -// //! -// //! The way this is done is by shimming a common REST interface (via actix-web) in -// //! between common `lockchain-core` types and the `lockchain-client` library which -// //! is a base wrapper around `reqwest` which uses this API. -// //! -// //! You can of course also use whatever other library, in whatever language you want -// //! to access this API. Doing so via the *official* client gives you the ability to -// //! negotiate version numbers and have more advanced error handling built-in. -// //! -// //! Ideally this shim-layer version should be the same as the `lockchain-core` it binds -// //! against, however especially during development this won't always be the case. +//! A plug and play http interface layer for various lockchain components +//! +//! The way this is done is by shimming a common REST interface (via actix-web) in +//! between common `lockchain-core` types and the `lockchain-client` library which +//! is a base wrapper around `reqwest` which uses this API. +//! +//! You can of course also use whatever other library, in whatever language you want +//! to access this API. Doing so via the *official* client gives you the ability to +//! negotiate version numbers and have more advanced error handling built-in. +//! +//! Ideally this shim-layer version should be the same as the `lockchain-core` it binds +//! against, however especially during development this won't always be the case. #[macro_use] extern crate serde_derive; @@ -21,7 +21,7 @@ extern crate lockchain_core as lockchain; mod handlers; mod model; -// pub use model::CarrierMessage; +pub use model::CarrierMessage; use actix_web::{server, App}; use lockchain::traits::{Body, Vault}; diff --git a/lockchain-http/src/model.rs b/lockchain-http/src/model.rs index bd8b6c1..c775ee6 100644 --- a/lockchain-http/src/model.rs +++ b/lockchain-http/src/model.rs @@ -1,10 +1,10 @@ -//! API data models +//! Data models specific to the lockchain API use lockchain::errors::Error as LockError; -use serde::{Serialize, de::DeserializeOwned}; +use serde::{de::DeserializeOwned, Serialize}; -/// A generic container that json wraps lockchain-types -/// +/// A generic container that json/error wraps lockchain-types +/// /// This is heavily used in the lockchain-REST API and can be utilised /// to send both encrypted and cleartext data via the API endpoint, using /// the same code. @@ -13,4 +13,4 @@ pub struct CarrierMessage<T: Serialize + DeserializeOwned> { pub error: Result<(), LockError>, #[serde(bound(deserialize = "T: Serialize + DeserializeOwned"))] pub data: Option<T>, -}
\ No newline at end of file +} diff --git a/lockchain-server/Cargo.toml b/lockchain-server/Cargo.toml index 6faeba2..7398ea2 100644 --- a/lockchain-server/Cargo.toml +++ b/lockchain-server/Cargo.toml @@ -8,4 +8,5 @@ lockchain-core = { path = "../lockchain-core" } lockchain-files ={ path = "../lockchain-files" } lockchain-http = { path = "../lockchain-http" } -clap = "*"
\ No newline at end of file +clap = "2.0" +insult = "2.0.3"
\ No newline at end of file diff --git a/lockchain-server/src/main.rs b/lockchain-server/src/main.rs index 089f490..25ba54d 100644 --- a/lockchain-server/src/main.rs +++ b/lockchain-server/src/main.rs @@ -4,17 +4,18 @@ extern crate lockchain_http; extern crate clap; +// use lockchain_core::{traits::*, EncryptedBody}; +// use lockchain_http::create_server; +// use lockchain_files::DataVault; + fn main() { - use lockchain_core::{traits::*, EncryptedBody}; - use lockchain_http::create_server; - use lockchain_files::DataVault; - let server = create_server( - "localhost", - "8080", - DataVault::<EncryptedBody>::new("name", "location"), - ); - server.run(); + // let server = create_server( + // "localhost", + // "8080", + // DataVault::<EncryptedBody>::new("name", "location"), + // ); + // server.run(); - println!("After the server died!"); + // println!("After the server died!"); } |