@sphereon/ssi-sdk.oid4vci-holder 0.34.1-next.91 → 0.36.1-feat.SSISDK.83.11

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.d.cts CHANGED
@@ -2,16 +2,16 @@ import { AuthorizationChallengeCodeResponse, EndpointMetadataResult, CredentialO
2
2
  import { IIdentifierResolution, ManagedIdentifierMethod, ManagedIdentifierOptsOrResult, ManagedIdentifierResult } from '@sphereon/ssi-sdk-ext.identifier-resolution';
3
3
  import { IJwtService } from '@sphereon/ssi-sdk-ext.jwt-service';
4
4
  import { IIdentifier, IPluginMethodMap, IAgentContext, ICredentialVerifier, ICredentialIssuer, IDIDManager, IResolver, IKeyManager, TKeyType, VerificationPolicies, TAgent, IAgentPlugin } from '@veramo/core';
5
- import { OpenID4VCIClientState, OpenID4VCIClient } from '@sphereon/oid4vci-client';
6
5
  import { DynamicRegistrationClientMetadata } from '@sphereon/oid4vc-common';
6
+ import { OpenID4VCIClientState, OpenID4VCIClientV1_0_15 } from '@sphereon/oid4vci-client';
7
7
  import { SupportedDidMethodEnum, CreateOrGetIdentifierOpts, IdentifierProviderOpts } from '@sphereon/ssi-sdk-ext.did-utils';
8
8
  import { IContactManager } from '@sphereon/ssi-sdk.contact-manager';
9
9
  import { UniqueDigitalCredential, ICredentialStore } from '@sphereon/ssi-sdk.credential-store';
10
- import { Party, DidAuthConfig, IIssuerLocaleBranding, IBasicIssuerLocaleBranding, IBasicCredentialLocaleBranding, Identity, DigitalCredential, IBasicCredentialClaim } from '@sphereon/ssi-sdk.data-store';
10
+ import { ICredentialValidation, SchemaValidation } from '@sphereon/ssi-sdk.credential-validation';
11
+ import { Party, DidAuthConfig, IIssuerLocaleBranding, IBasicIssuerLocaleBranding, IBasicCredentialLocaleBranding, Identity, DigitalCredential, IBasicCredentialClaim } from '@sphereon/ssi-sdk.data-store-types';
11
12
  import { IIssuanceBranding } from '@sphereon/ssi-sdk.issuance-branding';
12
13
  import { ImDLMdoc } from '@sphereon/ssi-sdk.mdl-mdoc';
13
14
  import { ISDJwtPlugin } from '@sphereon/ssi-sdk.sd-jwt';
14
- import { ICredentialValidation, SchemaValidation } from '@sphereon/ssi-sdk.credential-validation';
15
15
  import { IDidAuthSiopOpAuthenticator, CreateConfigResult } from '@sphereon/ssi-sdk.siopv2-oid4vp-op-auth';
16
16
  import { IVerifiableCredential, W3CVerifiableCredential, WrappedVerifiableCredential, WrappedVerifiablePresentation, JoseSignatureAlgorithm, JoseSignatureAlgorithmString, HasherSync, SdJwtTypeDisplayMetadata, SdJwtClaimMetadata, OriginalVerifiableCredential } from '@sphereon/ssi-types';
17
17
  import { Interpreter, State, StatesConfig, StateMachine, BaseActionObject, ServiceMap, ResolveTypegenMeta, TypegenDisabled } from 'xstate';
@@ -129,6 +129,7 @@ interface IOID4VCIHolder extends IPluginMethodMap {
129
129
  oid4vciHolderGetMachineInterpreter(args: GetMachineArgs, context: RequiredContext): Promise<OID4VCIMachine>;
130
130
  oid4vciHolderStart(args: PrepareStartArgs, context: RequiredContext): Promise<StartResult>;
131
131
  oid4vciHolderCreateCredentialsToSelectFrom(args: CreateCredentialsToSelectFromArgs, context: RequiredContext): Promise<Array<CredentialToSelectFromResult>>;
132
+ oid4vciHolderPrepareAuthorizationRequest(args: PrepareAuthorizationRequestArgs, context: RequiredContext): Promise<PrepareAuthorizationResult>;
132
133
  oid4vciHolderGetContact(args: GetContactArgs, context: RequiredContext): Promise<Party | undefined>;
133
134
  oid4vciHolderGetCredentials(args: GetCredentialsArgs, context: RequiredContext): Promise<Array<MappedCredentialToAccept>>;
134
135
  oid4vciHolderGetCredential(args: GetCredentialArgs, context: RequiredContext): Promise<MappedCredentialToAccept>;
@@ -177,6 +178,7 @@ type GetMachineArgs = {
177
178
  firstPartyStateNavigationListener?: FirstPartyMachineStateNavigationListener;
178
179
  };
179
180
  type PrepareStartArgs = Pick<OID4VCIMachineContext, 'requestData' | 'authorizationRequestOpts' | 'didMethodPreferences' | 'issuanceOpt' | 'accessTokenOpts'>;
181
+ type PrepareAuthorizationRequestArgs = Pick<OID4VCIMachineContext, 'openID4VCIClientState' | 'contact'>;
180
182
  type CreateCredentialsToSelectFromArgs = Pick<OID4VCIMachineContext, 'credentialsSupported' | 'credentialBranding' | 'selectedCredentials' | 'locale' | 'openID4VCIClientState'>;
181
183
  type GetContactArgs = Pick<OID4VCIMachineContext, 'serverMetadata'>;
182
184
  type GetCredentialsArgs = Pick<OID4VCIMachineContext, 'verificationCode' | 'openID4VCIClientState' | 'selectedCredentials' | 'didMethodPreferences' | 'issuanceOpt' | 'accessTokenOpts'>;
@@ -266,6 +268,7 @@ declare enum OID4VCIMachineStates {
266
268
  selectCredentials = "selectCredentials",
267
269
  transitionFromSelectingCredentials = "transitionFromSelectingCredentials",
268
270
  verifyPin = "verifyPin",
271
+ prepareAuthorizationRequest = "prepareAuthorizationRequest",
269
272
  initiateAuthorizationRequest = "initiateAuthorizationRequest",
270
273
  waitForAuthorizationResponse = "waitForAuthorizationResponse",
271
274
  getCredentials = "getCredentials",
@@ -373,6 +376,7 @@ declare enum OID4VCIMachineServices {
373
376
  getFederationTrust = "getFederationTrust",
374
377
  addContactIdentity = "addContactIdentity",
375
378
  createCredentialsToSelectFrom = "createCredentialsToSelectFrom",
379
+ prepareAuthorizationRequest = "prepareAuthorizationRequest",
376
380
  getIssuerBranding = "getIssuerBranding",
377
381
  storeIssuerBranding = "storeIssuerBranding",
378
382
  getCredentials = "getCredentials",
@@ -448,12 +452,15 @@ type OID4VCIMachine = {
448
452
  interpreter: OID4VCIMachineInterpreter;
449
453
  };
450
454
  type StartResult = {
451
- authorizationCodeURL?: string;
452
455
  credentialBranding?: Record<string, Array<IBasicCredentialLocaleBranding>>;
453
456
  credentialsSupported: Record<string, CredentialConfigurationSupported>;
454
457
  serverMetadata: EndpointMetadataResult;
455
458
  oid4vciClientState: OpenID4VCIClientState;
456
459
  };
460
+ type PrepareAuthorizationResult = {
461
+ authorizationCodeURL?: string;
462
+ oid4vciClientState: OpenID4VCIClientState;
463
+ };
457
464
  type SelectAppLocaleBrandingArgs = {
458
465
  locale?: string;
459
466
  localeBranding?: Array<IBasicCredentialLocaleBranding | IBasicIssuerLocaleBranding>;
@@ -487,7 +494,7 @@ type CredentialToAccept = {
487
494
  credentialResponse: CredentialResponseV1_0_15 | CredentialResponse;
488
495
  };
489
496
  type GetCredentialConfigsSupportedArgs = {
490
- client: OpenID4VCIClient;
497
+ client: OpenID4VCIClientV1_0_15;
491
498
  vcFormatPreferences: Array<string>;
492
499
  format?: Array<string>;
493
500
  types?: Array<Array<string>>;
@@ -498,7 +505,7 @@ type GetCredentialConfigsSupportedArgs = {
498
505
  * It can potentially return multiple results mainly because of different formats.
499
506
  */
500
507
  type GetCredentialConfigsSupportedBySingleTypeOrIdArgs = {
501
- client: OpenID4VCIClient;
508
+ client: OpenID4VCIClientV1_0_15;
502
509
  vcFormatPreferences: Array<string>;
503
510
  format?: string[];
504
511
  types?: string[];
@@ -527,7 +534,7 @@ type GetDefaultIssuanceOptsArgs = {
527
534
  context: RequiredContext;
528
535
  };
529
536
  type DefaultIssuanceOpts = {
530
- client: OpenID4VCIClient;
537
+ client: OpenID4VCIClientV1_0_15;
531
538
  };
532
539
  type GetIdentifierArgs = {
533
540
  issuanceOpt: IssuanceOpts;
@@ -557,7 +564,7 @@ type CreateIdentifierCreateOpts = {
557
564
  options?: IdentifierProviderOpts;
558
565
  };
559
566
  type GetIssuanceOptsArgs = {
560
- client: OpenID4VCIClient;
567
+ client: OpenID4VCIClientV1_0_15;
561
568
  credentialsSupported: Record<string, CredentialConfigurationSupported>;
562
569
  serverMetadata: EndpointMetadataResult;
563
570
  context: RequiredContext;
@@ -568,19 +575,19 @@ type GetIssuanceOptsArgs = {
568
575
  };
569
576
  type GetIssuanceDidMethodArgs = {
570
577
  credentialSupported: CredentialConfigurationSupported;
571
- client: OpenID4VCIClient;
578
+ client: OpenID4VCIClientV1_0_15;
572
579
  didMethodPreferences: Array<SupportedDidMethodEnum>;
573
580
  };
574
581
  type GetIssuanceCryptoSuiteArgs = {
575
582
  credentialSupported: CredentialConfigurationSupported;
576
- client: OpenID4VCIClient;
583
+ client: OpenID4VCIClientV1_0_15;
577
584
  jwtCryptographicSuitePreferences: Array<JoseSignatureAlgorithm | JoseSignatureAlgorithmString>;
578
585
  jsonldCryptographicSuitePreferences: Array<string>;
579
586
  };
580
587
  type GetCredentialArgs = {
581
588
  pin?: string;
582
589
  issuanceOpt: IssuanceOpts;
583
- client: OpenID4VCIClient;
590
+ client: OpenID4VCIClientV1_0_15;
584
591
  accessTokenOpts?: AccessTokenOpts;
585
592
  };
586
593
  type AccessTokenOpts = {
@@ -699,6 +706,7 @@ declare class OID4VCIHolder implements IAgentPlugin {
699
706
  * @private
700
707
  */
701
708
  private oid4vciHolderStart;
709
+ private oid4vciHolderPrepareAuthorizationRequest;
702
710
  private oid4vciHolderCreateCredentialsToSelectFrom;
703
711
  private oid4vciHolderGetContact;
704
712
  private oid4vciHolderGetCredentials;
@@ -786,4 +794,4 @@ declare class OID4VCIHolderLinkHandler extends LinkHandlerAdapter {
786
794
  }): Promise<void>;
787
795
  }
788
796
 
789
- export { type AccessTokenOpts, type AddContactIdentityArgs, type AssertValidCredentialsArgs, type Attribute, type AuthorizationResponseEvent, type ContactAliasEvent, type ContactConsentEvent, type CreateConfigArgs, type CreateContactEvent, type CreateCredentialsToSelectFromArgs, type CreateFirstPartyMachineOpts, type CreateIdentifierArgs, type CreateIdentifierCreateOpts, type CreateIdentifierOpts, type CreateOID4VCIMachineOpts, type CredentialToAccept, type CredentialToSelectFromResult, type CredentialVerificationError, type DeclineEvent, type DefaultIssuanceOpts, type DidAgents, type DynamicRegistrationClientMetadataDisplay, type ErrorDetails, type FirstPartyDeclineEvent, type FirstPartyMachineContext, type FirstPartyMachineEventTypes, FirstPartyMachineEvents, type FirstPartyMachineInterpreter, type FirstPartyMachineNavigationArgs, type FirstPartyMachineServiceDefinitions, FirstPartyMachineServices, type FirstPartyMachineState, type FirstPartyMachineStateNavigationListener, FirstPartyMachineStateTypes, type FirstPartyMachineStates, type FirstPartyMachineStatesConfig, type FirstPartyNextEvent, type FirstPartyPreviousEvent, type FirstPartySelectCredentialsEvent, type FirstPartyStateMachine, type GetAuthenticationKeyArgs, type GetBasicIssuerLocaleBrandingArgs, type GetContactArgs, type GetCredentialArgs, type GetCredentialBrandingArgs, type GetCredentialConfigsSupportedArgs, type GetCredentialConfigsSupportedBySingleTypeOrIdArgs, type GetCredentialsArgs, type GetDefaultIssuanceOptsArgs, type GetFederationTrustArgs, type GetIdentifierArgs, type GetIssuanceCryptoSuiteArgs, type GetIssuanceDidMethodArgs, type GetIssuanceOptsArgs, type GetIssuerBrandingArgs, type GetIssuerMetadataArgs, type GetMachineArgs, type GetOrCreatePrimaryIdentifierArgs, type GetPreferredCredentialFormatsArgs, type GetSiopRequestArgs, type IOID4VCIHolder, IdentifierAliasEnum, type InstanceFirstPartyMachineOpts, type InvokeAuthorizationRequestEvent, type IssuanceOpts, type IssuerLocaleBrandingFromArgs, type IssuerType, type MapCredentialToAcceptArgs, type MappedCredentialToAccept, type NextEvent, OID4VCICallbackStateListener, type OID4VCIContext, OID4VCIHolder, OID4VCIHolderEvent, OID4VCIHolderLinkHandler, type OID4VCIHolderOptions, type OID4VCIMachine, OID4VCIMachineAddContactStates, type OID4VCIMachineContext, type OID4VCIMachineEventTypes, OID4VCIMachineEvents, OID4VCIMachineGuards, type OID4VCIMachineInstanceOpts, type OID4VCIMachineInterpreter, type OID4VCIMachineNavigationArgs, type OID4VCIMachineServiceDefinitions, OID4VCIMachineServices, type OID4VCIMachineState, type OID4VCIMachineStateNavigationListener, OID4VCIMachineStates, OID4VCIMachineVerifyPinStates, type OID4VCIProviderProps, type OID4VCIStateMachine, type Oid4vciCombineDisplayLocalesFromArgs, type Oid4vciCredentialDisplayLocalesFromArgs, type Oid4vciCredentialLocaleBrandingFromArgs, type Oid4vciGetCredentialBrandingFromArgs, type Oid4vciIssuerCredentialSubjectLocalesFromArgs, type OnContactIdentityCreatedArgs, type OnCredentialStoredArgs, type OnIdentifierCreatedArgs, type PrepareStartArgs, type PreviousEvent, type RequestData, RequestType, type RequiredContext, type SdJwtCombineDisplayLocalesFromArgs, type SdJwtCredentialClaimLocalesFromArgs, type SdJwtCredentialDisplayLocalesFromArgs, type SdJwtCredentialLocaleBrandingFromArgs, type SdJwtGetCredentialBrandingFromArgs, type SelectAppLocaleBrandingArgs, type SelectCredentialsEvent, type SendAuthorizationChallengeRequestArgs, type SendAuthorizationResponseArgs, type SendNotificationArgs, type SetAuthorizationCodeURLEvent, type SiopV2AuthorizationRequestData, type StartFirstPartApplicationMachine, type StartResult, type StoreCredentialBrandingArgs, type StoreCredentialsArgs, type StoreIssuerBrandingArgs, SupportedLanguage, type VerificationCodeEvent, type VerificationResult, type VerificationSubResult, type VerifyCredentialArgs, type VerifyCredentialToAcceptArgs, type VerifyEBSICredentialIssuerArgs, type VerifyEBSICredentialIssuerResult, type VerifyMdocArgs, type VerifySDJWTCredentialArgs, createConfig, extractCredentialFromResponse, getBasicIssuerLocaleBranding, getCredentialBranding, getCredentialConfigsBasedOnFormatPref, getCredentialConfigsSupported, getCredentialConfigsSupportedBySingleTypeOrId, getCredentialConfigsSupportedMerged, getIdentifierOpts, getIssuanceCryptoSuite, getIssuanceMethod, getIssuanceOpts, getSiopRequest, issuerLocaleBrandingFrom, mapCredentialToAccept, oid4vciCombineDisplayLocalesFrom, oid4vciCredentialDisplayLocalesFrom, oid4vciCredentialLocaleBrandingFrom, oid4vciGetCredentialBrandingFrom, oid4vciHolderContextMethods, oid4vciIssuerCredentialSubjectLocalesFrom, sdJwtCombineDisplayLocalesFrom, sdJwtCredentialClaimLocalesFrom, sdJwtCredentialDisplayLocalesFrom, sdJwtCredentialLocaleBrandingFrom, sdJwtGetCredentialBrandingFrom, selectCredentialLocaleBranding, sendAuthorizationChallengeRequest, sendAuthorizationResponse, signCallback, startFirstPartApplicationMachine, verifyCredentialToAccept };
797
+ export { type AccessTokenOpts, type AddContactIdentityArgs, type AssertValidCredentialsArgs, type Attribute, type AuthorizationResponseEvent, type ContactAliasEvent, type ContactConsentEvent, type CreateConfigArgs, type CreateContactEvent, type CreateCredentialsToSelectFromArgs, type CreateFirstPartyMachineOpts, type CreateIdentifierArgs, type CreateIdentifierCreateOpts, type CreateIdentifierOpts, type CreateOID4VCIMachineOpts, type CredentialToAccept, type CredentialToSelectFromResult, type CredentialVerificationError, type DeclineEvent, type DefaultIssuanceOpts, type DidAgents, type DynamicRegistrationClientMetadataDisplay, type ErrorDetails, type FirstPartyDeclineEvent, type FirstPartyMachineContext, type FirstPartyMachineEventTypes, FirstPartyMachineEvents, type FirstPartyMachineInterpreter, type FirstPartyMachineNavigationArgs, type FirstPartyMachineServiceDefinitions, FirstPartyMachineServices, type FirstPartyMachineState, type FirstPartyMachineStateNavigationListener, FirstPartyMachineStateTypes, type FirstPartyMachineStates, type FirstPartyMachineStatesConfig, type FirstPartyNextEvent, type FirstPartyPreviousEvent, type FirstPartySelectCredentialsEvent, type FirstPartyStateMachine, type GetAuthenticationKeyArgs, type GetBasicIssuerLocaleBrandingArgs, type GetContactArgs, type GetCredentialArgs, type GetCredentialBrandingArgs, type GetCredentialConfigsSupportedArgs, type GetCredentialConfigsSupportedBySingleTypeOrIdArgs, type GetCredentialsArgs, type GetDefaultIssuanceOptsArgs, type GetFederationTrustArgs, type GetIdentifierArgs, type GetIssuanceCryptoSuiteArgs, type GetIssuanceDidMethodArgs, type GetIssuanceOptsArgs, type GetIssuerBrandingArgs, type GetIssuerMetadataArgs, type GetMachineArgs, type GetOrCreatePrimaryIdentifierArgs, type GetPreferredCredentialFormatsArgs, type GetSiopRequestArgs, type IOID4VCIHolder, IdentifierAliasEnum, type InstanceFirstPartyMachineOpts, type InvokeAuthorizationRequestEvent, type IssuanceOpts, type IssuerLocaleBrandingFromArgs, type IssuerType, type MapCredentialToAcceptArgs, type MappedCredentialToAccept, type NextEvent, OID4VCICallbackStateListener, type OID4VCIContext, OID4VCIHolder, OID4VCIHolderEvent, OID4VCIHolderLinkHandler, type OID4VCIHolderOptions, type OID4VCIMachine, OID4VCIMachineAddContactStates, type OID4VCIMachineContext, type OID4VCIMachineEventTypes, OID4VCIMachineEvents, OID4VCIMachineGuards, type OID4VCIMachineInstanceOpts, type OID4VCIMachineInterpreter, type OID4VCIMachineNavigationArgs, type OID4VCIMachineServiceDefinitions, OID4VCIMachineServices, type OID4VCIMachineState, type OID4VCIMachineStateNavigationListener, OID4VCIMachineStates, OID4VCIMachineVerifyPinStates, type OID4VCIProviderProps, type OID4VCIStateMachine, type Oid4vciCombineDisplayLocalesFromArgs, type Oid4vciCredentialDisplayLocalesFromArgs, type Oid4vciCredentialLocaleBrandingFromArgs, type Oid4vciGetCredentialBrandingFromArgs, type Oid4vciIssuerCredentialSubjectLocalesFromArgs, type OnContactIdentityCreatedArgs, type OnCredentialStoredArgs, type OnIdentifierCreatedArgs, type PrepareAuthorizationRequestArgs, type PrepareAuthorizationResult, type PrepareStartArgs, type PreviousEvent, type RequestData, RequestType, type RequiredContext, type SdJwtCombineDisplayLocalesFromArgs, type SdJwtCredentialClaimLocalesFromArgs, type SdJwtCredentialDisplayLocalesFromArgs, type SdJwtCredentialLocaleBrandingFromArgs, type SdJwtGetCredentialBrandingFromArgs, type SelectAppLocaleBrandingArgs, type SelectCredentialsEvent, type SendAuthorizationChallengeRequestArgs, type SendAuthorizationResponseArgs, type SendNotificationArgs, type SetAuthorizationCodeURLEvent, type SiopV2AuthorizationRequestData, type StartFirstPartApplicationMachine, type StartResult, type StoreCredentialBrandingArgs, type StoreCredentialsArgs, type StoreIssuerBrandingArgs, SupportedLanguage, type VerificationCodeEvent, type VerificationResult, type VerificationSubResult, type VerifyCredentialArgs, type VerifyCredentialToAcceptArgs, type VerifyEBSICredentialIssuerArgs, type VerifyEBSICredentialIssuerResult, type VerifyMdocArgs, type VerifySDJWTCredentialArgs, createConfig, extractCredentialFromResponse, getBasicIssuerLocaleBranding, getCredentialBranding, getCredentialConfigsBasedOnFormatPref, getCredentialConfigsSupported, getCredentialConfigsSupportedBySingleTypeOrId, getCredentialConfigsSupportedMerged, getIdentifierOpts, getIssuanceCryptoSuite, getIssuanceMethod, getIssuanceOpts, getSiopRequest, issuerLocaleBrandingFrom, mapCredentialToAccept, oid4vciCombineDisplayLocalesFrom, oid4vciCredentialDisplayLocalesFrom, oid4vciCredentialLocaleBrandingFrom, oid4vciGetCredentialBrandingFrom, oid4vciHolderContextMethods, oid4vciIssuerCredentialSubjectLocalesFrom, sdJwtCombineDisplayLocalesFrom, sdJwtCredentialClaimLocalesFrom, sdJwtCredentialDisplayLocalesFrom, sdJwtCredentialLocaleBrandingFrom, sdJwtGetCredentialBrandingFrom, selectCredentialLocaleBranding, sendAuthorizationChallengeRequest, sendAuthorizationResponse, signCallback, startFirstPartApplicationMachine, verifyCredentialToAccept };
package/dist/index.d.ts CHANGED
@@ -2,16 +2,16 @@ import { AuthorizationChallengeCodeResponse, EndpointMetadataResult, CredentialO
2
2
  import { IIdentifierResolution, ManagedIdentifierMethod, ManagedIdentifierOptsOrResult, ManagedIdentifierResult } from '@sphereon/ssi-sdk-ext.identifier-resolution';
3
3
  import { IJwtService } from '@sphereon/ssi-sdk-ext.jwt-service';
4
4
  import { IIdentifier, IPluginMethodMap, IAgentContext, ICredentialVerifier, ICredentialIssuer, IDIDManager, IResolver, IKeyManager, TKeyType, VerificationPolicies, TAgent, IAgentPlugin } from '@veramo/core';
5
- import { OpenID4VCIClientState, OpenID4VCIClient } from '@sphereon/oid4vci-client';
6
5
  import { DynamicRegistrationClientMetadata } from '@sphereon/oid4vc-common';
6
+ import { OpenID4VCIClientState, OpenID4VCIClientV1_0_15 } from '@sphereon/oid4vci-client';
7
7
  import { SupportedDidMethodEnum, CreateOrGetIdentifierOpts, IdentifierProviderOpts } from '@sphereon/ssi-sdk-ext.did-utils';
8
8
  import { IContactManager } from '@sphereon/ssi-sdk.contact-manager';
9
9
  import { UniqueDigitalCredential, ICredentialStore } from '@sphereon/ssi-sdk.credential-store';
10
- import { Party, DidAuthConfig, IIssuerLocaleBranding, IBasicIssuerLocaleBranding, IBasicCredentialLocaleBranding, Identity, DigitalCredential, IBasicCredentialClaim } from '@sphereon/ssi-sdk.data-store';
10
+ import { ICredentialValidation, SchemaValidation } from '@sphereon/ssi-sdk.credential-validation';
11
+ import { Party, DidAuthConfig, IIssuerLocaleBranding, IBasicIssuerLocaleBranding, IBasicCredentialLocaleBranding, Identity, DigitalCredential, IBasicCredentialClaim } from '@sphereon/ssi-sdk.data-store-types';
11
12
  import { IIssuanceBranding } from '@sphereon/ssi-sdk.issuance-branding';
12
13
  import { ImDLMdoc } from '@sphereon/ssi-sdk.mdl-mdoc';
13
14
  import { ISDJwtPlugin } from '@sphereon/ssi-sdk.sd-jwt';
14
- import { ICredentialValidation, SchemaValidation } from '@sphereon/ssi-sdk.credential-validation';
15
15
  import { IDidAuthSiopOpAuthenticator, CreateConfigResult } from '@sphereon/ssi-sdk.siopv2-oid4vp-op-auth';
16
16
  import { IVerifiableCredential, W3CVerifiableCredential, WrappedVerifiableCredential, WrappedVerifiablePresentation, JoseSignatureAlgorithm, JoseSignatureAlgorithmString, HasherSync, SdJwtTypeDisplayMetadata, SdJwtClaimMetadata, OriginalVerifiableCredential } from '@sphereon/ssi-types';
17
17
  import { Interpreter, State, StatesConfig, StateMachine, BaseActionObject, ServiceMap, ResolveTypegenMeta, TypegenDisabled } from 'xstate';
@@ -129,6 +129,7 @@ interface IOID4VCIHolder extends IPluginMethodMap {
129
129
  oid4vciHolderGetMachineInterpreter(args: GetMachineArgs, context: RequiredContext): Promise<OID4VCIMachine>;
130
130
  oid4vciHolderStart(args: PrepareStartArgs, context: RequiredContext): Promise<StartResult>;
131
131
  oid4vciHolderCreateCredentialsToSelectFrom(args: CreateCredentialsToSelectFromArgs, context: RequiredContext): Promise<Array<CredentialToSelectFromResult>>;
132
+ oid4vciHolderPrepareAuthorizationRequest(args: PrepareAuthorizationRequestArgs, context: RequiredContext): Promise<PrepareAuthorizationResult>;
132
133
  oid4vciHolderGetContact(args: GetContactArgs, context: RequiredContext): Promise<Party | undefined>;
133
134
  oid4vciHolderGetCredentials(args: GetCredentialsArgs, context: RequiredContext): Promise<Array<MappedCredentialToAccept>>;
134
135
  oid4vciHolderGetCredential(args: GetCredentialArgs, context: RequiredContext): Promise<MappedCredentialToAccept>;
@@ -177,6 +178,7 @@ type GetMachineArgs = {
177
178
  firstPartyStateNavigationListener?: FirstPartyMachineStateNavigationListener;
178
179
  };
179
180
  type PrepareStartArgs = Pick<OID4VCIMachineContext, 'requestData' | 'authorizationRequestOpts' | 'didMethodPreferences' | 'issuanceOpt' | 'accessTokenOpts'>;
181
+ type PrepareAuthorizationRequestArgs = Pick<OID4VCIMachineContext, 'openID4VCIClientState' | 'contact'>;
180
182
  type CreateCredentialsToSelectFromArgs = Pick<OID4VCIMachineContext, 'credentialsSupported' | 'credentialBranding' | 'selectedCredentials' | 'locale' | 'openID4VCIClientState'>;
181
183
  type GetContactArgs = Pick<OID4VCIMachineContext, 'serverMetadata'>;
182
184
  type GetCredentialsArgs = Pick<OID4VCIMachineContext, 'verificationCode' | 'openID4VCIClientState' | 'selectedCredentials' | 'didMethodPreferences' | 'issuanceOpt' | 'accessTokenOpts'>;
@@ -266,6 +268,7 @@ declare enum OID4VCIMachineStates {
266
268
  selectCredentials = "selectCredentials",
267
269
  transitionFromSelectingCredentials = "transitionFromSelectingCredentials",
268
270
  verifyPin = "verifyPin",
271
+ prepareAuthorizationRequest = "prepareAuthorizationRequest",
269
272
  initiateAuthorizationRequest = "initiateAuthorizationRequest",
270
273
  waitForAuthorizationResponse = "waitForAuthorizationResponse",
271
274
  getCredentials = "getCredentials",
@@ -373,6 +376,7 @@ declare enum OID4VCIMachineServices {
373
376
  getFederationTrust = "getFederationTrust",
374
377
  addContactIdentity = "addContactIdentity",
375
378
  createCredentialsToSelectFrom = "createCredentialsToSelectFrom",
379
+ prepareAuthorizationRequest = "prepareAuthorizationRequest",
376
380
  getIssuerBranding = "getIssuerBranding",
377
381
  storeIssuerBranding = "storeIssuerBranding",
378
382
  getCredentials = "getCredentials",
@@ -448,12 +452,15 @@ type OID4VCIMachine = {
448
452
  interpreter: OID4VCIMachineInterpreter;
449
453
  };
450
454
  type StartResult = {
451
- authorizationCodeURL?: string;
452
455
  credentialBranding?: Record<string, Array<IBasicCredentialLocaleBranding>>;
453
456
  credentialsSupported: Record<string, CredentialConfigurationSupported>;
454
457
  serverMetadata: EndpointMetadataResult;
455
458
  oid4vciClientState: OpenID4VCIClientState;
456
459
  };
460
+ type PrepareAuthorizationResult = {
461
+ authorizationCodeURL?: string;
462
+ oid4vciClientState: OpenID4VCIClientState;
463
+ };
457
464
  type SelectAppLocaleBrandingArgs = {
458
465
  locale?: string;
459
466
  localeBranding?: Array<IBasicCredentialLocaleBranding | IBasicIssuerLocaleBranding>;
@@ -487,7 +494,7 @@ type CredentialToAccept = {
487
494
  credentialResponse: CredentialResponseV1_0_15 | CredentialResponse;
488
495
  };
489
496
  type GetCredentialConfigsSupportedArgs = {
490
- client: OpenID4VCIClient;
497
+ client: OpenID4VCIClientV1_0_15;
491
498
  vcFormatPreferences: Array<string>;
492
499
  format?: Array<string>;
493
500
  types?: Array<Array<string>>;
@@ -498,7 +505,7 @@ type GetCredentialConfigsSupportedArgs = {
498
505
  * It can potentially return multiple results mainly because of different formats.
499
506
  */
500
507
  type GetCredentialConfigsSupportedBySingleTypeOrIdArgs = {
501
- client: OpenID4VCIClient;
508
+ client: OpenID4VCIClientV1_0_15;
502
509
  vcFormatPreferences: Array<string>;
503
510
  format?: string[];
504
511
  types?: string[];
@@ -527,7 +534,7 @@ type GetDefaultIssuanceOptsArgs = {
527
534
  context: RequiredContext;
528
535
  };
529
536
  type DefaultIssuanceOpts = {
530
- client: OpenID4VCIClient;
537
+ client: OpenID4VCIClientV1_0_15;
531
538
  };
532
539
  type GetIdentifierArgs = {
533
540
  issuanceOpt: IssuanceOpts;
@@ -557,7 +564,7 @@ type CreateIdentifierCreateOpts = {
557
564
  options?: IdentifierProviderOpts;
558
565
  };
559
566
  type GetIssuanceOptsArgs = {
560
- client: OpenID4VCIClient;
567
+ client: OpenID4VCIClientV1_0_15;
561
568
  credentialsSupported: Record<string, CredentialConfigurationSupported>;
562
569
  serverMetadata: EndpointMetadataResult;
563
570
  context: RequiredContext;
@@ -568,19 +575,19 @@ type GetIssuanceOptsArgs = {
568
575
  };
569
576
  type GetIssuanceDidMethodArgs = {
570
577
  credentialSupported: CredentialConfigurationSupported;
571
- client: OpenID4VCIClient;
578
+ client: OpenID4VCIClientV1_0_15;
572
579
  didMethodPreferences: Array<SupportedDidMethodEnum>;
573
580
  };
574
581
  type GetIssuanceCryptoSuiteArgs = {
575
582
  credentialSupported: CredentialConfigurationSupported;
576
- client: OpenID4VCIClient;
583
+ client: OpenID4VCIClientV1_0_15;
577
584
  jwtCryptographicSuitePreferences: Array<JoseSignatureAlgorithm | JoseSignatureAlgorithmString>;
578
585
  jsonldCryptographicSuitePreferences: Array<string>;
579
586
  };
580
587
  type GetCredentialArgs = {
581
588
  pin?: string;
582
589
  issuanceOpt: IssuanceOpts;
583
- client: OpenID4VCIClient;
590
+ client: OpenID4VCIClientV1_0_15;
584
591
  accessTokenOpts?: AccessTokenOpts;
585
592
  };
586
593
  type AccessTokenOpts = {
@@ -699,6 +706,7 @@ declare class OID4VCIHolder implements IAgentPlugin {
699
706
  * @private
700
707
  */
701
708
  private oid4vciHolderStart;
709
+ private oid4vciHolderPrepareAuthorizationRequest;
702
710
  private oid4vciHolderCreateCredentialsToSelectFrom;
703
711
  private oid4vciHolderGetContact;
704
712
  private oid4vciHolderGetCredentials;
@@ -786,4 +794,4 @@ declare class OID4VCIHolderLinkHandler extends LinkHandlerAdapter {
786
794
  }): Promise<void>;
787
795
  }
788
796
 
789
- export { type AccessTokenOpts, type AddContactIdentityArgs, type AssertValidCredentialsArgs, type Attribute, type AuthorizationResponseEvent, type ContactAliasEvent, type ContactConsentEvent, type CreateConfigArgs, type CreateContactEvent, type CreateCredentialsToSelectFromArgs, type CreateFirstPartyMachineOpts, type CreateIdentifierArgs, type CreateIdentifierCreateOpts, type CreateIdentifierOpts, type CreateOID4VCIMachineOpts, type CredentialToAccept, type CredentialToSelectFromResult, type CredentialVerificationError, type DeclineEvent, type DefaultIssuanceOpts, type DidAgents, type DynamicRegistrationClientMetadataDisplay, type ErrorDetails, type FirstPartyDeclineEvent, type FirstPartyMachineContext, type FirstPartyMachineEventTypes, FirstPartyMachineEvents, type FirstPartyMachineInterpreter, type FirstPartyMachineNavigationArgs, type FirstPartyMachineServiceDefinitions, FirstPartyMachineServices, type FirstPartyMachineState, type FirstPartyMachineStateNavigationListener, FirstPartyMachineStateTypes, type FirstPartyMachineStates, type FirstPartyMachineStatesConfig, type FirstPartyNextEvent, type FirstPartyPreviousEvent, type FirstPartySelectCredentialsEvent, type FirstPartyStateMachine, type GetAuthenticationKeyArgs, type GetBasicIssuerLocaleBrandingArgs, type GetContactArgs, type GetCredentialArgs, type GetCredentialBrandingArgs, type GetCredentialConfigsSupportedArgs, type GetCredentialConfigsSupportedBySingleTypeOrIdArgs, type GetCredentialsArgs, type GetDefaultIssuanceOptsArgs, type GetFederationTrustArgs, type GetIdentifierArgs, type GetIssuanceCryptoSuiteArgs, type GetIssuanceDidMethodArgs, type GetIssuanceOptsArgs, type GetIssuerBrandingArgs, type GetIssuerMetadataArgs, type GetMachineArgs, type GetOrCreatePrimaryIdentifierArgs, type GetPreferredCredentialFormatsArgs, type GetSiopRequestArgs, type IOID4VCIHolder, IdentifierAliasEnum, type InstanceFirstPartyMachineOpts, type InvokeAuthorizationRequestEvent, type IssuanceOpts, type IssuerLocaleBrandingFromArgs, type IssuerType, type MapCredentialToAcceptArgs, type MappedCredentialToAccept, type NextEvent, OID4VCICallbackStateListener, type OID4VCIContext, OID4VCIHolder, OID4VCIHolderEvent, OID4VCIHolderLinkHandler, type OID4VCIHolderOptions, type OID4VCIMachine, OID4VCIMachineAddContactStates, type OID4VCIMachineContext, type OID4VCIMachineEventTypes, OID4VCIMachineEvents, OID4VCIMachineGuards, type OID4VCIMachineInstanceOpts, type OID4VCIMachineInterpreter, type OID4VCIMachineNavigationArgs, type OID4VCIMachineServiceDefinitions, OID4VCIMachineServices, type OID4VCIMachineState, type OID4VCIMachineStateNavigationListener, OID4VCIMachineStates, OID4VCIMachineVerifyPinStates, type OID4VCIProviderProps, type OID4VCIStateMachine, type Oid4vciCombineDisplayLocalesFromArgs, type Oid4vciCredentialDisplayLocalesFromArgs, type Oid4vciCredentialLocaleBrandingFromArgs, type Oid4vciGetCredentialBrandingFromArgs, type Oid4vciIssuerCredentialSubjectLocalesFromArgs, type OnContactIdentityCreatedArgs, type OnCredentialStoredArgs, type OnIdentifierCreatedArgs, type PrepareStartArgs, type PreviousEvent, type RequestData, RequestType, type RequiredContext, type SdJwtCombineDisplayLocalesFromArgs, type SdJwtCredentialClaimLocalesFromArgs, type SdJwtCredentialDisplayLocalesFromArgs, type SdJwtCredentialLocaleBrandingFromArgs, type SdJwtGetCredentialBrandingFromArgs, type SelectAppLocaleBrandingArgs, type SelectCredentialsEvent, type SendAuthorizationChallengeRequestArgs, type SendAuthorizationResponseArgs, type SendNotificationArgs, type SetAuthorizationCodeURLEvent, type SiopV2AuthorizationRequestData, type StartFirstPartApplicationMachine, type StartResult, type StoreCredentialBrandingArgs, type StoreCredentialsArgs, type StoreIssuerBrandingArgs, SupportedLanguage, type VerificationCodeEvent, type VerificationResult, type VerificationSubResult, type VerifyCredentialArgs, type VerifyCredentialToAcceptArgs, type VerifyEBSICredentialIssuerArgs, type VerifyEBSICredentialIssuerResult, type VerifyMdocArgs, type VerifySDJWTCredentialArgs, createConfig, extractCredentialFromResponse, getBasicIssuerLocaleBranding, getCredentialBranding, getCredentialConfigsBasedOnFormatPref, getCredentialConfigsSupported, getCredentialConfigsSupportedBySingleTypeOrId, getCredentialConfigsSupportedMerged, getIdentifierOpts, getIssuanceCryptoSuite, getIssuanceMethod, getIssuanceOpts, getSiopRequest, issuerLocaleBrandingFrom, mapCredentialToAccept, oid4vciCombineDisplayLocalesFrom, oid4vciCredentialDisplayLocalesFrom, oid4vciCredentialLocaleBrandingFrom, oid4vciGetCredentialBrandingFrom, oid4vciHolderContextMethods, oid4vciIssuerCredentialSubjectLocalesFrom, sdJwtCombineDisplayLocalesFrom, sdJwtCredentialClaimLocalesFrom, sdJwtCredentialDisplayLocalesFrom, sdJwtCredentialLocaleBrandingFrom, sdJwtGetCredentialBrandingFrom, selectCredentialLocaleBranding, sendAuthorizationChallengeRequest, sendAuthorizationResponse, signCallback, startFirstPartApplicationMachine, verifyCredentialToAccept };
797
+ export { type AccessTokenOpts, type AddContactIdentityArgs, type AssertValidCredentialsArgs, type Attribute, type AuthorizationResponseEvent, type ContactAliasEvent, type ContactConsentEvent, type CreateConfigArgs, type CreateContactEvent, type CreateCredentialsToSelectFromArgs, type CreateFirstPartyMachineOpts, type CreateIdentifierArgs, type CreateIdentifierCreateOpts, type CreateIdentifierOpts, type CreateOID4VCIMachineOpts, type CredentialToAccept, type CredentialToSelectFromResult, type CredentialVerificationError, type DeclineEvent, type DefaultIssuanceOpts, type DidAgents, type DynamicRegistrationClientMetadataDisplay, type ErrorDetails, type FirstPartyDeclineEvent, type FirstPartyMachineContext, type FirstPartyMachineEventTypes, FirstPartyMachineEvents, type FirstPartyMachineInterpreter, type FirstPartyMachineNavigationArgs, type FirstPartyMachineServiceDefinitions, FirstPartyMachineServices, type FirstPartyMachineState, type FirstPartyMachineStateNavigationListener, FirstPartyMachineStateTypes, type FirstPartyMachineStates, type FirstPartyMachineStatesConfig, type FirstPartyNextEvent, type FirstPartyPreviousEvent, type FirstPartySelectCredentialsEvent, type FirstPartyStateMachine, type GetAuthenticationKeyArgs, type GetBasicIssuerLocaleBrandingArgs, type GetContactArgs, type GetCredentialArgs, type GetCredentialBrandingArgs, type GetCredentialConfigsSupportedArgs, type GetCredentialConfigsSupportedBySingleTypeOrIdArgs, type GetCredentialsArgs, type GetDefaultIssuanceOptsArgs, type GetFederationTrustArgs, type GetIdentifierArgs, type GetIssuanceCryptoSuiteArgs, type GetIssuanceDidMethodArgs, type GetIssuanceOptsArgs, type GetIssuerBrandingArgs, type GetIssuerMetadataArgs, type GetMachineArgs, type GetOrCreatePrimaryIdentifierArgs, type GetPreferredCredentialFormatsArgs, type GetSiopRequestArgs, type IOID4VCIHolder, IdentifierAliasEnum, type InstanceFirstPartyMachineOpts, type InvokeAuthorizationRequestEvent, type IssuanceOpts, type IssuerLocaleBrandingFromArgs, type IssuerType, type MapCredentialToAcceptArgs, type MappedCredentialToAccept, type NextEvent, OID4VCICallbackStateListener, type OID4VCIContext, OID4VCIHolder, OID4VCIHolderEvent, OID4VCIHolderLinkHandler, type OID4VCIHolderOptions, type OID4VCIMachine, OID4VCIMachineAddContactStates, type OID4VCIMachineContext, type OID4VCIMachineEventTypes, OID4VCIMachineEvents, OID4VCIMachineGuards, type OID4VCIMachineInstanceOpts, type OID4VCIMachineInterpreter, type OID4VCIMachineNavigationArgs, type OID4VCIMachineServiceDefinitions, OID4VCIMachineServices, type OID4VCIMachineState, type OID4VCIMachineStateNavigationListener, OID4VCIMachineStates, OID4VCIMachineVerifyPinStates, type OID4VCIProviderProps, type OID4VCIStateMachine, type Oid4vciCombineDisplayLocalesFromArgs, type Oid4vciCredentialDisplayLocalesFromArgs, type Oid4vciCredentialLocaleBrandingFromArgs, type Oid4vciGetCredentialBrandingFromArgs, type Oid4vciIssuerCredentialSubjectLocalesFromArgs, type OnContactIdentityCreatedArgs, type OnCredentialStoredArgs, type OnIdentifierCreatedArgs, type PrepareAuthorizationRequestArgs, type PrepareAuthorizationResult, type PrepareStartArgs, type PreviousEvent, type RequestData, RequestType, type RequiredContext, type SdJwtCombineDisplayLocalesFromArgs, type SdJwtCredentialClaimLocalesFromArgs, type SdJwtCredentialDisplayLocalesFromArgs, type SdJwtCredentialLocaleBrandingFromArgs, type SdJwtGetCredentialBrandingFromArgs, type SelectAppLocaleBrandingArgs, type SelectCredentialsEvent, type SendAuthorizationChallengeRequestArgs, type SendAuthorizationResponseArgs, type SendNotificationArgs, type SetAuthorizationCodeURLEvent, type SiopV2AuthorizationRequestData, type StartFirstPartApplicationMachine, type StartResult, type StoreCredentialBrandingArgs, type StoreCredentialsArgs, type StoreIssuerBrandingArgs, SupportedLanguage, type VerificationCodeEvent, type VerificationResult, type VerificationSubResult, type VerifyCredentialArgs, type VerifyCredentialToAcceptArgs, type VerifyEBSICredentialIssuerArgs, type VerifyEBSICredentialIssuerResult, type VerifyMdocArgs, type VerifySDJWTCredentialArgs, createConfig, extractCredentialFromResponse, getBasicIssuerLocaleBranding, getCredentialBranding, getCredentialConfigsBasedOnFormatPref, getCredentialConfigsSupported, getCredentialConfigsSupportedBySingleTypeOrId, getCredentialConfigsSupportedMerged, getIdentifierOpts, getIssuanceCryptoSuite, getIssuanceMethod, getIssuanceOpts, getSiopRequest, issuerLocaleBrandingFrom, mapCredentialToAccept, oid4vciCombineDisplayLocalesFrom, oid4vciCredentialDisplayLocalesFrom, oid4vciCredentialLocaleBrandingFrom, oid4vciGetCredentialBrandingFrom, oid4vciHolderContextMethods, oid4vciIssuerCredentialSubjectLocalesFrom, sdJwtCombineDisplayLocalesFrom, sdJwtCredentialClaimLocalesFrom, sdJwtCredentialDisplayLocalesFrom, sdJwtCredentialLocaleBrandingFrom, sdJwtGetCredentialBrandingFrom, selectCredentialLocaleBranding, sendAuthorizationChallengeRequest, sendAuthorizationResponse, signCallback, startFirstPartApplicationMachine, verifyCredentialToAccept };
package/dist/index.js CHANGED
@@ -55,15 +55,16 @@ var require_nl = __commonJS({
55
55
  });
56
56
 
57
57
  // src/agent/OID4VCIHolder.ts
58
- import { CredentialOfferClient, MetadataClient, OpenID4VCIClient as OpenID4VCIClient2 } from "@sphereon/oid4vci-client";
59
- import { DefaultURISchemes, getTypesFromAuthorizationDetails, getTypesFromCredentialOffer, getTypesFromObject as getTypesFromObject2 } from "@sphereon/oid4vci-common";
58
+ import { CredentialOfferClient, MetadataClient, OpenID4VCIClient as OpenID4VCIClient2, OpenID4VCIClientV1_0_15 } from "@sphereon/oid4vci-client";
59
+ import { DefaultURISchemes, 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";
63
63
  import { defaultHasher as defaultHasher2 } from "@sphereon/ssi-sdk.core";
64
- import { ConnectionType, CorrelationIdentifierType, CredentialCorrelationType, CredentialRole, ensureRawDocument, IdentityOrigin } from "@sphereon/ssi-sdk.data-store";
65
- import { CredentialMapper as CredentialMapper2, JoseSignatureAlgorithm as JoseSignatureAlgorithm2, Loggers, parseDid } from "@sphereon/ssi-types";
64
+ import { ConnectionType, CorrelationIdentifierType, CredentialCorrelationType, ensureRawDocument, IdentityOrigin } from "@sphereon/ssi-sdk.data-store-types";
65
+ import { CredentialMapper as CredentialMapper2, CredentialRole, JoseSignatureAlgorithm as JoseSignatureAlgorithm2, Loggers, parseDid } from "@sphereon/ssi-types";
66
66
  import { asArray as asArray2, computeEntryHash } from "@veramo/utils";
67
+ import fetch from "cross-fetch";
67
68
  import { decodeJWT } from "did-jwt";
68
69
  import { v4 as uuidv42 } from "uuid";
69
70
 
@@ -103,6 +104,7 @@ var OID4VCIMachineStates = /* @__PURE__ */ (function(OID4VCIMachineStates2) {
103
104
  OID4VCIMachineStates2["selectCredentials"] = "selectCredentials";
104
105
  OID4VCIMachineStates2["transitionFromSelectingCredentials"] = "transitionFromSelectingCredentials";
105
106
  OID4VCIMachineStates2["verifyPin"] = "verifyPin";
107
+ OID4VCIMachineStates2["prepareAuthorizationRequest"] = "prepareAuthorizationRequest";
106
108
  OID4VCIMachineStates2["initiateAuthorizationRequest"] = "initiateAuthorizationRequest";
107
109
  OID4VCIMachineStates2["waitForAuthorizationResponse"] = "waitForAuthorizationResponse";
108
110
  OID4VCIMachineStates2["getCredentials"] = "getCredentials";
@@ -167,6 +169,7 @@ var OID4VCIMachineServices = /* @__PURE__ */ (function(OID4VCIMachineServices2)
167
169
  OID4VCIMachineServices2["getFederationTrust"] = "getFederationTrust";
168
170
  OID4VCIMachineServices2["addContactIdentity"] = "addContactIdentity";
169
171
  OID4VCIMachineServices2["createCredentialsToSelectFrom"] = "createCredentialsToSelectFrom";
172
+ OID4VCIMachineServices2["prepareAuthorizationRequest"] = "prepareAuthorizationRequest";
170
173
  OID4VCIMachineServices2["getIssuerBranding"] = "getIssuerBranding";
171
174
  OID4VCIMachineServices2["storeIssuerBranding"] = "storeIssuerBranding";
172
175
  OID4VCIMachineServices2["getCredentials"] = "getCredentials";
@@ -308,9 +311,7 @@ var oid4vciRequireAuthorizationGuard = /* @__PURE__ */ __name((ctx, _event) => {
308
311
  if (!openID4VCIClientState) {
309
312
  throw Error("Missing openID4VCI client state in context");
310
313
  }
311
- if (!openID4VCIClientState.authorizationURL) {
312
- return false;
313
- } else if (openID4VCIClientState.authorizationRequestOpts) {
314
+ if (openID4VCIClientState.authorizationURL && openID4VCIClientState.authorizationRequestOpts) {
314
315
  return !ctx.openID4VCIClientState?.authorizationCodeResponse;
315
316
  } else if (openID4VCIClientState.credentialOffer?.supportedFlows?.includes(AuthzFlowType.AUTHORIZATION_CODE_FLOW)) {
316
317
  return !ctx.openID4VCIClientState?.authorizationCodeResponse;
@@ -361,7 +362,6 @@ var createOID4VCIMachine = /* @__PURE__ */ __name((opts) => {
361
362
  onDone: {
362
363
  target: OID4VCIMachineStates.createCredentialsToSelectFrom,
363
364
  actions: assign({
364
- authorizationCodeURL: /* @__PURE__ */ __name((_ctx, _event) => _event.data.authorizationCodeURL, "authorizationCodeURL"),
365
365
  credentialBranding: /* @__PURE__ */ __name((_ctx, _event) => _event.data.credentialBranding ?? {}, "credentialBranding"),
366
366
  credentialsSupported: /* @__PURE__ */ __name((_ctx, _event) => _event.data.credentialsSupported, "credentialsSupported"),
367
367
  serverMetadata: /* @__PURE__ */ __name((_ctx, _event) => _event.data.serverMetadata, "serverMetadata"),
@@ -598,6 +598,10 @@ var createOID4VCIMachine = /* @__PURE__ */ __name((opts) => {
598
598
  target: OID4VCIMachineStates.startFirstPartApplicationFlow,
599
599
  cond: OID4VCIMachineGuards.isFirstPartyApplication
600
600
  },
601
+ {
602
+ target: OID4VCIMachineStates.prepareAuthorizationRequest,
603
+ cond: OID4VCIMachineGuards.requireAuthorizationGuard
604
+ },
601
605
  {
602
606
  target: OID4VCIMachineStates.initiateAuthorizationRequest,
603
607
  cond: OID4VCIMachineGuards.requireAuthorizationGuard
@@ -673,12 +677,16 @@ var createOID4VCIMachine = /* @__PURE__ */ __name((opts) => {
673
677
  target: OID4VCIMachineStates.startFirstPartApplicationFlow,
674
678
  cond: OID4VCIMachineGuards.isFirstPartyApplication
675
679
  },
680
+ {
681
+ target: OID4VCIMachineStates.prepareAuthorizationRequest,
682
+ cond: OID4VCIMachineGuards.requireAuthorizationGuard
683
+ },
676
684
  {
677
685
  target: OID4VCIMachineStates.verifyPin,
678
686
  cond: OID4VCIMachineGuards.requirePinGuard
679
687
  },
680
688
  {
681
- target: OID4VCIMachineStates.initiateAuthorizationRequest,
689
+ target: OID4VCIMachineStates.prepareAuthorizationRequest,
682
690
  cond: OID4VCIMachineGuards.requireAuthorizationGuard
683
691
  },
684
692
  {
@@ -686,6 +694,29 @@ var createOID4VCIMachine = /* @__PURE__ */ __name((opts) => {
686
694
  }
687
695
  ]
688
696
  },
697
+ [OID4VCIMachineStates.prepareAuthorizationRequest]: {
698
+ id: OID4VCIMachineStates.prepareAuthorizationRequest,
699
+ invoke: {
700
+ src: OID4VCIMachineServices.prepareAuthorizationRequest,
701
+ onDone: {
702
+ target: OID4VCIMachineStates.initiateAuthorizationRequest,
703
+ actions: assign({
704
+ authorizationCodeURL: /* @__PURE__ */ __name((_ctx, _event) => _event.data.authorizationCodeURL, "authorizationCodeURL"),
705
+ openID4VCIClientState: /* @__PURE__ */ __name((_ctx, _event) => _event.data.oid4vciClientState, "openID4VCIClientState")
706
+ })
707
+ },
708
+ onError: {
709
+ target: OID4VCIMachineStates.handleError,
710
+ actions: assign({
711
+ error: /* @__PURE__ */ __name((_ctx, _event) => ({
712
+ title: translate("oid4vci_machine_prepare_authorization_error_title"),
713
+ message: _event.data.message,
714
+ stack: _event.data.stack
715
+ }), "error")
716
+ })
717
+ }
718
+ }
719
+ },
689
720
  [OID4VCIMachineStates.initiateAuthorizationRequest]: {
690
721
  id: OID4VCIMachineStates.initiateAuthorizationRequest,
691
722
  on: {
@@ -978,7 +1009,7 @@ var OID4VCIMachine = class {
978
1009
 
979
1010
  // src/services/OID4VCIHolderService.ts
980
1011
  import { LOG } from "@sphereon/oid4vci-client";
981
- import { getSupportedCredentials, getTypesFromCredentialSupported, getTypesFromObject, OpenId4VCIVersion } from "@sphereon/oid4vci-common";
1012
+ import { getSupportedCredentials, getTypesFromCredentialSupported, getTypesFromObject } from "@sphereon/oid4vci-common";
982
1013
  import { KeyUse } from "@sphereon/ssi-sdk-ext.did-resolver-jwk";
983
1014
  import { getOrCreatePrimaryIdentifier, SupportedDidMethodEnum } from "@sphereon/ssi-sdk-ext.did-utils";
984
1015
  import { isIIdentifier, isManagedIdentifierDidResult, isManagedIdentifierResult, managedIdentifierToJwk } from "@sphereon/ssi-sdk-ext.identifier-resolution";
@@ -1664,7 +1695,7 @@ var mapCredentialToAccept = /* @__PURE__ */ __name(async (args) => {
1664
1695
  });
1665
1696
  let uniformVerifiableCredential;
1666
1697
  if (CredentialMapper.isSdJwtDecodedCredential(wrappedVerifiableCredential.credential)) {
1667
- uniformVerifiableCredential = await sdJwtDecodedCredentialToUniformCredential(wrappedVerifiableCredential.credential);
1698
+ uniformVerifiableCredential = sdJwtDecodedCredentialToUniformCredential(wrappedVerifiableCredential.credential);
1668
1699
  } else if (CredentialMapper.isSdJwtEncoded(wrappedVerifiableCredential.credential)) {
1669
1700
  if (!hasher) {
1670
1701
  return Promise.reject("a hasher is required for encoded SD-JWT credentials");
@@ -1810,24 +1841,19 @@ var getCredentialConfigsSupportedBySingleTypeOrId = /* @__PURE__ */ __name(async
1810
1841
  }
1811
1842
  __name(createIdFromTypes, "createIdFromTypes");
1812
1843
  if (configurationId) {
1813
- const allSupported2 = client.getCredentialsSupported(false);
1844
+ const allSupported2 = client.getCredentialsSupported(void 0, format);
1814
1845
  return Object.fromEntries(Object.entries(allSupported2).filter(([id, supported]) => id === configurationId || supported.id === configurationId || createIdFromTypes(supported) === configurationId));
1815
1846
  }
1816
- if (!types && !client.credentialOffer) {
1817
- return Promise.reject(Error("openID4VCIClient has no credentialOffer and no types where provided"));
1847
+ if (!client.credentialOffer) {
1848
+ return Promise.reject(Error("openID4VCIClient has no credentialOffer"));
1818
1849
  }
1819
- if (!Array.isArray(format) && client.credentialOffer) {
1820
- if (client.version() > OpenId4VCIVersion.VER_1_0_09 && typeof client.credentialOffer.credential_offer === "object" && "credentials" in client.credentialOffer.credential_offer) {
1821
- format = client.credentialOffer.credential_offer.credentials.filter((cred) => typeof cred !== "string").map((cred) => cred.format);
1822
- if (format?.length === 0) {
1823
- format = void 0;
1824
- }
1825
- }
1850
+ if (!types) {
1851
+ return Promise.reject(Error("openID4VCIClient has no types"));
1826
1852
  }
1827
1853
  const offerSupported = getSupportedCredentials({
1828
- types: types ? [
1854
+ types: [
1829
1855
  types
1830
- ] : client.getCredentialOfferTypes(),
1856
+ ],
1831
1857
  format,
1832
1858
  version: client.version(),
1833
1859
  issuerMetadata: client.endpointMetadata.credentialIssuerMetadata
@@ -2071,7 +2097,6 @@ var startFirstPartApplicationMachine = /* @__PURE__ */ __name(async (args, conte
2071
2097
  }, "startFirstPartApplicationMachine");
2072
2098
 
2073
2099
  // src/agent/OID4VCIHolder.ts
2074
- import "cross-fetch/polyfill";
2075
2100
  var oid4vciHolderContextMethods = [
2076
2101
  "cmGetContacts",
2077
2102
  "cmGetContact",
@@ -2127,6 +2152,7 @@ var OID4VCIHolder = class _OID4VCIHolder {
2127
2152
  oid4vciHolderStart: this.oid4vciHolderStart.bind(this),
2128
2153
  oid4vciHolderGetIssuerMetadata: this.oid4vciHolderGetIssuerMetadata.bind(this),
2129
2154
  oid4vciHolderGetMachineInterpreter: this.oid4vciHolderGetMachineInterpreter.bind(this),
2155
+ oid4vciHolderPrepareAuthorizationRequest: this.oid4vciHolderPrepareAuthorizationRequest.bind(this),
2130
2156
  oid4vciHolderCreateCredentialsToSelectFrom: this.oid4vciHolderCreateCredentialsToSelectFrom.bind(this),
2131
2157
  oid4vciHolderGetContact: this.oid4vciHolderGetContact.bind(this),
2132
2158
  oid4vciHolderGetCredentials: this.oid4vciHolderGetCredentials.bind(this),
@@ -2231,6 +2257,7 @@ var OID4VCIHolder = class _OID4VCIHolder {
2231
2257
  stateNavigationListener: opts.firstPartyStateNavigationListener
2232
2258
  }, context),
2233
2259
  [OID4VCIMachineServices.createCredentialsToSelectFrom]: (args) => this.oid4vciHolderCreateCredentialsToSelectFrom(args, context),
2260
+ [OID4VCIMachineServices.prepareAuthorizationRequest]: (args) => this.oid4vciHolderPrepareAuthorizationRequest(args, context),
2234
2261
  [OID4VCIMachineServices.getContact]: (args) => this.oid4vciHolderGetContact(args, context),
2235
2262
  [OID4VCIMachineServices.getCredentials]: (args) => this.oid4vciHolderGetCredentials({
2236
2263
  accessTokenOpts: args.accessTokenOpts ?? opts.accessTokenOpts,
@@ -2279,7 +2306,7 @@ var OID4VCIHolder = class _OID4VCIHolder {
2279
2306
  ...this.defaultAuthorizationRequestOpts,
2280
2307
  ...args.authorizationRequestOpts
2281
2308
  };
2282
- authorizationRequestOpts.authorizationDetails = authorizationRequestOpts?.authorizationDetails ? asArray2(authorizationRequestOpts.authorizationDetails).filter((detail) => typeof detail === "string" || this.vcFormatPreferences.includes(detail.format)) : void 0;
2309
+ authorizationRequestOpts.authorizationDetails = authorizationRequestOpts?.authorizationDetails ? asArray2(authorizationRequestOpts.authorizationDetails) : void 0;
2283
2310
  if (!authorizationRequestOpts.redirectUri) {
2284
2311
  authorizationRequestOpts.redirectUri = _OID4VCIHolder.DEFAULT_MOBILE_REDIRECT_URI;
2285
2312
  }
@@ -2292,10 +2319,9 @@ var OID4VCIHolder = class _OID4VCIHolder {
2292
2319
  formats = Array.from(new Set(authFormats));
2293
2320
  }
2294
2321
  let oid4vciClient;
2295
- let types = void 0;
2296
2322
  let offer;
2297
2323
  if (requestData.existingClientState) {
2298
- oid4vciClient = await OpenID4VCIClient2.fromState({
2324
+ oid4vciClient = await OpenID4VCIClientV1_0_15.fromState({
2299
2325
  state: requestData.existingClientState
2300
2326
  });
2301
2327
  offer = oid4vciClient.credentialOffer;
@@ -2312,50 +2338,78 @@ var OID4VCIHolder = class _OID4VCIHolder {
2312
2338
  }
2313
2339
  if (!offer) {
2314
2340
  logger.log(`Issuer url received (no credential offer): ${uri}`);
2315
- oid4vciClient = await OpenID4VCIClient2.fromCredentialIssuer({
2341
+ oid4vciClient = await OpenID4VCIClientV1_0_15.fromCredentialIssuer({
2316
2342
  credentialIssuer: uri,
2317
2343
  authorizationRequest: authorizationRequestOpts,
2318
2344
  clientId: authorizationRequestOpts.clientId,
2319
- createAuthorizationRequestURL: requestData.createAuthorizationRequestURL ?? true
2345
+ createAuthorizationRequestURL: false
2320
2346
  });
2321
2347
  } else {
2322
2348
  logger.log(`Credential offer received: ${uri}`);
2323
- oid4vciClient = await OpenID4VCIClient2.fromURI({
2349
+ oid4vciClient = await OpenID4VCIClientV1_0_15.fromURI({
2324
2350
  uri,
2325
2351
  authorizationRequest: authorizationRequestOpts,
2326
2352
  clientId: authorizationRequestOpts.clientId,
2327
- createAuthorizationRequestURL: requestData.createAuthorizationRequestURL ?? true
2353
+ createAuthorizationRequestURL: false
2328
2354
  });
2329
2355
  }
2330
2356
  }
2357
+ let configurationIds = [];
2331
2358
  if (offer) {
2332
- types = getTypesFromCredentialOffer(offer.original_credential_offer);
2359
+ configurationIds = offer.original_credential_offer.credential_configuration_ids;
2333
2360
  } else {
2334
- types = asArray2(authorizationRequestOpts.authorizationDetails).map((authReqOpts) => getTypesFromAuthorizationDetails(authReqOpts) ?? []).filter((inner) => inner.length > 0);
2361
+ configurationIds = asArray2(authorizationRequestOpts.authorizationDetails).map((authReqOpts) => authReqOpts.credential_configuration_id).filter((id) => !!id);
2335
2362
  }
2336
- const serverMetadata = await oid4vciClient.retrieveServerMetadata();
2337
2363
  const credentialsSupported = await getCredentialConfigsSupportedMerged({
2338
2364
  client: oid4vciClient,
2339
2365
  vcFormatPreferences: formats,
2340
- types
2366
+ configurationIds
2341
2367
  });
2368
+ const serverMetadata = await oid4vciClient.retrieveServerMetadata();
2342
2369
  const credentialBranding = await getCredentialBranding({
2343
2370
  credentialsSupported,
2344
2371
  context
2345
2372
  });
2346
- const authorizationCodeURL = oid4vciClient.authorizationURL;
2347
- if (authorizationCodeURL) {
2348
- logger.log(`authorization code URL ${authorizationCodeURL}`);
2349
- }
2350
2373
  const oid4vciClientState = JSON.parse(await oid4vciClient.exportState());
2351
2374
  return {
2352
- authorizationCodeURL,
2353
2375
  credentialBranding,
2354
2376
  credentialsSupported,
2355
2377
  serverMetadata,
2356
2378
  oid4vciClientState
2357
2379
  };
2358
2380
  }
2381
+ async oid4vciHolderPrepareAuthorizationRequest(args, context) {
2382
+ const { openID4VCIClientState, contact } = args;
2383
+ if (!openID4VCIClientState) {
2384
+ return Promise.reject(Error("Missing openID4VCI client state in context"));
2385
+ }
2386
+ const clientId = contact?.identities.map((identity) => {
2387
+ const connectionConfig = identity.connection?.config;
2388
+ if (connectionConfig && "clientId" in connectionConfig) {
2389
+ return connectionConfig.clientId;
2390
+ }
2391
+ return void 0;
2392
+ }).find((clientId2) => clientId2);
2393
+ if (!clientId) {
2394
+ return Promise.reject(Error(`Missing client id in contact's connectionConfig`));
2395
+ }
2396
+ const client = await OpenID4VCIClient2.fromState({
2397
+ state: openID4VCIClientState
2398
+ });
2399
+ const authorizationCodeURL = await client.createAuthorizationRequestUrl({
2400
+ authorizationRequest: {
2401
+ clientId
2402
+ }
2403
+ });
2404
+ if (authorizationCodeURL) {
2405
+ logger.log(`authorization code URL ${authorizationCodeURL}`);
2406
+ }
2407
+ return {
2408
+ authorizationCodeURL,
2409
+ // Needed, because the above createAuthorizationRequestUrl manipulates the state, adding pkce opts to the state
2410
+ oid4vciClientState: JSON.parse(await client.exportState())
2411
+ };
2412
+ }
2359
2413
  async oid4vciHolderCreateCredentialsToSelectFrom(args, context) {
2360
2414
  const { credentialBranding, locale, selectedCredentials, credentialsSupported } = args;
2361
2415
  logger.info(`Credentials supported ${Object.keys(credentialsSupported).join(", ")}`);
@@ -2427,7 +2481,7 @@ var OID4VCIHolder = class _OID4VCIHolder {
2427
2481
  if (!openID4VCIClientState) {
2428
2482
  return Promise.reject(Error("Missing openID4VCI client state in context"));
2429
2483
  }
2430
- const client = await OpenID4VCIClient2.fromState({
2484
+ const client = await OpenID4VCIClientV1_0_15.fromState({
2431
2485
  state: openID4VCIClientState
2432
2486
  });
2433
2487
  const credentialsSupported = await getCredentialConfigsSupportedMerged({