GithubHelp home page GithubHelp logo

kaleido-io / kaleido-iden3-samples Goto Github PK

View Code? Open in Web Editor NEW
3.0 11.0 4.0 92.17 MB

Sample code for using the iden3 protocol to issue verifiable claims

License: Apache License 2.0

Go 43.85% Solidity 12.60% JavaScript 39.34% HTML 0.28% CSS 1.24% Makefile 1.31% Shell 1.04% Dockerfile 0.34%

kaleido-iden3-samples's Introduction

Kaleido Tutorials for Polygon ID and the iden3 protocol

There are two versions:

  • v1: based on the iden3 stack as of December 2022. Even though some of the components in the stack have been updated to support the Polygon ID platform, such as the circuits for the zero knowledge proofs, it's still a good source of information on the basics of the iden3 protocol. It's also easier to set up because it's all based on command line based programs

  • v2: based on the Polygon ID release 1.0 beta 3. It uses microservices built with the Polygon ID code to illustrate a more realistic workflow interactions between the issuer, the holder wallet and the verifier.

kaleido-iden3-samples's People

Contributors

chengxuan avatar jimthematrix avatar nedgar avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

kaleido-iden3-samples's Issues

support multiple claims and verification

  • add support for issuing different claims
  • make the holder select the right claim based on the QR query
  • Make the verifier, via different QR codes, be able to prompt for different claim proofs

Iden3/snarkJS questions

Hi Kaleido-iden3 team members:
we have several questions when executing the demo in https://github.com/iden3/snarkjs

  1. Should the entropy and the hashes be kept during the ceremony contribution part? What are these hashes meaning (contribution response hash/ next challenge hashes)?
  2. What's the purpose of applying random beacon?
  3. In kaleido-iden3 repo, how is the circuit_final.zkey file generated? which role is responsible for the generation of circuit_final.zkey file?
  4. How does the witness.wtns generated based on circom by the prover?
  5. How would verifier believe according to the public.json and proof.json generated by prover?

Proof generation with false condition fails with Assert Failed

In identity/internal/claim.go, I changed the birthday to not satisfy the challenge of being prior to 2000-01-01: birthDay := big.NewInt(20050704), then went through the normal flow of:

  • create the JohnDoe and AliceWonder IDs (make clean identities with PR #11)
  • publish JohnDoe's ID state on-chain (deploying State contract first if needed)
  • issue the claim (make issue-claim)
  • publish it
  • receive and respond to the challenge QR code as AliceWonder (make receive-claim respond-to-challenge).
  • generate the proof as AliceWonder

For the last step, generating the proof (in holder/wallet with command node index.js --holder AliceWonder --qrcode ~/Downloads/challenge-qr.png), it fails with:

...
After adding signal 0 of timestamp
Assert Failed.
Error in template CredentialAtomicQuerySig_350 line: 216

It's expected that the proof cannot be satisfied, but this is an unexpected error message which suggests a programming error.
Is there any way to distinguish between the proof not being satisfied vs. "the inputs are bad" to provide a clearer error message?

Comment on the GDPR note in Readme

Hello @jimthematrix, @Chengxuan!

You have a following note in the Readme file:

Note that the state published to the smart contract is the hash of the latest Merkle trees: hash(claims_root, revocation_root, roots_root). This means that care should be taken when designing the claim schemas. No PII should be part of the claim because a hash of PII is still considered PII under some regulations such as GDPR (details available here).

In the protocol we have two ways of issuing credentials: using MerkleTree Proofs (MTP) and using Babyjubjub signature (Sig).
Only claims issued using Merkletree proofs are added to Claims Tree and end up in Identity State Hash.
Claim issued using BJJ signature are not added to Claims Tree, and do not change Identity State. So there are no GDPR problems with this way of issuing credentials.

Credentials can (and should) include PII. We want users to be able to prove some statements based on the raw data, like date of birth or passort data. Care should be taken not to add such credentials into Claims Tree.

Question about claim indexing with the AgeCredential schema

The AgeCredential schema stores the birthDay in the first index data slot (index value 3 in the Merkle tree):

	birthDay := big.NewInt(19950704)
	claim, _ := core.NewClaim(kycAgeSchema, core.WithIndexID(holderId), core.WithIndexDataInts(birthDay, nil), core.WithRevocationNonce(revNonce))

But doesn't that allow issuing multiple birthday claims instead of just one, since the two claims would have unique index hashes?

Holder wallet's sendCallback is failing with checksum error on holder ID

With @jimthematrix's latest changes in #12, if I go through the steps from scratch, in final step the holder wallet's callback invocation (new) fails with Error: fromBytes error: checksum error in sendCallback line:
from: Id.fromBigInt(BigInt(holderId)).string(),

I added a console.log of the holderId, seen in output below, so it's reading it OK.

e.g.

node index.js --holder AliceWonder --qrcode ~/Downloads/challenge-qr2.png

...
Calculated witness successfully written to file /Users/nedgar/iden3/AliceWonder/witness-079da6b78545c4e08c02.wtns
Successfully generated proof!
holderId: 316342200244053077361837322580837170633470168946294832427234421230335098880
Error: fromBytes error: checksum error
    at Function.fromBytes (/Users/nedgar/src/github.com/kaleido-io/kaleido-iden3-samples/holder/wallet/node_modules/@iden3/js-iden3-core/dist/cjs/id.js:60:19)
    at Function.fromBigInt (/Users/nedgar/src/github.com/kaleido-io/kaleido-iden3-samples/holder/wallet/node_modules/@iden3/js-iden3-core/dist/cjs/id.js:70:19)
    at sendCallback (/Users/nedgar/src/github.com/kaleido-io/kaleido-iden3-samples/holder/wallet/index.js:228:14)
    at generateProof (/Users/nedgar/src/github.com/kaleido-io/kaleido-iden3-samples/holder/wallet/index.js:212:9)

FYI @Chengxuan

Regression in publishing issued claim

Steps:

  • make clean identities
  • deploy contracts
  • publish genesis state on-chain
  • make issue-claim
  • publish new state on-chain

This fails using the latest from main branch.

Identity and Claim Questions

Hi, this is Chengqing from Weiming's team. We have several questions after reviewing this sample.

  1. If we are going to integrate this sample into real product. Are these identity files under the $HOMEDIR/iden3/XXX folder supposed to be saved in user's mobile or server, for instance, Identity Hub?
  2. we cannot find the detailed Merkle tree proof algorithm implementation, neither in this sample nor go-merkletree-sql
  3. we would like to know why generating claim and verifying claim use different language? Generating part uses Golang while verifying uses Javascript?

Use DIDCommon for interactions

Would be great if the message format for issuing claims, presenting challenges and presenting claim proofs follow the DIDComm spec

What's the difference between <-- and <== in circom?

Hi, this is Ling Zhang from Weiming's team. I'm confused about the opeartor <-- and <== in circom.

For example. If I wrote c <== a * b, the value of c is always be equal to a * b since singals are immutable. In my opinion, add a constraint c === a * b is redundant. So why we should use “<==” ?

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.