This project is an implementation of the Chaum-Pedersen - page 377 section "3. Sigma Protocols" subsection "3.2. Chaum–Pedersen Protocol." - Zero-Knowledge protocol for authentication.
- Preliminaries
- Building the Project
- Running the Program
- Testing the Program
- Design Documentation
- Future Work
There are 2 options for building this project:
- You can build and run it directly with
Cargo. - Alternatively, you can build and run it using
Docker.
- You will need
cargo 1.78+. - Also, make sure you have
rustc 1.78+.
- Ensure you have both the Docker Server and Client version 26+ installed.
To build the project, run the following commands:
> cargo build> docker compose build- Generate Material for params
p,q,gandh.
> cd protocol
> cargo run -- -u johnBy default this will leave 2 files, one for the server in protocol/data/server_material.json and one for the client in protocol/data/client_material.json.
For more information about parameters run cargo run -- --help.
- Start the Verifier
> cd verifier
> RUST_LOG=info cargo run -- -c config/default.tomlverifier/config/default.toml: Contains configuration about how to run the server.
- Run the Prover with some
x
> cd prover
> RUST_LOG=info cargo run -- -p http://localhost:50000 -u john -m ../protocol/data/client_material.json -x 42For more information about parameters run carog run -- --help.
- By default
-pand-mare provided with the values in the example.
### Running with Docker Compose
- Generate material and run server verifier
> docker compose up- Run Prover against server
> cd prover
> RUST_LOG=info cargo run -- -p http://localhost:50000 -u docker_user -m ../protocol/data/client_material.json -x 42For more information about parameters run carog run -- --help.
- By default
-pand-mare provided with the values in the example.
NOTE:
uparam can be changed but for that you will need to editdocker-compose.ymlfile in line 15.
> cargo testIn this section, It will described all the assumptions, decisions, and pending improvements of SOTA of this project.
Domain-Driven Design (DDD) is a software development approach that emphasizes the importance of understanding and modeling the domain of the problem at hand. It encourages collaboration between domain experts and developers to create software that closely aligns with the real-world problem domain. By following DDD principles, developers can create more maintainable, extensible, and robust software systems.
The protocol module is a library that implements the Chaum-Pedersen protocol using a Type-State Pattern to control the flow of the protocol. This implementation uses pure functions, which enable testability, composability, and extensibility. The protocol module also includes a small binary that generates material parameters and saves them into a file using a random generator BigInt, while preserving the properties of the problem. This approach eliminates the need for manual parameter setup.
The verifier module implements a gRPC server for the Protobuf definition, utilizing the protocol module to solve the authentication process. It follows a Domain-Driven Design (DDD) approach. DDD is a software development methodology that focuses on aligning software design with the domain model, enabling better communication and collaboration between domain experts and developers.
The prover module is a client that interacts with the verifier module using the protocol module to authenticate against it.
sequenceDiagram
participant A as Prover
participant B as Verifier
A->>B: Register
A->>B: Commitment
B->>A: Challenge
A->>B: Response Challenge
B->>A: Verification Result TD
All error handling are based on anyhow since the main code is a gRPC server (a.k.a. verifier) and we need to convert all errors back to tonic::Status.
In protocol it could have been used thiserror but since there are any unwrap present and everything is handle in terms of Type-State pattern, there was no need to return errors.
- Implements observability.
- Implements automated integration tests
- Implements CD pipeline and automated deployment