@0xpolygonid/js-sdk 1.8.2 → 1.8.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.
@@ -64496,6 +64496,7 @@ class AuthHandler {
64496
64496
  if (message.type !== PROTOCOL_MESSAGE_TYPE.AUTHORIZATION_REQUEST_MESSAGE_TYPE) {
64497
64497
  throw new Error('Invalid media type');
64498
64498
  }
64499
+ authRequest.body.scope = authRequest.body.scope || [];
64499
64500
  return authRequest;
64500
64501
  }
64501
64502
  /**
@@ -64607,7 +64608,8 @@ class AuthHandler {
64607
64608
  throw new Error(`sender of the request is not a target of response - expected ${request.from}, given ${response.to}`);
64608
64609
  }
64609
64610
  this.verifyAuthRequest(request);
64610
- const requestScope = request.body.scope;
64611
+ const requestScope = request.body.scope || [];
64612
+ const responseScope = response.body.scope || [];
64611
64613
  if (!response.from) {
64612
64614
  throw new Error(`proof response doesn't contain from field`);
64613
64615
  }
@@ -64615,7 +64617,7 @@ class AuthHandler {
64615
64617
  // group requests by query group id
64616
64618
  for (const proofRequest of requestScope) {
64617
64619
  const groupId = proofRequest.query.groupId;
64618
- const proofResp = response.body.scope.find((resp) => resp.id === proofRequest.id);
64620
+ const proofResp = responseScope.find((resp) => resp.id === proofRequest.id);
64619
64621
  if (!proofResp) {
64620
64622
  throw new Error(`proof is not given for requestId ${proofRequest.id}`);
64621
64623
  }
@@ -64651,7 +64653,7 @@ class AuthHandler {
64651
64653
  }
64652
64654
  verifyAuthRequest(request) {
64653
64655
  const groupIdValidationMap = {};
64654
- const requestScope = request.body.scope;
64656
+ const requestScope = request.body.scope || [];
64655
64657
  for (const proofRequest of requestScope) {
64656
64658
  const groupId = proofRequest.query.groupId;
64657
64659
  if (groupId) {
@@ -64869,6 +64871,7 @@ class ContractRequestHandler {
64869
64871
  if (message.type !== PROTOCOL_MESSAGE_TYPE.CONTRACT_INVOKE_REQUEST_MESSAGE_TYPE) {
64870
64872
  throw new Error('Invalid media type');
64871
64873
  }
64874
+ ciRequest.body.scope = ciRequest.body.scope || [];
64872
64875
  return ciRequest;
64873
64876
  }
64874
64877
  /**