@sphereon/ssi-sdk.oid4vci-holder 0.36.1-feature.SSISDK.70.integrate.digidentity.10 → 0.36.1-feature.SSISDK.70.integrate.digidentity.55

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,
@@ -2556,7 +2557,7 @@ var OID4VCIHolder = class _OID4VCIHolder {
2556
2557
  return party;
2557
2558
  }
2558
2559
  async oid4vciHolderGetCredentials(args, context) {
2559
- const { verificationCode, openID4VCIClientState, didMethodPreferences = this.didMethodPreferences, issuanceOpt, accessTokenOpts } = args;
2560
+ const { verificationCode, openID4VCIClientState, didMethodPreferences, issuanceOpt, accessTokenOpts, walletType } = args;
2560
2561
  logger.debug(`Getting credentials`, issuanceOpt, accessTokenOpts);
2561
2562
  if (!openID4VCIClientState) {
2562
2563
  return Promise.reject(Error("Missing openID4VCI client state in context"));
@@ -2575,7 +2576,7 @@ var OID4VCIHolder = class _OID4VCIHolder {
2575
2576
  credentialsSupported,
2576
2577
  serverMetadata,
2577
2578
  context,
2578
- didMethodPreferences: Array.isArray(didMethodPreferences) && didMethodPreferences.length > 0 ? didMethodPreferences : this.didMethodPreferences,
2579
+ didMethodPreferences: this.selectDidMethodPreferences(didMethodPreferences, walletType),
2579
2580
  jwtCryptographicSuitePreferences: this.jwtCryptographicSuitePreferences,
2580
2581
  jsonldCryptographicSuitePreferences: this.jsonldCryptographicSuitePreferences,
2581
2582
  ...issuanceOpt && {
@@ -2592,6 +2593,16 @@ var OID4VCIHolder = class _OID4VCIHolder {
2592
2593
  logger.log(`Credentials received`, allCredentials);
2593
2594
  return allCredentials;
2594
2595
  }
2596
+ selectDidMethodPreferences(didMethodPreferences, walletType) {
2597
+ const supportedDidMethodEnums = Array.isArray(didMethodPreferences) && didMethodPreferences.length > 0 ? didMethodPreferences : this.didMethodPreferences;
2598
+ if (walletType === "ORGANIZATIONAL") {
2599
+ return [
2600
+ import_ssi_sdk_ext5.SupportedDidMethodEnum.DID_WEB,
2601
+ ...supportedDidMethodEnums
2602
+ ];
2603
+ }
2604
+ return supportedDidMethodEnums;
2605
+ }
2595
2606
  async oid4vciHolderGetCredential(args, context) {
2596
2607
  const { issuanceOpt, pin, client, accessTokenOpts } = args;
2597
2608
  logger.info(`Getting credential`, issuanceOpt);
@@ -3143,6 +3154,7 @@ var OID4VCIHolderLinkHandler = class extends import_ssi_sdk4.LinkHandlerAdapter
3143
3154
  stateNavigationListener;
3144
3155
  firstPartyStateNavigationListener;
3145
3156
  noStateMachinePersistence;
3157
+ walletType;
3146
3158
  authorizationRequestOpts;
3147
3159
  clientOpts;
3148
3160
  trustAnchors;
@@ -3154,6 +3166,7 @@ var OID4VCIHolderLinkHandler = class extends import_ssi_sdk4.LinkHandlerAdapter
3154
3166
  this.authorizationRequestOpts = args.authorizationRequestOpts;
3155
3167
  this.clientOpts = args.clientOpts;
3156
3168
  this.context = args.context;
3169
+ this.walletType = args.walletType ?? "NATURAL_PERSON";
3157
3170
  this.noStateMachinePersistence = args.noStateMachinePersistence === true;
3158
3171
  this.stateNavigationListener = args.stateNavigationListener;
3159
3172
  this.firstPartyStateNavigationListener = args.firstPartyStateNavigationListener;
@@ -3190,7 +3203,8 @@ var OID4VCIHolderLinkHandler = class extends import_ssi_sdk4.LinkHandlerAdapter
3190
3203
  clientOpts
3191
3204
  },
3192
3205
  stateNavigationListener: this.stateNavigationListener,
3193
- firstPartyStateNavigationListener: this.firstPartyStateNavigationListener
3206
+ firstPartyStateNavigationListener: this.firstPartyStateNavigationListener,
3207
+ walletType: this.walletType
3194
3208
  });
3195
3209
  const interpreter = oid4vciMachine.interpreter;
3196
3210
  if (!opts?.machineState && this.context.agent.availableMethods().includes("machineStatesFindActive")) {