@sphereon/ssi-sdk.oid4vci-holder 0.36.1-next.11 → 0.36.1-next.113
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 +35 -17
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +12 -3
- package/dist/index.d.ts +12 -3
- package/dist/index.js +35 -17
- package/dist/index.js.map +1 -1
- package/package.json +23 -23
- package/src/agent/OID4VCIHolder.ts +19 -5
- package/src/link-handler/index.ts +5 -2
- package/src/machines/oid4vciMachine.ts +2 -9
- package/src/services/OID4VCIHolderService.ts +8 -2
- package/src/types/IOID4VCIHolder.ts +8 -1
package/dist/index.d.cts
CHANGED
|
@@ -151,6 +151,7 @@ type OID4VCIHolderOptions = {
|
|
|
151
151
|
didMethodPreferences?: Array<SupportedDidMethodEnum>;
|
|
152
152
|
jwtCryptographicSuitePreferences?: Array<JoseSignatureAlgorithm | JoseSignatureAlgorithmString>;
|
|
153
153
|
hasher?: HasherSync;
|
|
154
|
+
defaultHolderIdentifier?: string;
|
|
154
155
|
};
|
|
155
156
|
type OnContactIdentityCreatedArgs = {
|
|
156
157
|
contactId: string;
|
|
@@ -169,6 +170,7 @@ type OnIdentifierCreatedArgs = {
|
|
|
169
170
|
};
|
|
170
171
|
type GetMachineArgs = {
|
|
171
172
|
requestData: RequestData;
|
|
173
|
+
walletType: WalletType;
|
|
172
174
|
trustAnchors?: Array<string>;
|
|
173
175
|
authorizationRequestOpts?: AuthorizationRequestOpts;
|
|
174
176
|
clientOpts?: AuthorizationServerClientOpts;
|
|
@@ -181,7 +183,7 @@ type PrepareStartArgs = Pick<OID4VCIMachineContext, 'requestData' | 'authorizati
|
|
|
181
183
|
type PrepareAuthorizationRequestArgs = Pick<OID4VCIMachineContext, 'openID4VCIClientState' | 'contact'>;
|
|
182
184
|
type CreateCredentialsToSelectFromArgs = Pick<OID4VCIMachineContext, 'credentialsSupported' | 'credentialBranding' | 'selectedCredentials' | 'locale' | 'openID4VCIClientState'>;
|
|
183
185
|
type GetContactArgs = Pick<OID4VCIMachineContext, 'serverMetadata'>;
|
|
184
|
-
type GetCredentialsArgs = Pick<OID4VCIMachineContext, 'verificationCode' | 'openID4VCIClientState' | 'selectedCredentials' | 'didMethodPreferences' | 'issuanceOpt' | 'accessTokenOpts'>;
|
|
186
|
+
type GetCredentialsArgs = Pick<OID4VCIMachineContext, 'verificationCode' | 'openID4VCIClientState' | 'selectedCredentials' | 'didMethodPreferences' | 'issuanceOpt' | 'accessTokenOpts' | 'walletType'>;
|
|
185
187
|
type AddContactIdentityArgs = Pick<OID4VCIMachineContext, 'credentialsToAccept' | 'contact'>;
|
|
186
188
|
type GetIssuerBrandingArgs = Pick<OID4VCIMachineContext, 'serverMetadata' | 'contact'>;
|
|
187
189
|
type StoreIssuerBrandingArgs = Pick<OID4VCIMachineContext, 'issuerBranding' | 'contact'>;
|
|
@@ -244,6 +246,7 @@ type OID4VCIMachineContext = {
|
|
|
244
246
|
openID4VCIClientState?: OpenID4VCIClientState;
|
|
245
247
|
credentialToSelectFrom: Array<CredentialToSelectFromResult>;
|
|
246
248
|
contactAlias: string;
|
|
249
|
+
walletType: WalletType;
|
|
247
250
|
contact?: Party;
|
|
248
251
|
selectedCredentials: Array<string>;
|
|
249
252
|
credentialsToAccept: Array<MappedCredentialToAccept>;
|
|
@@ -306,6 +309,7 @@ type OID4VCIStateMachine = StateMachine<OID4VCIMachineContext, any, OID4VCIMachi
|
|
|
306
309
|
}, BaseActionObject, ServiceMap, ResolveTypegenMeta<TypegenDisabled, OID4VCIMachineEventTypes, BaseActionObject, ServiceMap>>;
|
|
307
310
|
type CreateOID4VCIMachineOpts = {
|
|
308
311
|
requestData: RequestData;
|
|
312
|
+
walletType: WalletType;
|
|
309
313
|
machineName?: string;
|
|
310
314
|
locale?: string;
|
|
311
315
|
trustAnchors?: Array<string>;
|
|
@@ -539,6 +543,7 @@ type DefaultIssuanceOpts = {
|
|
|
539
543
|
type GetIdentifierArgs = {
|
|
540
544
|
issuanceOpt: IssuanceOpts;
|
|
541
545
|
context: RequiredContext;
|
|
546
|
+
defaultHolderIdentifier?: string;
|
|
542
547
|
};
|
|
543
548
|
type GetAuthenticationKeyArgs = {
|
|
544
549
|
identifier: ManagedIdentifierOptsOrResult;
|
|
@@ -669,6 +674,7 @@ type SdJwtCombineDisplayLocalesFromArgs = {
|
|
|
669
674
|
claimsMetadata?: Map<string, Array<IBasicCredentialClaim>>;
|
|
670
675
|
};
|
|
671
676
|
type DynamicRegistrationClientMetadataDisplay = Pick<DynamicRegistrationClientMetadata, 'client_name' | 'client_uri' | 'contacts' | 'tos_uri' | 'policy_uri' | 'logo_uri'>;
|
|
677
|
+
type WalletType = 'NATURAL_PERSON' | 'ORGANIZATIONAL';
|
|
672
678
|
type DidAgents = TAgent<IResolver & IDIDManager>;
|
|
673
679
|
type RequiredContext = IAgentContext<IIssuanceBranding & IContactManager & ICredentialValidation & ICredentialVerifier & ICredentialIssuer & ICredentialStore & IIdentifierResolution & IJwtService & IDIDManager & IResolver & IKeyManager & ISDJwtPlugin & ImDLMdoc & IDidAuthSiopOpAuthenticator>;
|
|
674
680
|
|
|
@@ -679,6 +685,7 @@ declare const oid4vciHolderContextMethods: Array<string>;
|
|
|
679
685
|
declare function signCallback(identifier: ManagedIdentifierOptsOrResult, context: IAgentContext<IKeyManager & IDIDManager & IResolver & IIdentifierResolution & IJwtService>, nonce?: string): (jwt: Jwt, kid?: string, noIssPayloadUpdate?: boolean) => Promise<string>;
|
|
680
686
|
declare class OID4VCIHolder implements IAgentPlugin {
|
|
681
687
|
private readonly hasher?;
|
|
688
|
+
private readonly defaultHolderIdentifier?;
|
|
682
689
|
readonly eventTypes: Array<OID4VCIHolderEvent>;
|
|
683
690
|
readonly methods: IOID4VCIHolder;
|
|
684
691
|
private readonly vcFormatPreferences;
|
|
@@ -710,6 +717,7 @@ declare class OID4VCIHolder implements IAgentPlugin {
|
|
|
710
717
|
private oid4vciHolderCreateCredentialsToSelectFrom;
|
|
711
718
|
private oid4vciHolderGetContact;
|
|
712
719
|
private oid4vciHolderGetCredentials;
|
|
720
|
+
private selectDidMethodPreferences;
|
|
713
721
|
private oid4vciHolderGetCredential;
|
|
714
722
|
private oid4vciHolderAddContactIdentity;
|
|
715
723
|
private oid4vciHolderGetIssuerBranding;
|
|
@@ -776,10 +784,11 @@ declare class OID4VCIHolderLinkHandler extends LinkHandlerAdapter {
|
|
|
776
784
|
private readonly stateNavigationListener?;
|
|
777
785
|
private readonly firstPartyStateNavigationListener?;
|
|
778
786
|
private readonly noStateMachinePersistence;
|
|
787
|
+
private readonly walletType;
|
|
779
788
|
private readonly authorizationRequestOpts?;
|
|
780
789
|
private readonly clientOpts?;
|
|
781
790
|
private readonly trustAnchors?;
|
|
782
|
-
constructor(args: Pick<GetMachineArgs, 'stateNavigationListener' | 'authorizationRequestOpts' | 'clientOpts' | 'trustAnchors' | 'firstPartyStateNavigationListener'> & {
|
|
791
|
+
constructor(args: Pick<GetMachineArgs, 'stateNavigationListener' | 'authorizationRequestOpts' | 'clientOpts' | 'trustAnchors' | 'firstPartyStateNavigationListener' | 'walletType'> & {
|
|
783
792
|
priority?: number | DefaultLinkPriorities;
|
|
784
793
|
protocols?: Array<string | RegExp>;
|
|
785
794
|
noStateMachinePersistence?: boolean;
|
|
@@ -794,4 +803,4 @@ declare class OID4VCIHolderLinkHandler extends LinkHandlerAdapter {
|
|
|
794
803
|
}): Promise<void>;
|
|
795
804
|
}
|
|
796
805
|
|
|
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 };
|
|
806
|
+
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
|
@@ -151,6 +151,7 @@ type OID4VCIHolderOptions = {
|
|
|
151
151
|
didMethodPreferences?: Array<SupportedDidMethodEnum>;
|
|
152
152
|
jwtCryptographicSuitePreferences?: Array<JoseSignatureAlgorithm | JoseSignatureAlgorithmString>;
|
|
153
153
|
hasher?: HasherSync;
|
|
154
|
+
defaultHolderIdentifier?: string;
|
|
154
155
|
};
|
|
155
156
|
type OnContactIdentityCreatedArgs = {
|
|
156
157
|
contactId: string;
|
|
@@ -169,6 +170,7 @@ type OnIdentifierCreatedArgs = {
|
|
|
169
170
|
};
|
|
170
171
|
type GetMachineArgs = {
|
|
171
172
|
requestData: RequestData;
|
|
173
|
+
walletType: WalletType;
|
|
172
174
|
trustAnchors?: Array<string>;
|
|
173
175
|
authorizationRequestOpts?: AuthorizationRequestOpts;
|
|
174
176
|
clientOpts?: AuthorizationServerClientOpts;
|
|
@@ -181,7 +183,7 @@ type PrepareStartArgs = Pick<OID4VCIMachineContext, 'requestData' | 'authorizati
|
|
|
181
183
|
type PrepareAuthorizationRequestArgs = Pick<OID4VCIMachineContext, 'openID4VCIClientState' | 'contact'>;
|
|
182
184
|
type CreateCredentialsToSelectFromArgs = Pick<OID4VCIMachineContext, 'credentialsSupported' | 'credentialBranding' | 'selectedCredentials' | 'locale' | 'openID4VCIClientState'>;
|
|
183
185
|
type GetContactArgs = Pick<OID4VCIMachineContext, 'serverMetadata'>;
|
|
184
|
-
type GetCredentialsArgs = Pick<OID4VCIMachineContext, 'verificationCode' | 'openID4VCIClientState' | 'selectedCredentials' | 'didMethodPreferences' | 'issuanceOpt' | 'accessTokenOpts'>;
|
|
186
|
+
type GetCredentialsArgs = Pick<OID4VCIMachineContext, 'verificationCode' | 'openID4VCIClientState' | 'selectedCredentials' | 'didMethodPreferences' | 'issuanceOpt' | 'accessTokenOpts' | 'walletType'>;
|
|
185
187
|
type AddContactIdentityArgs = Pick<OID4VCIMachineContext, 'credentialsToAccept' | 'contact'>;
|
|
186
188
|
type GetIssuerBrandingArgs = Pick<OID4VCIMachineContext, 'serverMetadata' | 'contact'>;
|
|
187
189
|
type StoreIssuerBrandingArgs = Pick<OID4VCIMachineContext, 'issuerBranding' | 'contact'>;
|
|
@@ -244,6 +246,7 @@ type OID4VCIMachineContext = {
|
|
|
244
246
|
openID4VCIClientState?: OpenID4VCIClientState;
|
|
245
247
|
credentialToSelectFrom: Array<CredentialToSelectFromResult>;
|
|
246
248
|
contactAlias: string;
|
|
249
|
+
walletType: WalletType;
|
|
247
250
|
contact?: Party;
|
|
248
251
|
selectedCredentials: Array<string>;
|
|
249
252
|
credentialsToAccept: Array<MappedCredentialToAccept>;
|
|
@@ -306,6 +309,7 @@ type OID4VCIStateMachine = StateMachine<OID4VCIMachineContext, any, OID4VCIMachi
|
|
|
306
309
|
}, BaseActionObject, ServiceMap, ResolveTypegenMeta<TypegenDisabled, OID4VCIMachineEventTypes, BaseActionObject, ServiceMap>>;
|
|
307
310
|
type CreateOID4VCIMachineOpts = {
|
|
308
311
|
requestData: RequestData;
|
|
312
|
+
walletType: WalletType;
|
|
309
313
|
machineName?: string;
|
|
310
314
|
locale?: string;
|
|
311
315
|
trustAnchors?: Array<string>;
|
|
@@ -539,6 +543,7 @@ type DefaultIssuanceOpts = {
|
|
|
539
543
|
type GetIdentifierArgs = {
|
|
540
544
|
issuanceOpt: IssuanceOpts;
|
|
541
545
|
context: RequiredContext;
|
|
546
|
+
defaultHolderIdentifier?: string;
|
|
542
547
|
};
|
|
543
548
|
type GetAuthenticationKeyArgs = {
|
|
544
549
|
identifier: ManagedIdentifierOptsOrResult;
|
|
@@ -669,6 +674,7 @@ type SdJwtCombineDisplayLocalesFromArgs = {
|
|
|
669
674
|
claimsMetadata?: Map<string, Array<IBasicCredentialClaim>>;
|
|
670
675
|
};
|
|
671
676
|
type DynamicRegistrationClientMetadataDisplay = Pick<DynamicRegistrationClientMetadata, 'client_name' | 'client_uri' | 'contacts' | 'tos_uri' | 'policy_uri' | 'logo_uri'>;
|
|
677
|
+
type WalletType = 'NATURAL_PERSON' | 'ORGANIZATIONAL';
|
|
672
678
|
type DidAgents = TAgent<IResolver & IDIDManager>;
|
|
673
679
|
type RequiredContext = IAgentContext<IIssuanceBranding & IContactManager & ICredentialValidation & ICredentialVerifier & ICredentialIssuer & ICredentialStore & IIdentifierResolution & IJwtService & IDIDManager & IResolver & IKeyManager & ISDJwtPlugin & ImDLMdoc & IDidAuthSiopOpAuthenticator>;
|
|
674
680
|
|
|
@@ -679,6 +685,7 @@ declare const oid4vciHolderContextMethods: Array<string>;
|
|
|
679
685
|
declare function signCallback(identifier: ManagedIdentifierOptsOrResult, context: IAgentContext<IKeyManager & IDIDManager & IResolver & IIdentifierResolution & IJwtService>, nonce?: string): (jwt: Jwt, kid?: string, noIssPayloadUpdate?: boolean) => Promise<string>;
|
|
680
686
|
declare class OID4VCIHolder implements IAgentPlugin {
|
|
681
687
|
private readonly hasher?;
|
|
688
|
+
private readonly defaultHolderIdentifier?;
|
|
682
689
|
readonly eventTypes: Array<OID4VCIHolderEvent>;
|
|
683
690
|
readonly methods: IOID4VCIHolder;
|
|
684
691
|
private readonly vcFormatPreferences;
|
|
@@ -710,6 +717,7 @@ declare class OID4VCIHolder implements IAgentPlugin {
|
|
|
710
717
|
private oid4vciHolderCreateCredentialsToSelectFrom;
|
|
711
718
|
private oid4vciHolderGetContact;
|
|
712
719
|
private oid4vciHolderGetCredentials;
|
|
720
|
+
private selectDidMethodPreferences;
|
|
713
721
|
private oid4vciHolderGetCredential;
|
|
714
722
|
private oid4vciHolderAddContactIdentity;
|
|
715
723
|
private oid4vciHolderGetIssuerBranding;
|
|
@@ -776,10 +784,11 @@ declare class OID4VCIHolderLinkHandler extends LinkHandlerAdapter {
|
|
|
776
784
|
private readonly stateNavigationListener?;
|
|
777
785
|
private readonly firstPartyStateNavigationListener?;
|
|
778
786
|
private readonly noStateMachinePersistence;
|
|
787
|
+
private readonly walletType;
|
|
779
788
|
private readonly authorizationRequestOpts?;
|
|
780
789
|
private readonly clientOpts?;
|
|
781
790
|
private readonly trustAnchors?;
|
|
782
|
-
constructor(args: Pick<GetMachineArgs, 'stateNavigationListener' | 'authorizationRequestOpts' | 'clientOpts' | 'trustAnchors' | 'firstPartyStateNavigationListener'> & {
|
|
791
|
+
constructor(args: Pick<GetMachineArgs, 'stateNavigationListener' | 'authorizationRequestOpts' | 'clientOpts' | 'trustAnchors' | 'firstPartyStateNavigationListener' | 'walletType'> & {
|
|
783
792
|
priority?: number | DefaultLinkPriorities;
|
|
784
793
|
protocols?: Array<string | RegExp>;
|
|
785
794
|
noStateMachinePersistence?: boolean;
|
|
@@ -794,4 +803,4 @@ declare class OID4VCIHolderLinkHandler extends LinkHandlerAdapter {
|
|
|
794
803
|
}): Promise<void>;
|
|
795
804
|
}
|
|
796
805
|
|
|
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 };
|
|
806
|
+
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
|
@@ -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,
|
|
@@ -497,7 +498,7 @@ var createOID4VCIMachine = /* @__PURE__ */ __name((opts) => {
|
|
|
497
498
|
cond: OID4VCIMachineGuards.isFirstPartyApplication
|
|
498
499
|
},
|
|
499
500
|
{
|
|
500
|
-
target: OID4VCIMachineStates.
|
|
501
|
+
target: OID4VCIMachineStates.prepareAuthorizationRequest,
|
|
501
502
|
cond: OID4VCIMachineGuards.requireAuthorizationGuard
|
|
502
503
|
},
|
|
503
504
|
{
|
|
@@ -602,10 +603,6 @@ var createOID4VCIMachine = /* @__PURE__ */ __name((opts) => {
|
|
|
602
603
|
target: OID4VCIMachineStates.prepareAuthorizationRequest,
|
|
603
604
|
cond: OID4VCIMachineGuards.requireAuthorizationGuard
|
|
604
605
|
},
|
|
605
|
-
{
|
|
606
|
-
target: OID4VCIMachineStates.initiateAuthorizationRequest,
|
|
607
|
-
cond: OID4VCIMachineGuards.requireAuthorizationGuard
|
|
608
|
-
},
|
|
609
606
|
{
|
|
610
607
|
target: OID4VCIMachineStates.verifyPin,
|
|
611
608
|
cond: OID4VCIMachineGuards.requirePinGuard
|
|
@@ -685,10 +682,6 @@ var createOID4VCIMachine = /* @__PURE__ */ __name((opts) => {
|
|
|
685
682
|
target: OID4VCIMachineStates.verifyPin,
|
|
686
683
|
cond: OID4VCIMachineGuards.requirePinGuard
|
|
687
684
|
},
|
|
688
|
-
{
|
|
689
|
-
target: OID4VCIMachineStates.prepareAuthorizationRequest,
|
|
690
|
-
cond: OID4VCIMachineGuards.requireAuthorizationGuard
|
|
691
|
-
},
|
|
692
685
|
{
|
|
693
686
|
target: OID4VCIMachineStates.getCredentials
|
|
694
687
|
}
|
|
@@ -1734,7 +1727,7 @@ var extractCredentialFromResponse = /* @__PURE__ */ __name((credentialResponse)
|
|
|
1734
1727
|
return credential;
|
|
1735
1728
|
}, "extractCredentialFromResponse");
|
|
1736
1729
|
var getIdentifierOpts = /* @__PURE__ */ __name(async (args) => {
|
|
1737
|
-
const { issuanceOpt, context } = args;
|
|
1730
|
+
const { issuanceOpt, context, defaultHolderIdentifier } = args;
|
|
1738
1731
|
const { identifier: identifierArg } = issuanceOpt;
|
|
1739
1732
|
if (identifierArg && isManagedIdentifierResult(identifierArg)) {
|
|
1740
1733
|
return identifierArg;
|
|
@@ -1757,6 +1750,11 @@ var getIdentifierOpts = /* @__PURE__ */ __name(async (args) => {
|
|
|
1757
1750
|
agent: context.agent
|
|
1758
1751
|
};
|
|
1759
1752
|
if ((!identifierArg || isIIdentifier(identifierArg.identifier)) && supportedPreferredDidMethod && (!supportedBindingMethods || supportedBindingMethods.length === 0 || supportedBindingMethods.filter((method) => method.startsWith("did")))) {
|
|
1753
|
+
const identifierFilter = defaultHolderIdentifier ? defaultHolderIdentifier.startsWith("did:") ? {
|
|
1754
|
+
did: defaultHolderIdentifier
|
|
1755
|
+
} : {
|
|
1756
|
+
alias: defaultHolderIdentifier
|
|
1757
|
+
} : {};
|
|
1760
1758
|
const { result, created } = await getOrCreatePrimaryIdentifier(agentContext, {
|
|
1761
1759
|
method: supportedPreferredDidMethod,
|
|
1762
1760
|
createOpts: {
|
|
@@ -1764,7 +1762,8 @@ var getIdentifierOpts = /* @__PURE__ */ __name(async (args) => {
|
|
|
1764
1762
|
type: issuanceOpt.keyType,
|
|
1765
1763
|
use: KeyUse.Signature,
|
|
1766
1764
|
codecName: issuanceOpt.codecName,
|
|
1767
|
-
kms: issuanceOpt.kms
|
|
1765
|
+
kms: issuanceOpt.kms,
|
|
1766
|
+
...identifierFilter
|
|
1768
1767
|
}
|
|
1769
1768
|
}
|
|
1770
1769
|
});
|
|
@@ -2143,6 +2142,7 @@ var OID4VCIHolder = class _OID4VCIHolder {
|
|
|
2143
2142
|
__name(this, "OID4VCIHolder");
|
|
2144
2143
|
}
|
|
2145
2144
|
hasher;
|
|
2145
|
+
defaultHolderIdentifier;
|
|
2146
2146
|
eventTypes = [
|
|
2147
2147
|
OID4VCIHolderEvent.CONTACT_IDENTITY_CREATED,
|
|
2148
2148
|
OID4VCIHolderEvent.CREDENTIAL_STORED,
|
|
@@ -2200,10 +2200,11 @@ var OID4VCIHolder = class _OID4VCIHolder {
|
|
|
2200
2200
|
onIdentifierCreated;
|
|
2201
2201
|
onVerifyEBSICredentialIssuer;
|
|
2202
2202
|
constructor(options) {
|
|
2203
|
-
const { onContactIdentityCreated, onCredentialStored, onIdentifierCreated, onVerifyEBSICredentialIssuer, vcFormatPreferences, jsonldCryptographicSuitePreferences, didMethodPreferences, jwtCryptographicSuitePreferences, defaultAuthorizationRequestOptions, hasher = defaultHasher2 } = {
|
|
2203
|
+
const { onContactIdentityCreated, onCredentialStored, onIdentifierCreated, onVerifyEBSICredentialIssuer, vcFormatPreferences, jsonldCryptographicSuitePreferences, didMethodPreferences, jwtCryptographicSuitePreferences, defaultAuthorizationRequestOptions, hasher = defaultHasher2, defaultHolderIdentifier } = {
|
|
2204
2204
|
...options
|
|
2205
2205
|
};
|
|
2206
2206
|
this.hasher = hasher;
|
|
2207
|
+
this.defaultHolderIdentifier = defaultHolderIdentifier;
|
|
2207
2208
|
if (vcFormatPreferences !== void 0 && vcFormatPreferences.length > 0) {
|
|
2208
2209
|
this.vcFormatPreferences = vcFormatPreferences;
|
|
2209
2210
|
}
|
|
@@ -2393,7 +2394,7 @@ var OID4VCIHolder = class _OID4VCIHolder {
|
|
|
2393
2394
|
if (!clientId) {
|
|
2394
2395
|
return Promise.reject(Error(`Missing client id in contact's connectionConfig`));
|
|
2395
2396
|
}
|
|
2396
|
-
const client = await
|
|
2397
|
+
const client = await OpenID4VCIClientV1_0_15.fromState({
|
|
2397
2398
|
state: openID4VCIClientState
|
|
2398
2399
|
});
|
|
2399
2400
|
const authorizationCodeURL = await client.createAuthorizationRequestUrl({
|
|
@@ -2476,7 +2477,7 @@ var OID4VCIHolder = class _OID4VCIHolder {
|
|
|
2476
2477
|
return party;
|
|
2477
2478
|
}
|
|
2478
2479
|
async oid4vciHolderGetCredentials(args, context) {
|
|
2479
|
-
const { verificationCode, openID4VCIClientState, didMethodPreferences
|
|
2480
|
+
const { verificationCode, openID4VCIClientState, didMethodPreferences, issuanceOpt, accessTokenOpts, walletType } = args;
|
|
2480
2481
|
logger.debug(`Getting credentials`, issuanceOpt, accessTokenOpts);
|
|
2481
2482
|
if (!openID4VCIClientState) {
|
|
2482
2483
|
return Promise.reject(Error("Missing openID4VCI client state in context"));
|
|
@@ -2495,7 +2496,7 @@ var OID4VCIHolder = class _OID4VCIHolder {
|
|
|
2495
2496
|
credentialsSupported,
|
|
2496
2497
|
serverMetadata,
|
|
2497
2498
|
context,
|
|
2498
|
-
didMethodPreferences:
|
|
2499
|
+
didMethodPreferences: this.selectDidMethodPreferences(didMethodPreferences, walletType),
|
|
2499
2500
|
jwtCryptographicSuitePreferences: this.jwtCryptographicSuitePreferences,
|
|
2500
2501
|
jsonldCryptographicSuitePreferences: this.jsonldCryptographicSuitePreferences,
|
|
2501
2502
|
...issuanceOpt && {
|
|
@@ -2512,6 +2513,16 @@ var OID4VCIHolder = class _OID4VCIHolder {
|
|
|
2512
2513
|
logger.log(`Credentials received`, allCredentials);
|
|
2513
2514
|
return allCredentials;
|
|
2514
2515
|
}
|
|
2516
|
+
selectDidMethodPreferences(didMethodPreferences, walletType) {
|
|
2517
|
+
const supportedDidMethodEnums = Array.isArray(didMethodPreferences) && didMethodPreferences.length > 0 ? didMethodPreferences : this.didMethodPreferences;
|
|
2518
|
+
if (walletType === "ORGANIZATIONAL") {
|
|
2519
|
+
return [
|
|
2520
|
+
SupportedDidMethodEnum2.DID_WEB,
|
|
2521
|
+
...supportedDidMethodEnums
|
|
2522
|
+
];
|
|
2523
|
+
}
|
|
2524
|
+
return supportedDidMethodEnums;
|
|
2525
|
+
}
|
|
2515
2526
|
async oid4vciHolderGetCredential(args, context) {
|
|
2516
2527
|
const { issuanceOpt, pin, client, accessTokenOpts } = args;
|
|
2517
2528
|
logger.info(`Getting credential`, issuanceOpt);
|
|
@@ -2520,7 +2531,8 @@ var OID4VCIHolder = class _OID4VCIHolder {
|
|
|
2520
2531
|
}
|
|
2521
2532
|
const identifier = await getIdentifierOpts({
|
|
2522
2533
|
issuanceOpt,
|
|
2523
|
-
context
|
|
2534
|
+
context,
|
|
2535
|
+
defaultHolderIdentifier: this.defaultHolderIdentifier
|
|
2524
2536
|
});
|
|
2525
2537
|
issuanceOpt.identifier = identifier;
|
|
2526
2538
|
logger.info(`ID opts`, identifier);
|
|
@@ -2579,6 +2591,9 @@ var OID4VCIHolder = class _OID4VCIHolder {
|
|
|
2579
2591
|
format: issuanceOpt.format,
|
|
2580
2592
|
// TODO: We need to update the machine and add notifications support for actual deferred credentials instead of just waiting/retrying
|
|
2581
2593
|
deferredCredentialAwait: true,
|
|
2594
|
+
...issuanceOpt.id && typeof issuanceOpt.id === "string" ? {
|
|
2595
|
+
credentialConfigurationId: issuanceOpt.id
|
|
2596
|
+
} : void 0,
|
|
2582
2597
|
...!jwk && {
|
|
2583
2598
|
kid
|
|
2584
2599
|
},
|
|
@@ -3063,6 +3078,7 @@ var OID4VCIHolderLinkHandler = class extends LinkHandlerAdapter {
|
|
|
3063
3078
|
stateNavigationListener;
|
|
3064
3079
|
firstPartyStateNavigationListener;
|
|
3065
3080
|
noStateMachinePersistence;
|
|
3081
|
+
walletType;
|
|
3066
3082
|
authorizationRequestOpts;
|
|
3067
3083
|
clientOpts;
|
|
3068
3084
|
trustAnchors;
|
|
@@ -3074,6 +3090,7 @@ var OID4VCIHolderLinkHandler = class extends LinkHandlerAdapter {
|
|
|
3074
3090
|
this.authorizationRequestOpts = args.authorizationRequestOpts;
|
|
3075
3091
|
this.clientOpts = args.clientOpts;
|
|
3076
3092
|
this.context = args.context;
|
|
3093
|
+
this.walletType = args.walletType ?? "NATURAL_PERSON";
|
|
3077
3094
|
this.noStateMachinePersistence = args.noStateMachinePersistence === true;
|
|
3078
3095
|
this.stateNavigationListener = args.stateNavigationListener;
|
|
3079
3096
|
this.firstPartyStateNavigationListener = args.firstPartyStateNavigationListener;
|
|
@@ -3110,7 +3127,8 @@ var OID4VCIHolderLinkHandler = class extends LinkHandlerAdapter {
|
|
|
3110
3127
|
clientOpts
|
|
3111
3128
|
},
|
|
3112
3129
|
stateNavigationListener: this.stateNavigationListener,
|
|
3113
|
-
firstPartyStateNavigationListener: this.firstPartyStateNavigationListener
|
|
3130
|
+
firstPartyStateNavigationListener: this.firstPartyStateNavigationListener,
|
|
3131
|
+
walletType: this.walletType
|
|
3114
3132
|
});
|
|
3115
3133
|
const interpreter = oid4vciMachine.interpreter;
|
|
3116
3134
|
if (!opts?.machineState && this.context.agent.availableMethods().includes("machineStatesFindActive")) {
|