-
Notifications
You must be signed in to change notification settings - Fork 22
/
verify-claim.circom
45 lines (35 loc) · 1.02 KB
/
verify-claim.circom
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
pragma circom 2.0.0;
include "check-query.circom";
include "../../iden3-circuits/lib/utils/claimUtils.circom";
template verifyClaim(valueArraySize) {
signal input claim[8];
/** Signature */
signal input sigR8x;
signal input sigR8y;
signal input sigS;
signal input pubKeyX;
signal input pubKeyY;
// out signal
signal output out;
/** Query */
signal input claimSchema;
signal input slotIndex;
signal input operator;
signal input value[valueArraySize];
// verify signature
component signature = verifyClaimSignature();
for (var i=0; i<8; i++) { signature.claim[i] <== claim[i]; }
signature.sigR8x <== sigR8x;
signature.sigR8y <== sigR8y;
signature.sigS <== sigS;
signature.pubKeyX <== pubKeyX;
signature.pubKeyY <== pubKeyY;
// verify query
component query = checkQuery(valueArraySize);
for (var i=0; i<8; i++) { query.issuerClaim[i] <== claim[i]; }
query.claimSchema <== claimSchema;
query.slotIndex <== slotIndex;
query.operator <== operator;
for(var i = 0; i<valueArraySize; i++){query.value[i] <== value[i];}
out <== query.out;
}