Skip to content

suhasBR/zku-final-project

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

zkEmailAuth

Creating Email Verified Anonymous Identities and Private Groups using Zero Knowledge Proof

About the Project

Anonymous identities are of prime importance today for applications that promise privacy and anonymity to its users. However, often there is a need for these applications to confirm if their users are authentic, i.e, probably belong to a certain group or an organization. One of the possible methods to confirm this would be to verify the user's official email, without compromising on the user's anonymity. zkEmailAuth project aims to achieve the same. The methodology involves getting user's official email, create anonymous identities, verify the email then finally add him/her to the private Semaphore group.

How It Works

The methodology employs 2 phases to achieve email verification without compromising on the anonymity of the user. The user first connects his wallet to the application to begin the verification procedure.

About Groups

Anonymous identities are added to Semaphore groups. These Semaphore groups represent the organization or group tied to the domain of the official email. Each Semaphore group has its own unique ID. Users are allowed to create their own groups by entering the domain of the official email and by choosing an arbitrary ID. If the group already exists, users can check the group ID using the lookup.

Phase 1

In Phase 1, user submits the group ID of the intended group user wishes to join, email address and a secret numeric password. The group ID, public key and secret password are hashed together to create an intermediate hash and sent to a backend server. The backend server generates a cryptographically secure random string and hashes it further to the intermediate hash to generate the final public hash. This public hash is returned to the front end and displayed to the user. Additionally, it is also stored on chain. The random string generated at the server is then sent over email to the address specified by the user. Also, user generates an anonymous identity using Semaphore in this stage and the identity commitment is stored on the browser.

Phase 2

User needs to produce the following in Phase 2 - the group ID, the public hash generated in Phase 1 (this needs to be same as the one stored on chain), the secret numeric password used by the user in Phase 1 and the random string received over user's email. These inputs are then provided as inputs to verify proof generated by a circuit to ensure that the user has not cheated and that this user is same as the one who submitted the data in Phase 1. If the proof verification is successful, user's anonymous identity (stored in browser in Phase 1) is email-verified and thus will be added to the intended group ID.

Project Structure

The project consists of three folders

  1. circuits - contains the circuit written in Circom which helps generate the proof
  2. contracts - contains the main contract and verify contract files along with tests
  3. frontend - NextJS project with the front end and server for sending email Refer to each folders to understand how to use them.

How to Run Locally

Clone the repository

git clone https://github.com/suhasBR/zku-final-project.git

Compile Circuits

cd circuits

Follow instructions given in circuits folder to compile circuits

Run Contracts

cd contracts

Follow instructions given in contracts folder

Run Frontend Enter frontend

cd frontend

Install Dependencies

yarn i

Run Dev Server

yarn dev

Screenshots

How it Works

image

Groups

image

Phase 1

image

Phase 2

image

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks