A Chaum-Pedersen Zero-Knowledge Protocol implementation for password-based authentication.
See Notes for more information on the application design and possible future improvements.
-
Start the server
$ cargo run -p zkp-server ================== ZKP Auth (Server) ================== [i] Listening on '127.0.0.1:3000'
See full help information with the
--helpflag.ZKP Auth Server Usage: zkp-server [OPTIONS] Options: -l, --listen <URI> Sets the address to listen on [default: 127.0.0.1:3000] Valid: `3000`, `127.0.0.1`, `127.0.0.1:3000` [env: PORT] -h, --help Print help -V, --version Print version
You can specify the address and port you want your server to run on as such:
$ cargo run -p zkp-server -- -l 127.0.0.1:3004 ================== ZKP Auth (Server) ================== [i] Listening on '127.0.0.1:3004'
Additionally, the app checks to see if the
PORTenvironment variable is defined:$ PORT=5004 cargo run -p zkp-server ================== ZKP Auth (Server) ================== [i] Listening on '127.0.0.1:5004'
-
In another terminal, connect to the server and register a user
$ cargo run -p zkp-client register =============== ZKP Auth (Registration) =============== [?] Enter a User ID: peggy [?] Select a Password: [i] Successfully registered user =============== ZKP Auth (Registration) ===============
See full help information with the
--helpflag.Registers a new user Usage: zkp-client register [OPTIONS] Options: -u, --username <USERNAME> Specifies the username to register -p, --password <PASSWORD> Specifies the password to register [env: PASSWORD] -s, --server <URI> Specifies the server address to connect to [default: http://127.0.0.1:3000] -h, --help Print help
-
Now you can login (you get 3 tries to enter the correct password)
$ cargo run -p zkp-client login =================== ZKP Auth (Login) ================== [?] Enter Your User ID: peggy [?] Enter Your Password: [i] Successfully authenticated user, session ID is: "F0tkGNreN6Cy" =================== ZKP Auth (Login) ==================
See full help information with the
--helpflag.Logs in an existing user Usage: zkp-client login [OPTIONS] Options: -u, --username <USERNAME> Specifies the username to login with -p, --password <PASSWORD> Specifies the password to login with [env: PASSWORD] -s, --server <URI> Specifies the server address to connect to [default: http://127.0.0.1:3000] -h, --help Print help
Alternatively, if you want to use docker and you have docker installed. Follow the steps below:
-
Build the images
docker compose build -
Start the server
docker compose up zkp-server -
In another terminal, connect to the server and register a user
docker compose run zkp-client register -
Now you can login (you get 3 tries to enter the correct password)
docker compose run zkp-client login
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as below, without any additional terms or conditions.
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.