This project demonstrates a simple implementation of a zero-knowledge proof (ZKP) system for password verification. It allows a prover (client) to prove knowledge of a password to a verifier (validator) without revealing the password itself.
The system consists of two main components:
- Client (Prover): Generates a proof of knowledge of the password.
- Validator (Verifier): Verifies the proof without learning the password.
The client uses the password to derive a private key, then generates a commitment, challenge, and response. The validator can verify the correctness of these values without ever seeing the original password.
- Node.js (v12.0.0 or higher recommended)
- npm (usually comes with Node.js)
-
Clone this repository:
git clone <repository-url> cd <repository-name>
-
Install the dependencies:
npm install
-
Run the client to generate the proof:
node client.js
This will create a
data.json
file containing the proof data. -
Run the validator to verify the proof:
node validator.js
The validator will read the
data.json
file and output whether the proof is valid or not.
client.js
: Implements the prover's side of the ZKP system.validator.js
: Implements the verifier's side of the ZKP system.data.json
: Intermediate file used to pass data from the client to the validator.
This is a simplified implementation for educational purposes and should not be used in production environments without further security measures and peer review.
This project is licensed under the ISC License. See the package.json
file for details.