diff --git a/circuits/credentialAtomicQueryMTP.circom b/circuits/credentialAtomicQueryMTP.circom index b431d4f9..7114e3cd 100644 --- a/circuits/credentialAtomicQueryMTP.circom +++ b/circuits/credentialAtomicQueryMTP.circom @@ -7,6 +7,7 @@ component main{public [challenge, userState, issuerID, issuerClaimIdenState, + issuerClaimNonRevState, claimSchema, slotIndex, operator, diff --git a/circuits/credentialAtomicQuerySig.circom b/circuits/credentialAtomicQuerySig.circom index 4e73f862..1a712502 100644 --- a/circuits/credentialAtomicQuerySig.circom +++ b/circuits/credentialAtomicQuerySig.circom @@ -6,7 +6,6 @@ component main{public [challenge, userID, userState, issuerID, - issuerState, issuerClaimNonRevState, claimSchema, slotIndex, diff --git a/circuits/lib/query/credentialAtomicQuerySig.circom b/circuits/lib/query/credentialAtomicQuerySig.circom index 915a32f8..18b0fa00 100644 --- a/circuits/lib/query/credentialAtomicQuerySig.circom +++ b/circuits/lib/query/credentialAtomicQuerySig.circom @@ -64,11 +64,6 @@ template CredentialAtomicQuerySig(IdOwnershipLevels, IssuerLevels, valueArraySiz // issuer state signal input issuerID; - signal input issuerState; - signal input issuerClaimsTreeRoot; - signal input issuerRevTreeRoot; - signal input issuerRootsTreeRoot; - signal input issuerAuthClaim[8]; signal input issuerAuthClaimMtp[IssuerLevels]; diff --git a/test/circuits/query/credentialAtomicQuerySigTest.circom b/test/circuits/query/credentialAtomicQuerySigTest.circom index 4ce651db..f824436b 100644 --- a/test/circuits/query/credentialAtomicQuerySigTest.circom +++ b/test/circuits/query/credentialAtomicQuerySigTest.circom @@ -3,10 +3,12 @@ pragma circom 2.0.0; include "../../../circuits/lib/query/credentialAtomicQuerySig.circom"; component main{public [challenge, - userID, - userState, - claimSchema, - slotIndex, - operator, - value, - timestamp]} = CredentialAtomicQuerySig(32, 32, 64); + userID, + userState, + issuerID, + issuerClaimNonRevState, + claimSchema, + slotIndex, + operator, + value, + timestamp]} = CredentialAtomicQuerySig(32, 32, 64); diff --git a/test/query/credentialAtomicQueryMTP.test.ts b/test/query/credentialAtomicQueryMTP.test.ts index 8647f040..d7519d29 100644 --- a/test/query/credentialAtomicQueryMTP.test.ts +++ b/test/query/credentialAtomicQueryMTP.test.ts @@ -69,11 +69,13 @@ describe("Test credential atomic query", function () { timestamp: "1642074362", value: ["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", "0"], } - const expOut = { challenge: "1", userID: "379949150130214723420589610911161895495647789006649785264738141299135414272", claimSchema: "180410020913331409885634153623124536270", + userState: "18656147546666944484453899241916469544090258810192803949522794490493271005313", + issuerClaimIdenState: "18605292738057394742004097311192572049290380262377486632479765119429313092475", + issuerClaimNonRevState: "18605292738057394742004097311192572049290380262377486632479765119429313092475", slotIndex: "2", operator: "1", timestamp: "1642074362", diff --git a/test/query/credentialAtomicQuerySig.test.ts b/test/query/credentialAtomicQuerySig.test.ts index eb081459..28ad0158 100644 --- a/test/query/credentialAtomicQuerySig.test.ts +++ b/test/query/credentialAtomicQuerySig.test.ts @@ -7,7 +7,7 @@ const assert = chai.assert; export {}; -describe("Test CredentialAtomicQuerySig.circom", function () { +describe("Test CredentialAtomicQuerySig.circom", function() { this.timeout(600000); @@ -32,61 +32,67 @@ describe("Test CredentialAtomicQuerySig.circom", function () { it("credentialAtomicQuerySigTest", async () => { // inputs MUST be generated by GO-CIRCUITS library https://github.com/iden3/go-circuits (using corresponding test) const inputs = { - "challenge": "84239", - "challengeSignatureR8x": "14443879978900947038971926807837206222830804504916993621940925629433736033219", - "challengeSignatureR8y": "12729002170022424539486365270180256739680472584306485783075800699487899204326", - "challengeSignatureS": "836454431395954422103086501419117817962615640408892446754696281220237408543", - "claimSchema": "210459579859058135404770043788028292398", - "issuerAuthClaim": ["304427537360709784173770334266246861770", "0", "4003653841729095893886045954705542872794447955766102255759127797295285488487", "12432651117722474612070219664501364108487965088671769880828964159025685825181", "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"], - "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"], - "issuerAuthClaimNonRevMtpAuxHi": "0", - "issuerAuthClaimNonRevMtpAuxHv": "0", - "issuerAuthClaimNonRevMtpNoAux": "1", - "issuerAuthClaimsTreeRoot": "5123307644320232334601789092683659046372501933037132521592406792551396194285", - "issuerAuthRevTreeRoot": "0", - "issuerAuthRootsTreeRoot": "0", - "issuerClaim": ["3613283249068442770038516118105710406958", "222712906379570502079611869905711649383946316867077911802139171411787317248", "19960424", "2", "227737578863135127229742293906", "0", "0", "0"], - "issuerClaimNonRevClaimsTreeRoot": "15223488090497480996164278132154256642649856052781941842012430126901504694315", - "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"], - "issuerClaimNonRevMtpAuxHi": "0", - "issuerClaimNonRevMtpAuxHv": "0", - "issuerClaimNonRevMtpNoAux": "1", - "issuerClaimNonRevRevTreeRoot": "0", - "issuerClaimNonRevRootsTreeRoot": "4990132952129040175987903194901426383880983865057110565659262312741936794566", - "issuerClaimNonRevState": "19221836623970007220538457599669851375427558847917606787084815224761802529201", - "issuerClaimSignatureR8x": "19045858395840746612549877977108164799354042570658196386453619850564787233776", - "issuerClaimSignatureR8y": "739473645024068689033722089826774751642222247621407780021799744545508322878", - "issuerClaimSignatureS": "649122636969614974711413717869822497148719098417447361410598803181314860028", - "issuerClaimsTreeRoot": "5123307644320232334601789092683659046372501933037132521592406792551396194285", - "issuerID": "330477016068568275516898063887311212065482015025379036159122139014924926976", - "issuerRevTreeRoot": "0", - "issuerRootsTreeRoot": "0", - "issuerState": "11672667429383627660992648216772306271234451162443612055001584519010749218959", - "operator": 2, - "slotIndex": 2, - "timestamp": "1651850376", - "userAuthClaim": ["304427537360709784173770334266246861770", "0", "11151655580697319947882291674102291730051706338247314064771322625319070352517", "17002319580480461745556995341522831877523489413849835052106266233588801210277", "0", "0", "0", "0"], - "userAuthClaimMtp": ["0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0"], - "userAuthClaimNonRevMtp": ["0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0"], - "userAuthClaimNonRevMtpAuxHi": "0", - "userAuthClaimNonRevMtpAuxHv": "0", - "userAuthClaimNonRevMtpNoAux": "1", - "userClaimsTreeRoot": "19778093938750740790275490062389575839849129769112681857212084478032253498250", - "userID": "222712906379570502079611869905711649383946316867077911802139171411787317248", - "userRevTreeRoot": "0", - "userRootsTreeRoot": "0", - "userState": "7608718875990494885422326673876913565155307854054144181362485232187902102852", - "value": ["20000101", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0"] + userAuthClaim: ["304427537360709784173770334266246861770", "0", "17640206035128972995519606214765283372613874593503528180869261482403155458945", "20634138280259599560273310290025659992320584624461316485434108770067472477956", "15930428023331155902", "0", "0", "0"], + userAuthClaimMtp: ["0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0"], + userAuthClaimNonRevMtp: ["0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0"], + userAuthClaimNonRevMtpAuxHi: "0", + userAuthClaimNonRevMtpAuxHv: "0", + userAuthClaimNonRevMtpNoAux: "1", + userClaimsTreeRoot: "9763429684850732628215303952870004997159843236039795272605841029866455670219", + userState: "18656147546666944484453899241916469544090258810192803949522794490493271005313", + userRevTreeRoot: "0", + userRootsTreeRoot: "0", + userID: "379949150130214723420589610911161895495647789006649785264738141299135414272", + challenge: "1", + challengeSignatureR8x: "8553678144208642175027223770335048072652078621216414881653012537434846327449", + challengeSignatureR8y: "5507837342589329113352496188906367161790372084365285966741761856353367255709", + challengeSignatureS: "2093461910575977345603199789919760192811763972089699387324401771367839603655", + issuerClaim: ["3583233690122716044519380227940806650830", "379949150130214723420589610911161895495647789006649785264738141299135414272", "10", "0", "30803922965249841627828060161", "0", "0", "0"], + issuerClaimNonRevClaimsTreeRoot: "3077200351284676204723270374054827783313480677490603169533924119235084704890", + issuerClaimNonRevRevTreeRoot: "0", + issuerClaimNonRevRootsTreeRoot: "0", + issuerClaimNonRevState: "18605292738057394742004097311192572049290380262377486632479765119429313092475", + 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"], + issuerClaimNonRevMtpAuxHi: "0", + issuerClaimNonRevMtpAuxHv: "0", + issuerClaimNonRevMtpNoAux: "1", + claimSchema: "180410020913331409885634153623124536270", + issuerID: "26599707002460144379092755370384635496563807452878989192352627271768342528", + operator: 1, + slotIndex: 2, + timestamp: "1642074362", + value: ["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", "0"], + issuerClaimSignatureR8x: "18625305647089498634672127449050652473073470525382360069529718632627474482386", + issuerClaimSignatureR8y: "14539700345423181413201048131770723125531044953576671601029329833956725811279", + issuerClaimSignatureS: "772934080142423067561028786350670095248312416624185973552603152377549415467", + issuerAuthClaim: ["304427537360709784173770334266246861770", "0", "9582165609074695838007712438814613121302719752874385708394134542816240804696", "18271435592817415588213874506882839610978320325722319742324814767882756910515", "11203087622270641253", "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"], + 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"], + issuerAuthClaimNonRevMtpAuxHi: "0", + issuerAuthClaimNonRevMtpAuxHv: "0", + issuerAuthClaimNonRevMtpNoAux: "1", + issuerAuthClaimsTreeRoot: "18337129644116656308842422695567930755039142442806278977230099338026575870840", + issuerAuthRevTreeRoot: "0", + issuerAuthRootsTreeRoot: "0", } + // signal input issuerState; + // signal input issuerClaimsTreeRoot; + // signal input issuerRevTreeRoot; + // signal input issuerRootsTreeRoot; + const expOut = { - challenge: "84239", - userID: "222712906379570502079611869905711649383946316867077911802139171411787317248", - claimSchema: "210459579859058135404770043788028292398", + userState: "18656147546666944484453899241916469544090258810192803949522794490493271005313", + issuerID: "26599707002460144379092755370384635496563807452878989192352627271768342528", + issuerAuthState: "6317996369756476782464660619835940615734517981889733696047139451453239145426", + issuerClaimNonRevState: "18605292738057394742004097311192572049290380262377486632479765119429313092475", + challenge: "1", + userID: "379949150130214723420589610911161895495647789006649785264738141299135414272", + claimSchema: "180410020913331409885634153623124536270", slotIndex: "2", - operator: "2", - timestamp: "1651850376", + operator: "1", + value: ["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", "0"], + timestamp: "1642074362", } const w = await circuit.calculateWitness(inputs, true); await circuit.assertOut(w, expOut);