https://github.com/10d9e/zk-pass
A password authentication service, based on the chaum-pedersen zero-knowledge interactive protocol
https://github.com/10d9e/zk-pass
chaum-pedersen cryptography rust zero-knowledge
Last synced: about 1 year ago
JSON representation
A password authentication service, based on the chaum-pedersen zero-knowledge interactive protocol
- Host: GitHub
- URL: https://github.com/10d9e/zk-pass
- Owner: 10d9e
- License: mit
- Created: 2023-10-28T11:59:32.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-11-14T16:19:58.000Z (over 2 years ago)
- Last Synced: 2025-04-12T12:16:44.826Z (about 1 year ago)
- Topics: chaum-pedersen, cryptography, rust, zero-knowledge
- Language: Rust
- Homepage: https://10d9e.github.io/zk-pass/zk_pass/
- Size: 1.67 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ZKPass 🔑
[](https://nightly.link/jlogelin/zk_pass/workflows/build/main/binaries.zip)
[](https://jlogelin.github.io/zk_pass)
[](LICENSE)
## Overview
The ZKPass server is a command-line application that facilitates a secret verification [Chaum-Pedersen protocol](PROTOCOL.md) 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.
## Quick Start
0. **Install Prerequesites**
```bash
brew install protoc
```
1. **Run the build**
Open a terminal and navigate to the root directory of the project.
```bash
cd path/to/your/zk_pass
cargo build --release
```
2. **Start the server with default parameters**
```bash
❯ ./target/release/server
🔥 Starting ZK_PASS server 🔥
🤖 host: [::1]
🔌 port: 50051
💥 stereotype: discrete_log
🔢 modp group: rfc5114_modp_1024_160
```
3. **In another terminal send a request with the client using default parameters**
```bash
❯ ./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
```
4. **Read about more configuration options by asking for --help**
**Server:**
```bash
❯ ./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 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 Command line option to set the host address for the server. Defaults to "[::1]" if not
specified [default: [::1]]
-m, --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 Command line option to set the port for the server. Defaults to 50051 if not specified
[default: 50051]
-t, --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:**
```bash
❯ ./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 Elliptic curve type for the Elliptic Curve implementation of Chaum-Pedersen [default:
ec25519] [possible values: ec25519, pallas, vesta]
-h, --host The host address of the ZKPass server [default: [::1]]
-m, --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 The port number to connect to the ZKPass server [default: 50051]
-s, --secret Optional secret passcode for authentication
-t, --type Underlying type of the Chaum-Pedersen protocol to use [default: discrete_log] [possible
values: discrete_log, elliptic_curve]
-u, --user Username for identification [default: foo]
```
# Docker
### Running the docker-compose Setup
1. **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.
```bash
cd path/to/your/zk_pass
```
2. **Build the Docker Images:**
Run the following command to build the Docker images as defined in your `docker-compose.yml` file.
```bash
docker-compose build
```
3. **Start the Services:**
To start the services (server and client containers) as defined in the `docker-compose.yml`, run:
```bash
docker-compose up
```
4. **Shutting Down:**
When you're done, you can shut down the containers by pressing `Ctrl+C` in the terminal where `docker-compose up` is running. Alternatively, you can run the following command in another terminal (still in the project root):
```bash
docker-compose down
```
### Building and Running the Container Integration Tests
There are a comprehensive set of dockerized tests for all of the different stereotype configutations. To run them
0. **Make sure Docker is installed**
1. **Navigate to Your Project Directory:**
Open a terminal and navigate to the root directory of the project.
```bash
cd path/to/your/zk_pass
```
2. **Build the Test Container:**
Build the Docker image for your test container. Replace `test-container` with your desired image name.
```bash
docker build -f docker/Dockerfile.test -t test-container .
```
3. **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.
```bash
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:
```bash
❯ 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!
```