Function client::main

source ·
pub(crate) fn main() -> Result<(), Box<dyn Error>>
Expand description

Main entry point for the ZKPass client.

Usage

This program starts a client to interact with a server implementing the ZKPass Chaum-Pedersen protocol. It requires command-line arguments to specify its configuration and to perform authentication.

Starting the Client from the Command Line

  1. Open Terminal or Command Prompt: Ensure you have a terminal or command prompt window open.

  2. Navigate to the Project Directory: Use the cd command to navigate to the directory where the client code is located.

    cd path/to/project_directory
    
  3. Build the Project (if needed): If you haven’t already built your Rust project, build it using the cargo build command.

    cargo build
    
  4. Run the Client: Start the client using the cargo run command followed by the necessary options.

    cargo run -- --host <host_address> --port <port_number> --secret <secret_passcode> --user <user_name> --modp <modp_type> --type <protocol_type> --curve <elliptic_curve_type>
    

    Replace <host_address>, <port_number>, <secret_passcode>, <user_name>, <modp_type>, <protocol_type>, and <elliptic_curve_type> with appropriate values.

Command Line Options

  • --host or -h: Sets the host address of the ZKPass server. Defaults to “[::1]” if not specified.
  • --port or -p: Sets the port number of the ZKPass server. Defaults to 50051 if not specified.
  • --secret or -s: Sets the secret passcode for authentication. Optional.
  • --user or -u: Sets the username for authentication. Defaults to “foo” if not specified.
  • --modp or -m: Sets the type of the RFC log group to use. Required if --type is “discrete_log”.
  • --type or -t: Sets the type of the Chaum-Pedersen protocol to use. Possible values: “discrete_log”, “elliptic_curve”.
  • --curve or -c: Sets the elliptic curve type. Required if --type is “elliptic_curve”.

Example Usage

To connect to a server on localhost, port 50051, using the elliptic curve protocol with user “alice”:

cargo run -- --host [::1] --port 50051 --user alice --type elliptic_curve --curve ec25519

Remember to replace the values in the command with those suitable for your setup, and that the server must be serving the same protocol (type, modp, curve) as the client.