0xPolygonID / contracts

Smart contracts for zero-knowledge proofs verification on-chain with PolygonID
GNU General Public License v3.0
85 stars 36 forks source link

what fields of the credential are used for the uniqeness of the nullifier? #27

Closed sirpy closed 6 months ago

sirpy commented 7 months ago

Is it based on the credential id? For example if an issuer created two copies of the same credential with only the id field (randomly generated) different between the two credentials, will that result in two different nullifiers?

elias-garcia commented 6 months ago

No, it's not based on the credential id. The nullifier for a credential is calculated as follows:

Nullifier = hash(genesisID, profileNonce, schemaHash, verifierID, nullifierSessionID)
sirpy commented 6 months ago

@elias-garcia thanks so how is the nullifier uniqueness kept across profiles? if I use a different profile I can use the same credential to generate another unique proof? (as the profilenonce is part of the hash)

elias-garcia commented 6 months ago

@sirpy In Polygon ID that's a responsibility for the issuer. If issuer wants to issue Proof Of Uniqueness credentials it's responsible for not issuing the same credential to more than one profile. This could be done through biometrics for example. A quick example: imagine that you are a government and you want to issue passports after a KYC process. When you pass the KYC for the first time, you will get the credential issued (to the profile you want). If I try to get another credential, the issuer should be aware that I already passed the KYC so he shouldn't issue another credential (even if I'm using a different profile), as the KYC data has already been used to issue a credential before.

OBrezhniev commented 6 months ago

It's profileNonce of profile to which credential was issued (and not which is used to authenticate to the verifier).