@sphereon/oid4vci-client 0.19.1-feature.SSISDK.73.well.known.draftv1.209 → 0.19.1-feature.SSISDK.78.code.auth.flow.222

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.
package/dist/index.cjs CHANGED
@@ -1099,6 +1099,12 @@ function filterSupportedCredentials(credentialOffer, credentialsSupported) {
1099
1099
  __name(filterSupportedCredentials, "filterSupportedCredentials");
1100
1100
  var createAuthorizationRequestUrl = /* @__PURE__ */ __name(async ({ pkce, endpointMetadata, authorizationRequest, credentialOffer, credentialConfigurationSupported, clientId, version }) => {
1101
1101
  function removeDisplayAndValueTypes(obj) {
1102
+ if (Array.isArray(obj)) {
1103
+ return obj.map((item) => removeDisplayAndValueTypes(item));
1104
+ }
1105
+ if (typeof obj !== "object" || obj === null) {
1106
+ return obj;
1107
+ }
1102
1108
  const newObj = {
1103
1109
  ...obj
1104
1110
  };
@@ -1108,7 +1114,7 @@ var createAuthorizationRequestUrl = /* @__PURE__ */ __name(async ({ pkce, endpoi
1108
1114
  "value_type"
1109
1115
  ].includes(prop)) {
1110
1116
  delete newObj[prop];
1111
- } else if (typeof newObj[prop] === "object") {
1117
+ } else if (typeof newObj[prop] === "object" && newObj[prop] !== null) {
1112
1118
  newObj[prop] = removeDisplayAndValueTypes(newObj[prop]);
1113
1119
  }
1114
1120
  }
@@ -1199,7 +1205,7 @@ var createAuthorizationRequestUrl = /* @__PURE__ */ __name(async ({ pkce, endpoi
1199
1205
  ...credentialOffer?.issuerState && {
1200
1206
  issuer_state: credentialOffer.issuerState
1201
1207
  },
1202
- scope: authorizationRequest.scope
1208
+ scope: authorizationRequest.scope ?? "openid"
1203
1209
  };
1204
1210
  if (credentialOffer?.issuerState) {
1205
1211
  queryObj.state = credentialOffer?.issuerState;
@@ -1208,7 +1214,7 @@ var createAuthorizationRequestUrl = /* @__PURE__ */ __name(async ({ pkce, endpoi
1208
1214
  throw Error(`PAR mode is set to required by Authorization Server does not support PAR!`);
1209
1215
  } else if (parEndpoint && parMode !== import_oid4vci_common11.PARMode.NEVER) {
1210
1216
  logger4.debug(`USING PAR with endpoint ${parEndpoint}`);
1211
- const parResponse = await (0, import_oid4vci_common11.formPost)(parEndpoint, (0, import_oid4vci_common11.convertJsonToURI)(queryObj, {
1217
+ const parBody = (0, import_oid4vci_common11.convertJsonToURI)(queryObj, {
1212
1218
  mode: import_oid4vci_common11.JsonURIMode.X_FORM_WWW_URLENCODED,
1213
1219
  uriTypeProperties: [
1214
1220
  "client_id",
@@ -1219,7 +1225,8 @@ var createAuthorizationRequestUrl = /* @__PURE__ */ __name(async ({ pkce, endpoi
1219
1225
  "issuer_state",
1220
1226
  "state"
1221
1227
  ]
1222
- }), {
1228
+ });
1229
+ const parResponse = await (0, import_oid4vci_common11.formPost)(parEndpoint, parBody, {
1223
1230
  contentType: "application/x-www-form-urlencoded",
1224
1231
  accept: "application/json"
1225
1232
  });
@@ -1298,6 +1305,11 @@ var handleLocations = /* @__PURE__ */ __name((endpointMetadata, authorizationDet
1298
1305
  endpointMetadata.issuer
1299
1306
  ];
1300
1307
  }
1308
+ if (Array.isArray(authorizationDetails.locations)) {
1309
+ authorizationDetails.locations = [
1310
+ ...new Set(authorizationDetails.locations)
1311
+ ];
1312
+ }
1301
1313
  }
1302
1314
  return authorizationDetails;
1303
1315
  }, "handleLocations");
@@ -1497,11 +1509,6 @@ var CredentialRequestClient = class {
1497
1509
  });
1498
1510
  }
1499
1511
  response.access_token = requestToken;
1500
- if (uniformRequest.credential_subject_issuance && response.successBody || response.successBody?.credential_subject_issuance) {
1501
- if (JSON.stringify(uniformRequest.credential_subject_issuance) !== JSON.stringify(response.successBody?.credential_subject_issuance)) {
1502
- throw Error("Subject signing was requested, but issuer did not provide the options in its response");
1503
- }
1504
- }
1505
1512
  logger5.debug(`Credential endpoint ${credentialEndpoint} response:\r
1506
1513
  ${JSON.stringify(response, null, 2)}`);
1507
1514
  return {