Skip to content

Commit

Permalink
Move the end-to-end example to a separate demo crate
Browse files Browse the repository at this point in the history
The example code is now envoked as

    cargo run --example server &
    cargo run --example client

This is intended to make the demo code easier to find on first
inspection, and clarify which dependencies apply to the http
framework use and which are specific to the `t256` curve example.
  • Loading branch information
rillian committed Aug 13, 2024
1 parent 08a70cd commit 6d2f74e
Show file tree
Hide file tree
Showing 9 changed files with 49 additions and 23 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ members = [
"./boomerang",
"./macros",
"./bulletproofs",
"./demo",
]
resolver = "2"
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ clean:

test:
cargo test --release
@echo "Starting end2end example server and client..."

e2e:
cargo build --release --bin server
@echo "Starting end2end example server and client..."
cargo build --release --example server
# Run the server in the background, terminate it after the client
cargo run --release --bin server & \
cargo run --release --example server & \
export SERVER_PID=$$!; \
cargo run --release --bin client; \
cargo run --release --example client; \
kill -s HUP $$SERVER_PID
@echo "Ok"

Expand Down
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ To benchmark:

cargo bench

To see the the protocol in action, run the end2end example client and server
To see the the protocol in action, run the example client and server
programs in separate terminals:
```sh
cargo run --bin server
cargo run --example server
```
and then
```sh
cargo run --bin client
cargo run --example client
```

These end2end examples are also run automatically after the unit tests
Expand All @@ -42,6 +42,7 @@ The implementation is broken down into a number of crates handling
specific parts of the protocol, tests, and demonstration code.

- `boomerang` Overall protocol implementation with separate representations for the client and server sides.
- `demo` Example client and server applications demonstrating the protocol over https.
- `pedersen` Commitment scheme after **Pedersen,**[Non-Interactive and Information-Theoretic Secure Verifiable Secret Sharing](https://doi.org/10.1007/3-540-46766-1_9).” *Advances in Cryptology* CRYPTO ’91, LNCS 576, pp. 129-140, 1992. Based on [code](https://github.com/brave-experiments/CDLS) from the [CDLS paper](https://eprint.iacr.org/2023/1595).
- `t256` and `t384` Elliptic curve implementations using the [arkworks](https://arkworks.rs) framework. These are also from CDLS.
- `acl` [Anonymous Credentials Light](https://eprint.iacr.org/2012/298) blind signature system after **Baldimtsi and Lysyanskaya**, 2012.
Expand Down
38 changes: 38 additions & 0 deletions demo/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
[package]
name = "boomerang-demo"
version = "0.1.1"
description = "Demonstration of the Boomerang protocol over HTTP"
edition = "2021"

[dependencies]
ark-ff = { version = "0.4.2", default-features = false }
ark-ec = { version = "0.4.2", default-features = false }
ark-r1cs-std = { version = "0.4.0", default-features = false, optional = true }
ark-std = { version = "0.4.0", default-features = false }
ark-secp256r1 = {default-features = false, git = "https://github.com/arkworks-rs/curves" }
ark-serialize = { version = "0.4.2", default-features = false }
pedersen = { path="../pedersen" }
acl = { path="../acl" }
boomerang = { path="../boomerang" }
boomerang-macros = { path="../macros"}
t256 = { path = "../t256" }
rand = { version = "0.8.5" }
rand_core = { version = "0.6.4" }
merlin = { version = "3.0.0" }
ark-ff-macros = { version = "0.4.2", default-features = false }
sha2 = "0.10.8"
axum = "0.7" # or the latest version
axum-server = { version = "0.6", features = ["tls-rustls"] }
tokio = { version = "1", features = ["full"] }
tracing = "0.1" # Ensure you have tracing
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
reqwest = { version = "0.12", features = ["rustls-tls", "json"] }
serde = { version = "1", features = ["derive"] }
bincode = "1.3"
lazy_static = "1.4.0"

[dev-dependencies]
ark-relations = { version = "0.4.0", default-features = false }
ark-secp256r1 = {default-features = false, git = "https://github.com/arkworks-rs/curves" }
criterion = "0.5.1"
sha2 = "0.10.8"
File renamed without changes.
File renamed without changes.
10 changes: 2 additions & 8 deletions t256/src/e2e/server.rs → demo/examples/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,8 @@ async fn main() {
tokio::spawn(redirect_http_to_https(ports));

let config = RustlsConfig::from_pem_file(
PathBuf::from(env!("CARGO_MANIFEST_DIR"))
.join("src")
.join("e2e")
.join("cert.pem"),
PathBuf::from(env!("CARGO_MANIFEST_DIR"))
.join("src")
.join("e2e")
.join("key.pem"),
PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("cert.pem"),
PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("key.pem"),
)
.await
.unwrap();
Expand Down
File renamed without changes.
8 changes: 0 additions & 8 deletions t256/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,3 @@ harness = false
default = []
std = [ "ark-std/std", "ark-ff/std", "ark-ec/std" ]
r1cs = [ "ark-r1cs-std" ]

[[bin]]
name = "server"
path = "src/e2e/server.rs"

[[bin]]
name = "client"
path = "src/e2e/client.rs"

0 comments on commit 6d2f74e

Please sign in to comment.