@sphereon/ssi-sdk.oid4vci-holder 0.34.1-feature.SSISDK.82.linkedVP.328 → 0.34.1-feature.SSISDK.82.linkedVP.341

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
@@ -413,6 +413,7 @@ var createOID4VCIMachine = /* @__PURE__ */ __name((opts) => {
413
413
  // TODO WAL-671 we need to store the data from OpenIdProvider here in the context and make sure we can restart the machine with it and init the OpenIdProvider
414
414
  accessTokenOpts: opts?.accessTokenOpts,
415
415
  requestData: opts?.requestData,
416
+ walletType: opts?.walletType ?? "NATURAL_PERSON",
416
417
  trustAnchors: opts?.trustAnchors ?? [],
417
418
  issuanceOpt: opts?.issuanceOpt,
418
419
  didMethodPreferences: opts?.didMethodPreferences,
@@ -2385,7 +2386,7 @@ var OID4VCIHolder = class _OID4VCIHolder {
2385
2386
  ...this.defaultAuthorizationRequestOpts,
2386
2387
  ...args.authorizationRequestOpts
2387
2388
  };
2388
- authorizationRequestOpts.authorizationDetails = authorizationRequestOpts?.authorizationDetails ? (0, import_utils2.asArray)(authorizationRequestOpts.authorizationDetails).filter((detail) => typeof detail === "string" || this.vcFormatPreferences.includes(detail.format)) : void 0;
2389
+ authorizationRequestOpts.authorizationDetails = authorizationRequestOpts?.authorizationDetails ? (0, import_utils2.asArray)(authorizationRequestOpts.authorizationDetails) : void 0;
2389
2390
  if (!authorizationRequestOpts.redirectUri) {
2390
2391
  authorizationRequestOpts.redirectUri = _OID4VCIHolder.DEFAULT_MOBILE_REDIRECT_URI;
2391
2392
  }
@@ -2437,7 +2438,7 @@ var OID4VCIHolder = class _OID4VCIHolder {
2437
2438
  if (offer) {
2438
2439
  configurationIds = offer.original_credential_offer.credential_configuration_ids;
2439
2440
  } else {
2440
- configurationIds = (0, import_utils2.asArray)(authorizationRequestOpts.authorizationDetails).filter((authDetails) => typeof authDetails !== "string").map((authReqOpts) => authReqOpts.credential_configuration_id).filter((id) => !!id);
2441
+ configurationIds = (0, import_utils2.asArray)(authorizationRequestOpts.authorizationDetails).map((authReqOpts) => authReqOpts.credential_configuration_id).filter((id) => !!id);
2441
2442
  }
2442
2443
  const credentialsSupported = await getCredentialConfigsSupportedMerged({
2443
2444
  client: oid4vciClient,
@@ -2553,7 +2554,7 @@ var OID4VCIHolder = class _OID4VCIHolder {
2553
2554
  return party;
2554
2555
  }
2555
2556
  async oid4vciHolderGetCredentials(args, context) {
2556
- const { verificationCode, openID4VCIClientState, didMethodPreferences = this.didMethodPreferences, issuanceOpt, accessTokenOpts } = args;
2557
+ const { verificationCode, openID4VCIClientState, didMethodPreferences, issuanceOpt, accessTokenOpts, walletType } = args;
2557
2558
  logger.debug(`Getting credentials`, issuanceOpt, accessTokenOpts);
2558
2559
  if (!openID4VCIClientState) {
2559
2560
  return Promise.reject(Error("Missing openID4VCI client state in context"));
@@ -2572,7 +2573,7 @@ var OID4VCIHolder = class _OID4VCIHolder {
2572
2573
  credentialsSupported,
2573
2574
  serverMetadata,
2574
2575
  context,
2575
- didMethodPreferences: Array.isArray(didMethodPreferences) && didMethodPreferences.length > 0 ? didMethodPreferences : this.didMethodPreferences,
2576
+ didMethodPreferences: this.selectDidMethodPreferences(didMethodPreferences, walletType),
2576
2577
  jwtCryptographicSuitePreferences: this.jwtCryptographicSuitePreferences,
2577
2578
  jsonldCryptographicSuitePreferences: this.jsonldCryptographicSuitePreferences,
2578
2579
  ...issuanceOpt && {
@@ -2589,6 +2590,16 @@ var OID4VCIHolder = class _OID4VCIHolder {
2589
2590
  logger.log(`Credentials received`, allCredentials);
2590
2591
  return allCredentials;
2591
2592
  }
2593
+ selectDidMethodPreferences(didMethodPreferences, walletType) {
2594
+ const supportedDidMethodEnums = Array.isArray(didMethodPreferences) && didMethodPreferences.length > 0 ? didMethodPreferences : this.didMethodPreferences;
2595
+ if (walletType === "ORGANIZATIONAL") {
2596
+ return [
2597
+ import_ssi_sdk_ext5.SupportedDidMethodEnum.DID_WEB,
2598
+ ...supportedDidMethodEnums
2599
+ ];
2600
+ }
2601
+ return supportedDidMethodEnums;
2602
+ }
2592
2603
  async oid4vciHolderGetCredential(args, context) {
2593
2604
  const { issuanceOpt, pin, client, accessTokenOpts } = args;
2594
2605
  logger.info(`Getting credential`, issuanceOpt);
@@ -3140,6 +3151,7 @@ var OID4VCIHolderLinkHandler = class extends import_ssi_sdk4.LinkHandlerAdapter
3140
3151
  stateNavigationListener;
3141
3152
  firstPartyStateNavigationListener;
3142
3153
  noStateMachinePersistence;
3154
+ walletType;
3143
3155
  authorizationRequestOpts;
3144
3156
  clientOpts;
3145
3157
  trustAnchors;
@@ -3151,6 +3163,7 @@ var OID4VCIHolderLinkHandler = class extends import_ssi_sdk4.LinkHandlerAdapter
3151
3163
  this.authorizationRequestOpts = args.authorizationRequestOpts;
3152
3164
  this.clientOpts = args.clientOpts;
3153
3165
  this.context = args.context;
3166
+ this.walletType = args.walletType ?? "NATURAL_PERSON";
3154
3167
  this.noStateMachinePersistence = args.noStateMachinePersistence === true;
3155
3168
  this.stateNavigationListener = args.stateNavigationListener;
3156
3169
  this.firstPartyStateNavigationListener = args.firstPartyStateNavigationListener;
@@ -3187,7 +3200,8 @@ var OID4VCIHolderLinkHandler = class extends import_ssi_sdk4.LinkHandlerAdapter
3187
3200
  clientOpts
3188
3201
  },
3189
3202
  stateNavigationListener: this.stateNavigationListener,
3190
- firstPartyStateNavigationListener: this.firstPartyStateNavigationListener
3203
+ firstPartyStateNavigationListener: this.firstPartyStateNavigationListener,
3204
+ walletType: this.walletType
3191
3205
  });
3192
3206
  const interpreter = oid4vciMachine.interpreter;
3193
3207
  if (!opts?.machineState && this.context.agent.availableMethods().includes("machineStatesFindActive")) {