@sphereon/ssi-sdk.oid4vci-holder 0.34.1-feature.SSISDK.78.280 → 0.34.1-feature.SSISDK.82.and.SSISDK.70.345
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +34 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +18 -12
- package/dist/index.d.ts +18 -12
- package/dist/index.js +35 -13
- package/dist/index.js.map +1 -1
- package/package.json +24 -24
- package/src/agent/OID4VCIHolder.ts +24 -15
- package/src/link-handler/index.ts +5 -2
- package/src/machines/oid4vciMachine.ts +10 -1
- package/src/services/OID4VCIHolderService.ts +2 -4
- package/src/types/IOID4VCIHolder.ts +16 -11
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';
|
|
@@ -169,6 +169,7 @@ type OnIdentifierCreatedArgs = {
|
|
|
169
169
|
};
|
|
170
170
|
type GetMachineArgs = {
|
|
171
171
|
requestData: RequestData;
|
|
172
|
+
walletType: WalletType;
|
|
172
173
|
trustAnchors?: Array<string>;
|
|
173
174
|
authorizationRequestOpts?: AuthorizationRequestOpts;
|
|
174
175
|
clientOpts?: AuthorizationServerClientOpts;
|
|
@@ -181,7 +182,7 @@ type PrepareStartArgs = Pick<OID4VCIMachineContext, 'requestData' | 'authorizati
|
|
|
181
182
|
type PrepareAuthorizationRequestArgs = Pick<OID4VCIMachineContext, 'openID4VCIClientState' | 'contact'>;
|
|
182
183
|
type CreateCredentialsToSelectFromArgs = Pick<OID4VCIMachineContext, 'credentialsSupported' | 'credentialBranding' | 'selectedCredentials' | 'locale' | 'openID4VCIClientState'>;
|
|
183
184
|
type GetContactArgs = Pick<OID4VCIMachineContext, 'serverMetadata'>;
|
|
184
|
-
type GetCredentialsArgs = Pick<OID4VCIMachineContext, 'verificationCode' | 'openID4VCIClientState' | 'selectedCredentials' | 'didMethodPreferences' | 'issuanceOpt' | 'accessTokenOpts'>;
|
|
185
|
+
type GetCredentialsArgs = Pick<OID4VCIMachineContext, 'verificationCode' | 'openID4VCIClientState' | 'selectedCredentials' | 'didMethodPreferences' | 'issuanceOpt' | 'accessTokenOpts' | 'walletType'>;
|
|
185
186
|
type AddContactIdentityArgs = Pick<OID4VCIMachineContext, 'credentialsToAccept' | 'contact'>;
|
|
186
187
|
type GetIssuerBrandingArgs = Pick<OID4VCIMachineContext, 'serverMetadata' | 'contact'>;
|
|
187
188
|
type StoreIssuerBrandingArgs = Pick<OID4VCIMachineContext, 'issuerBranding' | 'contact'>;
|
|
@@ -244,6 +245,7 @@ type OID4VCIMachineContext = {
|
|
|
244
245
|
openID4VCIClientState?: OpenID4VCIClientState;
|
|
245
246
|
credentialToSelectFrom: Array<CredentialToSelectFromResult>;
|
|
246
247
|
contactAlias: string;
|
|
248
|
+
walletType: WalletType;
|
|
247
249
|
contact?: Party;
|
|
248
250
|
selectedCredentials: Array<string>;
|
|
249
251
|
credentialsToAccept: Array<MappedCredentialToAccept>;
|
|
@@ -306,6 +308,7 @@ type OID4VCIStateMachine = StateMachine<OID4VCIMachineContext, any, OID4VCIMachi
|
|
|
306
308
|
}, BaseActionObject, ServiceMap, ResolveTypegenMeta<TypegenDisabled, OID4VCIMachineEventTypes, BaseActionObject, ServiceMap>>;
|
|
307
309
|
type CreateOID4VCIMachineOpts = {
|
|
308
310
|
requestData: RequestData;
|
|
311
|
+
walletType: WalletType;
|
|
309
312
|
machineName?: string;
|
|
310
313
|
locale?: string;
|
|
311
314
|
trustAnchors?: Array<string>;
|
|
@@ -493,7 +496,7 @@ type CredentialToAccept = {
|
|
|
493
496
|
credentialResponse: CredentialResponseV1_0_15 | CredentialResponse;
|
|
494
497
|
};
|
|
495
498
|
type GetCredentialConfigsSupportedArgs = {
|
|
496
|
-
client:
|
|
499
|
+
client: OpenID4VCIClientV1_0_15;
|
|
497
500
|
vcFormatPreferences: Array<string>;
|
|
498
501
|
format?: Array<string>;
|
|
499
502
|
types?: Array<Array<string>>;
|
|
@@ -504,7 +507,7 @@ type GetCredentialConfigsSupportedArgs = {
|
|
|
504
507
|
* It can potentially return multiple results mainly because of different formats.
|
|
505
508
|
*/
|
|
506
509
|
type GetCredentialConfigsSupportedBySingleTypeOrIdArgs = {
|
|
507
|
-
client:
|
|
510
|
+
client: OpenID4VCIClientV1_0_15;
|
|
508
511
|
vcFormatPreferences: Array<string>;
|
|
509
512
|
format?: string[];
|
|
510
513
|
types?: string[];
|
|
@@ -533,7 +536,7 @@ type GetDefaultIssuanceOptsArgs = {
|
|
|
533
536
|
context: RequiredContext;
|
|
534
537
|
};
|
|
535
538
|
type DefaultIssuanceOpts = {
|
|
536
|
-
client:
|
|
539
|
+
client: OpenID4VCIClientV1_0_15;
|
|
537
540
|
};
|
|
538
541
|
type GetIdentifierArgs = {
|
|
539
542
|
issuanceOpt: IssuanceOpts;
|
|
@@ -563,7 +566,7 @@ type CreateIdentifierCreateOpts = {
|
|
|
563
566
|
options?: IdentifierProviderOpts;
|
|
564
567
|
};
|
|
565
568
|
type GetIssuanceOptsArgs = {
|
|
566
|
-
client:
|
|
569
|
+
client: OpenID4VCIClientV1_0_15;
|
|
567
570
|
credentialsSupported: Record<string, CredentialConfigurationSupported>;
|
|
568
571
|
serverMetadata: EndpointMetadataResult;
|
|
569
572
|
context: RequiredContext;
|
|
@@ -574,19 +577,19 @@ type GetIssuanceOptsArgs = {
|
|
|
574
577
|
};
|
|
575
578
|
type GetIssuanceDidMethodArgs = {
|
|
576
579
|
credentialSupported: CredentialConfigurationSupported;
|
|
577
|
-
client:
|
|
580
|
+
client: OpenID4VCIClientV1_0_15;
|
|
578
581
|
didMethodPreferences: Array<SupportedDidMethodEnum>;
|
|
579
582
|
};
|
|
580
583
|
type GetIssuanceCryptoSuiteArgs = {
|
|
581
584
|
credentialSupported: CredentialConfigurationSupported;
|
|
582
|
-
client:
|
|
585
|
+
client: OpenID4VCIClientV1_0_15;
|
|
583
586
|
jwtCryptographicSuitePreferences: Array<JoseSignatureAlgorithm | JoseSignatureAlgorithmString>;
|
|
584
587
|
jsonldCryptographicSuitePreferences: Array<string>;
|
|
585
588
|
};
|
|
586
589
|
type GetCredentialArgs = {
|
|
587
590
|
pin?: string;
|
|
588
591
|
issuanceOpt: IssuanceOpts;
|
|
589
|
-
client:
|
|
592
|
+
client: OpenID4VCIClientV1_0_15;
|
|
590
593
|
accessTokenOpts?: AccessTokenOpts;
|
|
591
594
|
};
|
|
592
595
|
type AccessTokenOpts = {
|
|
@@ -668,6 +671,7 @@ type SdJwtCombineDisplayLocalesFromArgs = {
|
|
|
668
671
|
claimsMetadata?: Map<string, Array<IBasicCredentialClaim>>;
|
|
669
672
|
};
|
|
670
673
|
type DynamicRegistrationClientMetadataDisplay = Pick<DynamicRegistrationClientMetadata, 'client_name' | 'client_uri' | 'contacts' | 'tos_uri' | 'policy_uri' | 'logo_uri'>;
|
|
674
|
+
type WalletType = 'NATURAL_PERSON' | 'ORGANIZATIONAL';
|
|
671
675
|
type DidAgents = TAgent<IResolver & IDIDManager>;
|
|
672
676
|
type RequiredContext = IAgentContext<IIssuanceBranding & IContactManager & ICredentialValidation & ICredentialVerifier & ICredentialIssuer & ICredentialStore & IIdentifierResolution & IJwtService & IDIDManager & IResolver & IKeyManager & ISDJwtPlugin & ImDLMdoc & IDidAuthSiopOpAuthenticator>;
|
|
673
677
|
|
|
@@ -709,6 +713,7 @@ declare class OID4VCIHolder implements IAgentPlugin {
|
|
|
709
713
|
private oid4vciHolderCreateCredentialsToSelectFrom;
|
|
710
714
|
private oid4vciHolderGetContact;
|
|
711
715
|
private oid4vciHolderGetCredentials;
|
|
716
|
+
private selectDidMethodPreferences;
|
|
712
717
|
private oid4vciHolderGetCredential;
|
|
713
718
|
private oid4vciHolderAddContactIdentity;
|
|
714
719
|
private oid4vciHolderGetIssuerBranding;
|
|
@@ -775,10 +780,11 @@ declare class OID4VCIHolderLinkHandler extends LinkHandlerAdapter {
|
|
|
775
780
|
private readonly stateNavigationListener?;
|
|
776
781
|
private readonly firstPartyStateNavigationListener?;
|
|
777
782
|
private readonly noStateMachinePersistence;
|
|
783
|
+
private readonly walletType;
|
|
778
784
|
private readonly authorizationRequestOpts?;
|
|
779
785
|
private readonly clientOpts?;
|
|
780
786
|
private readonly trustAnchors?;
|
|
781
|
-
constructor(args: Pick<GetMachineArgs, 'stateNavigationListener' | 'authorizationRequestOpts' | 'clientOpts' | 'trustAnchors' | 'firstPartyStateNavigationListener'> & {
|
|
787
|
+
constructor(args: Pick<GetMachineArgs, 'stateNavigationListener' | 'authorizationRequestOpts' | 'clientOpts' | 'trustAnchors' | 'firstPartyStateNavigationListener' | 'walletType'> & {
|
|
782
788
|
priority?: number | DefaultLinkPriorities;
|
|
783
789
|
protocols?: Array<string | RegExp>;
|
|
784
790
|
noStateMachinePersistence?: boolean;
|
|
@@ -793,4 +799,4 @@ declare class OID4VCIHolderLinkHandler extends LinkHandlerAdapter {
|
|
|
793
799
|
}): Promise<void>;
|
|
794
800
|
}
|
|
795
801
|
|
|
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 };
|
|
802
|
+
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, type WalletType, 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';
|
|
@@ -169,6 +169,7 @@ type OnIdentifierCreatedArgs = {
|
|
|
169
169
|
};
|
|
170
170
|
type GetMachineArgs = {
|
|
171
171
|
requestData: RequestData;
|
|
172
|
+
walletType: WalletType;
|
|
172
173
|
trustAnchors?: Array<string>;
|
|
173
174
|
authorizationRequestOpts?: AuthorizationRequestOpts;
|
|
174
175
|
clientOpts?: AuthorizationServerClientOpts;
|
|
@@ -181,7 +182,7 @@ type PrepareStartArgs = Pick<OID4VCIMachineContext, 'requestData' | 'authorizati
|
|
|
181
182
|
type PrepareAuthorizationRequestArgs = Pick<OID4VCIMachineContext, 'openID4VCIClientState' | 'contact'>;
|
|
182
183
|
type CreateCredentialsToSelectFromArgs = Pick<OID4VCIMachineContext, 'credentialsSupported' | 'credentialBranding' | 'selectedCredentials' | 'locale' | 'openID4VCIClientState'>;
|
|
183
184
|
type GetContactArgs = Pick<OID4VCIMachineContext, 'serverMetadata'>;
|
|
184
|
-
type GetCredentialsArgs = Pick<OID4VCIMachineContext, 'verificationCode' | 'openID4VCIClientState' | 'selectedCredentials' | 'didMethodPreferences' | 'issuanceOpt' | 'accessTokenOpts'>;
|
|
185
|
+
type GetCredentialsArgs = Pick<OID4VCIMachineContext, 'verificationCode' | 'openID4VCIClientState' | 'selectedCredentials' | 'didMethodPreferences' | 'issuanceOpt' | 'accessTokenOpts' | 'walletType'>;
|
|
185
186
|
type AddContactIdentityArgs = Pick<OID4VCIMachineContext, 'credentialsToAccept' | 'contact'>;
|
|
186
187
|
type GetIssuerBrandingArgs = Pick<OID4VCIMachineContext, 'serverMetadata' | 'contact'>;
|
|
187
188
|
type StoreIssuerBrandingArgs = Pick<OID4VCIMachineContext, 'issuerBranding' | 'contact'>;
|
|
@@ -244,6 +245,7 @@ type OID4VCIMachineContext = {
|
|
|
244
245
|
openID4VCIClientState?: OpenID4VCIClientState;
|
|
245
246
|
credentialToSelectFrom: Array<CredentialToSelectFromResult>;
|
|
246
247
|
contactAlias: string;
|
|
248
|
+
walletType: WalletType;
|
|
247
249
|
contact?: Party;
|
|
248
250
|
selectedCredentials: Array<string>;
|
|
249
251
|
credentialsToAccept: Array<MappedCredentialToAccept>;
|
|
@@ -306,6 +308,7 @@ type OID4VCIStateMachine = StateMachine<OID4VCIMachineContext, any, OID4VCIMachi
|
|
|
306
308
|
}, BaseActionObject, ServiceMap, ResolveTypegenMeta<TypegenDisabled, OID4VCIMachineEventTypes, BaseActionObject, ServiceMap>>;
|
|
307
309
|
type CreateOID4VCIMachineOpts = {
|
|
308
310
|
requestData: RequestData;
|
|
311
|
+
walletType: WalletType;
|
|
309
312
|
machineName?: string;
|
|
310
313
|
locale?: string;
|
|
311
314
|
trustAnchors?: Array<string>;
|
|
@@ -493,7 +496,7 @@ type CredentialToAccept = {
|
|
|
493
496
|
credentialResponse: CredentialResponseV1_0_15 | CredentialResponse;
|
|
494
497
|
};
|
|
495
498
|
type GetCredentialConfigsSupportedArgs = {
|
|
496
|
-
client:
|
|
499
|
+
client: OpenID4VCIClientV1_0_15;
|
|
497
500
|
vcFormatPreferences: Array<string>;
|
|
498
501
|
format?: Array<string>;
|
|
499
502
|
types?: Array<Array<string>>;
|
|
@@ -504,7 +507,7 @@ type GetCredentialConfigsSupportedArgs = {
|
|
|
504
507
|
* It can potentially return multiple results mainly because of different formats.
|
|
505
508
|
*/
|
|
506
509
|
type GetCredentialConfigsSupportedBySingleTypeOrIdArgs = {
|
|
507
|
-
client:
|
|
510
|
+
client: OpenID4VCIClientV1_0_15;
|
|
508
511
|
vcFormatPreferences: Array<string>;
|
|
509
512
|
format?: string[];
|
|
510
513
|
types?: string[];
|
|
@@ -533,7 +536,7 @@ type GetDefaultIssuanceOptsArgs = {
|
|
|
533
536
|
context: RequiredContext;
|
|
534
537
|
};
|
|
535
538
|
type DefaultIssuanceOpts = {
|
|
536
|
-
client:
|
|
539
|
+
client: OpenID4VCIClientV1_0_15;
|
|
537
540
|
};
|
|
538
541
|
type GetIdentifierArgs = {
|
|
539
542
|
issuanceOpt: IssuanceOpts;
|
|
@@ -563,7 +566,7 @@ type CreateIdentifierCreateOpts = {
|
|
|
563
566
|
options?: IdentifierProviderOpts;
|
|
564
567
|
};
|
|
565
568
|
type GetIssuanceOptsArgs = {
|
|
566
|
-
client:
|
|
569
|
+
client: OpenID4VCIClientV1_0_15;
|
|
567
570
|
credentialsSupported: Record<string, CredentialConfigurationSupported>;
|
|
568
571
|
serverMetadata: EndpointMetadataResult;
|
|
569
572
|
context: RequiredContext;
|
|
@@ -574,19 +577,19 @@ type GetIssuanceOptsArgs = {
|
|
|
574
577
|
};
|
|
575
578
|
type GetIssuanceDidMethodArgs = {
|
|
576
579
|
credentialSupported: CredentialConfigurationSupported;
|
|
577
|
-
client:
|
|
580
|
+
client: OpenID4VCIClientV1_0_15;
|
|
578
581
|
didMethodPreferences: Array<SupportedDidMethodEnum>;
|
|
579
582
|
};
|
|
580
583
|
type GetIssuanceCryptoSuiteArgs = {
|
|
581
584
|
credentialSupported: CredentialConfigurationSupported;
|
|
582
|
-
client:
|
|
585
|
+
client: OpenID4VCIClientV1_0_15;
|
|
583
586
|
jwtCryptographicSuitePreferences: Array<JoseSignatureAlgorithm | JoseSignatureAlgorithmString>;
|
|
584
587
|
jsonldCryptographicSuitePreferences: Array<string>;
|
|
585
588
|
};
|
|
586
589
|
type GetCredentialArgs = {
|
|
587
590
|
pin?: string;
|
|
588
591
|
issuanceOpt: IssuanceOpts;
|
|
589
|
-
client:
|
|
592
|
+
client: OpenID4VCIClientV1_0_15;
|
|
590
593
|
accessTokenOpts?: AccessTokenOpts;
|
|
591
594
|
};
|
|
592
595
|
type AccessTokenOpts = {
|
|
@@ -668,6 +671,7 @@ type SdJwtCombineDisplayLocalesFromArgs = {
|
|
|
668
671
|
claimsMetadata?: Map<string, Array<IBasicCredentialClaim>>;
|
|
669
672
|
};
|
|
670
673
|
type DynamicRegistrationClientMetadataDisplay = Pick<DynamicRegistrationClientMetadata, 'client_name' | 'client_uri' | 'contacts' | 'tos_uri' | 'policy_uri' | 'logo_uri'>;
|
|
674
|
+
type WalletType = 'NATURAL_PERSON' | 'ORGANIZATIONAL';
|
|
671
675
|
type DidAgents = TAgent<IResolver & IDIDManager>;
|
|
672
676
|
type RequiredContext = IAgentContext<IIssuanceBranding & IContactManager & ICredentialValidation & ICredentialVerifier & ICredentialIssuer & ICredentialStore & IIdentifierResolution & IJwtService & IDIDManager & IResolver & IKeyManager & ISDJwtPlugin & ImDLMdoc & IDidAuthSiopOpAuthenticator>;
|
|
673
677
|
|
|
@@ -709,6 +713,7 @@ declare class OID4VCIHolder implements IAgentPlugin {
|
|
|
709
713
|
private oid4vciHolderCreateCredentialsToSelectFrom;
|
|
710
714
|
private oid4vciHolderGetContact;
|
|
711
715
|
private oid4vciHolderGetCredentials;
|
|
716
|
+
private selectDidMethodPreferences;
|
|
712
717
|
private oid4vciHolderGetCredential;
|
|
713
718
|
private oid4vciHolderAddContactIdentity;
|
|
714
719
|
private oid4vciHolderGetIssuerBranding;
|
|
@@ -775,10 +780,11 @@ declare class OID4VCIHolderLinkHandler extends LinkHandlerAdapter {
|
|
|
775
780
|
private readonly stateNavigationListener?;
|
|
776
781
|
private readonly firstPartyStateNavigationListener?;
|
|
777
782
|
private readonly noStateMachinePersistence;
|
|
783
|
+
private readonly walletType;
|
|
778
784
|
private readonly authorizationRequestOpts?;
|
|
779
785
|
private readonly clientOpts?;
|
|
780
786
|
private readonly trustAnchors?;
|
|
781
|
-
constructor(args: Pick<GetMachineArgs, 'stateNavigationListener' | 'authorizationRequestOpts' | 'clientOpts' | 'trustAnchors' | 'firstPartyStateNavigationListener'> & {
|
|
787
|
+
constructor(args: Pick<GetMachineArgs, 'stateNavigationListener' | 'authorizationRequestOpts' | 'clientOpts' | 'trustAnchors' | 'firstPartyStateNavigationListener' | 'walletType'> & {
|
|
782
788
|
priority?: number | DefaultLinkPriorities;
|
|
783
789
|
protocols?: Array<string | RegExp>;
|
|
784
790
|
noStateMachinePersistence?: boolean;
|
|
@@ -793,4 +799,4 @@ declare class OID4VCIHolderLinkHandler extends LinkHandlerAdapter {
|
|
|
793
799
|
}): Promise<void>;
|
|
794
800
|
}
|
|
795
801
|
|
|
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 };
|
|
802
|
+
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, type WalletType, 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,7 +55,7 @@ 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";
|
|
@@ -311,7 +311,7 @@ var oid4vciRequireAuthorizationGuard = /* @__PURE__ */ __name((ctx, _event) => {
|
|
|
311
311
|
if (!openID4VCIClientState) {
|
|
312
312
|
throw Error("Missing openID4VCI client state in context");
|
|
313
313
|
}
|
|
314
|
-
if (openID4VCIClientState.authorizationRequestOpts) {
|
|
314
|
+
if (openID4VCIClientState.authorizationURL && openID4VCIClientState.authorizationRequestOpts) {
|
|
315
315
|
return !ctx.openID4VCIClientState?.authorizationCodeResponse;
|
|
316
316
|
} else if (openID4VCIClientState.credentialOffer?.supportedFlows?.includes(AuthzFlowType.AUTHORIZATION_CODE_FLOW)) {
|
|
317
317
|
return !ctx.openID4VCIClientState?.authorizationCodeResponse;
|
|
@@ -333,6 +333,7 @@ var createOID4VCIMachine = /* @__PURE__ */ __name((opts) => {
|
|
|
333
333
|
// TODO WAL-671 we need to store the data from OpenIdProvider here in the context and make sure we can restart the machine with it and init the OpenIdProvider
|
|
334
334
|
accessTokenOpts: opts?.accessTokenOpts,
|
|
335
335
|
requestData: opts?.requestData,
|
|
336
|
+
walletType: opts?.walletType ?? "NATURAL_PERSON",
|
|
336
337
|
trustAnchors: opts?.trustAnchors ?? [],
|
|
337
338
|
issuanceOpt: opts?.issuanceOpt,
|
|
338
339
|
didMethodPreferences: opts?.didMethodPreferences,
|
|
@@ -598,6 +599,10 @@ var createOID4VCIMachine = /* @__PURE__ */ __name((opts) => {
|
|
|
598
599
|
target: OID4VCIMachineStates.startFirstPartApplicationFlow,
|
|
599
600
|
cond: OID4VCIMachineGuards.isFirstPartyApplication
|
|
600
601
|
},
|
|
602
|
+
{
|
|
603
|
+
target: OID4VCIMachineStates.prepareAuthorizationRequest,
|
|
604
|
+
cond: OID4VCIMachineGuards.requireAuthorizationGuard
|
|
605
|
+
},
|
|
601
606
|
{
|
|
602
607
|
target: OID4VCIMachineStates.initiateAuthorizationRequest,
|
|
603
608
|
cond: OID4VCIMachineGuards.requireAuthorizationGuard
|
|
@@ -673,6 +678,10 @@ var createOID4VCIMachine = /* @__PURE__ */ __name((opts) => {
|
|
|
673
678
|
target: OID4VCIMachineStates.startFirstPartApplicationFlow,
|
|
674
679
|
cond: OID4VCIMachineGuards.isFirstPartyApplication
|
|
675
680
|
},
|
|
681
|
+
{
|
|
682
|
+
target: OID4VCIMachineStates.prepareAuthorizationRequest,
|
|
683
|
+
cond: OID4VCIMachineGuards.requireAuthorizationGuard
|
|
684
|
+
},
|
|
676
685
|
{
|
|
677
686
|
target: OID4VCIMachineStates.verifyPin,
|
|
678
687
|
cond: OID4VCIMachineGuards.requirePinGuard
|
|
@@ -1686,7 +1695,7 @@ var mapCredentialToAccept = /* @__PURE__ */ __name(async (args) => {
|
|
|
1686
1695
|
});
|
|
1687
1696
|
let uniformVerifiableCredential;
|
|
1688
1697
|
if (CredentialMapper.isSdJwtDecodedCredential(wrappedVerifiableCredential.credential)) {
|
|
1689
|
-
uniformVerifiableCredential =
|
|
1698
|
+
uniformVerifiableCredential = sdJwtDecodedCredentialToUniformCredential(wrappedVerifiableCredential.credential);
|
|
1690
1699
|
} else if (CredentialMapper.isSdJwtEncoded(wrappedVerifiableCredential.credential)) {
|
|
1691
1700
|
if (!hasher) {
|
|
1692
1701
|
return Promise.reject("a hasher is required for encoded SD-JWT credentials");
|
|
@@ -1832,7 +1841,7 @@ var getCredentialConfigsSupportedBySingleTypeOrId = /* @__PURE__ */ __name(async
|
|
|
1832
1841
|
}
|
|
1833
1842
|
__name(createIdFromTypes, "createIdFromTypes");
|
|
1834
1843
|
if (configurationId) {
|
|
1835
|
-
const allSupported2 = client.getCredentialsSupported(format);
|
|
1844
|
+
const allSupported2 = client.getCredentialsSupported(void 0, format);
|
|
1836
1845
|
return Object.fromEntries(Object.entries(allSupported2).filter(([id, supported]) => id === configurationId || supported.id === configurationId || createIdFromTypes(supported) === configurationId));
|
|
1837
1846
|
}
|
|
1838
1847
|
if (!client.credentialOffer) {
|
|
@@ -2297,7 +2306,7 @@ var OID4VCIHolder = class _OID4VCIHolder {
|
|
|
2297
2306
|
...this.defaultAuthorizationRequestOpts,
|
|
2298
2307
|
...args.authorizationRequestOpts
|
|
2299
2308
|
};
|
|
2300
|
-
authorizationRequestOpts.authorizationDetails = authorizationRequestOpts?.authorizationDetails ? asArray2(authorizationRequestOpts.authorizationDetails)
|
|
2309
|
+
authorizationRequestOpts.authorizationDetails = authorizationRequestOpts?.authorizationDetails ? asArray2(authorizationRequestOpts.authorizationDetails) : void 0;
|
|
2301
2310
|
if (!authorizationRequestOpts.redirectUri) {
|
|
2302
2311
|
authorizationRequestOpts.redirectUri = _OID4VCIHolder.DEFAULT_MOBILE_REDIRECT_URI;
|
|
2303
2312
|
}
|
|
@@ -2312,7 +2321,7 @@ var OID4VCIHolder = class _OID4VCIHolder {
|
|
|
2312
2321
|
let oid4vciClient;
|
|
2313
2322
|
let offer;
|
|
2314
2323
|
if (requestData.existingClientState) {
|
|
2315
|
-
oid4vciClient = await
|
|
2324
|
+
oid4vciClient = await OpenID4VCIClientV1_0_15.fromState({
|
|
2316
2325
|
state: requestData.existingClientState
|
|
2317
2326
|
});
|
|
2318
2327
|
offer = oid4vciClient.credentialOffer;
|
|
@@ -2329,7 +2338,7 @@ var OID4VCIHolder = class _OID4VCIHolder {
|
|
|
2329
2338
|
}
|
|
2330
2339
|
if (!offer) {
|
|
2331
2340
|
logger.log(`Issuer url received (no credential offer): ${uri}`);
|
|
2332
|
-
oid4vciClient = await
|
|
2341
|
+
oid4vciClient = await OpenID4VCIClientV1_0_15.fromCredentialIssuer({
|
|
2333
2342
|
credentialIssuer: uri,
|
|
2334
2343
|
authorizationRequest: authorizationRequestOpts,
|
|
2335
2344
|
clientId: authorizationRequestOpts.clientId,
|
|
@@ -2337,7 +2346,7 @@ var OID4VCIHolder = class _OID4VCIHolder {
|
|
|
2337
2346
|
});
|
|
2338
2347
|
} else {
|
|
2339
2348
|
logger.log(`Credential offer received: ${uri}`);
|
|
2340
|
-
oid4vciClient = await
|
|
2349
|
+
oid4vciClient = await OpenID4VCIClientV1_0_15.fromURI({
|
|
2341
2350
|
uri,
|
|
2342
2351
|
authorizationRequest: authorizationRequestOpts,
|
|
2343
2352
|
clientId: authorizationRequestOpts.clientId,
|
|
@@ -2349,7 +2358,7 @@ var OID4VCIHolder = class _OID4VCIHolder {
|
|
|
2349
2358
|
if (offer) {
|
|
2350
2359
|
configurationIds = offer.original_credential_offer.credential_configuration_ids;
|
|
2351
2360
|
} else {
|
|
2352
|
-
configurationIds = asArray2(authorizationRequestOpts.authorizationDetails).
|
|
2361
|
+
configurationIds = asArray2(authorizationRequestOpts.authorizationDetails).map((authReqOpts) => authReqOpts.credential_configuration_id).filter((id) => !!id);
|
|
2353
2362
|
}
|
|
2354
2363
|
const credentialsSupported = await getCredentialConfigsSupportedMerged({
|
|
2355
2364
|
client: oid4vciClient,
|
|
@@ -2465,12 +2474,12 @@ var OID4VCIHolder = class _OID4VCIHolder {
|
|
|
2465
2474
|
return party;
|
|
2466
2475
|
}
|
|
2467
2476
|
async oid4vciHolderGetCredentials(args, context) {
|
|
2468
|
-
const { verificationCode, openID4VCIClientState, didMethodPreferences
|
|
2477
|
+
const { verificationCode, openID4VCIClientState, didMethodPreferences, issuanceOpt, accessTokenOpts, walletType } = args;
|
|
2469
2478
|
logger.debug(`Getting credentials`, issuanceOpt, accessTokenOpts);
|
|
2470
2479
|
if (!openID4VCIClientState) {
|
|
2471
2480
|
return Promise.reject(Error("Missing openID4VCI client state in context"));
|
|
2472
2481
|
}
|
|
2473
|
-
const client = await
|
|
2482
|
+
const client = await OpenID4VCIClientV1_0_15.fromState({
|
|
2474
2483
|
state: openID4VCIClientState
|
|
2475
2484
|
});
|
|
2476
2485
|
const credentialsSupported = await getCredentialConfigsSupportedMerged({
|
|
@@ -2484,7 +2493,7 @@ var OID4VCIHolder = class _OID4VCIHolder {
|
|
|
2484
2493
|
credentialsSupported,
|
|
2485
2494
|
serverMetadata,
|
|
2486
2495
|
context,
|
|
2487
|
-
didMethodPreferences:
|
|
2496
|
+
didMethodPreferences: this.selectDidMethodPreferences(didMethodPreferences, walletType),
|
|
2488
2497
|
jwtCryptographicSuitePreferences: this.jwtCryptographicSuitePreferences,
|
|
2489
2498
|
jsonldCryptographicSuitePreferences: this.jsonldCryptographicSuitePreferences,
|
|
2490
2499
|
...issuanceOpt && {
|
|
@@ -2501,6 +2510,16 @@ var OID4VCIHolder = class _OID4VCIHolder {
|
|
|
2501
2510
|
logger.log(`Credentials received`, allCredentials);
|
|
2502
2511
|
return allCredentials;
|
|
2503
2512
|
}
|
|
2513
|
+
selectDidMethodPreferences(didMethodPreferences, walletType) {
|
|
2514
|
+
const supportedDidMethodEnums = Array.isArray(didMethodPreferences) && didMethodPreferences.length > 0 ? didMethodPreferences : this.didMethodPreferences;
|
|
2515
|
+
if (walletType === "ORGANIZATIONAL") {
|
|
2516
|
+
return [
|
|
2517
|
+
SupportedDidMethodEnum2.DID_WEB,
|
|
2518
|
+
...supportedDidMethodEnums
|
|
2519
|
+
];
|
|
2520
|
+
}
|
|
2521
|
+
return supportedDidMethodEnums;
|
|
2522
|
+
}
|
|
2504
2523
|
async oid4vciHolderGetCredential(args, context) {
|
|
2505
2524
|
const { issuanceOpt, pin, client, accessTokenOpts } = args;
|
|
2506
2525
|
logger.info(`Getting credential`, issuanceOpt);
|
|
@@ -3052,6 +3071,7 @@ var OID4VCIHolderLinkHandler = class extends LinkHandlerAdapter {
|
|
|
3052
3071
|
stateNavigationListener;
|
|
3053
3072
|
firstPartyStateNavigationListener;
|
|
3054
3073
|
noStateMachinePersistence;
|
|
3074
|
+
walletType;
|
|
3055
3075
|
authorizationRequestOpts;
|
|
3056
3076
|
clientOpts;
|
|
3057
3077
|
trustAnchors;
|
|
@@ -3063,6 +3083,7 @@ var OID4VCIHolderLinkHandler = class extends LinkHandlerAdapter {
|
|
|
3063
3083
|
this.authorizationRequestOpts = args.authorizationRequestOpts;
|
|
3064
3084
|
this.clientOpts = args.clientOpts;
|
|
3065
3085
|
this.context = args.context;
|
|
3086
|
+
this.walletType = args.walletType ?? "NATURAL_PERSON";
|
|
3066
3087
|
this.noStateMachinePersistence = args.noStateMachinePersistence === true;
|
|
3067
3088
|
this.stateNavigationListener = args.stateNavigationListener;
|
|
3068
3089
|
this.firstPartyStateNavigationListener = args.firstPartyStateNavigationListener;
|
|
@@ -3099,7 +3120,8 @@ var OID4VCIHolderLinkHandler = class extends LinkHandlerAdapter {
|
|
|
3099
3120
|
clientOpts
|
|
3100
3121
|
},
|
|
3101
3122
|
stateNavigationListener: this.stateNavigationListener,
|
|
3102
|
-
firstPartyStateNavigationListener: this.firstPartyStateNavigationListener
|
|
3123
|
+
firstPartyStateNavigationListener: this.firstPartyStateNavigationListener,
|
|
3124
|
+
walletType: this.walletType
|
|
3103
3125
|
});
|
|
3104
3126
|
const interpreter = oid4vciMachine.interpreter;
|
|
3105
3127
|
if (!opts?.machineState && this.context.agent.availableMethods().includes("machineStatesFindActive")) {
|