@0xpolygonid/js-sdk 1.10.1 → 1.10.3

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.
@@ -60656,9 +60656,9 @@ class EthStateStorage {
60656
60656
  };
60657
60657
  }
60658
60658
  /** {@inheritdoc IStateStorage.getGISTRootInfo} */
60659
- async getGISTRootInfo(id) {
60659
+ async getGISTRootInfo(root, id) {
60660
60660
  const { stateContract } = this.getStateContractAndProviderForId(id);
60661
- const data = await stateContract.getGISTRootInfo(id);
60661
+ const data = await stateContract.getGISTRootInfo(root);
60662
60662
  return {
60663
60663
  root: BigInt(data.root.toString()),
60664
60664
  replacedByRoot: BigInt(data.replacedByRoot.toString()),
@@ -65259,7 +65259,7 @@ class PubSignalsVerifier {
65259
65259
  this.challenge = authV2PubSignals.challenge;
65260
65260
  // no query verification
65261
65261
  // verify state
65262
- const gist = await this.checkGlobalState(authV2PubSignals.GISTRoot);
65262
+ const gist = await this.checkGlobalState(authV2PubSignals.GISTRoot, this.userId);
65263
65263
  let acceptedStateTransitionDelay = defaultAuthVerifyOpts;
65264
65264
  if (opts?.acceptedStateTransitionDelay) {
65265
65265
  acceptedStateTransitionDelay = opts.acceptedStateTransitionDelay;
@@ -65341,9 +65341,8 @@ class PubSignalsVerifier {
65341
65341
  throw userStateError;
65342
65342
  }
65343
65343
  };
65344
- this.checkGlobalState = async (state) => {
65345
- const gistStateResolved = await this.rootResolve(state.bigInt());
65346
- return gistStateResolved;
65344
+ this.checkGlobalState = async (state, id) => {
65345
+ return this.rootResolve(state.bigInt(), id.bigInt());
65347
65346
  };
65348
65347
  this.checkRevocationStateForId = async (issuerId, issuerClaimNonRevState) => {
65349
65348
  const issuerNonRevStateResolved = await this.resolve(issuerId, issuerClaimNonRevState.bigInt());
@@ -65457,12 +65456,16 @@ class PubSignalsVerifier {
65457
65456
  transitionTimestamp: contractState.replacedAtTimestamp.toString()
65458
65457
  };
65459
65458
  }
65460
- return { latest: true, transitionTimestamp: 0 };
65459
+ return {
65460
+ latest: !contractState.replacedAtTimestamp ||
65461
+ contractState.replacedAtTimestamp.toString() === zeroInt.toString(),
65462
+ transitionTimestamp: contractState.replacedAtTimestamp?.toString() ?? 0
65463
+ };
65461
65464
  }
65462
- async rootResolve(state) {
65465
+ async rootResolve(state, id) {
65463
65466
  let globalStateInfo;
65464
65467
  try {
65465
- globalStateInfo = await this._stateStorage.getGISTRootInfo(state);
65468
+ globalStateInfo = await this._stateStorage.getGISTRootInfo(state, id);
65466
65469
  }
65467
65470
  catch (e) {
65468
65471
  if (e.errorArgs[0] === 'Root does not exist') {
@@ -65731,7 +65734,8 @@ class ProofService {
65731
65734
  throw new Error(`CircuitId is not supported ${circuitId}`);
65732
65735
  }
65733
65736
  const gistRoot = Hash$2.fromString(pubSignals[2]).bigInt();
65734
- const globalStateInfo = await this._stateStorage.getGISTRootInfo(gistRoot);
65737
+ const userId = BigInt(pubSignals[0]);
65738
+ const globalStateInfo = await this._stateStorage.getGISTRootInfo(gistRoot, userId);
65735
65739
  if (globalStateInfo.createdAtTimestamp === 0n) {
65736
65740
  throw new Error(`gist state doesn't exists in contract`);
65737
65741
  }