Coder Social home page Coder Social logo

anon-aadhaar / anon-aadhaar Goto Github PK

View Code? Open in Web Editor NEW
103.0 3.0 15.0 3.89 MB

Anon Aadhaar is a zero-knowledge protocol that allows Aadhaar ID owners to prove their identity in a privacy preserving way.

Home Page: https://anon-aadhaar-documentation.vercel.app

License: MIT License

JavaScript 0.39% Shell 3.02% TypeScript 51.15% Circom 34.23% Solidity 11.21%
aadhaar pcd privacy zk

anon-aadhaar's Introduction

Anon Aadhaar

Anon Aadhaar is a protocol for proving ownership of an Aadhaar identity (Indian Residence ID) in a privacy-preserving manner. It lets users generate a ZK proof of their identity by only revealing the information they want to share (to an application).

Developers can use the AnonAadhaar SDK to integrate this into their applications to verify the identity of users without asking them to reveal more personal data than necessary. The proof generated can also be verified on EVM-based blockchains making Anon Aadhaar suitable for on-chain applications.

Demo App: Anon Aadhaar Example | Source

Documentation: Anon Aadhaar Documentation


How it works

Aadhaar data is signed by the government. Anon Aadhaar uses zero-knowledge circuits to verify this signature and generate proof of it.

A "verifier" (an app or a smart contract) verifying the proof can be sure the "prover" had a valid Aadhaar containing the information (like age, state, gender) they revealed.

Anon Aadhaar works on the client side (browser, mobile app) and does not require the user to send their Aadhaar details to any server. Read more


๐Ÿ“ฆ Packages

This repo contains the core ZK circuits of Anon Aadhaar and JS/React SDKs for developers to integrate into their applications.

The following packages are available, and published to npm:

To build on top of Anon Aadhaar, read out documentation here and check out the boilerplate repo (Next.js)


Building and Running locally

Below steps are for building Anon Aadhaar circuits locally and generating proof with it.

For production, always use the published npm packages.

Requirements:

  • Node JS (v18 or higher)
  • Yarn

Install dependencies

yarn install

Build libraries

yarn build:libraries

Build circuit and generate zkey

# PWD = packages/circuits

yarn dev-install
yarn build-circuit
yarn dev-setup

This will generate the build folder with the compiled circuit and artifacts. The generated zkey is only meant for testing and should not be used in production.

โš ๏ธ This will take a couple of minutes to finish.

Generate test data

# PWD = packages/circuits

yarn gen-test-data

This will generate dummy Aadhaar data and save it to packages/circuits/assets/test.json

The generated test data is verified using a test public/private key pair.

You can also use your real Aadhaar by setting env REAL_DATA=true and QR_DATA=<QR_DATA> (the large number in the Aadhaar QR code) in the gen-proof script in the next section.

Generate Witness and proof

# PWD = packages/circuits

yarn gen-witness
yarn gen-proof

This will generate and save the proof to packages/circuits/build/proofs/proof.json and the public signals to packages/circuits/build/proofs/public.json

Verify the proof

yarn verif-proof

This will verify the generated proof and print the result to the console.

Verify on-chain

You can also generate the solidity verifier contract using yarn gen-contracts and deploy it to a blockchain to verify the proof on-chain. You can use this method to convert the generated proof to a format that can be used in the contract.


Contributing

Contributions with fixes and general improvements are always welcome. Please check the PR template

New features are currently being developed internally, but if you would like to work on any open issues, please comment on them and it will be assigned to you if possible.


Our Community

  • PSE Discord server:
  • Twitter account:
  • Telegram group:

Please join our Telegram group to receive updates, ask questions, get support with integration, etc.


License

MIT

anon-aadhaar's People

Contributors

aguzmant103 avatar meyanis95 avatar saleel avatar turupawn avatar vuvoth avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

anon-aadhaar's Issues

feat: Enable test vs staging in react lib

What is the feature?

The main flow for now is to extract the modulus (RSA public key) from the PDF, which enables us to test with a random RSA signature. But to check Aadhaar authenticity the inputted modulus must be the official public key.

The feature will consist of boolean parameters initialized in the react context provider, if true it will take the modulus from PDF, if false it will take the official modulus.

Prove user know a pdf password

Motivation

In current version, prover only need provide a pdf file, however prover must provide password of pdf also to ensure he have permission on this pdf file.

Solution

Researching...

Nullifier: double proof preventing mechanism

Problem

We use zkp protocol to create proof for signature. This mean one user can create the proof from his data and share it for other people. We don't know who create this proof but this proof still valid. They can use this proof to cheat our systems. We should think the mechanism to avoid this case.

feat: React Native Support

Feature

Currently anon-aadhaar-react doesn't support with react-native. I'm happy to work package for anon-aadhaar-react-native

Error

image

Create test vectors

What is the feature?

These test vectors are needed to directly test our circuit, they make abstraction of the PCD and the typescript implementation.

Additional context (optional)

These vectors will enable testing new frameworks.
Check the following example

Artifacts import in pcd.ts/getVerifyKey() doesn't work when using the package

As the path is the relative path from the root src folder, when building the package this path is not relevant anymore.

function getVerifyKey() {
  // eslint-disable-next-line @typescript-eslint/no-var-requires
  const verifyKey = require('../artifacts/verification_key.json')
  return verifyKey
}

There is some solutions to this problem:

  • Change the way the path is implemented, so the relative path works in src and in build
  • Implement a bundler

UI fixes

What is the bug?

  • Title and Label font color to black
  • Add disclaimer and explanation in model
  • Improve input file button UI
  • Proof component size and display

How can it be reproduced? (optional)

Include steps, code samples, replies, screenshots and anything else that would be helpful to reproduce the problem.

Additional context (optional)

Add any other context about the problem here.

Create new test PDF

What is the bug?

As we are changing the way to compute the witness, we will to generate a new test PDF that support the same signature type as the original PDF.
This is needing to enhance our unitary tests and enable users to test our tool without an Aadhaar card.

Generate a PDF with the following specs:

  • adbe.x509.rsa.sha1
  • Signature length: 128
  • V = 2
  • Password encrypted (optional)

Prove proof not created by user functionability

Motivation

We should support selective disclosure on anon aadhaar. Users/Prover can prove they don't create exist proof, without review her/his(their) all information of him. However, Users/Prover can do it if they hold some private information. Malicious parties can not create this proof because they don't know this information.

We can use this to handle a lot of illegitimate action/transaction.

Solution

Researching...

feat: package proving flow to deliver it in a web-worker

What is the bug?

For now, the proving flow is working on browsers but as it is running in the main thread it can cause freezes or even an overflow on not powerful computers/mobiles.

How can it be solved? (optional)

We can try to package the proving flow in a web-worker using this lib.

Can't use Big int in Zupass

For now we can't verify a proof using the SDK in the Zupass repo, because it's not compatible with es2015.

When importing the verify function I have these errors:

โœ˜ [ERROR] Big integer literals are not available in the configured target environment ("es2015")
@pcd/passport-interface:dev: 
@pcd/passport-interface:dev:     ../../../anon-aadhaar/node_modules/wasmcurves/src/bigint.js:107:15:
@pcd/passport-interface:dev:       107 โ”‚     return n - 1n;
@pcd/passport-interface:dev:           โ•ต                ~~

One time/limited use pcd argument.

Relate with #28

Motivation

We can limited number proof user can create. This is useful for avoid spam and DOS attack

Research

We can add RLN circuit to our circuit or think about another solution.

Test web prover in pcd packages

With web prover we can fetch proving key data from Web server. For testing web prover we should:

  • Create mock server to store key.
  • Test fetch key from server
  • PCD flow should run successfully.

Miss depenency qpdf

What is the bug?

We miss auto install qpdf for command yarn gen-pdf in pcd packkage

How can it be reproduced? (optional)

Run yarn gen-pdf in pcd package.

Update RSA verify circuit: Use circuit in zk-email-verify

Motivation

After benchmark a few circuits open source implemented on Github(check the issue #16) , The RSA circuit in zk-email-verify have a good performance more than another circuit. We should replace current circuit to zk-email-verify.

Plan

  • Clone circuit from zk-email-verify.
  • Modify circuit and support RSA signature use sha1 hash function.

Proof is not working anymore

What is the bug?

Proof is not being created , trapped in error

How can it be reproduced? (optional)

Simple try logging in with Aadhar

Additional context (optional)

This is the error Uncaught (in promise) Error: Not all inputs have been set. Only 96 out of 97

and i think its become zkey json was changed

Research about CP SNARK

Motivation

CP-SNARK help we modular prove system on same witness input. This can be good for compose and exchange credential between parties based on same witness about one people without lack privacy.

This also another direction research to improve performance/

zk-regex research

Motivation

We should proof data we extract from identity sources(from pdf file, website, xml data). The zk-regex is one of good direction we should try.

Plan and expect outcome.

  • Understand zk-regex constructions
  • Build a few playground examples
  • Think how we can apply it to anon-aadhaar project.

Explore new Aadhaar endpoints

What is the bug?

It seems that the Aadhaar pdf cars is not the main way to handle the Indian citizenship. We need to explore new ways to interact with the Indian Identity that feets more with the actual user journey.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.