@sphereon/ssi-sdk.oid4vci-holder 0.34.1-next.88 → 0.36.0

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;
@@ -735,6 +743,7 @@ declare const getCredentialConfigsBasedOnFormatPref: (args: GetPreferredCredenti
735
743
  declare const selectCredentialLocaleBranding: (args: SelectAppLocaleBrandingArgs) => Promise<IBasicCredentialLocaleBranding | IBasicIssuerLocaleBranding | undefined>;
736
744
  declare const verifyCredentialToAccept: (args: VerifyCredentialToAcceptArgs) => Promise<VerificationResult>;
737
745
  declare const mapCredentialToAccept: (args: MapCredentialToAcceptArgs) => Promise<MappedCredentialToAccept>;
746
+ declare const extractCredentialFromResponse: (credentialResponse: CredentialResponse) => OriginalVerifiableCredential;
738
747
  declare const getIdentifierOpts: (args: GetIdentifierArgs) => Promise<ManagedIdentifierResult>;
739
748
  declare const getCredentialConfigsSupportedMerged: (args: GetCredentialConfigsSupportedArgs) => Promise<Record<string, CredentialConfigurationSupported>>;
740
749
  declare const getCredentialConfigsSupported: (args: GetCredentialConfigsSupportedArgs) => Promise<Array<Record<string, CredentialConfigurationSupported>>>;
@@ -785,4 +794,4 @@ declare class OID4VCIHolderLinkHandler extends LinkHandlerAdapter {
785
794
  }): Promise<void>;
786
795
  }
787
796
 
788
- 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, 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;
@@ -735,6 +743,7 @@ declare const getCredentialConfigsBasedOnFormatPref: (args: GetPreferredCredenti
735
743
  declare const selectCredentialLocaleBranding: (args: SelectAppLocaleBrandingArgs) => Promise<IBasicCredentialLocaleBranding | IBasicIssuerLocaleBranding | undefined>;
736
744
  declare const verifyCredentialToAccept: (args: VerifyCredentialToAcceptArgs) => Promise<VerificationResult>;
737
745
  declare const mapCredentialToAccept: (args: MapCredentialToAcceptArgs) => Promise<MappedCredentialToAccept>;
746
+ declare const extractCredentialFromResponse: (credentialResponse: CredentialResponse) => OriginalVerifiableCredential;
738
747
  declare const getIdentifierOpts: (args: GetIdentifierArgs) => Promise<ManagedIdentifierResult>;
739
748
  declare const getCredentialConfigsSupportedMerged: (args: GetCredentialConfigsSupportedArgs) => Promise<Record<string, CredentialConfigurationSupported>>;
740
749
  declare const getCredentialConfigsSupported: (args: GetCredentialConfigsSupportedArgs) => Promise<Array<Record<string, CredentialConfigurationSupported>>>;
@@ -785,4 +794,4 @@ declare class OID4VCIHolderLinkHandler extends LinkHandlerAdapter {
785
794
  }): Promise<void>;
786
795
  }
787
796
 
788
- 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, 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 };