@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.js CHANGED
@@ -56,7 +56,7 @@ var require_nl = __commonJS({
56
56
 
57
57
  // src/agent/OID4VCIHolder.ts
58
58
  import { CredentialOfferClient, MetadataClient, OpenID4VCIClient as OpenID4VCIClient2 } from "@sphereon/oid4vci-client";
59
- import { DefaultURISchemes, getTypesFromObject as getTypesFromObject2 } from "@sphereon/oid4vci-common";
59
+ import { DefaultURISchemes, getTypesFromAuthorizationDetails, getTypesFromCredentialSupported as getTypesFromCredentialSupported2, getTypesFromObject as getTypesFromObject2 } from "@sphereon/oid4vci-common";
60
60
  import { SupportedDidMethodEnum as SupportedDidMethodEnum2 } from "@sphereon/ssi-sdk-ext.did-utils";
61
61
  import { isManagedIdentifierDidOpts, isManagedIdentifierDidResult as isManagedIdentifierDidResult2, isManagedIdentifierJwkResult, isManagedIdentifierKidResult, isManagedIdentifierResult as isManagedIdentifierResult2, isManagedIdentifierX5cOpts, isManagedIdentifierX5cResult } from "@sphereon/ssi-sdk-ext.identifier-resolution";
62
62
  import { signatureAlgorithmFromKey } from "@sphereon/ssi-sdk-ext.key-utils";
@@ -1812,6 +1812,9 @@ var getCredentialConfigsSupportedBySingleTypeOrId = /* @__PURE__ */ __name(async
1812
1812
  }
1813
1813
  __name(createIdFromTypes, "createIdFromTypes");
1814
1814
  if (configurationId) {
1815
+ if (!format) {
1816
+ return Promise.reject(Error("format parameter missing from input"));
1817
+ }
1815
1818
  const allSupported2 = client.getCredentialsSupported(format);
1816
1819
  return Object.fromEntries(Object.entries(allSupported2).filter(([id, supported]) => id === configurationId || supported.id === configurationId || createIdFromTypes(supported) === configurationId));
1817
1820
  }
@@ -2288,6 +2291,7 @@ var OID4VCIHolder = class _OID4VCIHolder {
2288
2291
  formats = Array.from(new Set(authFormats));
2289
2292
  }
2290
2293
  let oid4vciClient;
2294
+ let types = void 0;
2291
2295
  let offer;
2292
2296
  if (requestData.existingClientState) {
2293
2297
  oid4vciClient = await OpenID4VCIClient2.fromState({
@@ -2323,18 +2327,23 @@ var OID4VCIHolder = class _OID4VCIHolder {
2323
2327
  });
2324
2328
  }
2325
2329
  }
2326
- let configurationIds = [];
2327
2330
  if (offer) {
2328
- configurationIds = offer.original_credential_offer.credential_configuration_ids;
2331
+ const credentialsSupported2 = offer.original_credential_offer.credential_configuration_ids.flatMap((configId) => {
2332
+ const config = oid4vciClient.endpointMetadata.credentialIssuerMetadata?.credential_configurations_supported[configId];
2333
+ return config ? [
2334
+ config
2335
+ ] : [];
2336
+ });
2337
+ types = credentialsSupported2.map((credentialSupported) => getTypesFromCredentialSupported2(credentialSupported));
2329
2338
  } else {
2330
- configurationIds = asArray2(authorizationRequestOpts.authorizationDetails).filter((authDetails) => typeof authDetails !== "string").map((authReqOpts) => authReqOpts.credential_configuration_id).filter((id) => !!id);
2339
+ types = asArray2(authorizationRequestOpts.authorizationDetails).map((authReqOpts) => getTypesFromAuthorizationDetails(authReqOpts) ?? []).filter((inner) => inner.length > 0);
2331
2340
  }
2341
+ const serverMetadata = await oid4vciClient.retrieveServerMetadata();
2332
2342
  const credentialsSupported = await getCredentialConfigsSupportedMerged({
2333
2343
  client: oid4vciClient,
2334
2344
  vcFormatPreferences: formats,
2335
- configurationIds
2345
+ types
2336
2346
  });
2337
- const serverMetadata = await oid4vciClient.retrieveServerMetadata();
2338
2347
  const credentialBranding = await getCredentialBranding({
2339
2348
  credentialsSupported,
2340
2349
  context