MCPcopy Index your code
hub / github.com/anon-aadhaar/anon-aadhaar

github.com/anon-aadhaar/anon-aadhaar @v2.4.3

Chat with this repo
repository ↗ · DeepWiki ↗ · release v2.4.3 ↗ · + Follow
141 symbols 386 edges 55 files 2 documented · 1%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

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

Extension points exported contracts — how you extend this code

KeyPathInterface (Interface)
(no doc) [1 implementers]
packages/core/src/prover.ts
LogInWithAnonAadhaarProps (Interface)
(no doc)
packages/react/src/components/LogInWithAnonAadhaar.tsx
ProverInferace (Interface)
(no doc) [1 implementers]
packages/core/src/prover.ts
FileInputProps (Interface)
(no doc)
packages/react/src/components/FileInput.tsx
GenerateArgsOptions (Interface)
(no doc)
packages/core/src/generateArgs.ts
ScanQRProps (Interface)
(no doc)
packages/react/src/components/ScanQR.tsx
InitArgs (Interface)
(no doc)
packages/core/src/types.ts
LogInWithAnonAadhaarProps (Interface)
(no doc)
packages/react/src/components/LaunchProveModal.tsx

Core symbols most depended-on inside this repo

createBlobURL
called by 14
packages/react/src/util.ts
splitToWords
called by 8
packages/core/src/utils.ts
init
called by 7
packages/core/src/core.ts
generateArgs
called by 7
packages/core/src/generateArgs.ts
getKey
called by 6
packages/core/src/prover.ts
convertBigIntToByteArray
called by 6
packages/core/src/utils.ts
decompressByteArray
called by 6
packages/core/src/utils.ts
prove
called by 6
packages/core/src/core.ts

Shape

Function 102
Interface 15
Method 9
Class 8
Enum 7

Languages

TypeScript100%

Modules by API surface

packages/core/src/utils.ts14 symbols
packages/core/src/prover.ts12 symbols
packages/core/src/qrGenerator.ts11 symbols
packages/core/src/core.ts10 symbols
packages/react/src/provider/AnonAadhaarProvider.tsx9 symbols
packages/react/src/util.ts6 symbols
packages/core/test/__mocks__/localforage.ts6 symbols
packages/react/src/components/LogInWithAnonAadhaar.tsx5 symbols
packages/circuits/scripts/generateTestKeys.ts5 symbols
packages/react/src/components/LaunchProveModal.tsx4 symbols
packages/circuits/test/util.ts4 symbols
packages/react/test/hook.test.tsx3 symbols

For agents

$ claude mcp add anon-aadhaar \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact