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