@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.
@@ -85400,6 +85400,7 @@ var PolygonIdSdk = (function (exports) {
85400
85400
  if (message.type !== PROTOCOL_MESSAGE_TYPE.AUTHORIZATION_REQUEST_MESSAGE_TYPE) {
85401
85401
  throw new Error('Invalid media type');
85402
85402
  }
85403
+ authRequest.body.scope = authRequest.body.scope || [];
85403
85404
  return authRequest;
85404
85405
  }
85405
85406
  /**
@@ -85511,7 +85512,8 @@ var PolygonIdSdk = (function (exports) {
85511
85512
  throw new Error(`sender of the request is not a target of response - expected ${request.from}, given ${response.to}`);
85512
85513
  }
85513
85514
  this.verifyAuthRequest(request);
85514
- const requestScope = request.body.scope;
85515
+ const requestScope = request.body.scope || [];
85516
+ const responseScope = response.body.scope || [];
85515
85517
  if (!response.from) {
85516
85518
  throw new Error(`proof response doesn't contain from field`);
85517
85519
  }
@@ -85519,7 +85521,7 @@ var PolygonIdSdk = (function (exports) {
85519
85521
  // group requests by query group id
85520
85522
  for (const proofRequest of requestScope) {
85521
85523
  const groupId = proofRequest.query.groupId;
85522
- const proofResp = response.body.scope.find((resp) => resp.id === proofRequest.id);
85524
+ const proofResp = responseScope.find((resp) => resp.id === proofRequest.id);
85523
85525
  if (!proofResp) {
85524
85526
  throw new Error(`proof is not given for requestId ${proofRequest.id}`);
85525
85527
  }
@@ -85555,7 +85557,7 @@ var PolygonIdSdk = (function (exports) {
85555
85557
  }
85556
85558
  verifyAuthRequest(request) {
85557
85559
  const groupIdValidationMap = {};
85558
- const requestScope = request.body.scope;
85560
+ const requestScope = request.body.scope || [];
85559
85561
  for (const proofRequest of requestScope) {
85560
85562
  const groupId = proofRequest.query.groupId;
85561
85563
  if (groupId) {
@@ -85773,6 +85775,7 @@ var PolygonIdSdk = (function (exports) {
85773
85775
  if (message.type !== PROTOCOL_MESSAGE_TYPE.CONTRACT_INVOKE_REQUEST_MESSAGE_TYPE) {
85774
85776
  throw new Error('Invalid media type');
85775
85777
  }
85778
+ ciRequest.body.scope = ciRequest.body.scope || [];
85776
85779
  return ciRequest;
85777
85780
  }
85778
85781
  /**