The ZKPass server is a command-line application that facilitates a secret verification Chaum-Pedersen protocol service. It offers support for both Discrete Log and Elliptic Curve implementations of the protocol.
The following table shows the possible combinations of stereotype(discrete log and elliptic curve) group configurations:
Type | Modp / Curve |
---|---|
discrete_log | rfc5114_modp_1024_160 |
discrete_log | rfc5114_modp_2048_224 |
discrete_log | rfc5114_modp_2048_256 |
elliptic_curve | ec25519 |
elliptic_curve | pallas |
elliptic_curve | vesta |
Note: This table shows a subset of possible combinations focusing on type
, curve
, and modp
options as they must match between the server and client.
-
Install Prerequesites
brew install protoc
-
Run the build Open a terminal and navigate to the root directory of the project.
cd path/to/your/zk_pass cargo build --release
-
Start the server with default parameters
❯ ./target/release/server 🔥 Starting ZK_PASS server 🔥 🤖 host: [::1] 🔌 port: 50051 💥 stereotype: discrete_log 🔢 modp group: rfc5114_modp_1024_160
-
In another terminal send a request with the client using default parameters
❯ ./target/release/client 🔥 Starting ZK_PASS client 🔥 🤖 host: [::1] 🔌 port: 50051 💥 stereotype: discrete_log 🔢 modp group: rfc5114_modp_1024_160 🔑 user: foo 🔑 Authentication successful! 🔑 Session ID: 97f6e2e1-19d5-404e-ad03-aa3a96d10fc1
-
Read about more configuration options by asking for --help
Server:
❯ ./target/release/server --help
server 0.1.0
A server for the ZKPass Chaum-Pedersen protocol service
USAGE:
server [OPTIONS]
FLAGS:
--help Prints help information
-V, --version Prints version information
OPTIONS:
-c, --curve <curve> Command line option to set the elliptic curve type. Required if the stereotype is set to
"elliptic_curve" [default: ec25519] [possible values: ec25519, pallas, vesta]
-h, --host <host> Command line option to set the host address for the server. Defaults to "[::1]" if not
specified [default: [::1]]
-m, --modp <modp> Command line option to set the type of the RFC log group to use. Required if the stereotype
is set to "discrete_log" [default: rfc5114_modp_1024_160] [possible values:
rfc5114_modp_1024_160, rfc5114_modp_2048_224, rfc5114_modp_2048_256]
-p, --port <port> Command line option to set the port for the server. Defaults to 50051 if not specified
[default: 50051]
-t, --type <type> Command line option to set the underlying type of the Chaum-Pedersen protocol to use
[default: discrete_log] [possible values: discrete_log, elliptic_curve]
Client:
❯ ./target/release/client --help
client 0.1.0
A client for the ZKPass server
USAGE:
client [OPTIONS]
FLAGS:
--help Prints help information
-V, --version Prints version information
OPTIONS:
-c, --curve <curve> Elliptic curve type for the Elliptic Curve implementation of Chaum-Pedersen [default:
ec25519] [possible values: ec25519, pallas, vesta]
-h, --host <host> The host address of the ZKPass server [default: [::1]]
-m, --modp <modp> Type of RFC log group to use for the Discrete Log implementation of Chaum-Pedersen
[default: rfc5114_modp_1024_160] [possible values: rfc5114_modp_1024_160,
rfc5114_modp_2048_224, rfc5114_modp_2048_256]
-p, --port <port> The port number to connect to the ZKPass server [default: 50051]
-s, --secret <secret> Optional secret passcode for authentication
-t, --type <type> Underlying type of the Chaum-Pedersen protocol to use [default: discrete_log] [possible
values: discrete_log, elliptic_curve]
-u, --user <user> Username for identification [default: foo]
-
Navigate to Your Project Directory: Open a terminal and navigate to the root directory of the project, where the
docker-compose.yml
file is located.cd path/to/your/zk_pass
-
Build the Docker Images: Run the following command to build the Docker images as defined in your
docker-compose.yml
file.docker-compose build
-
Start the Services: To start the services (server and client containers) as defined in the
docker-compose.yml
, run:docker-compose up
-
Shutting Down: When you're done, you can shut down the containers by pressing
Ctrl+C
in the terminal wheredocker-compose up
is running. Alternatively, you can run the following command in another terminal (still in the project root):docker-compose down
There are a comprehensive set of dockerized tests for all of the different stereotype configutations. To run them
-
Make sure Docker is installed
-
Navigate to Your Project Directory: Open a terminal and navigate to the root directory of the project.
cd path/to/your/zk_pass
-
Build the Test Container: Build the Docker image for your test container. Replace
test-container
with your desired image name.docker build -f docker/Dockerfile.test -t test-container .
-
Run the Test Container: Once the build is complete, you can run the test container. This will execute the tests as defined in your test setup.
docker run test-container
The test will execute and validate the full set of integration test with the client and server, the output will look something like:
❯ docker run test-container
Testing configuration: type=discrete_log, curve=ec25519, modp=rfc5114_modp_1024_160
🔥 Starting ZK_PASS server 🔥
🤖 host: 0.0.0.0
🔌 port: 50051
💥 stereotype: discrete_log
🔢 modp group: rfc5114_modp_1024_160
🔥 Starting ZK_PASS client 🔥
🤖 host: 0.0.0.0
🔌 port: 50051
💥 stereotype: discrete_log
🔢 modp group: rfc5114_modp_1024_160
🔑 user: foo
🔑 Authentication successful! 🔑
Session ID: c78dd9a6-d8e7-4d5d-8ae3-84e4b3779a87
Test passed for configuration: type=discrete_log, curve=ec25519, modp=rfc5114_modp_1024_160
Testing configuration: type=discrete_log, curve=ec25519, modp=rfc5114_modp_2048_224
🔥 Starting ZK_PASS server 🔥
🤖 host: 0.0.0.0
🔌 port: 50051
💥 stereotype: discrete_log
🔢 modp group: rfc5114_modp_2048_224
🔥 Starting ZK_PASS client 🔥
🤖 host: 0.0.0.0
🔌 port: 50051
💥 stereotype: discrete_log
🔢 modp group: rfc5114_modp_2048_224
🔑 user: foo
🔑 Authentication successful! 🔑
Session ID: 6567c805-a57f-41e6-bd02-304b4c8b8b65
Test passed for configuration: type=discrete_log, curve=ec25519, modp=rfc5114_modp_2048_224
Testing configuration: type=discrete_log, curve=ec25519, modp=rfc5114_modp_1024_160
🔥 Starting ZK_PASS server 🔥
🤖 host: 0.0.0.0
🔌 port: 50051
💥 stereotype: discrete_log
🔢 modp group: rfc5114_modp_1024_160
🔥 Starting ZK_PASS client 🔥
🤖 host: 0.0.0.0
🔌 port: 50051
💥 stereotype: discrete_log
🔢 modp group: rfc5114_modp_1024_160
🔑 user: foo
🔑 Authentication successful! 🔑
Session ID: 41560d5c-ca8e-49e5-8f2e-1d077b300dbf
Test passed for configuration: type=discrete_log, curve=ec25519, modp=rfc5114_modp_1024_160
Testing configuration: type=elliptic_curve, curve=ec25519, modp=rfc5114_modp_1024_160
🔥 Starting ZK_PASS server 🔥
🤖 host: 0.0.0.0
🔌 port: 50051
💥 stereotype: elliptic_curve
📈 elliptic curve: ec25519
🔥 Starting ZK_PASS client 🔥
🤖 host: 0.0.0.0
🔌 port: 50051
💥 stereotype: elliptic_curve
📈 elliptic curve: ec25519
🔑 user: foo
🔑 Authentication successful! 🔑
Session ID: a47b981e-2b85-4316-a573-d51bb4427e1d
Test passed for configuration: type=elliptic_curve, curve=ec25519, modp=rfc5114_modp_1024_160
Testing configuration: type=elliptic_curve, curve=pallas, modp=rfc5114_modp_1024_160
🔥 Starting ZK_PASS server 🔥
🤖 host: 0.0.0.0
🔌 port: 50051
💥 stereotype: elliptic_curve
📈 elliptic curve: pallas
🔥 Starting ZK_PASS client 🔥
🤖 host: 0.0.0.0
🔌 port: 50051
💥 stereotype: elliptic_curve
📈 elliptic curve: pallas
🔑 user: foo
🔑 Authentication successful! 🔑
Session ID: e03ee7b0-eae9-43de-816d-528e43aae8f2
Test passed for configuration: type=elliptic_curve, curve=pallas, modp=rfc5114_modp_1024_160
Testing configuration: type=elliptic_curve, curve=vesta, modp=rfc5114_modp_1024_160
🔥 Starting ZK_PASS server 🔥
🤖 host: 0.0.0.0
🔌 port: 50051
💥 stereotype: elliptic_curve
📈 elliptic curve: vesta
🔥 Starting ZK_PASS client 🔥
🤖 host: 0.0.0.0
🔌 port: 50051
💥 stereotype: elliptic_curve
📈 elliptic curve: vesta
🔑 user: foo
🔑 Authentication successful! 🔑
Session ID: 227c090b-85dc-44b7-987a-091be0278248
Test passed for configuration: type=elliptic_curve, curve=vesta, modp=rfc5114_modp_1024_160
All tests passed successfully!