@0xpolygonid/js-sdk 1.7.4 → 1.7.5
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 +37 -96
- package/dist/browser/esm/index.js.map +1 -1
- package/dist/browser/umd/index.js +36 -97
- package/dist/browser/umd/index.js.map +1 -1
- package/dist/node/cjs/circuits/atomic-query-v3.js +18 -13
- package/dist/node/cjs/circuits/index.js +0 -1
- package/dist/node/cjs/circuits/linked-multi-query.js +16 -6
- package/dist/node/cjs/circuits/models.js +0 -5
- package/dist/node/cjs/proof/inputs-generator.js +2 -18
- package/dist/node/cjs/storage/filters/jsonQuery.js +2 -2
- package/dist/node/esm/circuits/atomic-query-v3.js +18 -13
- package/dist/node/esm/circuits/index.js +0 -1
- package/dist/node/esm/circuits/linked-multi-query.js +16 -6
- package/dist/node/esm/circuits/models.js +0 -5
- package/dist/node/esm/proof/inputs-generator.js +3 -19
- package/dist/node/esm/storage/filters/jsonQuery.js +2 -2
- package/dist/types/circuits/index.d.ts +0 -1
- package/dist/types/circuits/linked-multi-query.d.ts +3 -3
- package/dist/types/circuits/models.d.ts +0 -4
- package/dist/types/proof/inputs-generator.d.ts +1 -2
- package/package.json +1 -1
- package/dist/node/cjs/circuits/linked-nullifier.js +0 -57
- package/dist/node/esm/circuits/linked-nullifier.js +0 -52
- package/dist/types/circuits/linked-nullifier.d.ts +0 -37
|
@@ -55619,11 +55619,6 @@ var PolygonIdSdk = (function (exports) {
|
|
|
55619
55619
|
*/
|
|
55620
55620
|
// AtomicQueryV3OnChainCircuitID is a type for credentialAtomicQueryV3OnChain.circom
|
|
55621
55621
|
CircuitId["AtomicQueryV3OnChain"] = "credentialAtomicQueryV3OnChain-beta.0";
|
|
55622
|
-
/**
|
|
55623
|
-
* @beta
|
|
55624
|
-
*/
|
|
55625
|
-
// LinkedNullifier is a type for linkedNullifier.circom
|
|
55626
|
-
CircuitId["LinkedNullifier"] = "linkedNullifier-beta.0";
|
|
55627
55622
|
/**
|
|
55628
55623
|
* @beta
|
|
55629
55624
|
*/
|
|
@@ -56362,23 +56357,28 @@ var PolygonIdSdk = (function (exports) {
|
|
|
56362
56357
|
s.isRevocationChecked = 0;
|
|
56363
56358
|
}
|
|
56364
56359
|
if (this.proofType === exports.ProofType.BJJSignature) {
|
|
56360
|
+
const sigProof = this.claim.signatureProof;
|
|
56365
56361
|
s.proofType = '1';
|
|
56366
|
-
s.issuerClaimSignatureR8x =
|
|
56367
|
-
s.issuerClaimSignatureR8y =
|
|
56368
|
-
s.issuerClaimSignatureS =
|
|
56369
|
-
s.issuerAuthClaim =
|
|
56370
|
-
s.issuerAuthClaimMtp = prepareSiblingsStr(
|
|
56371
|
-
s.issuerAuthClaimsTreeRoot = treeState
|
|
56372
|
-
|
|
56373
|
-
|
|
56374
|
-
s.
|
|
56375
|
-
|
|
56362
|
+
s.issuerClaimSignatureR8x = sigProof.signature.R8[0].toString();
|
|
56363
|
+
s.issuerClaimSignatureR8y = sigProof.signature.R8[1].toString();
|
|
56364
|
+
s.issuerClaimSignatureS = sigProof.signature.S.toString();
|
|
56365
|
+
s.issuerAuthClaim = sigProof.issuerAuthClaim?.marshalJson();
|
|
56366
|
+
s.issuerAuthClaimMtp = prepareSiblingsStr(sigProof.issuerAuthIncProof.proof, this.getMTLevel());
|
|
56367
|
+
s.issuerAuthClaimsTreeRoot = sigProof.issuerAuthIncProof.treeState?.claimsRoot
|
|
56368
|
+
.bigInt()
|
|
56369
|
+
.toString();
|
|
56370
|
+
s.issuerAuthRevTreeRoot = sigProof.issuerAuthIncProof.treeState?.revocationRoot
|
|
56371
|
+
.bigInt()
|
|
56372
|
+
.toString();
|
|
56373
|
+
s.issuerAuthRootsTreeRoot = sigProof.issuerAuthIncProof.treeState?.rootOfRoots
|
|
56374
|
+
.bigInt()
|
|
56375
|
+
.toString();
|
|
56376
|
+
s.issuerAuthClaimNonRevMtp = prepareSiblingsStr(sigProof.issuerAuthNonRevProof.proof, this.getMTLevel());
|
|
56377
|
+
const nodeAuxIssuerAuthNonRev = getNodeAuxValue(sigProof.issuerAuthNonRevProof.proof);
|
|
56376
56378
|
s.issuerAuthClaimNonRevMtpAuxHi = nodeAuxIssuerAuthNonRev.key.bigInt().toString();
|
|
56377
56379
|
s.issuerAuthClaimNonRevMtpAuxHv = nodeAuxIssuerAuthNonRev.value.bigInt().toString();
|
|
56378
56380
|
s.issuerAuthClaimNonRevMtpNoAux = nodeAuxIssuerAuthNonRev.noAux;
|
|
56379
|
-
s.issuerAuthState =
|
|
56380
|
-
.bigInt()
|
|
56381
|
-
.toString();
|
|
56381
|
+
s.issuerAuthState = sigProof.issuerAuthIncProof.treeState?.state.bigInt().toString();
|
|
56382
56382
|
this.fillMTPProofsWithZero(s);
|
|
56383
56383
|
}
|
|
56384
56384
|
else if (this.proofType === exports.ProofType.Iden3SparseMerkleTreeProof) {
|
|
@@ -57225,57 +57225,6 @@ var PolygonIdSdk = (function (exports) {
|
|
|
57225
57225
|
}
|
|
57226
57226
|
}
|
|
57227
57227
|
|
|
57228
|
-
/**
|
|
57229
|
-
* LinkedNullifier circuit representation
|
|
57230
|
-
* Inputs and public signals declaration, marshalling and parsing
|
|
57231
|
-
*
|
|
57232
|
-
* @beta
|
|
57233
|
-
* @class LinkedNullifierInputs
|
|
57234
|
-
*/
|
|
57235
|
-
class LinkedNullifierInputs {
|
|
57236
|
-
// InputsMarshal returns Circom private inputs for nullifier.circom
|
|
57237
|
-
inputsMarshal() {
|
|
57238
|
-
const s = {
|
|
57239
|
-
linkNonce: this.linkNonce.toString(),
|
|
57240
|
-
issuerClaim: this.issuerClaim.marshalJson(),
|
|
57241
|
-
userGenesisID: this.id.bigInt().toString(),
|
|
57242
|
-
claimSubjectProfileNonce: this.claimSubjectProfileNonce.toString(),
|
|
57243
|
-
claimSchema: this.issuerClaim.getSchemaHash().bigInt().toString(),
|
|
57244
|
-
verifierID: this.verifierID?.bigInt().toString() ?? '0',
|
|
57245
|
-
nullifierSessionID: this.nullifierSessionID.toString()
|
|
57246
|
-
};
|
|
57247
|
-
return byteEncoder.encode(JSON.stringify(s));
|
|
57248
|
-
}
|
|
57249
|
-
}
|
|
57250
|
-
// LinkedNullifierPubSignals nullifier.circom public signals
|
|
57251
|
-
/**
|
|
57252
|
-
* public signals
|
|
57253
|
-
*
|
|
57254
|
-
* @beta
|
|
57255
|
-
* @class LinkedNullifierPubSignals
|
|
57256
|
-
*/
|
|
57257
|
-
class LinkedNullifierPubSignals {
|
|
57258
|
-
/**
|
|
57259
|
-
* PubSignalsUnmarshal unmarshal nullifier.circom public inputs to LinkedNullifierPubSignals
|
|
57260
|
-
*
|
|
57261
|
-
* @beta
|
|
57262
|
-
* @param {Uint8Array} data
|
|
57263
|
-
* @returns LinkedNullifierPubSignals
|
|
57264
|
-
*/
|
|
57265
|
-
pubSignalsUnmarshal(data) {
|
|
57266
|
-
const len = 4;
|
|
57267
|
-
const sVals = JSON.parse(byteDecoder.decode(data));
|
|
57268
|
-
if (sVals.length !== len) {
|
|
57269
|
-
throw new Error(`invalid number of Output values expected ${len} got ${sVals.length}`);
|
|
57270
|
-
}
|
|
57271
|
-
this.nullifier = BigInt(sVals[0]);
|
|
57272
|
-
this.linkID = BigInt(sVals[1]);
|
|
57273
|
-
this.verifierID = k$2.fromBigInt(BigInt(sVals[2]));
|
|
57274
|
-
this.nullifierSessionID = BigInt(sVals[3]);
|
|
57275
|
-
return this;
|
|
57276
|
-
}
|
|
57277
|
-
}
|
|
57278
|
-
|
|
57279
57228
|
/**
|
|
57280
57229
|
* LinkedMultiQuery circuit representation
|
|
57281
57230
|
* Inputs and public signals declaration, marshalling and parsing
|
|
@@ -57297,7 +57246,7 @@ var PolygonIdSdk = (function (exports) {
|
|
|
57297
57246
|
const slotIndex = [];
|
|
57298
57247
|
const operator = [];
|
|
57299
57248
|
const value = [];
|
|
57300
|
-
for (let i = 0; i <
|
|
57249
|
+
for (let i = 0; i < LinkedMultiQueryInputs.queryCount; i++) {
|
|
57301
57250
|
if (!this.query[i]) {
|
|
57302
57251
|
enabled.push(0);
|
|
57303
57252
|
claimPathNotExists.push(0);
|
|
@@ -57314,7 +57263,13 @@ var PolygonIdSdk = (function (exports) {
|
|
|
57314
57263
|
continue;
|
|
57315
57264
|
}
|
|
57316
57265
|
enabled.push(1);
|
|
57317
|
-
|
|
57266
|
+
let valueProof = this.query[i].valueProof;
|
|
57267
|
+
if (!valueProof) {
|
|
57268
|
+
valueProof = new ValueProof();
|
|
57269
|
+
valueProof.path = 0n;
|
|
57270
|
+
valueProof.value = 0n;
|
|
57271
|
+
valueProof.mtp = new Kt$1();
|
|
57272
|
+
}
|
|
57318
57273
|
claimPathNotExists.push(existenceToInt(valueProof.mtp.existence));
|
|
57319
57274
|
claimPathMtp.push(prepareSiblingsStr(valueProof.mtp, this.getMTLevelsClaim()));
|
|
57320
57275
|
const nodAuxJSONLD = getNodeAuxValue(valueProof.mtp);
|
|
@@ -57347,7 +57302,8 @@ var PolygonIdSdk = (function (exports) {
|
|
|
57347
57302
|
return byteEncoder.encode(JSON.stringify(s));
|
|
57348
57303
|
}
|
|
57349
57304
|
}
|
|
57350
|
-
|
|
57305
|
+
LinkedMultiQueryInputs.queryCount = 10;
|
|
57306
|
+
// LinkedMultiQueryPubSignals linkedMultiQuery10.circom public signals
|
|
57351
57307
|
/**
|
|
57352
57308
|
* public signals
|
|
57353
57309
|
*
|
|
@@ -57356,14 +57312,15 @@ var PolygonIdSdk = (function (exports) {
|
|
|
57356
57312
|
*/
|
|
57357
57313
|
class LinkedMultiQueryPubSignals {
|
|
57358
57314
|
/**
|
|
57359
|
-
* PubSignalsUnmarshal unmarshal
|
|
57315
|
+
* PubSignalsUnmarshal unmarshal linkedMultiQuery10.circom public inputs to LinkedMultiQueryPubSignals
|
|
57360
57316
|
*
|
|
57361
57317
|
* @beta
|
|
57362
57318
|
* @param {Uint8Array} data
|
|
57363
57319
|
* @returns LinkedMultiQueryPubSignals
|
|
57364
57320
|
*/
|
|
57365
|
-
pubSignalsUnmarshal(data
|
|
57366
|
-
const len =
|
|
57321
|
+
pubSignalsUnmarshal(data) {
|
|
57322
|
+
const len = 32;
|
|
57323
|
+
const queryLength = LinkedMultiQueryInputs.queryCount;
|
|
57367
57324
|
const sVals = JSON.parse(byteDecoder.decode(data));
|
|
57368
57325
|
if (sVals.length !== len) {
|
|
57369
57326
|
throw new Error(`invalid number of Output values expected ${len} got ${sVals.length}`);
|
|
@@ -59474,8 +59431,8 @@ var PolygonIdSdk = (function (exports) {
|
|
|
59474
59431
|
case 'claimId':
|
|
59475
59432
|
return acc.concat(new FilterQuery('id', comparatorOptions.$eq, queryValue));
|
|
59476
59433
|
case 'allowedIssuers': {
|
|
59477
|
-
const
|
|
59478
|
-
if (
|
|
59434
|
+
const queryValueParam = queryValue || ['*'];
|
|
59435
|
+
if (queryValueParam.includes('*')) {
|
|
59479
59436
|
return acc;
|
|
59480
59437
|
}
|
|
59481
59438
|
return acc.concat(new FilterQuery('issuer', comparatorOptions.$in, queryValue));
|
|
@@ -82953,8 +82910,7 @@ var PolygonIdSdk = (function (exports) {
|
|
|
82953
82910
|
[exports.CircuitId.AtomicQueryV3OnChain]: { maxQueriesCount: 1 },
|
|
82954
82911
|
[exports.CircuitId.AuthV2]: { maxQueriesCount: 0 },
|
|
82955
82912
|
[exports.CircuitId.StateTransition]: { maxQueriesCount: 0 },
|
|
82956
|
-
[exports.CircuitId.
|
|
82957
|
-
[exports.CircuitId.LinkedMultiQuery10]: { maxQueriesCount: 10 }
|
|
82913
|
+
[exports.CircuitId.LinkedMultiQuery10]: { maxQueriesCount: LinkedMultiQueryInputs.queryCount }
|
|
82958
82914
|
};
|
|
82959
82915
|
class InputGenerator {
|
|
82960
82916
|
constructor(_identityWallet, _credentialWallet, _stateStorage) {
|
|
@@ -83222,28 +83178,13 @@ var PolygonIdSdk = (function (exports) {
|
|
|
83222
83178
|
}
|
|
83223
83179
|
return circuitInputs.inputsMarshal();
|
|
83224
83180
|
};
|
|
83225
|
-
this.
|
|
83226
|
-
const circuitClaimData = await this.newCircuitClaimData(preparedCredential);
|
|
83227
|
-
circuitClaimData.nonRevProof = toClaimNonRevStatus(preparedCredential.revStatus);
|
|
83228
|
-
const circuitInputs = new LinkedNullifierInputs();
|
|
83229
|
-
circuitInputs.linkNonce = params.linkNonce ?? BigInt(0);
|
|
83230
|
-
circuitInputs.issuerClaim = circuitClaimData.claim;
|
|
83231
|
-
circuitInputs.id = W$2.idFromDID(identifier);
|
|
83232
|
-
circuitInputs.claimSubjectProfileNonce = BigInt(params.credentialSubjectProfileNonce);
|
|
83233
|
-
circuitInputs.verifierID = params.verifierDid ? W$2.idFromDID(params.verifierDid) : undefined;
|
|
83234
|
-
circuitInputs.nullifierSessionID = proofReq.params?.nullifierSessionID
|
|
83235
|
-
? BigInt(proofReq.params?.nullifierSessionID?.toString())
|
|
83236
|
-
: BigInt(0);
|
|
83237
|
-
return circuitInputs.inputsMarshal();
|
|
83238
|
-
};
|
|
83239
|
-
this.linkedMultiQuery10PrepareInputs = async ({ preparedCredential, proofReq, params, circuitQueries }) => {
|
|
83181
|
+
this.linkedMultiQuery10PrepareInputs = async ({ preparedCredential, params, circuitQueries }) => {
|
|
83240
83182
|
const circuitClaimData = await this.newCircuitClaimData(preparedCredential);
|
|
83241
83183
|
circuitClaimData.nonRevProof = toClaimNonRevStatus(preparedCredential.revStatus);
|
|
83242
83184
|
const circuitInputs = new LinkedMultiQueryInputs();
|
|
83243
83185
|
circuitInputs.linkNonce = params.linkNonce ?? BigInt(0);
|
|
83244
83186
|
circuitInputs.claim = circuitClaimData.claim;
|
|
83245
83187
|
circuitInputs.query = circuitQueries;
|
|
83246
|
-
circuitInputs.queryLength = circuitValidator[proofReq.circuitId].maxQueriesCount;
|
|
83247
83188
|
return circuitInputs.inputsMarshal();
|
|
83248
83189
|
};
|
|
83249
83190
|
}
|
|
@@ -84670,8 +84611,6 @@ var PolygonIdSdk = (function (exports) {
|
|
|
84670
84611
|
exports.LDParser = LDParser;
|
|
84671
84612
|
exports.LinkedMultiQueryInputs = LinkedMultiQueryInputs;
|
|
84672
84613
|
exports.LinkedMultiQueryPubSignals = LinkedMultiQueryPubSignals;
|
|
84673
|
-
exports.LinkedNullifierInputs = LinkedNullifierInputs;
|
|
84674
|
-
exports.LinkedNullifierPubSignals = LinkedNullifierPubSignals;
|
|
84675
84614
|
exports.LocalStoragePrivateKeyStore = LocalStoragePrivateKeyStore;
|
|
84676
84615
|
exports.MerkleTreeIndexedDBStorage = MerkleTreeIndexedDBStorage;
|
|
84677
84616
|
exports.MerkleTreeLocalStorage = MerkleTreeLocalStorage;
|