@sphereon/ssi-sdk.oid4vci-holder 0.34.1-fix.182 → 0.34.1-fix.223

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
@@ -1890,6 +1890,9 @@ var getCredentialConfigsSupportedBySingleTypeOrId = /* @__PURE__ */ __name(async
1890
1890
  }
1891
1891
  __name(createIdFromTypes, "createIdFromTypes");
1892
1892
  if (configurationId) {
1893
+ if (!format) {
1894
+ return Promise.reject(Error("format parameter missing from input"));
1895
+ }
1893
1896
  const allSupported2 = client.getCredentialsSupported(format);
1894
1897
  return Object.fromEntries(Object.entries(allSupported2).filter(([id, supported]) => id === configurationId || supported.id === configurationId || createIdFromTypes(supported) === configurationId));
1895
1898
  }
@@ -2367,6 +2370,7 @@ var OID4VCIHolder = class _OID4VCIHolder {
2367
2370
  formats = Array.from(new Set(authFormats));
2368
2371
  }
2369
2372
  let oid4vciClient;
2373
+ let types = void 0;
2370
2374
  let offer;
2371
2375
  if (requestData.existingClientState) {
2372
2376
  oid4vciClient = await import_oid4vci_client3.OpenID4VCIClient.fromState({
@@ -2402,18 +2406,23 @@ var OID4VCIHolder = class _OID4VCIHolder {
2402
2406
  });
2403
2407
  }
2404
2408
  }
2405
- let configurationIds = [];
2406
2409
  if (offer) {
2407
- configurationIds = offer.original_credential_offer.credential_configuration_ids;
2410
+ const credentialsSupported2 = offer.original_credential_offer.credential_configuration_ids.flatMap((configId) => {
2411
+ const config = oid4vciClient.endpointMetadata.credentialIssuerMetadata?.credential_configurations_supported[configId];
2412
+ return config ? [
2413
+ config
2414
+ ] : [];
2415
+ });
2416
+ types = credentialsSupported2.map((credentialSupported) => (0, import_oid4vci_common4.getTypesFromCredentialSupported)(credentialSupported));
2408
2417
  } else {
2409
- configurationIds = (0, import_utils2.asArray)(authorizationRequestOpts.authorizationDetails).filter((authDetails) => typeof authDetails !== "string").map((authReqOpts) => authReqOpts.credential_configuration_id).filter((id) => !!id);
2418
+ types = (0, import_utils2.asArray)(authorizationRequestOpts.authorizationDetails).map((authReqOpts) => (0, import_oid4vci_common4.getTypesFromAuthorizationDetails)(authReqOpts) ?? []).filter((inner) => inner.length > 0);
2410
2419
  }
2420
+ const serverMetadata = await oid4vciClient.retrieveServerMetadata();
2411
2421
  const credentialsSupported = await getCredentialConfigsSupportedMerged({
2412
2422
  client: oid4vciClient,
2413
2423
  vcFormatPreferences: formats,
2414
- configurationIds
2424
+ types
2415
2425
  });
2416
- const serverMetadata = await oid4vciClient.retrieveServerMetadata();
2417
2426
  const credentialBranding = await getCredentialBranding({
2418
2427
  credentialsSupported,
2419
2428
  context