@0xpolygonid/js-sdk 1.9.0 → 1.9.2

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.
Files changed (31) hide show
  1. package/dist/browser/esm/index.js +201 -78
  2. package/dist/browser/esm/index.js.map +1 -1
  3. package/dist/browser/umd/index.js +202 -77
  4. package/dist/browser/umd/index.js.map +1 -1
  5. package/dist/node/cjs/iden3comm/handlers/auth.js +14 -55
  6. package/dist/node/cjs/iden3comm/handlers/common.js +85 -0
  7. package/dist/node/cjs/iden3comm/handlers/contract-request.js +5 -15
  8. package/dist/node/cjs/iden3comm/handlers/index.js +2 -0
  9. package/dist/node/cjs/iden3comm/handlers/revocation-status.js +119 -0
  10. package/dist/node/cjs/identity/identity-wallet.js +4 -0
  11. package/dist/node/cjs/proof/common.js +11 -3
  12. package/dist/node/cjs/proof/proof-service.js +1 -4
  13. package/dist/node/cjs/storage/filters/jsonQuery.js +1 -1
  14. package/dist/node/esm/iden3comm/handlers/auth.js +15 -56
  15. package/dist/node/esm/iden3comm/handlers/common.js +81 -0
  16. package/dist/node/esm/iden3comm/handlers/contract-request.js +5 -15
  17. package/dist/node/esm/iden3comm/handlers/index.js +2 -0
  18. package/dist/node/esm/iden3comm/handlers/revocation-status.js +92 -0
  19. package/dist/node/esm/identity/identity-wallet.js +4 -0
  20. package/dist/node/esm/proof/common.js +12 -4
  21. package/dist/node/esm/proof/proof-service.js +1 -4
  22. package/dist/node/esm/storage/filters/jsonQuery.js +1 -1
  23. package/dist/types/iden3comm/handlers/auth.d.ts +1 -0
  24. package/dist/types/iden3comm/handlers/common.d.ts +23 -0
  25. package/dist/types/iden3comm/handlers/contract-request.d.ts +1 -1
  26. package/dist/types/iden3comm/handlers/index.d.ts +2 -0
  27. package/dist/types/iden3comm/handlers/revocation-status.d.ts +59 -0
  28. package/dist/types/identity/identity-wallet.d.ts +13 -1
  29. package/dist/types/verifiable/credential.d.ts +1 -1
  30. package/dist/types/verifiable/proof.d.ts +5 -1
  31. package/package.json +1 -1
@@ -59969,7 +59969,7 @@ class FilterQuery {
59969
59969
  }
59970
59970
  const credentialPathValue = resolvePath(credential, this.path);
59971
59971
  if ((credentialPathValue === null || credentialPathValue === undefined) &&
59972
- this.operatorFunc !== existsComparator) {
59972
+ this.operatorFunc !== comparatorOptions.$exists) {
59973
59973
  return false;
59974
59974
  }
59975
59975
  if (this.isReverseParams) {
@@ -61990,6 +61990,10 @@ class IdentityWallet {
61990
61990
  async generateNonRevocationMtp(did, credential, treeState) {
61991
61991
  const coreClaim = await this.getCoreClaimFromCredential(credential);
61992
61992
  const revNonce = coreClaim.getRevocationNonce();
61993
+ return this.generateNonRevocationMtpWithNonce(did, revNonce, treeState);
61994
+ }
61995
+ /** {@inheritDoc IIdentityWallet.generateNonRevocationMtpWithNonce} */
61996
+ async generateNonRevocationMtpWithNonce(did, revNonce, treeState) {
61993
61997
  const treesModel = await this.getDIDTreeModel(did);
61994
61998
  const revocationTree = await this._storage.mt.getMerkleTreeByIdentifierAndType(did.string(), MerkleTreeType.Revocations);
61995
61999
  const claimsRoot = await treesModel.claimsTree.root();
@@ -62389,12 +62393,14 @@ const parseQueryMetadata = async (propertyQuery, ldContextJSON, credentialType,
62389
62393
  throw new Error(`field does not exist in the schema ${e.message}`);
62390
62394
  }
62391
62395
  }
62392
- if (propertyQuery.operatorValue) {
62396
+ if (propertyQuery.operatorValue !== undefined) {
62393
62397
  if (!isValidOperation(query.datatype, propertyQuery.operator)) {
62394
62398
  throw new Error(`operator ${propertyQuery.operator} is not supported for datatype ${query.datatype}`);
62395
62399
  }
62396
- const datatype = propertyQuery.operator === Operators.EXISTS ? XSDNS.Boolean : query.datatype;
62397
- query.values = await transformQueryValueToBigInts(propertyQuery.operatorValue, datatype);
62400
+ query.values =
62401
+ propertyQuery.operator === Operators.EXISTS
62402
+ ? transformExistsValue(propertyQuery.operatorValue)
62403
+ : await transformQueryValueToBigInts(propertyQuery.operatorValue, query.datatype);
62398
62404
  }
62399
62405
  return query;
62400
62406
  };
@@ -62414,6 +62420,12 @@ const transformQueryValueToBigInts = async (value, ldType) => {
62414
62420
  }
62415
62421
  return values;
62416
62422
  };
62423
+ const transformExistsValue = (value) => {
62424
+ if (typeof value == 'boolean') {
62425
+ return [BigInt(value)];
62426
+ }
62427
+ throw new Error('exists operator value must be true or false');
62428
+ };
62417
62429
 
62418
62430
  /* eslint-disable require-await */
62419
62431
  /* eslint-disable @typescript-eslint/no-explicit-any */
@@ -63882,10 +63894,7 @@ class ProofService {
63882
63894
  query.valueProof = new ValueProof();
63883
63895
  query.valueProof.mtp = proof;
63884
63896
  query.valueProof.path = queryMetadata.claimPathKey;
63885
- const mtEntry = await mtValue?.mtEntry();
63886
- if (!mtEntry) {
63887
- throw new Error(`can't merklize credential: no merkle tree entry found`);
63888
- }
63897
+ const mtEntry = (await mtValue?.mtEntry()) ?? 0n;
63889
63898
  query.valueProof.value = mtEntry;
63890
63899
  if (!queryMetadata.fieldName) {
63891
63900
  query.values = [mtEntry];
@@ -64553,6 +64562,86 @@ class JWSPacker {
64553
64562
  }
64554
64563
  }
64555
64564
 
64565
+ /**
64566
+ * Groups the ZeroKnowledgeProofRequest objects based on their groupId.
64567
+ * Returns a Map where the key is the groupId and the value is an object containing the query and linkNonce.
64568
+ *
64569
+ * @param requestScope - An array of ZeroKnowledgeProofRequest objects.
64570
+ * @returns A Map<number, { query: JSONObject; linkNonce: number }> representing the grouped queries.
64571
+ */
64572
+ const getGroupedQueries = (requestScope) => requestScope.reduce((acc, proofReq) => {
64573
+ const groupId = proofReq.query.groupId;
64574
+ if (!groupId) {
64575
+ return acc;
64576
+ }
64577
+ const existedData = acc.get(groupId);
64578
+ if (!existedData) {
64579
+ const seed = getRandomBytes(12);
64580
+ const dataView = new DataView(seed.buffer);
64581
+ const linkNonce = dataView.getUint32(0);
64582
+ acc.set(groupId, { query: proofReq.query, linkNonce });
64583
+ return acc;
64584
+ }
64585
+ const credentialSubject = mergeObjects(existedData.query.credentialSubject, proofReq.query.credentialSubject);
64586
+ acc.set(groupId, {
64587
+ ...existedData,
64588
+ query: {
64589
+ skipClaimRevocationCheck: existedData.query.skipClaimRevocationCheck || proofReq.query.skipClaimRevocationCheck,
64590
+ ...existedData.query,
64591
+ credentialSubject
64592
+ }
64593
+ });
64594
+ return acc;
64595
+ }, new Map());
64596
+ /**
64597
+ * Processes zero knowledge proof requests.
64598
+ *
64599
+ * @param senderIdentifier - The identifier of the sender.
64600
+ * @param requests - An array of zero knowledge proof requests.
64601
+ * @param from - The identifier of the sender.
64602
+ * @param proofService - The proof service.
64603
+ * @param opts - Additional options for processing the requests.
64604
+ * @returns A promise that resolves to an array of zero knowledge proof responses.
64605
+ */
64606
+ const processZeroKnowledgeProofRequests = async (senderIdentifier, requests, from, proofService, opts) => {
64607
+ const requestScope = requests ?? [];
64608
+ const combinedQueries = getGroupedQueries(requestScope);
64609
+ const groupedCredentialsCache = new Map();
64610
+ const zkpResponses = [];
64611
+ for (const proofReq of requestScope) {
64612
+ if (!opts.supportedCircuits.includes(proofReq.circuitId)) {
64613
+ throw new Error(`Circuit ${proofReq.circuitId} is not allowed`);
64614
+ }
64615
+ const query = proofReq.query;
64616
+ const groupId = query.groupId;
64617
+ const combinedQueryData = combinedQueries.get(groupId);
64618
+ if (groupId) {
64619
+ if (!combinedQueryData) {
64620
+ throw new Error(`Invalid group id ${query.groupId}`);
64621
+ }
64622
+ const combinedQuery = combinedQueryData.query;
64623
+ if (!groupedCredentialsCache.has(groupId)) {
64624
+ const credWithRevStatus = await proofService.findCredentialByProofQuery(senderIdentifier, combinedQueryData.query);
64625
+ if (!credWithRevStatus.cred) {
64626
+ throw new Error(`Credential not found for query ${JSON.stringify(combinedQuery)}`);
64627
+ }
64628
+ groupedCredentialsCache.set(groupId, credWithRevStatus);
64629
+ }
64630
+ }
64631
+ const credWithRevStatus = groupedCredentialsCache.get(groupId);
64632
+ const zkpRes = await proofService.generateProof(proofReq, senderIdentifier, {
64633
+ verifierDid: from,
64634
+ challenge: opts.challenge,
64635
+ skipRevocation: Boolean(query.skipClaimRevocationCheck),
64636
+ credential: credWithRevStatus?.cred,
64637
+ credentialRevocationStatus: credWithRevStatus?.revStatus,
64638
+ linkNonce: combinedQueryData?.linkNonce ? BigInt(combinedQueryData.linkNonce) : undefined
64639
+ });
64640
+ zkpResponses.push(zkpRes);
64641
+ }
64642
+ return zkpResponses;
64643
+ };
64644
+
64556
64645
  /**
64557
64646
  * createAuthorizationRequest is a function to create protocol authorization request
64558
64647
  * @param {string} reason - reason to request proof
@@ -64607,6 +64696,12 @@ class AuthHandler {
64607
64696
  constructor(_packerMgr, _proofService) {
64608
64697
  this._packerMgr = _packerMgr;
64609
64698
  this._proofService = _proofService;
64699
+ this._supportedCircuits = [
64700
+ CircuitId.AtomicQueryV3,
64701
+ CircuitId.AtomicQuerySigV2,
64702
+ CircuitId.AtomicQueryMTPV2,
64703
+ CircuitId.LinkedMultiQuery10
64704
+ ];
64610
64705
  }
64611
64706
  /**
64612
64707
  * @inheritdoc IAuthHandler#parseAuthorizationRequest
@@ -64641,6 +64736,11 @@ class AuthHandler {
64641
64736
  did = DID.parse(authRequest.to);
64642
64737
  }
64643
64738
  const guid = v4();
64739
+ if (!authRequest.from) {
64740
+ throw new Error('auth request should contain from field');
64741
+ }
64742
+ const from = DID.parse(authRequest.from);
64743
+ const responseScope = await processZeroKnowledgeProofRequests(did, authRequest?.body.scope, from, this._proofService, { ...opts, supportedCircuits: this._supportedCircuits });
64644
64744
  const authResponse = {
64645
64745
  id: guid,
64646
64746
  typ: opts.mediaType,
@@ -64648,64 +64748,11 @@ class AuthHandler {
64648
64748
  thid: authRequest.thid ?? guid,
64649
64749
  body: {
64650
64750
  message: authRequest?.body?.message,
64651
- scope: []
64751
+ scope: responseScope
64652
64752
  },
64653
64753
  from: did.string(),
64654
64754
  to: authRequest.from
64655
64755
  };
64656
- const requestScope = authRequest.body.scope;
64657
- const combinedQueries = requestScope.reduce((acc, proofReq) => {
64658
- const groupId = proofReq.query.groupId;
64659
- if (!groupId) {
64660
- return acc;
64661
- }
64662
- const existedData = acc.get(groupId);
64663
- if (!existedData) {
64664
- const seed = getRandomBytes(12);
64665
- const dataView = new DataView(seed.buffer);
64666
- const linkNonce = dataView.getUint32(0);
64667
- acc.set(groupId, { query: proofReq.query, linkNonce });
64668
- return acc;
64669
- }
64670
- const credentialSubject = mergeObjects(existedData.query.credentialSubject, proofReq.query.credentialSubject);
64671
- acc.set(groupId, {
64672
- ...existedData,
64673
- query: {
64674
- skipClaimRevocationCheck: existedData.query.skipClaimRevocationCheck || proofReq.query.skipClaimRevocationCheck,
64675
- ...existedData.query,
64676
- credentialSubject
64677
- }
64678
- });
64679
- return acc;
64680
- }, new Map());
64681
- const groupedCredentialsCache = new Map();
64682
- for (const proofReq of requestScope) {
64683
- const query = proofReq.query;
64684
- const groupId = query.groupId;
64685
- const combinedQueryData = combinedQueries.get(groupId);
64686
- if (groupId) {
64687
- if (!combinedQueryData) {
64688
- throw new Error(`Invalid group id ${query.groupId}`);
64689
- }
64690
- const combinedQuery = combinedQueryData.query;
64691
- if (!groupedCredentialsCache.has(groupId)) {
64692
- const credWithRevStatus = await this._proofService.findCredentialByProofQuery(did, combinedQueryData.query);
64693
- if (!credWithRevStatus.cred) {
64694
- throw new Error(`Credential not found for query ${JSON.stringify(combinedQuery)}`);
64695
- }
64696
- groupedCredentialsCache.set(groupId, credWithRevStatus);
64697
- }
64698
- }
64699
- const credWithRevStatus = groupedCredentialsCache.get(groupId);
64700
- const zkpRes = await this._proofService.generateProof(proofReq, did, {
64701
- verifierDid: DID.parse(authRequest.from),
64702
- skipRevocation: Boolean(query.skipClaimRevocationCheck),
64703
- credential: credWithRevStatus?.cred,
64704
- credentialRevocationStatus: credWithRevStatus?.revStatus,
64705
- linkNonce: combinedQueryData?.linkNonce ? BigInt(combinedQueryData.linkNonce) : undefined
64706
- });
64707
- authResponse.body.scope.push(zkpRes);
64708
- }
64709
64756
  const msgBytes = byteEncoder.encode(JSON.stringify(authResponse));
64710
64757
  const packerOpts = opts.mediaType === MediaType.SignedMessage
64711
64758
  ? opts.packerOptions
@@ -64974,7 +65021,7 @@ class ContractRequestHandler {
64974
65021
  this._packerMgr = _packerMgr;
64975
65022
  this._proofService = _proofService;
64976
65023
  this._zkpVerifier = _zkpVerifier;
64977
- this._allowedCircuits = [
65024
+ this._supportedCircuits = [
64978
65025
  CircuitId.AtomicQueryMTPV2OnChain,
64979
65026
  CircuitId.AtomicQuerySigV2OnChain,
64980
65027
  CircuitId.AtomicQueryV3OnChain
@@ -65011,25 +65058,14 @@ class ContractRequestHandler {
65011
65058
  if (!opts.ethSigner) {
65012
65059
  throw new Error("Can't sign transaction. Provide Signer in options.");
65013
65060
  }
65014
- const zkRequests = [];
65015
65061
  const { chain_id } = ciRequest.body.transaction_data;
65016
65062
  const networkFlag = Object.keys(ChainIds).find((key) => ChainIds[key] === chain_id);
65017
65063
  if (!networkFlag) {
65018
65064
  throw new Error(`Invalid chain id ${chain_id}`);
65019
65065
  }
65020
- for (const proofReq of ciRequest.body.scope) {
65021
- if (!this._allowedCircuits.includes(proofReq.circuitId)) {
65022
- throw new Error(`Can't handle circuit ${proofReq.circuitId}. Only onchain circuits are allowed.`);
65023
- }
65024
- const query = proofReq.query;
65025
- const zkpRes = await this._proofService.generateProof(proofReq, did, {
65026
- skipRevocation: query.skipClaimRevocationCheck ?? false,
65027
- challenge: opts.challenge,
65028
- verifierDid: ciRequest.from ? DID.parse(ciRequest.from) : undefined
65029
- });
65030
- zkRequests.push(zkpRes);
65031
- }
65032
- return this._zkpVerifier.submitZKPResponse(opts.ethSigner, ciRequest.body.transaction_data, zkRequests);
65066
+ const verifierDid = ciRequest.from ? DID.parse(ciRequest.from) : undefined;
65067
+ const zkpResponses = await processZeroKnowledgeProofRequests(did, ciRequest?.body?.scope, verifierDid, this._proofService, { ...opts, supportedCircuits: this._supportedCircuits });
65068
+ return this._zkpVerifier.submitZKPResponse(opts.ethSigner, ciRequest.body.transaction_data, zkpResponses);
65033
65069
  }
65034
65070
  }
65035
65071
 
@@ -65098,5 +65134,92 @@ class RefreshHandler {
65098
65134
  }
65099
65135
  }
65100
65136
 
65101
- 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, InputGenerator, IssuerResolver, JSON_SCHEMA_VALIDATORS_REGISTRY, JWSPacker, JsonSchemaValidator, KMS, KmsKeyType, LDParser, LinkedMultiQueryInputs, LinkedMultiQueryPubSignals, LocalStoragePrivateKeyStore, MerkleTreeIndexedDBStorage, MerkleTreeLocalStorage, MerkleTreeType, MerklizedRootPosition, MessageBus, NativeProver, OnChainResolver, OnChainRevocationStorage, OnChainZKPVerifier, Operators, constants as PROTOCOL_CONSTANTS, PackageManager, Parser, PlainPacker, ProofNode, ProofPurpose, ProofService, ProofType, PubSignalsVerifier, Query, QueryOperators, RHSResolver, RefreshHandler, RefreshServiceType, SDK_EVENTS, Scalar, SearchError, Sec256k1Provider, StandardJSONCredentialsQueryFilter, StateTransitionInputs, StateTransitionPubSignals, SubjectPosition, ValueProof, Vector, VerifiableConstants, VerificationHandlerFunc, W3CCredential, XSDNS, ZKPPacker, availableTypesOperators, base58ToBytes, base64ToBytes, base64UrlToBytes, bigIntArrayToStringArray, bigIntCompare, buildFieldPath, buildTreeState, buildVerifierId, byteDecoder, byteEncoder, bytesToBase58, bytesToBase64, bytesToBase64url, bytesToHex$1 as bytesToHex, cacheLoader, calculateCoreSchemaHash, calculateQueryHashV2, calculateQueryHashV3, checkDataInField, checkQueryRequest, circuitValidator, comparatorOptions, createAuthorizationRequest, createAuthorizationRequestWithMessage, createSchemaHash, createVerifiablePresentation, credentialSubjectKey, dataFillsSlot, decodeBase64url, defaultEthConnectionConfig, defaultMTLevels, defaultMTLevelsClaim, defaultMTLevelsOnChain, defaultValueArraySize, defineMerklizedRootPosition, encodeBase64url, existenceToInt, extractProof, extractPublicKeyBytes, factoryComparer, fieldToByteArray, fieldValueFromVerifiablePresentation, fillCoreClaimSlot, fillSlot, findCredentialType, findValue, generateProfileDID, getFieldSlotIndex, getKMSIdByAuthCredential, getNodeAuxValue, getNodesRepresentation, getProperties, getSerializationAttrFromContext, getSerializationAttrFromParsedContext, getUserDIDFromCredential, hexToBytes$1 as hexToBytes, isGenesisState, isGenesisStateId, isIssuerGenesis, isValidOperation, keyPath, mergeObjects, parseCoreClaimSlots, parseCredentialSubject, parseQueriesMetadata, parseQueryMetadata, parseSerializationAttr, prepareCircuitArrayValues, prepareSiblingsStr, pushHashesToRHS, resolveDIDDocumentAuth, resolvePath, resolveVerificationMethods, strMTHex, stringByPath, subjectPositionIndex, swapEndianness, toClaimNonRevStatus, toGISTProof, toRevocationStatus, transformQueryValueToBigInts, userStateError, validateDIDDocumentAuth, validateTreeState, witnessBuilder };
65137
+ /**
65138
+ *
65139
+ * Allows to process RevocationStatusRequest protocol message
65140
+ *
65141
+
65142
+ * @class RevocationStatusHandler
65143
+ * @implements implements IRevocationStatusHandler interface
65144
+ */
65145
+ class RevocationStatusHandler {
65146
+ /**
65147
+ * Creates an instance of RevocationStatusHandler.
65148
+ * @param {IPackageManager} _packerMgr - package manager to unpack message envelope
65149
+ * @param {IIdentityWallet} _identityWallet - identity wallet
65150
+ *
65151
+ */
65152
+ constructor(_packerMgr, _identityWallet) {
65153
+ this._packerMgr = _packerMgr;
65154
+ this._identityWallet = _identityWallet;
65155
+ }
65156
+ /**
65157
+ * @inheritdoc IRevocationStatusHandler#parseRevocationStatusRequest
65158
+ */
65159
+ async parseRevocationStatusRequest(request) {
65160
+ const { unpackedMessage: message } = await this._packerMgr.unpack(request);
65161
+ const ciRequest = message;
65162
+ if (message.type !== PROTOCOL_MESSAGE_TYPE.REVOCATION_STATUS_REQUEST_MESSAGE_TYPE) {
65163
+ throw new Error('Invalid media type');
65164
+ }
65165
+ return ciRequest;
65166
+ }
65167
+ /**
65168
+ * @inheritdoc IRevocationStatusHandler#handleRevocationStatusRequest
65169
+ */
65170
+ async handleRevocationStatusRequest(did, request, opts) {
65171
+ if (!opts) {
65172
+ opts = {
65173
+ mediaType: MediaType.PlainMessage
65174
+ };
65175
+ }
65176
+ if (opts.mediaType === MediaType.SignedMessage && !opts.packerOptions) {
65177
+ throw new Error(`jws packer options are required for ${MediaType.SignedMessage}`);
65178
+ }
65179
+ const rsRequest = await this.parseRevocationStatusRequest(request);
65180
+ if (!rsRequest.to) {
65181
+ throw new Error(`failed request. empty 'to' field`);
65182
+ }
65183
+ if (!rsRequest.from) {
65184
+ throw new Error(`failed request. empty 'from' field`);
65185
+ }
65186
+ if (!rsRequest.body?.revocation_nonce) {
65187
+ throw new Error(`failed request. empty 'revocation_nonce' field`);
65188
+ }
65189
+ const issuerDID = DID.parse(rsRequest.to);
65190
+ const mtpWithTreeState = await this._identityWallet.generateNonRevocationMtpWithNonce(issuerDID, BigInt(rsRequest.body.revocation_nonce), opts?.treeState);
65191
+ const treeState = mtpWithTreeState.treeState;
65192
+ const revStatus = {
65193
+ issuer: {
65194
+ state: treeState?.state.string(),
65195
+ claimsTreeRoot: treeState.claimsRoot.string(),
65196
+ revocationTreeRoot: treeState.revocationRoot.string(),
65197
+ rootOfRoots: treeState.rootOfRoots.string()
65198
+ },
65199
+ mtp: mtpWithTreeState.proof
65200
+ };
65201
+ const packerOpts = opts.mediaType === MediaType.SignedMessage
65202
+ ? opts.packerOptions
65203
+ : {
65204
+ provingMethodAlg: proving.provingMethodGroth16AuthV2Instance.methodAlg
65205
+ };
65206
+ const senderDID = DID.parse(rsRequest.to);
65207
+ const guid = v4();
65208
+ const response = {
65209
+ id: guid,
65210
+ typ: MediaType.PlainMessage,
65211
+ type: PROTOCOL_MESSAGE_TYPE.REVOCATION_STATUS_RESPONSE_MESSAGE_TYPE,
65212
+ thid: rsRequest.thid ?? guid,
65213
+ body: revStatus,
65214
+ from: did.string(),
65215
+ to: rsRequest.from
65216
+ };
65217
+ return this._packerMgr.pack(opts.mediaType, byteEncoder.encode(JSON.stringify(response)), {
65218
+ senderDID,
65219
+ ...packerOpts
65220
+ });
65221
+ }
65222
+ }
65223
+
65224
+ 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, InputGenerator, IssuerResolver, JSON_SCHEMA_VALIDATORS_REGISTRY, JWSPacker, JsonSchemaValidator, KMS, KmsKeyType, LDParser, LinkedMultiQueryInputs, LinkedMultiQueryPubSignals, LocalStoragePrivateKeyStore, MerkleTreeIndexedDBStorage, MerkleTreeLocalStorage, MerkleTreeType, MerklizedRootPosition, MessageBus, NativeProver, OnChainResolver, OnChainRevocationStorage, OnChainZKPVerifier, Operators, constants as PROTOCOL_CONSTANTS, PackageManager, Parser, PlainPacker, ProofNode, ProofPurpose, ProofService, ProofType, PubSignalsVerifier, Query, QueryOperators, RHSResolver, RefreshHandler, RefreshServiceType, RevocationStatusHandler, SDK_EVENTS, Scalar, SearchError, Sec256k1Provider, StandardJSONCredentialsQueryFilter, StateTransitionInputs, StateTransitionPubSignals, SubjectPosition, ValueProof, Vector, VerifiableConstants, VerificationHandlerFunc, W3CCredential, XSDNS, ZKPPacker, availableTypesOperators, base58ToBytes, base64ToBytes, base64UrlToBytes, bigIntArrayToStringArray, bigIntCompare, buildFieldPath, buildTreeState, buildVerifierId, byteDecoder, byteEncoder, bytesToBase58, bytesToBase64, bytesToBase64url, bytesToHex$1 as bytesToHex, cacheLoader, calculateCoreSchemaHash, calculateQueryHashV2, calculateQueryHashV3, checkDataInField, checkQueryRequest, circuitValidator, comparatorOptions, createAuthorizationRequest, createAuthorizationRequestWithMessage, createSchemaHash, createVerifiablePresentation, credentialSubjectKey, dataFillsSlot, decodeBase64url, defaultEthConnectionConfig, defaultMTLevels, defaultMTLevelsClaim, defaultMTLevelsOnChain, defaultValueArraySize, defineMerklizedRootPosition, encodeBase64url, existenceToInt, extractProof, extractPublicKeyBytes, factoryComparer, fieldToByteArray, fieldValueFromVerifiablePresentation, fillCoreClaimSlot, fillSlot, findCredentialType, findValue, generateProfileDID, getFieldSlotIndex, getKMSIdByAuthCredential, getNodeAuxValue, getNodesRepresentation, getProperties, getSerializationAttrFromContext, getSerializationAttrFromParsedContext, getUserDIDFromCredential, hexToBytes$1 as hexToBytes, isGenesisState, isGenesisStateId, isIssuerGenesis, isValidOperation, keyPath, mergeObjects, parseCoreClaimSlots, parseCredentialSubject, parseQueriesMetadata, parseQueryMetadata, parseSerializationAttr, prepareCircuitArrayValues, prepareSiblingsStr, processZeroKnowledgeProofRequests, pushHashesToRHS, resolveDIDDocumentAuth, resolvePath, resolveVerificationMethods, strMTHex, stringByPath, subjectPositionIndex, swapEndianness, toClaimNonRevStatus, toGISTProof, toRevocationStatus, transformQueryValueToBigInts, userStateError, validateDIDDocumentAuth, validateTreeState, witnessBuilder };
65102
65225
  //# sourceMappingURL=index.js.map