Skip to content

Commit

Permalink
Rename verifier to nullifier session id (#117)
Browse files Browse the repository at this point in the history
* Rename verifierSessionID to nullifierSessionID. Move nullifier template to utils. Regenerate test vectors after rename.

* Fixes
  • Loading branch information
OBrezhniev authored Dec 6, 2023
1 parent 160917f commit 2cb1704
Show file tree
Hide file tree
Showing 64 changed files with 102 additions and 100 deletions.
2 changes: 1 addition & 1 deletion circuits/credentialAtomicQueryV3.circom
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@ component main{public [requestID,
isRevocationChecked,
proofType,
verifierID,
verifierSessionID
nullifierSessionID
]} = credentialAtomicQueryV3OffChain(40, 32, 64);
2 changes: 1 addition & 1 deletion circuits/credentialAtomicQueryV3OnChain.circom
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ component main{public [requestID,
gistRoot,
proofType,
verifierID,
verifierSessionID,
nullifierSessionID,
authEnabled
]} = credentialAtomicQueryV3OnChain(40, 32, 64, 40, 64);
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@ template Nullify() {
signal input claimSubjectProfileNonce;
signal input claimSchema;
signal input verifierID;
signal input verifierSessionID;
signal input nullifierSessionID;

signal output nullifier;

signal isZeroNonce <== IsZero()(claimSubjectProfileNonce);
signal isZeroVerifierID <== IsZero()(verifierID);
signal isZeroVerifierSessionID <== IsZero()(verifierSessionID);
signal isZeroNullifierSessionID <== IsZero()(nullifierSessionID);

signal hash <== Poseidon(5)([genesisID, claimSubjectProfileNonce, claimSchema, verifierID, verifierSessionID]);
signal hash <== Poseidon(5)([genesisID, claimSubjectProfileNonce, claimSchema, verifierID, nullifierSessionID]);

signal isZero1 <== OR()(isZeroNonce, isZeroVerifierID);
signal isZero2 <== OR()(isZero1, isZeroVerifierSessionID);
signal isZero2 <== OR()(isZero1, isZeroNullifierSessionID);

nullifier <== Mux1()(
[hash, 0],
Expand Down
8 changes: 5 additions & 3 deletions circuits/offchain/credentialAtomicQueryV3OffChain.circom
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ include "../auth/authV2.circom";
include "../lib/linked/linkId.circom";
include "../lib/query/comparators.circom";
include "../lib/query/modifiers.circom";
include "../lib/query/nullify.circom";
include "../lib/query/query.circom";
include "../lib/utils/nullify.circom";
include "../lib/utils/idUtils.circom";
include "../lib/utils/safeOne.circom";

Expand Down Expand Up @@ -90,7 +90,9 @@ template credentialAtomicQueryV3OffChain(issuerLevels, claimLevels, valueArraySi

// Identifier of the verifier
signal input verifierID;
signal input verifierSessionID;

// nullifier input & output signals
signal input nullifierSessionID;
signal output nullifier;

// Modifier/Computation Operator output ($sd)
Expand Down Expand Up @@ -259,7 +261,7 @@ template credentialAtomicQueryV3OffChain(issuerLevels, claimLevels, valueArraySi
claimSubjectProfileNonce,
claimSchema,
verifierID,
verifierSessionID
nullifierSessionID
); // 330 constraints

/////////////////////////////////////////////////////////////////
Expand Down
6 changes: 4 additions & 2 deletions circuits/onchain/credentialAtomicQueryV3OnChain.circom
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,9 @@ template credentialAtomicQueryV3OnChain(issuerLevels, claimLevels, valueArraySiz

// Identifier of the verifier
signal input verifierID;
signal input verifierSessionID;

// nullifier input & output signals
signal input nullifierSessionID;
signal output nullifier;

// Modifier/Computation Operator output ($sd, $nullify)
Expand Down Expand Up @@ -248,7 +250,7 @@ template credentialAtomicQueryV3OnChain(issuerLevels, claimLevels, valueArraySiz
issuerClaimSignatureS <== issuerClaimSignatureS,
linkNonce <== linkNonce,
verifierID <== verifierID,
verifierSessionID <== verifierSessionID
nullifierSessionID <== nullifierSessionID
);

/////////////////////////////////////////////////////////////////
Expand Down
2 changes: 1 addition & 1 deletion test/circuits/query/nullifyTest.circom
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
pragma circom 2.1.5;

include "../../../circuits/lib/query/nullify.circom";
include "../../../circuits/lib/utils/nullify.circom";

component main = Nullify();
10 changes: 5 additions & 5 deletions test/query/nullify.test.ts → test/utils/nullify.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,18 @@ describe("Test Nullify template:", async function () {
claimSubjectProfileNonce: "999",
claimSchema: "180410020913331409885634153623124536270",
verifierID: "21929109382993718606847853573861987353620810345503358891473103689157378049",
verifierSessionID: "94313",
nullifierSessionID: "94313",
},
expOut: { nullifier: "1774255757463994926045333540514329781531189541970510727873068125458049917662" }
},
{
desc: "nullify with verifierSessionID = zero",
desc: "nullify with nullifierSessionID = zero",
input: {
genesisID: "23148936466334350744548790012294489365207440754509988986684797708370051073",
claimSubjectProfileNonce: "999",
claimSchema: "180410020913331409885634153623124536270",
verifierID: "21929109382993718606847853573861987353620810345503358891473103689157378049",
verifierSessionID: "0",
nullifierSessionID: "0",
},
expOut: { nullifier: "0" }
},
Expand All @@ -34,7 +34,7 @@ describe("Test Nullify template:", async function () {
claimSubjectProfileNonce: "0",
claimSchema: "180410020913331409885634153623124536270",
verifierID: "21929109382993718606847853573861987353620810345503358891473103689157378049",
verifierSessionID: "94313",
nullifierSessionID: "94313",
},
expOut: { nullifier: "0" }
},
Expand All @@ -45,7 +45,7 @@ describe("Test Nullify template:", async function () {
claimSubjectProfileNonce: "999",
claimSchema: "180410020913331409885634153623124536270",
verifierID: "0",
verifierSessionID: "94313",
nullifierSessionID: "94313",
},
expOut: { nullifier: "0" }
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"desc":"Skip Auth V2 check","inputs":{"requestID":"41","userGenesisID":"23273167900576580892722615617815475823351560716009055944677723144398443009","profileNonce":"0","claimSubjectProfileNonce":"0","authClaim":["80551937543569765027552589160822318028","0","4720763745722683616702324599137259461509439547324750011830105416383780791263","4844030361230692908091131578688419341633213823133966379083981236400104720538","16547485850637761685","0","0","0"],"authClaimIncMtp":["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],"authClaimNonRevMtp":["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],"authClaimNonRevMtpAuxHi":"0","authClaimNonRevMtpAuxHv":"0","authClaimNonRevMtpNoAux":"1","challenge":"12345","challengeSignatureR8x":"15829360093371098546177008474519342171461782120259125067189481965541223738777","challengeSignatureR8y":"10840522802382821290541462398953040493080116495308402635486440290351677745960","challengeSignatureS":"1196477404779941775725836688033485533497812196897664950083199167075327114562","userClaimsTreeRoot":"8162166103065016664685834856644195001371303013149727027131225893397958846382","userRevTreeRoot":"0","userRootsTreeRoot":"0","userState":"8039964009611210398788855768060749920589777058607598891238307089541758339342","gistRoot":"1243904711429961858774220647610724273798918457991486031567244100767259239747","gistMtp":["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],"gistMtpAuxHi":"1","gistMtpAuxHv":"1","gistMtpNoAux":"0","issuerID":"22057981499787921734624217749308316644136637822444794206796063681866502657","issuerClaim":["3583233690122716044519380227940806650830","23273167900576580892722615617815475823351560716009055944677723144398443009","10","0","30803922965249841627828060161","0","0","0"],"issuerClaimMtp":["0","20643387758736831799596675626240785455902781070167728593409367019626753600795","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],"issuerClaimClaimsTreeRoot":"822392840143531676250086160084530040476172248252065459222610568880934884086","issuerClaimRevTreeRoot":"0","issuerClaimRootsTreeRoot":"0","issuerClaimIdenState":"595634593597118989354040083735120083650459900146875299094425656479483321655","isRevocationChecked":1,"issuerClaimNonRevClaimsTreeRoot":"822392840143531676250086160084530040476172248252065459222610568880934884086","issuerClaimNonRevRevTreeRoot":"0","issuerClaimNonRevRootsTreeRoot":"0","issuerClaimNonRevState":"595634593597118989354040083735120083650459900146875299094425656479483321655","issuerClaimNonRevMtp":["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],"issuerClaimNonRevMtpAuxHi":"0","issuerClaimNonRevMtpAuxHv":"0","issuerClaimNonRevMtpNoAux":"1","claimSchema":"180410020913331409885634153623124536270","claimPathNotExists":"0","claimPathMtp":["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],"claimPathMtpNoAux":"0","claimPathMtpAuxHi":"0","claimPathMtpAuxHv":"0","claimPathKey":"0","claimPathValue":"0","operator":9,"slotIndex":2,"timestamp":"1642074362","value":["8","10","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],"issuerClaimSignatureR8x":"0","issuerClaimSignatureR8y":"0","issuerClaimSignatureS":"0","issuerAuthClaim":["0","0","0","0","0","0","0","0"],"issuerAuthClaimMtp":["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],"issuerAuthClaimNonRevMtp":["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],"issuerAuthClaimNonRevMtpAuxHi":"0","issuerAuthClaimNonRevMtpAuxHv":"0","issuerAuthClaimNonRevMtpNoAux":"0","issuerAuthClaimsTreeRoot":"0","issuerAuthRevTreeRoot":"0","issuerAuthRootsTreeRoot":"0","issuerAuthState":"0","proofType":"2","linkNonce":"0","verifierID":"21929109382993718606847853573861987353620810345503358891473103689157378049","verifierSessionID":"0","authEnabled":0},"expOut":{"requestID":"41","userID":"23273167900576580892722615617815475823351560716009055944677723144398443009","issuerID":"22057981499787921734624217749308316644136637822444794206796063681866502657","issuerClaimNonRevState":"595634593597118989354040083735120083650459900146875299094425656479483321655","circuitQueryHash":"1200197573263720781403876012067624377690459697223785410935360278236612478754","gistRoot":"1243904711429961858774220647610724273798918457991486031567244100767259239747","timestamp":"1642074362","merklized":"0","proofType":"2","isRevocationChecked":"1","challenge":"12345","issuerState":"595634593597118989354040083735120083650459900146875299094425656479483321655","linkID":"0","verifierID":"21929109382993718606847853573861987353620810345503358891473103689157378049","verifierSessionID":"0","operatorOutput":"0","nullifier":"0","authEnabled":"0"}}
{"desc":"Skip Auth V2 check","inputs":{"requestID":"41","userGenesisID":"23273167900576580892722615617815475823351560716009055944677723144398443009","profileNonce":"0","claimSubjectProfileNonce":"0","authClaim":["80551937543569765027552589160822318028","0","4720763745722683616702324599137259461509439547324750011830105416383780791263","4844030361230692908091131578688419341633213823133966379083981236400104720538","16547485850637761685","0","0","0"],"authClaimIncMtp":["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],"authClaimNonRevMtp":["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],"authClaimNonRevMtpAuxHi":"0","authClaimNonRevMtpAuxHv":"0","authClaimNonRevMtpNoAux":"1","challenge":"12345","challengeSignatureR8x":"15829360093371098546177008474519342171461782120259125067189481965541223738777","challengeSignatureR8y":"10840522802382821290541462398953040493080116495308402635486440290351677745960","challengeSignatureS":"1196477404779941775725836688033485533497812196897664950083199167075327114562","userClaimsTreeRoot":"8162166103065016664685834856644195001371303013149727027131225893397958846382","userRevTreeRoot":"0","userRootsTreeRoot":"0","userState":"8039964009611210398788855768060749920589777058607598891238307089541758339342","gistRoot":"1243904711429961858774220647610724273798918457991486031567244100767259239747","gistMtp":["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],"gistMtpAuxHi":"1","gistMtpAuxHv":"1","gistMtpNoAux":"0","issuerID":"22057981499787921734624217749308316644136637822444794206796063681866502657","issuerClaim":["3583233690122716044519380227940806650830","23273167900576580892722615617815475823351560716009055944677723144398443009","10","0","30803922965249841627828060161","0","0","0"],"issuerClaimMtp":["0","20643387758736831799596675626240785455902781070167728593409367019626753600795","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],"issuerClaimClaimsTreeRoot":"822392840143531676250086160084530040476172248252065459222610568880934884086","issuerClaimRevTreeRoot":"0","issuerClaimRootsTreeRoot":"0","issuerClaimIdenState":"595634593597118989354040083735120083650459900146875299094425656479483321655","isRevocationChecked":1,"issuerClaimNonRevClaimsTreeRoot":"822392840143531676250086160084530040476172248252065459222610568880934884086","issuerClaimNonRevRevTreeRoot":"0","issuerClaimNonRevRootsTreeRoot":"0","issuerClaimNonRevState":"595634593597118989354040083735120083650459900146875299094425656479483321655","issuerClaimNonRevMtp":["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],"issuerClaimNonRevMtpAuxHi":"0","issuerClaimNonRevMtpAuxHv":"0","issuerClaimNonRevMtpNoAux":"1","claimSchema":"180410020913331409885634153623124536270","claimPathNotExists":"0","claimPathMtp":["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],"claimPathMtpNoAux":"0","claimPathMtpAuxHi":"0","claimPathMtpAuxHv":"0","claimPathKey":"0","claimPathValue":"0","operator":9,"slotIndex":2,"timestamp":"1642074362","value":["8","10","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],"issuerClaimSignatureR8x":"0","issuerClaimSignatureR8y":"0","issuerClaimSignatureS":"0","issuerAuthClaim":["0","0","0","0","0","0","0","0"],"issuerAuthClaimMtp":["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],"issuerAuthClaimNonRevMtp":["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],"issuerAuthClaimNonRevMtpAuxHi":"0","issuerAuthClaimNonRevMtpAuxHv":"0","issuerAuthClaimNonRevMtpNoAux":"0","issuerAuthClaimsTreeRoot":"0","issuerAuthRevTreeRoot":"0","issuerAuthRootsTreeRoot":"0","issuerAuthState":"0","proofType":"2","linkNonce":"0","verifierID":"21929109382993718606847853573861987353620810345503358891473103689157378049","nullifierSessionID":"0","authEnabled":0},"expOut":{"requestID":"41","userID":"23273167900576580892722615617815475823351560716009055944677723144398443009","issuerID":"22057981499787921734624217749308316644136637822444794206796063681866502657","issuerClaimNonRevState":"595634593597118989354040083735120083650459900146875299094425656479483321655","circuitQueryHash":"1200197573263720781403876012067624377690459697223785410935360278236612478754","gistRoot":"1243904711429961858774220647610724273798918457991486031567244100767259239747","timestamp":"1642074362","merklized":"0","proofType":"2","isRevocationChecked":"1","challenge":"12345","issuerState":"595634593597118989354040083735120083650459900146875299094425656479483321655","linkID":"0","verifierID":"21929109382993718606847853573861987353620810345503358891473103689157378049","nullifierSessionID":"0","operatorOutput":"0","nullifier":"0","authEnabled":"0"}}
Loading

0 comments on commit 2cb1704

Please sign in to comment.