@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.
@@ -55480,11 +55480,6 @@ var CircuitId;
55480
55480
  */
55481
55481
  // AtomicQueryV3OnChainCircuitID is a type for credentialAtomicQueryV3OnChain.circom
55482
55482
  CircuitId["AtomicQueryV3OnChain"] = "credentialAtomicQueryV3OnChain-beta.0";
55483
- /**
55484
- * @beta
55485
- */
55486
- // LinkedNullifier is a type for linkedNullifier.circom
55487
- CircuitId["LinkedNullifier"] = "linkedNullifier-beta.0";
55488
55483
  /**
55489
55484
  * @beta
55490
55485
  */
@@ -56223,23 +56218,28 @@ class AtomicQueryV3Inputs extends BaseConfig {
56223
56218
  s.isRevocationChecked = 0;
56224
56219
  }
56225
56220
  if (this.proofType === ProofType.BJJSignature) {
56221
+ const sigProof = this.claim.signatureProof;
56226
56222
  s.proofType = '1';
56227
- s.issuerClaimSignatureR8x = this.claim.signatureProof?.signature.R8[0].toString();
56228
- s.issuerClaimSignatureR8y = this.claim.signatureProof?.signature.R8[1].toString();
56229
- s.issuerClaimSignatureS = this.claim.signatureProof?.signature.S.toString();
56230
- s.issuerAuthClaim = this.claim.signatureProof?.issuerAuthClaim?.marshalJson();
56231
- s.issuerAuthClaimMtp = prepareSiblingsStr(this.claim.signatureProof?.issuerAuthIncProof.proof, this.getMTLevel());
56232
- s.issuerAuthClaimsTreeRoot = treeState.claimsRoot.bigInt().toString();
56233
- s.issuerAuthRevTreeRoot = treeState.revocationRoot.bigInt().toString();
56234
- s.issuerAuthRootsTreeRoot = treeState.rootOfRoots.bigInt().toString();
56235
- s.issuerAuthClaimNonRevMtp = prepareSiblingsStr(this.claim.signatureProof?.issuerAuthNonRevProof.proof, this.getMTLevel());
56236
- const nodeAuxIssuerAuthNonRev = getNodeAuxValue(this.claim.signatureProof?.issuerAuthNonRevProof.proof);
56223
+ s.issuerClaimSignatureR8x = sigProof.signature.R8[0].toString();
56224
+ s.issuerClaimSignatureR8y = sigProof.signature.R8[1].toString();
56225
+ s.issuerClaimSignatureS = sigProof.signature.S.toString();
56226
+ s.issuerAuthClaim = sigProof.issuerAuthClaim?.marshalJson();
56227
+ s.issuerAuthClaimMtp = prepareSiblingsStr(sigProof.issuerAuthIncProof.proof, this.getMTLevel());
56228
+ s.issuerAuthClaimsTreeRoot = sigProof.issuerAuthIncProof.treeState?.claimsRoot
56229
+ .bigInt()
56230
+ .toString();
56231
+ s.issuerAuthRevTreeRoot = sigProof.issuerAuthIncProof.treeState?.revocationRoot
56232
+ .bigInt()
56233
+ .toString();
56234
+ s.issuerAuthRootsTreeRoot = sigProof.issuerAuthIncProof.treeState?.rootOfRoots
56235
+ .bigInt()
56236
+ .toString();
56237
+ s.issuerAuthClaimNonRevMtp = prepareSiblingsStr(sigProof.issuerAuthNonRevProof.proof, this.getMTLevel());
56238
+ const nodeAuxIssuerAuthNonRev = getNodeAuxValue(sigProof.issuerAuthNonRevProof.proof);
56237
56239
  s.issuerAuthClaimNonRevMtpAuxHi = nodeAuxIssuerAuthNonRev.key.bigInt().toString();
56238
56240
  s.issuerAuthClaimNonRevMtpAuxHv = nodeAuxIssuerAuthNonRev.value.bigInt().toString();
56239
56241
  s.issuerAuthClaimNonRevMtpNoAux = nodeAuxIssuerAuthNonRev.noAux;
56240
- s.issuerAuthState = this.claim.signatureProof?.issuerAuthIncProof.treeState?.state
56241
- .bigInt()
56242
- .toString();
56242
+ s.issuerAuthState = sigProof.issuerAuthIncProof.treeState?.state.bigInt().toString();
56243
56243
  this.fillMTPProofsWithZero(s);
56244
56244
  }
56245
56245
  else if (this.proofType === ProofType.Iden3SparseMerkleTreeProof) {
@@ -57086,57 +57086,6 @@ class StateTransitionPubSignals {
57086
57086
  }
57087
57087
  }
57088
57088
 
57089
- /**
57090
- * LinkedNullifier circuit representation
57091
- * Inputs and public signals declaration, marshalling and parsing
57092
- *
57093
- * @beta
57094
- * @class LinkedNullifierInputs
57095
- */
57096
- class LinkedNullifierInputs {
57097
- // InputsMarshal returns Circom private inputs for nullifier.circom
57098
- inputsMarshal() {
57099
- const s = {
57100
- linkNonce: this.linkNonce.toString(),
57101
- issuerClaim: this.issuerClaim.marshalJson(),
57102
- userGenesisID: this.id.bigInt().toString(),
57103
- claimSubjectProfileNonce: this.claimSubjectProfileNonce.toString(),
57104
- claimSchema: this.issuerClaim.getSchemaHash().bigInt().toString(),
57105
- verifierID: this.verifierID?.bigInt().toString() ?? '0',
57106
- nullifierSessionID: this.nullifierSessionID.toString()
57107
- };
57108
- return byteEncoder.encode(JSON.stringify(s));
57109
- }
57110
- }
57111
- // LinkedNullifierPubSignals nullifier.circom public signals
57112
- /**
57113
- * public signals
57114
- *
57115
- * @beta
57116
- * @class LinkedNullifierPubSignals
57117
- */
57118
- class LinkedNullifierPubSignals {
57119
- /**
57120
- * PubSignalsUnmarshal unmarshal nullifier.circom public inputs to LinkedNullifierPubSignals
57121
- *
57122
- * @beta
57123
- * @param {Uint8Array} data
57124
- * @returns LinkedNullifierPubSignals
57125
- */
57126
- pubSignalsUnmarshal(data) {
57127
- const len = 4;
57128
- const sVals = JSON.parse(byteDecoder.decode(data));
57129
- if (sVals.length !== len) {
57130
- throw new Error(`invalid number of Output values expected ${len} got ${sVals.length}`);
57131
- }
57132
- this.nullifier = BigInt(sVals[0]);
57133
- this.linkID = BigInt(sVals[1]);
57134
- this.verifierID = Id.fromBigInt(BigInt(sVals[2]));
57135
- this.nullifierSessionID = BigInt(sVals[3]);
57136
- return this;
57137
- }
57138
- }
57139
-
57140
57089
  /**
57141
57090
  * LinkedMultiQuery circuit representation
57142
57091
  * Inputs and public signals declaration, marshalling and parsing
@@ -57158,7 +57107,7 @@ class LinkedMultiQueryInputs extends BaseConfig {
57158
57107
  const slotIndex = [];
57159
57108
  const operator = [];
57160
57109
  const value = [];
57161
- for (let i = 0; i < this.queryLength; i++) {
57110
+ for (let i = 0; i < LinkedMultiQueryInputs.queryCount; i++) {
57162
57111
  if (!this.query[i]) {
57163
57112
  enabled.push(0);
57164
57113
  claimPathNotExists.push(0);
@@ -57175,7 +57124,13 @@ class LinkedMultiQueryInputs extends BaseConfig {
57175
57124
  continue;
57176
57125
  }
57177
57126
  enabled.push(1);
57178
- const valueProof = this.query[i].valueProof;
57127
+ let valueProof = this.query[i].valueProof;
57128
+ if (!valueProof) {
57129
+ valueProof = new ValueProof();
57130
+ valueProof.path = 0n;
57131
+ valueProof.value = 0n;
57132
+ valueProof.mtp = new Proof();
57133
+ }
57179
57134
  claimPathNotExists.push(existenceToInt(valueProof.mtp.existence));
57180
57135
  claimPathMtp.push(prepareSiblingsStr(valueProof.mtp, this.getMTLevelsClaim()));
57181
57136
  const nodAuxJSONLD = getNodeAuxValue(valueProof.mtp);
@@ -57208,7 +57163,8 @@ class LinkedMultiQueryInputs extends BaseConfig {
57208
57163
  return byteEncoder.encode(JSON.stringify(s));
57209
57164
  }
57210
57165
  }
57211
- // LinkedMultiQueryPubSignals linkedMultiQuery.circom public signals
57166
+ LinkedMultiQueryInputs.queryCount = 10;
57167
+ // LinkedMultiQueryPubSignals linkedMultiQuery10.circom public signals
57212
57168
  /**
57213
57169
  * public signals
57214
57170
  *
@@ -57217,14 +57173,15 @@ class LinkedMultiQueryInputs extends BaseConfig {
57217
57173
  */
57218
57174
  class LinkedMultiQueryPubSignals {
57219
57175
  /**
57220
- * PubSignalsUnmarshal unmarshal linkedMultiQuery.circom public inputs to LinkedMultiQueryPubSignals
57176
+ * PubSignalsUnmarshal unmarshal linkedMultiQuery10.circom public inputs to LinkedMultiQueryPubSignals
57221
57177
  *
57222
57178
  * @beta
57223
57179
  * @param {Uint8Array} data
57224
57180
  * @returns LinkedMultiQueryPubSignals
57225
57181
  */
57226
- pubSignalsUnmarshal(data, queryLength) {
57227
- const len = queryLength * 3 + 2;
57182
+ pubSignalsUnmarshal(data) {
57183
+ const len = 32;
57184
+ const queryLength = LinkedMultiQueryInputs.queryCount;
57228
57185
  const sVals = JSON.parse(byteDecoder.decode(data));
57229
57186
  if (sVals.length !== len) {
57230
57187
  throw new Error(`invalid number of Output values expected ${len} got ${sVals.length}`);
@@ -59335,8 +59292,8 @@ const StandardJSONCredentialsQueryFilter = (query) => {
59335
59292
  case 'claimId':
59336
59293
  return acc.concat(new FilterQuery('id', comparatorOptions.$eq, queryValue));
59337
59294
  case 'allowedIssuers': {
59338
- const [first] = queryValue || [];
59339
- if (first && first === '*') {
59295
+ const queryValueParam = queryValue || ['*'];
59296
+ if (queryValueParam.includes('*')) {
59340
59297
  return acc;
59341
59298
  }
59342
59299
  return acc.concat(new FilterQuery('issuer', comparatorOptions.$in, queryValue));
@@ -62054,8 +62011,7 @@ const circuitValidator = {
62054
62011
  [CircuitId.AtomicQueryV3OnChain]: { maxQueriesCount: 1 },
62055
62012
  [CircuitId.AuthV2]: { maxQueriesCount: 0 },
62056
62013
  [CircuitId.StateTransition]: { maxQueriesCount: 0 },
62057
- [CircuitId.LinkedNullifier]: { maxQueriesCount: 1 },
62058
- [CircuitId.LinkedMultiQuery10]: { maxQueriesCount: 10 }
62014
+ [CircuitId.LinkedMultiQuery10]: { maxQueriesCount: LinkedMultiQueryInputs.queryCount }
62059
62015
  };
62060
62016
  class InputGenerator {
62061
62017
  constructor(_identityWallet, _credentialWallet, _stateStorage) {
@@ -62323,28 +62279,13 @@ class InputGenerator {
62323
62279
  }
62324
62280
  return circuitInputs.inputsMarshal();
62325
62281
  };
62326
- this.linkedNullifierPrepareInputs = async ({ preparedCredential, identifier, proofReq, params }) => {
62327
- const circuitClaimData = await this.newCircuitClaimData(preparedCredential);
62328
- circuitClaimData.nonRevProof = toClaimNonRevStatus(preparedCredential.revStatus);
62329
- const circuitInputs = new LinkedNullifierInputs();
62330
- circuitInputs.linkNonce = params.linkNonce ?? BigInt(0);
62331
- circuitInputs.issuerClaim = circuitClaimData.claim;
62332
- circuitInputs.id = DID.idFromDID(identifier);
62333
- circuitInputs.claimSubjectProfileNonce = BigInt(params.credentialSubjectProfileNonce);
62334
- circuitInputs.verifierID = params.verifierDid ? DID.idFromDID(params.verifierDid) : undefined;
62335
- circuitInputs.nullifierSessionID = proofReq.params?.nullifierSessionID
62336
- ? BigInt(proofReq.params?.nullifierSessionID?.toString())
62337
- : BigInt(0);
62338
- return circuitInputs.inputsMarshal();
62339
- };
62340
- this.linkedMultiQuery10PrepareInputs = async ({ preparedCredential, proofReq, params, circuitQueries }) => {
62282
+ this.linkedMultiQuery10PrepareInputs = async ({ preparedCredential, params, circuitQueries }) => {
62341
62283
  const circuitClaimData = await this.newCircuitClaimData(preparedCredential);
62342
62284
  circuitClaimData.nonRevProof = toClaimNonRevStatus(preparedCredential.revStatus);
62343
62285
  const circuitInputs = new LinkedMultiQueryInputs();
62344
62286
  circuitInputs.linkNonce = params.linkNonce ?? BigInt(0);
62345
62287
  circuitInputs.claim = circuitClaimData.claim;
62346
62288
  circuitInputs.query = circuitQueries;
62347
- circuitInputs.queryLength = circuitValidator[proofReq.circuitId].maxQueriesCount;
62348
62289
  return circuitInputs.inputsMarshal();
62349
62290
  };
62350
62291
  }
@@ -63707,5 +63648,5 @@ class RefreshHandler {
63707
63648
  }
63708
63649
  }
63709
63650
 
63710
- export { AbstractPrivateKeyStore, AgentResolver, AtomicQueryMTPV2Inputs, AtomicQueryMTPV2OnChainInputs, AtomicQueryMTPV2OnChainPubSignals, AtomicQueryMTPV2PubSignals, AtomicQuerySigV2Inputs, AtomicQuerySigV2OnChainCircuitInputs, AtomicQuerySigV2OnChainInputs, AtomicQuerySigV2OnChainPubSignals, AtomicQuerySigV2PubSignals, AtomicQueryV3Inputs, AtomicQueryV3OnChainInputs, AtomicQueryV3OnChainPubSignals, AtomicQueryV3PubSignals, AuthHandler, AuthV2Inputs, AuthV2PubSignals, BJJSignatureProof2021, BaseConfig, BjjProvider, BrowserDataSource, CircuitClaim, CircuitError, CircuitId, CircuitStorage, ContractRequestHandler, CredentialStatusPublisherRegistry, CredentialStatusResolverRegistry, CredentialStatusType, CredentialStorage, CredentialWallet, DIDDocumentJSONSchema, DataPrepareHandlerFunc, ErrorEmptyAuthClaimNonRevProof, ErrorEmptyAuthClaimProof, ErrorEmptyChallengeSignature, ErrorEmptyClaimNonRevProof, ErrorEmptyClaimProof, ErrorEmptyClaimSignature, ErrorEmptyIssuerAuthClaimNonRevProof, ErrorEmptyIssuerAuthClaimProof, ErrorUserStateInRelayClaimProof, EthStateStorage, FSCircuitStorage, FetchHandler, FilterQuery, Iden3OnchainSmtCredentialStatusPublisher, Iden3SmtRhsCredentialStatusPublisher, Iden3SparseMerkleTreeProof, IdentityStorage, IdentityWallet, InMemoryDataSource, InMemoryMerkleTreeStorage, InMemoryPrivateKeyStore, IndexedDBDataSource, IndexedDBPrivateKeyStore, IssuerResolver, JSON_SCHEMA_VALIDATORS_REGISTRY, JWSPacker, JsonSchemaValidator, KMS, KmsKeyType, LDParser, LinkedMultiQueryInputs, LinkedMultiQueryPubSignals, LinkedNullifierInputs, LinkedNullifierPubSignals, LocalStoragePrivateKeyStore, MerkleTreeIndexedDBStorage, MerkleTreeLocalStorage, MerkleTreeType, MerklizedRootPosition, NativeProver, OnChainResolver, OnChainRevocationStorage, OnChainZKPVerifier, Operators, constants as PROTOCOL_CONSTANTS, PackageManager, Parser, PlainPacker, ProofNode, ProofPurpose, ProofService, ProofType, Query, QueryOperators, RHSResolver, RefreshHandler, RefreshServiceType, Scalar, SearchError, Sec256k1Provider, StandardJSONCredentialsQueryFilter, StateTransitionInputs, StateTransitionPubSignals, SubjectPosition, ValueProof, Vector, VerifiableConstants, VerificationHandlerFunc, W3CCredential, XSDNS, ZKPPacker, availableTypesOperators, base58ToBytes, base64ToBytes, base64UrlToBytes, bigIntArrayToStringArray, buildFieldPath, buildTreeState, buildVerifierId, byteDecoder, byteEncoder, bytesToBase58, bytesToBase64, bytesToBase64url, bytesToHex$1 as bytesToHex, cacheLoader, checkDataInField, comparatorOptions, createSchemaHash, createVerifiablePresentation, credentialSubjectKey, dataFillsSlot, decodeBase64url, defaultEthConnectionConfig, defaultMTLevels, defaultMTLevelsClaim, defaultMTLevelsOnChain, defaultValueArraySize, defineMerklizedRootPosition, encodeBase64url, existenceToInt, extractProof, extractPublicKeyBytes, factoryComparer, fieldToByteArray, fillSlot, findValue, generateProfileDID, getKMSIdByAuthCredential, getNodeAuxValue, getNodesRepresentation, getProperties, getUserDIDFromCredential, hexToBytes$1 as hexToBytes, isGenesisState, isGenesisStateId, isIssuerGenesis, isValidOperation, keyPath, mergeObjects, parseCredentialSubject, parseQueriesMetadata, parseQueryMetadata, prepareCircuitArrayValues, prepareSiblingsStr, pushHashesToRHS, resolveDIDDocumentAuth, resolvePath, resolveVerificationMethods, strMTHex, stringByPath, subjectPositionIndex, swapEndianness, toClaimNonRevStatus, toGISTProof, toRevocationStatus, transformQueryValueToBigInts, validateDIDDocumentAuth, validateTreeState };
63651
+ export { AbstractPrivateKeyStore, AgentResolver, AtomicQueryMTPV2Inputs, AtomicQueryMTPV2OnChainInputs, AtomicQueryMTPV2OnChainPubSignals, AtomicQueryMTPV2PubSignals, AtomicQuerySigV2Inputs, AtomicQuerySigV2OnChainCircuitInputs, AtomicQuerySigV2OnChainInputs, AtomicQuerySigV2OnChainPubSignals, AtomicQuerySigV2PubSignals, AtomicQueryV3Inputs, AtomicQueryV3OnChainInputs, AtomicQueryV3OnChainPubSignals, AtomicQueryV3PubSignals, AuthHandler, AuthV2Inputs, AuthV2PubSignals, BJJSignatureProof2021, BaseConfig, BjjProvider, BrowserDataSource, CircuitClaim, CircuitError, CircuitId, CircuitStorage, ContractRequestHandler, CredentialStatusPublisherRegistry, CredentialStatusResolverRegistry, CredentialStatusType, CredentialStorage, CredentialWallet, DIDDocumentJSONSchema, DataPrepareHandlerFunc, ErrorEmptyAuthClaimNonRevProof, ErrorEmptyAuthClaimProof, ErrorEmptyChallengeSignature, ErrorEmptyClaimNonRevProof, ErrorEmptyClaimProof, ErrorEmptyClaimSignature, ErrorEmptyIssuerAuthClaimNonRevProof, ErrorEmptyIssuerAuthClaimProof, ErrorUserStateInRelayClaimProof, EthStateStorage, FSCircuitStorage, FetchHandler, FilterQuery, Iden3OnchainSmtCredentialStatusPublisher, Iden3SmtRhsCredentialStatusPublisher, Iden3SparseMerkleTreeProof, IdentityStorage, IdentityWallet, InMemoryDataSource, InMemoryMerkleTreeStorage, InMemoryPrivateKeyStore, IndexedDBDataSource, IndexedDBPrivateKeyStore, IssuerResolver, JSON_SCHEMA_VALIDATORS_REGISTRY, JWSPacker, JsonSchemaValidator, KMS, KmsKeyType, LDParser, LinkedMultiQueryInputs, LinkedMultiQueryPubSignals, LocalStoragePrivateKeyStore, MerkleTreeIndexedDBStorage, MerkleTreeLocalStorage, MerkleTreeType, MerklizedRootPosition, NativeProver, OnChainResolver, OnChainRevocationStorage, OnChainZKPVerifier, Operators, constants as PROTOCOL_CONSTANTS, PackageManager, Parser, PlainPacker, ProofNode, ProofPurpose, ProofService, ProofType, Query, QueryOperators, RHSResolver, RefreshHandler, RefreshServiceType, Scalar, SearchError, Sec256k1Provider, StandardJSONCredentialsQueryFilter, StateTransitionInputs, StateTransitionPubSignals, SubjectPosition, ValueProof, Vector, VerifiableConstants, VerificationHandlerFunc, W3CCredential, XSDNS, ZKPPacker, availableTypesOperators, base58ToBytes, base64ToBytes, base64UrlToBytes, bigIntArrayToStringArray, buildFieldPath, buildTreeState, buildVerifierId, byteDecoder, byteEncoder, bytesToBase58, bytesToBase64, bytesToBase64url, bytesToHex$1 as bytesToHex, cacheLoader, checkDataInField, comparatorOptions, createSchemaHash, createVerifiablePresentation, credentialSubjectKey, dataFillsSlot, decodeBase64url, defaultEthConnectionConfig, defaultMTLevels, defaultMTLevelsClaim, defaultMTLevelsOnChain, defaultValueArraySize, defineMerklizedRootPosition, encodeBase64url, existenceToInt, extractProof, extractPublicKeyBytes, factoryComparer, fieldToByteArray, fillSlot, findValue, generateProfileDID, getKMSIdByAuthCredential, getNodeAuxValue, getNodesRepresentation, getProperties, getUserDIDFromCredential, hexToBytes$1 as hexToBytes, isGenesisState, isGenesisStateId, isIssuerGenesis, isValidOperation, keyPath, mergeObjects, parseCredentialSubject, parseQueriesMetadata, parseQueryMetadata, prepareCircuitArrayValues, prepareSiblingsStr, pushHashesToRHS, resolveDIDDocumentAuth, resolvePath, resolveVerificationMethods, strMTHex, stringByPath, subjectPositionIndex, swapEndianness, toClaimNonRevStatus, toGISTProof, toRevocationStatus, transformQueryValueToBigInts, validateDIDDocumentAuth, validateTreeState };
63711
63652
  //# sourceMappingURL=index.js.map