@sphereon/ssi-sdk.oid4vci-holder 0.34.1-next.299 → 0.34.1-next.322

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 { ICredentialValidation, SchemaValidation } from '@sphereon/ssi-sdk.credential-validation';
10
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,14 @@ 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
+ };
457
463
  type SelectAppLocaleBrandingArgs = {
458
464
  locale?: string;
459
465
  localeBranding?: Array<IBasicCredentialLocaleBranding | IBasicIssuerLocaleBranding>;
@@ -487,7 +493,7 @@ type CredentialToAccept = {
487
493
  credentialResponse: CredentialResponseV1_0_15 | CredentialResponse;
488
494
  };
489
495
  type GetCredentialConfigsSupportedArgs = {
490
- client: OpenID4VCIClient;
496
+ client: OpenID4VCIClientV1_0_15;
491
497
  vcFormatPreferences: Array<string>;
492
498
  format?: Array<string>;
493
499
  types?: Array<Array<string>>;
@@ -498,7 +504,7 @@ type GetCredentialConfigsSupportedArgs = {
498
504
  * It can potentially return multiple results mainly because of different formats.
499
505
  */
500
506
  type GetCredentialConfigsSupportedBySingleTypeOrIdArgs = {
501
- client: OpenID4VCIClient;
507
+ client: OpenID4VCIClientV1_0_15;
502
508
  vcFormatPreferences: Array<string>;
503
509
  format?: string[];
504
510
  types?: string[];
@@ -527,7 +533,7 @@ type GetDefaultIssuanceOptsArgs = {
527
533
  context: RequiredContext;
528
534
  };
529
535
  type DefaultIssuanceOpts = {
530
- client: OpenID4VCIClient;
536
+ client: OpenID4VCIClientV1_0_15;
531
537
  };
532
538
  type GetIdentifierArgs = {
533
539
  issuanceOpt: IssuanceOpts;
@@ -557,7 +563,7 @@ type CreateIdentifierCreateOpts = {
557
563
  options?: IdentifierProviderOpts;
558
564
  };
559
565
  type GetIssuanceOptsArgs = {
560
- client: OpenID4VCIClient;
566
+ client: OpenID4VCIClientV1_0_15;
561
567
  credentialsSupported: Record<string, CredentialConfigurationSupported>;
562
568
  serverMetadata: EndpointMetadataResult;
563
569
  context: RequiredContext;
@@ -568,19 +574,19 @@ type GetIssuanceOptsArgs = {
568
574
  };
569
575
  type GetIssuanceDidMethodArgs = {
570
576
  credentialSupported: CredentialConfigurationSupported;
571
- client: OpenID4VCIClient;
577
+ client: OpenID4VCIClientV1_0_15;
572
578
  didMethodPreferences: Array<SupportedDidMethodEnum>;
573
579
  };
574
580
  type GetIssuanceCryptoSuiteArgs = {
575
581
  credentialSupported: CredentialConfigurationSupported;
576
- client: OpenID4VCIClient;
582
+ client: OpenID4VCIClientV1_0_15;
577
583
  jwtCryptographicSuitePreferences: Array<JoseSignatureAlgorithm | JoseSignatureAlgorithmString>;
578
584
  jsonldCryptographicSuitePreferences: Array<string>;
579
585
  };
580
586
  type GetCredentialArgs = {
581
587
  pin?: string;
582
588
  issuanceOpt: IssuanceOpts;
583
- client: OpenID4VCIClient;
589
+ client: OpenID4VCIClientV1_0_15;
584
590
  accessTokenOpts?: AccessTokenOpts;
585
591
  };
586
592
  type AccessTokenOpts = {
@@ -699,6 +705,7 @@ declare class OID4VCIHolder implements IAgentPlugin {
699
705
  * @private
700
706
  */
701
707
  private oid4vciHolderStart;
708
+ private oid4vciHolderPrepareAuthorizationRequest;
702
709
  private oid4vciHolderCreateCredentialsToSelectFrom;
703
710
  private oid4vciHolderGetContact;
704
711
  private oid4vciHolderGetCredentials;
@@ -786,4 +793,4 @@ declare class OID4VCIHolderLinkHandler extends LinkHandlerAdapter {
786
793
  }): Promise<void>;
787
794
  }
788
795
 
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 };
796
+ 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 { ICredentialValidation, SchemaValidation } from '@sphereon/ssi-sdk.credential-validation';
10
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,14 @@ 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
+ };
457
463
  type SelectAppLocaleBrandingArgs = {
458
464
  locale?: string;
459
465
  localeBranding?: Array<IBasicCredentialLocaleBranding | IBasicIssuerLocaleBranding>;
@@ -487,7 +493,7 @@ type CredentialToAccept = {
487
493
  credentialResponse: CredentialResponseV1_0_15 | CredentialResponse;
488
494
  };
489
495
  type GetCredentialConfigsSupportedArgs = {
490
- client: OpenID4VCIClient;
496
+ client: OpenID4VCIClientV1_0_15;
491
497
  vcFormatPreferences: Array<string>;
492
498
  format?: Array<string>;
493
499
  types?: Array<Array<string>>;
@@ -498,7 +504,7 @@ type GetCredentialConfigsSupportedArgs = {
498
504
  * It can potentially return multiple results mainly because of different formats.
499
505
  */
500
506
  type GetCredentialConfigsSupportedBySingleTypeOrIdArgs = {
501
- client: OpenID4VCIClient;
507
+ client: OpenID4VCIClientV1_0_15;
502
508
  vcFormatPreferences: Array<string>;
503
509
  format?: string[];
504
510
  types?: string[];
@@ -527,7 +533,7 @@ type GetDefaultIssuanceOptsArgs = {
527
533
  context: RequiredContext;
528
534
  };
529
535
  type DefaultIssuanceOpts = {
530
- client: OpenID4VCIClient;
536
+ client: OpenID4VCIClientV1_0_15;
531
537
  };
532
538
  type GetIdentifierArgs = {
533
539
  issuanceOpt: IssuanceOpts;
@@ -557,7 +563,7 @@ type CreateIdentifierCreateOpts = {
557
563
  options?: IdentifierProviderOpts;
558
564
  };
559
565
  type GetIssuanceOptsArgs = {
560
- client: OpenID4VCIClient;
566
+ client: OpenID4VCIClientV1_0_15;
561
567
  credentialsSupported: Record<string, CredentialConfigurationSupported>;
562
568
  serverMetadata: EndpointMetadataResult;
563
569
  context: RequiredContext;
@@ -568,19 +574,19 @@ type GetIssuanceOptsArgs = {
568
574
  };
569
575
  type GetIssuanceDidMethodArgs = {
570
576
  credentialSupported: CredentialConfigurationSupported;
571
- client: OpenID4VCIClient;
577
+ client: OpenID4VCIClientV1_0_15;
572
578
  didMethodPreferences: Array<SupportedDidMethodEnum>;
573
579
  };
574
580
  type GetIssuanceCryptoSuiteArgs = {
575
581
  credentialSupported: CredentialConfigurationSupported;
576
- client: OpenID4VCIClient;
582
+ client: OpenID4VCIClientV1_0_15;
577
583
  jwtCryptographicSuitePreferences: Array<JoseSignatureAlgorithm | JoseSignatureAlgorithmString>;
578
584
  jsonldCryptographicSuitePreferences: Array<string>;
579
585
  };
580
586
  type GetCredentialArgs = {
581
587
  pin?: string;
582
588
  issuanceOpt: IssuanceOpts;
583
- client: OpenID4VCIClient;
589
+ client: OpenID4VCIClientV1_0_15;
584
590
  accessTokenOpts?: AccessTokenOpts;
585
591
  };
586
592
  type AccessTokenOpts = {
@@ -699,6 +705,7 @@ declare class OID4VCIHolder implements IAgentPlugin {
699
705
  * @private
700
706
  */
701
707
  private oid4vciHolderStart;
708
+ private oid4vciHolderPrepareAuthorizationRequest;
702
709
  private oid4vciHolderCreateCredentialsToSelectFrom;
703
710
  private oid4vciHolderGetContact;
704
711
  private oid4vciHolderGetCredentials;
@@ -786,4 +793,4 @@ declare class OID4VCIHolderLinkHandler extends LinkHandlerAdapter {
786
793
  }): Promise<void>;
787
794
  }
788
795
 
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 };
796
+ 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,14 +55,13 @@ 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";
58
+ import { CredentialOfferClient, MetadataClient, OpenID4VCIClient as OpenID4VCIClient2, OpenID4VCIClientV1_0_15 } from "@sphereon/oid4vci-client";
59
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 { ensureRawDocument } from "@sphereon/ssi-sdk.data-store-types";
65
- import { ConnectionType, CorrelationIdentifierType, CredentialCorrelationType, IdentityOrigin } from "@sphereon/ssi-sdk.data-store-types";
64
+ import { ConnectionType, CorrelationIdentifierType, CredentialCorrelationType, ensureRawDocument, IdentityOrigin } from "@sphereon/ssi-sdk.data-store-types";
66
65
  import { CredentialMapper as CredentialMapper2, CredentialRole, JoseSignatureAlgorithm as JoseSignatureAlgorithm2, Loggers, parseDid } from "@sphereon/ssi-types";
67
66
  import { asArray as asArray2, computeEntryHash } from "@veramo/utils";
68
67
  import fetch from "cross-fetch";
@@ -105,6 +104,7 @@ var OID4VCIMachineStates = /* @__PURE__ */ (function(OID4VCIMachineStates2) {
105
104
  OID4VCIMachineStates2["selectCredentials"] = "selectCredentials";
106
105
  OID4VCIMachineStates2["transitionFromSelectingCredentials"] = "transitionFromSelectingCredentials";
107
106
  OID4VCIMachineStates2["verifyPin"] = "verifyPin";
107
+ OID4VCIMachineStates2["prepareAuthorizationRequest"] = "prepareAuthorizationRequest";
108
108
  OID4VCIMachineStates2["initiateAuthorizationRequest"] = "initiateAuthorizationRequest";
109
109
  OID4VCIMachineStates2["waitForAuthorizationResponse"] = "waitForAuthorizationResponse";
110
110
  OID4VCIMachineStates2["getCredentials"] = "getCredentials";
@@ -169,6 +169,7 @@ var OID4VCIMachineServices = /* @__PURE__ */ (function(OID4VCIMachineServices2)
169
169
  OID4VCIMachineServices2["getFederationTrust"] = "getFederationTrust";
170
170
  OID4VCIMachineServices2["addContactIdentity"] = "addContactIdentity";
171
171
  OID4VCIMachineServices2["createCredentialsToSelectFrom"] = "createCredentialsToSelectFrom";
172
+ OID4VCIMachineServices2["prepareAuthorizationRequest"] = "prepareAuthorizationRequest";
172
173
  OID4VCIMachineServices2["getIssuerBranding"] = "getIssuerBranding";
173
174
  OID4VCIMachineServices2["storeIssuerBranding"] = "storeIssuerBranding";
174
175
  OID4VCIMachineServices2["getCredentials"] = "getCredentials";
@@ -310,9 +311,7 @@ var oid4vciRequireAuthorizationGuard = /* @__PURE__ */ __name((ctx, _event) => {
310
311
  if (!openID4VCIClientState) {
311
312
  throw Error("Missing openID4VCI client state in context");
312
313
  }
313
- if (!openID4VCIClientState.authorizationURL) {
314
- return false;
315
- } else if (openID4VCIClientState.authorizationRequestOpts) {
314
+ if (openID4VCIClientState.authorizationURL && openID4VCIClientState.authorizationRequestOpts) {
316
315
  return !ctx.openID4VCIClientState?.authorizationCodeResponse;
317
316
  } else if (openID4VCIClientState.credentialOffer?.supportedFlows?.includes(AuthzFlowType.AUTHORIZATION_CODE_FLOW)) {
318
317
  return !ctx.openID4VCIClientState?.authorizationCodeResponse;
@@ -363,7 +362,6 @@ var createOID4VCIMachine = /* @__PURE__ */ __name((opts) => {
363
362
  onDone: {
364
363
  target: OID4VCIMachineStates.createCredentialsToSelectFrom,
365
364
  actions: assign({
366
- authorizationCodeURL: /* @__PURE__ */ __name((_ctx, _event) => _event.data.authorizationCodeURL, "authorizationCodeURL"),
367
365
  credentialBranding: /* @__PURE__ */ __name((_ctx, _event) => _event.data.credentialBranding ?? {}, "credentialBranding"),
368
366
  credentialsSupported: /* @__PURE__ */ __name((_ctx, _event) => _event.data.credentialsSupported, "credentialsSupported"),
369
367
  serverMetadata: /* @__PURE__ */ __name((_ctx, _event) => _event.data.serverMetadata, "serverMetadata"),
@@ -600,6 +598,10 @@ var createOID4VCIMachine = /* @__PURE__ */ __name((opts) => {
600
598
  target: OID4VCIMachineStates.startFirstPartApplicationFlow,
601
599
  cond: OID4VCIMachineGuards.isFirstPartyApplication
602
600
  },
601
+ {
602
+ target: OID4VCIMachineStates.prepareAuthorizationRequest,
603
+ cond: OID4VCIMachineGuards.requireAuthorizationGuard
604
+ },
603
605
  {
604
606
  target: OID4VCIMachineStates.initiateAuthorizationRequest,
605
607
  cond: OID4VCIMachineGuards.requireAuthorizationGuard
@@ -675,12 +677,16 @@ var createOID4VCIMachine = /* @__PURE__ */ __name((opts) => {
675
677
  target: OID4VCIMachineStates.startFirstPartApplicationFlow,
676
678
  cond: OID4VCIMachineGuards.isFirstPartyApplication
677
679
  },
680
+ {
681
+ target: OID4VCIMachineStates.prepareAuthorizationRequest,
682
+ cond: OID4VCIMachineGuards.requireAuthorizationGuard
683
+ },
678
684
  {
679
685
  target: OID4VCIMachineStates.verifyPin,
680
686
  cond: OID4VCIMachineGuards.requirePinGuard
681
687
  },
682
688
  {
683
- target: OID4VCIMachineStates.initiateAuthorizationRequest,
689
+ target: OID4VCIMachineStates.prepareAuthorizationRequest,
684
690
  cond: OID4VCIMachineGuards.requireAuthorizationGuard
685
691
  },
686
692
  {
@@ -688,6 +694,28 @@ var createOID4VCIMachine = /* @__PURE__ */ __name((opts) => {
688
694
  }
689
695
  ]
690
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
+ })
706
+ },
707
+ onError: {
708
+ target: OID4VCIMachineStates.handleError,
709
+ actions: assign({
710
+ error: /* @__PURE__ */ __name((_ctx, _event) => ({
711
+ title: translate("oid4vci_machine_prepare_authorization_error_title"),
712
+ message: _event.data.message,
713
+ stack: _event.data.stack
714
+ }), "error")
715
+ })
716
+ }
717
+ }
718
+ },
691
719
  [OID4VCIMachineStates.initiateAuthorizationRequest]: {
692
720
  id: OID4VCIMachineStates.initiateAuthorizationRequest,
693
721
  on: {
@@ -1666,7 +1694,7 @@ var mapCredentialToAccept = /* @__PURE__ */ __name(async (args) => {
1666
1694
  });
1667
1695
  let uniformVerifiableCredential;
1668
1696
  if (CredentialMapper.isSdJwtDecodedCredential(wrappedVerifiableCredential.credential)) {
1669
- uniformVerifiableCredential = await sdJwtDecodedCredentialToUniformCredential(wrappedVerifiableCredential.credential);
1697
+ uniformVerifiableCredential = sdJwtDecodedCredentialToUniformCredential(wrappedVerifiableCredential.credential);
1670
1698
  } else if (CredentialMapper.isSdJwtEncoded(wrappedVerifiableCredential.credential)) {
1671
1699
  if (!hasher) {
1672
1700
  return Promise.reject("a hasher is required for encoded SD-JWT credentials");
@@ -1812,7 +1840,7 @@ var getCredentialConfigsSupportedBySingleTypeOrId = /* @__PURE__ */ __name(async
1812
1840
  }
1813
1841
  __name(createIdFromTypes, "createIdFromTypes");
1814
1842
  if (configurationId) {
1815
- const allSupported2 = client.getCredentialsSupported(format);
1843
+ const allSupported2 = client.getCredentialsSupported(void 0, format);
1816
1844
  return Object.fromEntries(Object.entries(allSupported2).filter(([id, supported]) => id === configurationId || supported.id === configurationId || createIdFromTypes(supported) === configurationId));
1817
1845
  }
1818
1846
  if (!client.credentialOffer) {
@@ -2123,6 +2151,7 @@ var OID4VCIHolder = class _OID4VCIHolder {
2123
2151
  oid4vciHolderStart: this.oid4vciHolderStart.bind(this),
2124
2152
  oid4vciHolderGetIssuerMetadata: this.oid4vciHolderGetIssuerMetadata.bind(this),
2125
2153
  oid4vciHolderGetMachineInterpreter: this.oid4vciHolderGetMachineInterpreter.bind(this),
2154
+ oid4vciHolderPrepareAuthorizationRequest: this.oid4vciHolderPrepareAuthorizationRequest.bind(this),
2126
2155
  oid4vciHolderCreateCredentialsToSelectFrom: this.oid4vciHolderCreateCredentialsToSelectFrom.bind(this),
2127
2156
  oid4vciHolderGetContact: this.oid4vciHolderGetContact.bind(this),
2128
2157
  oid4vciHolderGetCredentials: this.oid4vciHolderGetCredentials.bind(this),
@@ -2227,6 +2256,7 @@ var OID4VCIHolder = class _OID4VCIHolder {
2227
2256
  stateNavigationListener: opts.firstPartyStateNavigationListener
2228
2257
  }, context),
2229
2258
  [OID4VCIMachineServices.createCredentialsToSelectFrom]: (args) => this.oid4vciHolderCreateCredentialsToSelectFrom(args, context),
2259
+ [OID4VCIMachineServices.prepareAuthorizationRequest]: (args) => this.oid4vciHolderPrepareAuthorizationRequest(args, context),
2230
2260
  [OID4VCIMachineServices.getContact]: (args) => this.oid4vciHolderGetContact(args, context),
2231
2261
  [OID4VCIMachineServices.getCredentials]: (args) => this.oid4vciHolderGetCredentials({
2232
2262
  accessTokenOpts: args.accessTokenOpts ?? opts.accessTokenOpts,
@@ -2275,7 +2305,7 @@ var OID4VCIHolder = class _OID4VCIHolder {
2275
2305
  ...this.defaultAuthorizationRequestOpts,
2276
2306
  ...args.authorizationRequestOpts
2277
2307
  };
2278
- authorizationRequestOpts.authorizationDetails = authorizationRequestOpts?.authorizationDetails ? asArray2(authorizationRequestOpts.authorizationDetails).filter((detail) => typeof detail === "string" || this.vcFormatPreferences.includes(detail.format)) : void 0;
2308
+ authorizationRequestOpts.authorizationDetails = authorizationRequestOpts?.authorizationDetails ? asArray2(authorizationRequestOpts.authorizationDetails) : void 0;
2279
2309
  if (!authorizationRequestOpts.redirectUri) {
2280
2310
  authorizationRequestOpts.redirectUri = _OID4VCIHolder.DEFAULT_MOBILE_REDIRECT_URI;
2281
2311
  }
@@ -2290,7 +2320,7 @@ var OID4VCIHolder = class _OID4VCIHolder {
2290
2320
  let oid4vciClient;
2291
2321
  let offer;
2292
2322
  if (requestData.existingClientState) {
2293
- oid4vciClient = await OpenID4VCIClient2.fromState({
2323
+ oid4vciClient = await OpenID4VCIClientV1_0_15.fromState({
2294
2324
  state: requestData.existingClientState
2295
2325
  });
2296
2326
  offer = oid4vciClient.credentialOffer;
@@ -2307,19 +2337,19 @@ var OID4VCIHolder = class _OID4VCIHolder {
2307
2337
  }
2308
2338
  if (!offer) {
2309
2339
  logger.log(`Issuer url received (no credential offer): ${uri}`);
2310
- oid4vciClient = await OpenID4VCIClient2.fromCredentialIssuer({
2340
+ oid4vciClient = await OpenID4VCIClientV1_0_15.fromCredentialIssuer({
2311
2341
  credentialIssuer: uri,
2312
2342
  authorizationRequest: authorizationRequestOpts,
2313
2343
  clientId: authorizationRequestOpts.clientId,
2314
- createAuthorizationRequestURL: requestData.createAuthorizationRequestURL ?? true
2344
+ createAuthorizationRequestURL: false
2315
2345
  });
2316
2346
  } else {
2317
2347
  logger.log(`Credential offer received: ${uri}`);
2318
- oid4vciClient = await OpenID4VCIClient2.fromURI({
2348
+ oid4vciClient = await OpenID4VCIClientV1_0_15.fromURI({
2319
2349
  uri,
2320
2350
  authorizationRequest: authorizationRequestOpts,
2321
2351
  clientId: authorizationRequestOpts.clientId,
2322
- createAuthorizationRequestURL: requestData.createAuthorizationRequestURL ?? true
2352
+ createAuthorizationRequestURL: false
2323
2353
  });
2324
2354
  }
2325
2355
  }
@@ -2327,7 +2357,7 @@ var OID4VCIHolder = class _OID4VCIHolder {
2327
2357
  if (offer) {
2328
2358
  configurationIds = offer.original_credential_offer.credential_configuration_ids;
2329
2359
  } else {
2330
- configurationIds = asArray2(authorizationRequestOpts.authorizationDetails).filter((authDetails) => typeof authDetails !== "string").map((authReqOpts) => authReqOpts.credential_configuration_id).filter((id) => !!id);
2360
+ configurationIds = asArray2(authorizationRequestOpts.authorizationDetails).map((authReqOpts) => authReqOpts.credential_configuration_id).filter((id) => !!id);
2331
2361
  }
2332
2362
  const credentialsSupported = await getCredentialConfigsSupportedMerged({
2333
2363
  client: oid4vciClient,
@@ -2339,19 +2369,44 @@ var OID4VCIHolder = class _OID4VCIHolder {
2339
2369
  credentialsSupported,
2340
2370
  context
2341
2371
  });
2342
- const authorizationCodeURL = oid4vciClient.authorizationURL;
2343
- if (authorizationCodeURL) {
2344
- logger.log(`authorization code URL ${authorizationCodeURL}`);
2345
- }
2346
2372
  const oid4vciClientState = JSON.parse(await oid4vciClient.exportState());
2347
2373
  return {
2348
- authorizationCodeURL,
2349
2374
  credentialBranding,
2350
2375
  credentialsSupported,
2351
2376
  serverMetadata,
2352
2377
  oid4vciClientState
2353
2378
  };
2354
2379
  }
2380
+ async oid4vciHolderPrepareAuthorizationRequest(args, context) {
2381
+ const { openID4VCIClientState, contact } = args;
2382
+ if (!openID4VCIClientState) {
2383
+ return Promise.reject(Error("Missing openID4VCI client state in context"));
2384
+ }
2385
+ const clientId = contact?.identities.map((identity) => {
2386
+ const connectionConfig = identity.connection?.config;
2387
+ if (connectionConfig && "clientId" in connectionConfig) {
2388
+ return connectionConfig.clientId;
2389
+ }
2390
+ return void 0;
2391
+ }).find((clientId2) => clientId2);
2392
+ if (!clientId) {
2393
+ return Promise.reject(Error(`Missing client id in contact's connectionConfig`));
2394
+ }
2395
+ const client = await OpenID4VCIClient2.fromState({
2396
+ state: openID4VCIClientState
2397
+ });
2398
+ const authorizationCodeURL = await client.createAuthorizationRequestUrl({
2399
+ authorizationRequest: {
2400
+ clientId
2401
+ }
2402
+ });
2403
+ if (authorizationCodeURL) {
2404
+ logger.log(`authorization code URL ${authorizationCodeURL}`);
2405
+ }
2406
+ return {
2407
+ authorizationCodeURL
2408
+ };
2409
+ }
2355
2410
  async oid4vciHolderCreateCredentialsToSelectFrom(args, context) {
2356
2411
  const { credentialBranding, locale, selectedCredentials, credentialsSupported } = args;
2357
2412
  logger.info(`Credentials supported ${Object.keys(credentialsSupported).join(", ")}`);
@@ -2423,7 +2478,7 @@ var OID4VCIHolder = class _OID4VCIHolder {
2423
2478
  if (!openID4VCIClientState) {
2424
2479
  return Promise.reject(Error("Missing openID4VCI client state in context"));
2425
2480
  }
2426
- const client = await OpenID4VCIClient2.fromState({
2481
+ const client = await OpenID4VCIClientV1_0_15.fromState({
2427
2482
  state: openID4VCIClientState
2428
2483
  });
2429
2484
  const credentialsSupported = await getCredentialConfigsSupportedMerged({