@0xpolygonid/js-sdk 1.5.1 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/esm/index.js +1685 -468
- package/dist/browser/esm/index.js.map +1 -1
- package/dist/browser/umd/index.js +1703 -470
- package/dist/browser/umd/index.js.map +1 -1
- package/dist/node/cjs/circuits/atomic-query-mtp-v2-on-chain.js +1 -1
- package/dist/node/cjs/circuits/atomic-query-mtp-v2.js +1 -1
- package/dist/node/cjs/circuits/atomic-query-sig-v2-on-chain.js +2 -2
- package/dist/node/cjs/circuits/atomic-query-sig-v2.js +11 -14
- package/dist/node/cjs/circuits/atomic-query-v3-on-chain.js +320 -0
- package/dist/node/cjs/circuits/atomic-query-v3.js +275 -0
- package/dist/node/cjs/circuits/common.js +5 -7
- package/dist/node/cjs/circuits/comparer.js +57 -2
- package/dist/node/cjs/circuits/index.js +4 -0
- package/dist/node/cjs/circuits/linked-multi-query.js +128 -0
- package/dist/node/cjs/circuits/linked-nullifier.js +57 -0
- package/dist/node/cjs/circuits/models.js +25 -1
- package/dist/node/cjs/credentials/credential-wallet.js +2 -10
- package/dist/node/cjs/credentials/index.js +1 -0
- package/dist/node/cjs/credentials/utils.js +23 -0
- package/dist/node/cjs/iden3comm/handlers/auth.js +49 -8
- package/dist/node/cjs/iden3comm/handlers/contract-request.js +20 -8
- package/dist/node/cjs/proof/common.js +104 -1
- package/dist/node/cjs/proof/inputs-generator.js +393 -0
- package/dist/node/cjs/proof/proof-service.js +105 -372
- package/dist/node/cjs/schema-processor/json/parser.js +7 -0
- package/dist/node/cjs/schema-processor/json/validator.js +1 -0
- package/dist/node/cjs/storage/filters/jsonQuery.js +73 -8
- package/dist/node/cjs/utils/did-helper.js +14 -0
- package/dist/node/cjs/utils/index.js +2 -0
- package/dist/node/cjs/utils/object.js +42 -0
- package/dist/node/cjs/verifiable/presentation.js +34 -33
- package/dist/node/cjs/verifiable/proof.js +2 -0
- package/dist/node/esm/circuits/atomic-query-mtp-v2-on-chain.js +1 -1
- package/dist/node/esm/circuits/atomic-query-mtp-v2.js +1 -1
- package/dist/node/esm/circuits/atomic-query-sig-v2-on-chain.js +2 -2
- package/dist/node/esm/circuits/atomic-query-sig-v2.js +11 -14
- package/dist/node/esm/circuits/atomic-query-v3-on-chain.js +315 -0
- package/dist/node/esm/circuits/atomic-query-v3.js +270 -0
- package/dist/node/esm/circuits/common.js +4 -6
- package/dist/node/esm/circuits/comparer.js +55 -1
- package/dist/node/esm/circuits/index.js +4 -0
- package/dist/node/esm/circuits/linked-multi-query.js +123 -0
- package/dist/node/esm/circuits/linked-nullifier.js +52 -0
- package/dist/node/esm/circuits/models.js +25 -1
- package/dist/node/esm/credentials/credential-wallet.js +2 -10
- package/dist/node/esm/credentials/index.js +1 -0
- package/dist/node/esm/credentials/utils.js +19 -0
- package/dist/node/esm/iden3comm/handlers/auth.js +50 -9
- package/dist/node/esm/iden3comm/handlers/contract-request.js +20 -8
- package/dist/node/esm/proof/common.js +101 -2
- package/dist/node/esm/proof/inputs-generator.js +389 -0
- package/dist/node/esm/proof/proof-service.js +111 -377
- package/dist/node/esm/schema-processor/json/parser.js +7 -0
- package/dist/node/esm/schema-processor/json/validator.js +1 -0
- package/dist/node/esm/storage/filters/jsonQuery.js +74 -9
- package/dist/node/esm/utils/did-helper.js +10 -0
- package/dist/node/esm/utils/index.js +2 -0
- package/dist/node/esm/utils/object.js +38 -0
- package/dist/node/esm/verifiable/presentation.js +30 -29
- package/dist/node/esm/verifiable/proof.js +2 -0
- package/dist/types/circuits/atomic-query-mtp-v2.d.ts +13 -13
- package/dist/types/circuits/atomic-query-v3-on-chain.d.ts +142 -0
- package/dist/types/circuits/atomic-query-v3.d.ts +120 -0
- package/dist/types/circuits/common.d.ts +4 -4
- package/dist/types/circuits/comparer.d.ts +33 -1
- package/dist/types/circuits/index.d.ts +4 -0
- package/dist/types/circuits/linked-multi-query.d.ts +38 -0
- package/dist/types/circuits/linked-nullifier.d.ts +37 -0
- package/dist/types/circuits/models.d.ts +20 -2
- package/dist/types/credentials/index.d.ts +1 -0
- package/dist/types/credentials/utils.d.ts +12 -0
- package/dist/types/iden3comm/types/packer.d.ts +1 -2
- package/dist/types/iden3comm/types/protocol/auth.d.ts +1 -0
- package/dist/types/proof/common.d.ts +34 -3
- package/dist/types/proof/inputs-generator.d.ts +46 -0
- package/dist/types/proof/proof-service.d.ts +14 -25
- package/dist/types/schema-processor/json/parser.d.ts +1 -0
- package/dist/types/storage/filters/jsonQuery.d.ts +1 -1
- package/dist/types/utils/did-helper.d.ts +6 -0
- package/dist/types/utils/index.d.ts +2 -0
- package/dist/types/utils/object.d.ts +12 -0
- package/dist/types/verifiable/presentation.d.ts +6 -10
- package/package.json +1 -1
|
@@ -14,6 +14,17 @@ var SearchError;
|
|
|
14
14
|
const truthyValues = [true, 1, 'true'];
|
|
15
15
|
const falsyValues = [false, 0, 'false'];
|
|
16
16
|
const equalsComparator = (a, b) => {
|
|
17
|
+
if (Array.isArray(a) && Array.isArray(b)) {
|
|
18
|
+
return (a.length === b.length && a.every((val, index) => val === b[index]));
|
|
19
|
+
}
|
|
20
|
+
if (!Array.isArray(a) && Array.isArray(b)) {
|
|
21
|
+
return b.includes(a);
|
|
22
|
+
}
|
|
23
|
+
if (Array.isArray(a) && !Array.isArray(b)) {
|
|
24
|
+
return a.includes(b);
|
|
25
|
+
}
|
|
26
|
+
a = a;
|
|
27
|
+
b = b;
|
|
17
28
|
if (truthyValues.includes(a) && truthyValues.includes(b)) {
|
|
18
29
|
return true;
|
|
19
30
|
}
|
|
@@ -22,14 +33,65 @@ const equalsComparator = (a, b) => {
|
|
|
22
33
|
}
|
|
23
34
|
return a === b;
|
|
24
35
|
};
|
|
36
|
+
const greaterThan = (a, b) => {
|
|
37
|
+
if (Array.isArray(a) && Array.isArray(b)) {
|
|
38
|
+
return a.every((val, index) => val > b[index]);
|
|
39
|
+
}
|
|
40
|
+
if (!Array.isArray(a) && Array.isArray(b)) {
|
|
41
|
+
return b.every((val) => a > val);
|
|
42
|
+
}
|
|
43
|
+
if (Array.isArray(a) && !Array.isArray(b)) {
|
|
44
|
+
return a.every((val) => val > b);
|
|
45
|
+
}
|
|
46
|
+
return a > b;
|
|
47
|
+
};
|
|
48
|
+
const greaterThanOrEqual = (a, b) => {
|
|
49
|
+
if (Array.isArray(a) && Array.isArray(b)) {
|
|
50
|
+
return a.every((val, index) => val >= b[index]);
|
|
51
|
+
}
|
|
52
|
+
if (!Array.isArray(a) && Array.isArray(b)) {
|
|
53
|
+
return b.every((val) => a >= val);
|
|
54
|
+
}
|
|
55
|
+
if (Array.isArray(a) && !Array.isArray(b)) {
|
|
56
|
+
return a.every((val) => val >= b);
|
|
57
|
+
}
|
|
58
|
+
return a >= b;
|
|
59
|
+
};
|
|
60
|
+
const lessThanOrEqual = (a, b) => {
|
|
61
|
+
if (Array.isArray(a) && Array.isArray(b)) {
|
|
62
|
+
return a.every((val, index) => val <= b[index]);
|
|
63
|
+
}
|
|
64
|
+
if (!Array.isArray(a) && Array.isArray(b)) {
|
|
65
|
+
return b.every((val) => a <= val);
|
|
66
|
+
}
|
|
67
|
+
if (Array.isArray(a) && !Array.isArray(b)) {
|
|
68
|
+
return a.every((val) => val <= b);
|
|
69
|
+
}
|
|
70
|
+
return a <= b;
|
|
71
|
+
};
|
|
72
|
+
const inOperator = (a, b) => {
|
|
73
|
+
if (Array.isArray(a) && Array.isArray(b)) {
|
|
74
|
+
return a.every((val) => b.includes(val));
|
|
75
|
+
}
|
|
76
|
+
if (!Array.isArray(a) && Array.isArray(b)) {
|
|
77
|
+
return b.includes(a);
|
|
78
|
+
}
|
|
79
|
+
if (Array.isArray(a) && !Array.isArray(b)) {
|
|
80
|
+
return a.includes(b);
|
|
81
|
+
}
|
|
82
|
+
return false;
|
|
83
|
+
};
|
|
25
84
|
exports.comparatorOptions = {
|
|
26
85
|
$noop: () => true,
|
|
86
|
+
$sd: () => true,
|
|
27
87
|
$eq: (a, b) => equalsComparator(a, b),
|
|
28
|
-
$in: (a, b) =>
|
|
29
|
-
$nin: (a, b) => !
|
|
30
|
-
$gt: (a, b) => a
|
|
31
|
-
$lt: (a, b) => a
|
|
32
|
-
$ne: (a, b) => !equalsComparator(a, b)
|
|
88
|
+
$in: (a, b) => inOperator(a, b),
|
|
89
|
+
$nin: (a, b) => !inOperator(a, b),
|
|
90
|
+
$gt: (a, b) => greaterThan(a, b),
|
|
91
|
+
$lt: (a, b) => !greaterThan(a, b),
|
|
92
|
+
$ne: (a, b) => !equalsComparator(a, b),
|
|
93
|
+
$gte: (a, b) => greaterThanOrEqual(a, b),
|
|
94
|
+
$lte: (a, b) => lessThanOrEqual(a, b)
|
|
33
95
|
};
|
|
34
96
|
/**
|
|
35
97
|
* credential search path resolver
|
|
@@ -115,8 +177,6 @@ const StandardJSONCredentialsQueryFilter = (query) => {
|
|
|
115
177
|
return acc.concat(new FilterQuery('credentialSubject.id', exports.comparatorOptions.$eq, queryValue));
|
|
116
178
|
case 'schema':
|
|
117
179
|
return acc.concat(new FilterQuery('credentialSchema.id', exports.comparatorOptions.$eq, queryValue));
|
|
118
|
-
case 'skipClaimRevocationCheck':
|
|
119
|
-
return acc;
|
|
120
180
|
case 'credentialSubject': {
|
|
121
181
|
const reqFilters = Object.keys(queryValue).reduce((acc, fieldKey) => {
|
|
122
182
|
const fieldParams = queryValue[fieldKey];
|
|
@@ -134,8 +194,13 @@ const StandardJSONCredentialsQueryFilter = (query) => {
|
|
|
134
194
|
}, []);
|
|
135
195
|
return acc.concat(reqFilters);
|
|
136
196
|
}
|
|
197
|
+
case 'proofType':
|
|
198
|
+
case 'groupId':
|
|
199
|
+
case 'skipClaimRevocationCheck': {
|
|
200
|
+
return acc;
|
|
201
|
+
}
|
|
137
202
|
default:
|
|
138
|
-
throw new Error(SearchError.NotDefinedQueryKey);
|
|
203
|
+
throw new Error(`${queryKey} : ${SearchError.NotDefinedQueryKey}`);
|
|
139
204
|
}
|
|
140
205
|
}, []);
|
|
141
206
|
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildVerifierId = void 0;
|
|
4
|
+
const js_crypto_1 = require("@iden3/js-crypto");
|
|
5
|
+
const js_iden3_core_1 = require("@iden3/js-iden3-core");
|
|
6
|
+
const buildVerifierId = (address, info) => {
|
|
7
|
+
address = address.replace('0x', '');
|
|
8
|
+
const ethAddrBytes = js_crypto_1.Hex.decodeString(address);
|
|
9
|
+
const ethAddr = ethAddrBytes.slice(0, 20);
|
|
10
|
+
const genesis = (0, js_iden3_core_1.genesisFromEthAddress)(ethAddr);
|
|
11
|
+
const tp = (0, js_iden3_core_1.buildDIDType)(info.method, info.blockchain, info.networkId);
|
|
12
|
+
return new js_iden3_core_1.Id(tp, genesis);
|
|
13
|
+
};
|
|
14
|
+
exports.buildVerifierId = buildVerifierId;
|
|
@@ -15,3 +15,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./encoding"), exports);
|
|
18
|
+
__exportStar(require("./object"), exports);
|
|
19
|
+
__exportStar(require("./did-helper"), exports);
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.mergeObjects = void 0;
|
|
4
|
+
function mergeObjects(credSubject, otherCredSubject) {
|
|
5
|
+
let result = {};
|
|
6
|
+
const credSubjectKeys = Object.keys(credSubject);
|
|
7
|
+
for (const key of credSubjectKeys) {
|
|
8
|
+
if (typeof otherCredSubject[key] !== 'undefined') {
|
|
9
|
+
if (typeof credSubject[key] !== 'object' && typeof otherCredSubject[key] !== 'object') {
|
|
10
|
+
throw new Error('Invalid query');
|
|
11
|
+
}
|
|
12
|
+
const subjectProperty = credSubject[key];
|
|
13
|
+
const otherSubjectProperty = otherCredSubject[key];
|
|
14
|
+
const propertyOperators = Object.keys(subjectProperty);
|
|
15
|
+
const subjectPropertyResult = {};
|
|
16
|
+
for (const operatorKey of propertyOperators) {
|
|
17
|
+
if (typeof otherSubjectProperty[operatorKey] !== 'undefined') {
|
|
18
|
+
const operatorValue1 = subjectProperty[operatorKey];
|
|
19
|
+
const operatorValue2 = otherSubjectProperty[operatorKey];
|
|
20
|
+
subjectPropertyResult[operatorKey] = [
|
|
21
|
+
...new Set([
|
|
22
|
+
...(subjectPropertyResult[operatorKey] ?? []),
|
|
23
|
+
operatorValue1,
|
|
24
|
+
...(Array.isArray(operatorValue2) ? operatorValue2 : [operatorValue2])
|
|
25
|
+
])
|
|
26
|
+
];
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
subjectPropertyResult[operatorKey] = subjectProperty[operatorKey];
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
result[key] = {
|
|
33
|
+
...otherCredSubject[key],
|
|
34
|
+
...subjectPropertyResult
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
// Add remaining keys from obj2
|
|
39
|
+
result = { ...credSubject, ...otherCredSubject, ...result };
|
|
40
|
+
return result;
|
|
41
|
+
}
|
|
42
|
+
exports.mergeObjects = mergeObjects;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.createVerifiablePresentation = exports.findValue = exports.buildFieldPath = exports.stringByPath = void 0;
|
|
4
4
|
const constants_1 = require("./constants");
|
|
5
5
|
const js_jsonld_merklization_1 = require("@iden3/js-jsonld-merklization");
|
|
6
6
|
const stringByPath = (obj, path) => {
|
|
@@ -19,20 +19,25 @@ const stringByPath = (obj, path) => {
|
|
|
19
19
|
return value.toString();
|
|
20
20
|
};
|
|
21
21
|
exports.stringByPath = stringByPath;
|
|
22
|
-
const
|
|
23
|
-
let
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
const buildFieldPath = async (ldSchema, contextType, field, opts) => {
|
|
23
|
+
let path = new js_jsonld_merklization_1.Path();
|
|
24
|
+
if (field) {
|
|
25
|
+
path = await js_jsonld_merklization_1.Path.getContextPathKey(ldSchema, contextType, field, opts);
|
|
26
26
|
}
|
|
27
|
-
catch (error) {
|
|
28
|
-
throw new Error(`context not found: ${error.message}`);
|
|
29
|
-
}
|
|
30
|
-
const path = await js_jsonld_merklization_1.Path.getContextPathKey(JSON.stringify(resp), contextType, field, opts);
|
|
31
27
|
path.prepend([constants_1.VerifiableConstants.CREDENTIAL_SUBJECT_PATH]);
|
|
32
28
|
return path;
|
|
33
29
|
};
|
|
34
|
-
exports.
|
|
35
|
-
const
|
|
30
|
+
exports.buildFieldPath = buildFieldPath;
|
|
31
|
+
const findValue = (fieldName, credential) => {
|
|
32
|
+
const [first, ...rest] = fieldName.split('.');
|
|
33
|
+
let v = credential.credentialSubject[first];
|
|
34
|
+
for (const part of rest) {
|
|
35
|
+
v = v[part];
|
|
36
|
+
}
|
|
37
|
+
return v;
|
|
38
|
+
};
|
|
39
|
+
exports.findValue = findValue;
|
|
40
|
+
const createVerifiablePresentation = (context, tp, credential, queries) => {
|
|
36
41
|
const baseContext = [constants_1.VerifiableConstants.JSONLD_SCHEMA.W3C_CREDENTIAL_2018];
|
|
37
42
|
const ldContext = baseContext[0] === context ? baseContext : [...baseContext, context];
|
|
38
43
|
const vc = constants_1.VerifiableConstants.CREDENTIAL_TYPE.W3C_VERIFIABLE_CREDENTIAL;
|
|
@@ -40,36 +45,32 @@ const createVerifiablePresentation = (context, tp, path, value) => {
|
|
|
40
45
|
if (tp !== vc) {
|
|
41
46
|
vcTypes.push(tp);
|
|
42
47
|
}
|
|
43
|
-
const
|
|
44
|
-
const obj = rest.reduceRight((acc, key) => ({ [key]: acc }), value);
|
|
45
|
-
return {
|
|
48
|
+
const skeleton = {
|
|
46
49
|
'@context': baseContext,
|
|
47
50
|
'@type': constants_1.VerifiableConstants.CREDENTIAL_TYPE.W3C_VERIFIABLE_PRESENTATION,
|
|
48
51
|
verifiableCredential: {
|
|
49
52
|
'@context': ldContext,
|
|
50
53
|
'@type': vcTypes,
|
|
51
54
|
credentialSubject: {
|
|
52
|
-
'@type': tp
|
|
53
|
-
[first]: obj
|
|
55
|
+
'@type': tp
|
|
54
56
|
}
|
|
55
57
|
}
|
|
56
58
|
};
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
const rawValue = mz.rawValue(path);
|
|
68
|
-
const { value } = await mz.proof(path);
|
|
69
|
-
const vp = (0, exports.createVerifiablePresentation)(contextURL, contextType, field, rawValue);
|
|
70
|
-
if (!value) {
|
|
71
|
-
throw new Error(`can't merklize verifiable presentation`);
|
|
59
|
+
let result = {};
|
|
60
|
+
for (const query of queries) {
|
|
61
|
+
const parts = query.fieldName.split('.');
|
|
62
|
+
const current = parts.reduceRight((acc, part) => {
|
|
63
|
+
if (result[part]) {
|
|
64
|
+
return { [part]: { ...result[part], ...acc } };
|
|
65
|
+
}
|
|
66
|
+
return { [part]: acc };
|
|
67
|
+
}, (0, exports.findValue)(query.fieldName, credential));
|
|
68
|
+
result = { ...result, ...current };
|
|
72
69
|
}
|
|
73
|
-
|
|
70
|
+
skeleton.verifiableCredential.credentialSubject = {
|
|
71
|
+
...skeleton.verifiableCredential.credentialSubject,
|
|
72
|
+
...result
|
|
73
|
+
};
|
|
74
|
+
return skeleton;
|
|
74
75
|
};
|
|
75
|
-
exports.
|
|
76
|
+
exports.createVerifiablePresentation = createVerifiablePresentation;
|
|
@@ -45,6 +45,7 @@ class Iden3SparseMerkleTreeProof {
|
|
|
45
45
|
mtp: this.mtp.toJSON()
|
|
46
46
|
};
|
|
47
47
|
}
|
|
48
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
48
49
|
static fromJSON(obj) {
|
|
49
50
|
let mtp;
|
|
50
51
|
if (obj?.mtp?.notEmpties && obj?.mtp?.depth && obj?.mtp?.siblings) {
|
|
@@ -124,6 +125,7 @@ class BJJSignatureProof2021 {
|
|
|
124
125
|
* fromJSON is a method to deserialize BJJSignatureProof2021 from json
|
|
125
126
|
* @param obj
|
|
126
127
|
*/
|
|
128
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
127
129
|
static fromJSON(obj) {
|
|
128
130
|
return new BJJSignatureProof2021({
|
|
129
131
|
issuerData: {
|
|
@@ -67,7 +67,7 @@ export class AtomicQueryMTPV2OnChainInputs extends BaseConfig {
|
|
|
67
67
|
issuerClaimNonRevRootsTreeRoot: this.claim.nonRevProof?.treeState?.rootOfRoots?.string(),
|
|
68
68
|
issuerClaimNonRevState: this.claim.nonRevProof?.treeState?.state?.string(),
|
|
69
69
|
claimSchema: this.claim.claim?.getSchemaHash().bigInt().toString(),
|
|
70
|
-
claimPathMtp: prepareSiblingsStr(valueProof.mtp, this.
|
|
70
|
+
claimPathMtp: prepareSiblingsStr(valueProof.mtp, this.getMTLevelsClaim()),
|
|
71
71
|
claimPathValue: valueProof.value.toString(),
|
|
72
72
|
operator: this.query.operator,
|
|
73
73
|
slotIndex: this.query.slotIndex,
|
|
@@ -58,7 +58,7 @@ export class AtomicQueryMTPV2Inputs extends BaseConfig {
|
|
|
58
58
|
.toString(),
|
|
59
59
|
issuerClaimNonRevState: this.claim.nonRevProof?.treeState?.state?.bigInt().toString(),
|
|
60
60
|
claimSchema: this.claim.claim?.getSchemaHash().bigInt().toString(),
|
|
61
|
-
claimPathMtp: prepareSiblingsStr(valueProof.mtp, this.
|
|
61
|
+
claimPathMtp: prepareSiblingsStr(valueProof.mtp, this.getMTLevelsClaim()),
|
|
62
62
|
claimPathValue: valueProof.value.toString(),
|
|
63
63
|
operator: this.query.operator,
|
|
64
64
|
slotIndex: this.query.slotIndex,
|
|
@@ -100,9 +100,9 @@ export class AtomicQuerySigV2OnChainInputs extends BaseConfig {
|
|
|
100
100
|
issuerAuthClaimNonRevMtp: this.claim.signatureProof?.issuerAuthNonRevProof?.proof &&
|
|
101
101
|
prepareSiblingsStr(this.claim.signatureProof.issuerAuthNonRevProof.proof, this.getMTLevel()),
|
|
102
102
|
claimSchema: this.claim.claim?.getSchemaHash().bigInt().toString(),
|
|
103
|
-
claimPathMtp: prepareSiblingsStr(valueProof.mtp, this.
|
|
103
|
+
claimPathMtp: prepareSiblingsStr(valueProof.mtp, this.getMTLevelsClaim()),
|
|
104
104
|
claimPathValue: valueProof.value.toString(),
|
|
105
|
-
operator: this.query
|
|
105
|
+
operator: this.query.operator,
|
|
106
106
|
timestamp: this.currentTimeStamp,
|
|
107
107
|
// value in this path in merklized json-ld document
|
|
108
108
|
slotIndex: this.query?.slotIndex,
|
|
@@ -49,6 +49,9 @@ export class AtomicQuerySigV2Inputs extends BaseConfig {
|
|
|
49
49
|
this.query.valueProof.validate();
|
|
50
50
|
}
|
|
51
51
|
const valueProof = this.query.valueProof ?? new ValueProof();
|
|
52
|
+
const treeState = this.skipClaimRevocationCheck
|
|
53
|
+
? this.claim.signatureProof?.issuerAuthNonRevProof.treeState
|
|
54
|
+
: this.claim.nonRevProof?.treeState;
|
|
52
55
|
const s = {
|
|
53
56
|
requestID: this.requestID.toString(),
|
|
54
57
|
userGenesisID: this.id.bigInt().toString(),
|
|
@@ -56,16 +59,10 @@ export class AtomicQuerySigV2Inputs extends BaseConfig {
|
|
|
56
59
|
claimSubjectProfileNonce: this.claimSubjectProfileNonce?.toString(),
|
|
57
60
|
issuerID: this.claim.issuerID?.bigInt().toString(),
|
|
58
61
|
issuerClaim: this.claim.claim?.marshalJson(),
|
|
59
|
-
issuerClaimNonRevClaimsTreeRoot:
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
?.bigInt()
|
|
64
|
-
.toString(),
|
|
65
|
-
issuerClaimNonRevRootsTreeRoot: this.claim.nonRevProof?.treeState?.rootOfRoots
|
|
66
|
-
?.bigInt()
|
|
67
|
-
.toString(),
|
|
68
|
-
issuerClaimNonRevState: this.claim.nonRevProof?.treeState?.state?.bigInt().toString(),
|
|
62
|
+
issuerClaimNonRevClaimsTreeRoot: treeState?.claimsRoot.bigInt().toString(),
|
|
63
|
+
issuerClaimNonRevRevTreeRoot: treeState?.revocationRoot.bigInt().toString(),
|
|
64
|
+
issuerClaimNonRevRootsTreeRoot: treeState?.rootOfRoots.bigInt().toString(),
|
|
65
|
+
issuerClaimNonRevState: treeState?.state.bigInt().toString(),
|
|
69
66
|
issuerClaimNonRevMtp: this.claim.nonRevProof?.proof &&
|
|
70
67
|
prepareSiblingsStr(this.claim.nonRevProof.proof, this.getMTLevel()),
|
|
71
68
|
issuerClaimSignatureR8x: this.claim.signatureProof?.signature.R8[0].toString(),
|
|
@@ -75,18 +72,18 @@ export class AtomicQuerySigV2Inputs extends BaseConfig {
|
|
|
75
72
|
issuerAuthClaimMtp: this.claim.signatureProof?.issuerAuthIncProof?.proof &&
|
|
76
73
|
prepareSiblingsStr(this.claim.signatureProof.issuerAuthIncProof.proof, this.getMTLevel()),
|
|
77
74
|
issuerAuthClaimsTreeRoot: this.claim.signatureProof?.issuerAuthIncProof.treeState?.claimsRoot
|
|
78
|
-
|
|
75
|
+
.bigInt()
|
|
79
76
|
.toString(),
|
|
80
77
|
issuerAuthRevTreeRoot: this.claim.signatureProof?.issuerAuthIncProof?.treeState?.revocationRoot
|
|
81
|
-
|
|
78
|
+
.bigInt()
|
|
82
79
|
.toString(),
|
|
83
80
|
issuerAuthRootsTreeRoot: this.claim.signatureProof?.issuerAuthIncProof?.treeState?.rootOfRoots
|
|
84
|
-
|
|
81
|
+
.bigInt()
|
|
85
82
|
.toString(),
|
|
86
83
|
issuerAuthClaimNonRevMtp: this.claim.signatureProof?.issuerAuthNonRevProof?.proof &&
|
|
87
84
|
prepareSiblingsStr(this.claim.signatureProof.issuerAuthNonRevProof.proof, this.getMTLevel()),
|
|
88
85
|
claimSchema: this.claim.claim?.getSchemaHash().bigInt().toString(),
|
|
89
|
-
claimPathMtp: prepareSiblingsStr(valueProof.mtp, this.
|
|
86
|
+
claimPathMtp: prepareSiblingsStr(valueProof.mtp, this.getMTLevelsClaim()),
|
|
90
87
|
claimPathValue: valueProof.value.toString(),
|
|
91
88
|
operator: this.query.operator,
|
|
92
89
|
timestamp: this.currentTimeStamp,
|