@sphereon/ssi-sdk.oid4vci-holder 0.36.1-feat.SSISDK.83.5 → 0.36.1-feature.SSISDK.82.and.SSISDK.70.35

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,
@@ -577,7 +578,7 @@ var createOID4VCIMachine = /* @__PURE__ */ __name((opts) => {
577
578
  cond: OID4VCIMachineGuards.isFirstPartyApplication
578
579
  },
579
580
  {
580
- target: OID4VCIMachineStates.initiateAuthorizationRequest,
581
+ target: OID4VCIMachineStates.prepareAuthorizationRequest,
581
582
  cond: OID4VCIMachineGuards.requireAuthorizationGuard
582
583
  },
583
584
  {
@@ -682,10 +683,6 @@ var createOID4VCIMachine = /* @__PURE__ */ __name((opts) => {
682
683
  target: OID4VCIMachineStates.prepareAuthorizationRequest,
683
684
  cond: OID4VCIMachineGuards.requireAuthorizationGuard
684
685
  },
685
- {
686
- target: OID4VCIMachineStates.initiateAuthorizationRequest,
687
- cond: OID4VCIMachineGuards.requireAuthorizationGuard
688
- },
689
686
  {
690
687
  target: OID4VCIMachineStates.verifyPin,
691
688
  cond: OID4VCIMachineGuards.requirePinGuard
@@ -765,10 +762,6 @@ var createOID4VCIMachine = /* @__PURE__ */ __name((opts) => {
765
762
  target: OID4VCIMachineStates.verifyPin,
766
763
  cond: OID4VCIMachineGuards.requirePinGuard
767
764
  },
768
- {
769
- target: OID4VCIMachineStates.prepareAuthorizationRequest,
770
- cond: OID4VCIMachineGuards.requireAuthorizationGuard
771
- },
772
765
  {
773
766
  target: OID4VCIMachineStates.getCredentials
774
767
  }
@@ -2473,7 +2466,7 @@ var OID4VCIHolder = class _OID4VCIHolder {
2473
2466
  if (!clientId) {
2474
2467
  return Promise.reject(Error(`Missing client id in contact's connectionConfig`));
2475
2468
  }
2476
- const client = await import_oid4vci_client3.OpenID4VCIClient.fromState({
2469
+ const client = await import_oid4vci_client3.OpenID4VCIClientV1_0_15.fromState({
2477
2470
  state: openID4VCIClientState
2478
2471
  });
2479
2472
  const authorizationCodeURL = await client.createAuthorizationRequestUrl({
@@ -2556,7 +2549,7 @@ var OID4VCIHolder = class _OID4VCIHolder {
2556
2549
  return party;
2557
2550
  }
2558
2551
  async oid4vciHolderGetCredentials(args, context) {
2559
- const { verificationCode, openID4VCIClientState, didMethodPreferences = this.didMethodPreferences, issuanceOpt, accessTokenOpts } = args;
2552
+ const { verificationCode, openID4VCIClientState, didMethodPreferences, issuanceOpt, accessTokenOpts, walletType } = args;
2560
2553
  logger.debug(`Getting credentials`, issuanceOpt, accessTokenOpts);
2561
2554
  if (!openID4VCIClientState) {
2562
2555
  return Promise.reject(Error("Missing openID4VCI client state in context"));
@@ -2575,7 +2568,7 @@ var OID4VCIHolder = class _OID4VCIHolder {
2575
2568
  credentialsSupported,
2576
2569
  serverMetadata,
2577
2570
  context,
2578
- didMethodPreferences: Array.isArray(didMethodPreferences) && didMethodPreferences.length > 0 ? didMethodPreferences : this.didMethodPreferences,
2571
+ didMethodPreferences: this.selectDidMethodPreferences(didMethodPreferences, walletType),
2579
2572
  jwtCryptographicSuitePreferences: this.jwtCryptographicSuitePreferences,
2580
2573
  jsonldCryptographicSuitePreferences: this.jsonldCryptographicSuitePreferences,
2581
2574
  ...issuanceOpt && {
@@ -2592,6 +2585,16 @@ var OID4VCIHolder = class _OID4VCIHolder {
2592
2585
  logger.log(`Credentials received`, allCredentials);
2593
2586
  return allCredentials;
2594
2587
  }
2588
+ selectDidMethodPreferences(didMethodPreferences, walletType) {
2589
+ const supportedDidMethodEnums = Array.isArray(didMethodPreferences) && didMethodPreferences.length > 0 ? didMethodPreferences : this.didMethodPreferences;
2590
+ if (walletType === "ORGANIZATIONAL") {
2591
+ return [
2592
+ import_ssi_sdk_ext5.SupportedDidMethodEnum.DID_WEB,
2593
+ ...supportedDidMethodEnums
2594
+ ];
2595
+ }
2596
+ return supportedDidMethodEnums;
2597
+ }
2595
2598
  async oid4vciHolderGetCredential(args, context) {
2596
2599
  const { issuanceOpt, pin, client, accessTokenOpts } = args;
2597
2600
  logger.info(`Getting credential`, issuanceOpt);
@@ -3143,6 +3146,7 @@ var OID4VCIHolderLinkHandler = class extends import_ssi_sdk4.LinkHandlerAdapter
3143
3146
  stateNavigationListener;
3144
3147
  firstPartyStateNavigationListener;
3145
3148
  noStateMachinePersistence;
3149
+ walletType;
3146
3150
  authorizationRequestOpts;
3147
3151
  clientOpts;
3148
3152
  trustAnchors;
@@ -3154,6 +3158,7 @@ var OID4VCIHolderLinkHandler = class extends import_ssi_sdk4.LinkHandlerAdapter
3154
3158
  this.authorizationRequestOpts = args.authorizationRequestOpts;
3155
3159
  this.clientOpts = args.clientOpts;
3156
3160
  this.context = args.context;
3161
+ this.walletType = args.walletType ?? "NATURAL_PERSON";
3157
3162
  this.noStateMachinePersistence = args.noStateMachinePersistence === true;
3158
3163
  this.stateNavigationListener = args.stateNavigationListener;
3159
3164
  this.firstPartyStateNavigationListener = args.firstPartyStateNavigationListener;
@@ -3190,7 +3195,8 @@ var OID4VCIHolderLinkHandler = class extends import_ssi_sdk4.LinkHandlerAdapter
3190
3195
  clientOpts
3191
3196
  },
3192
3197
  stateNavigationListener: this.stateNavigationListener,
3193
- firstPartyStateNavigationListener: this.firstPartyStateNavigationListener
3198
+ firstPartyStateNavigationListener: this.firstPartyStateNavigationListener,
3199
+ walletType: this.walletType
3194
3200
  });
3195
3201
  const interpreter = oid4vciMachine.interpreter;
3196
3202
  if (!opts?.machineState && this.context.agent.availableMethods().includes("machineStatesFindActive")) {