@sphereon/ssi-sdk.oid4vci-holder 0.34.1-feature.SSISDK.65.redirect.fix.258 → 0.34.1-feature.SSISDK.70.integrate.digidentity.306
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 +86 -31
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +9 -2
- package/dist/index.d.ts +9 -2
- package/dist/index.js +70 -15
- package/dist/index.js.map +1 -1
- package/package.json +24 -24
- package/src/agent/OID4VCIHolder.ts +44 -8
- package/src/machines/oid4vciMachine.ts +37 -5
- package/src/services/OID4VCIHolderService.ts +1 -3
- package/src/types/IOID4VCIHolder.ts +8 -1
package/dist/index.d.cts
CHANGED
|
@@ -129,6 +129,7 @@ interface IOID4VCIHolder extends IPluginMethodMap {
|
|
|
129
129
|
oid4vciHolderGetMachineInterpreter(args: GetMachineArgs, context: RequiredContext): Promise<OID4VCIMachine>;
|
|
130
130
|
oid4vciHolderStart(args: PrepareStartArgs, context: RequiredContext): Promise<StartResult>;
|
|
131
131
|
oid4vciHolderCreateCredentialsToSelectFrom(args: CreateCredentialsToSelectFromArgs, context: RequiredContext): Promise<Array<CredentialToSelectFromResult>>;
|
|
132
|
+
oid4vciHolderPrepareAuthorizationRequest(args: PrepareAuthorizationRequestArgs, context: RequiredContext): Promise<PrepareAuthorizationResult>;
|
|
132
133
|
oid4vciHolderGetContact(args: GetContactArgs, context: RequiredContext): Promise<Party | undefined>;
|
|
133
134
|
oid4vciHolderGetCredentials(args: GetCredentialsArgs, context: RequiredContext): Promise<Array<MappedCredentialToAccept>>;
|
|
134
135
|
oid4vciHolderGetCredential(args: GetCredentialArgs, context: RequiredContext): Promise<MappedCredentialToAccept>;
|
|
@@ -177,6 +178,7 @@ type GetMachineArgs = {
|
|
|
177
178
|
firstPartyStateNavigationListener?: FirstPartyMachineStateNavigationListener;
|
|
178
179
|
};
|
|
179
180
|
type PrepareStartArgs = Pick<OID4VCIMachineContext, 'requestData' | 'authorizationRequestOpts' | 'didMethodPreferences' | 'issuanceOpt' | 'accessTokenOpts'>;
|
|
181
|
+
type PrepareAuthorizationRequestArgs = Pick<OID4VCIMachineContext, 'openID4VCIClientState' | 'contact'>;
|
|
180
182
|
type CreateCredentialsToSelectFromArgs = Pick<OID4VCIMachineContext, 'credentialsSupported' | 'credentialBranding' | 'selectedCredentials' | 'locale' | 'openID4VCIClientState'>;
|
|
181
183
|
type GetContactArgs = Pick<OID4VCIMachineContext, 'serverMetadata'>;
|
|
182
184
|
type GetCredentialsArgs = Pick<OID4VCIMachineContext, 'verificationCode' | 'openID4VCIClientState' | 'selectedCredentials' | 'didMethodPreferences' | 'issuanceOpt' | 'accessTokenOpts'>;
|
|
@@ -266,6 +268,7 @@ declare enum OID4VCIMachineStates {
|
|
|
266
268
|
selectCredentials = "selectCredentials",
|
|
267
269
|
transitionFromSelectingCredentials = "transitionFromSelectingCredentials",
|
|
268
270
|
verifyPin = "verifyPin",
|
|
271
|
+
prepareAuthorizationRequest = "prepareAuthorizationRequest",
|
|
269
272
|
initiateAuthorizationRequest = "initiateAuthorizationRequest",
|
|
270
273
|
waitForAuthorizationResponse = "waitForAuthorizationResponse",
|
|
271
274
|
getCredentials = "getCredentials",
|
|
@@ -373,6 +376,7 @@ declare enum OID4VCIMachineServices {
|
|
|
373
376
|
getFederationTrust = "getFederationTrust",
|
|
374
377
|
addContactIdentity = "addContactIdentity",
|
|
375
378
|
createCredentialsToSelectFrom = "createCredentialsToSelectFrom",
|
|
379
|
+
prepareAuthorizationRequest = "prepareAuthorizationRequest",
|
|
376
380
|
getIssuerBranding = "getIssuerBranding",
|
|
377
381
|
storeIssuerBranding = "storeIssuerBranding",
|
|
378
382
|
getCredentials = "getCredentials",
|
|
@@ -448,12 +452,14 @@ type OID4VCIMachine = {
|
|
|
448
452
|
interpreter: OID4VCIMachineInterpreter;
|
|
449
453
|
};
|
|
450
454
|
type StartResult = {
|
|
451
|
-
authorizationCodeURL?: string;
|
|
452
455
|
credentialBranding?: Record<string, Array<IBasicCredentialLocaleBranding>>;
|
|
453
456
|
credentialsSupported: Record<string, CredentialConfigurationSupported>;
|
|
454
457
|
serverMetadata: EndpointMetadataResult;
|
|
455
458
|
oid4vciClientState: OpenID4VCIClientState;
|
|
456
459
|
};
|
|
460
|
+
type PrepareAuthorizationResult = {
|
|
461
|
+
authorizationCodeURL?: string;
|
|
462
|
+
};
|
|
457
463
|
type SelectAppLocaleBrandingArgs = {
|
|
458
464
|
locale?: string;
|
|
459
465
|
localeBranding?: Array<IBasicCredentialLocaleBranding | IBasicIssuerLocaleBranding>;
|
|
@@ -699,6 +705,7 @@ declare class OID4VCIHolder implements IAgentPlugin {
|
|
|
699
705
|
* @private
|
|
700
706
|
*/
|
|
701
707
|
private oid4vciHolderStart;
|
|
708
|
+
private oid4vciHolderPrepareAuthorizationRequest;
|
|
702
709
|
private oid4vciHolderCreateCredentialsToSelectFrom;
|
|
703
710
|
private oid4vciHolderGetContact;
|
|
704
711
|
private oid4vciHolderGetCredentials;
|
|
@@ -786,4 +793,4 @@ declare class OID4VCIHolderLinkHandler extends LinkHandlerAdapter {
|
|
|
786
793
|
}): Promise<void>;
|
|
787
794
|
}
|
|
788
795
|
|
|
789
|
-
export { type AccessTokenOpts, type AddContactIdentityArgs, type AssertValidCredentialsArgs, type Attribute, type AuthorizationResponseEvent, type ContactAliasEvent, type ContactConsentEvent, type CreateConfigArgs, type CreateContactEvent, type CreateCredentialsToSelectFromArgs, type CreateFirstPartyMachineOpts, type CreateIdentifierArgs, type CreateIdentifierCreateOpts, type CreateIdentifierOpts, type CreateOID4VCIMachineOpts, type CredentialToAccept, type CredentialToSelectFromResult, type CredentialVerificationError, type DeclineEvent, type DefaultIssuanceOpts, type DidAgents, type DynamicRegistrationClientMetadataDisplay, type ErrorDetails, type FirstPartyDeclineEvent, type FirstPartyMachineContext, type FirstPartyMachineEventTypes, FirstPartyMachineEvents, type FirstPartyMachineInterpreter, type FirstPartyMachineNavigationArgs, type FirstPartyMachineServiceDefinitions, FirstPartyMachineServices, type FirstPartyMachineState, type FirstPartyMachineStateNavigationListener, FirstPartyMachineStateTypes, type FirstPartyMachineStates, type FirstPartyMachineStatesConfig, type FirstPartyNextEvent, type FirstPartyPreviousEvent, type FirstPartySelectCredentialsEvent, type FirstPartyStateMachine, type GetAuthenticationKeyArgs, type GetBasicIssuerLocaleBrandingArgs, type GetContactArgs, type GetCredentialArgs, type GetCredentialBrandingArgs, type GetCredentialConfigsSupportedArgs, type GetCredentialConfigsSupportedBySingleTypeOrIdArgs, type GetCredentialsArgs, type GetDefaultIssuanceOptsArgs, type GetFederationTrustArgs, type GetIdentifierArgs, type GetIssuanceCryptoSuiteArgs, type GetIssuanceDidMethodArgs, type GetIssuanceOptsArgs, type GetIssuerBrandingArgs, type GetIssuerMetadataArgs, type GetMachineArgs, type GetOrCreatePrimaryIdentifierArgs, type GetPreferredCredentialFormatsArgs, type GetSiopRequestArgs, type IOID4VCIHolder, IdentifierAliasEnum, type InstanceFirstPartyMachineOpts, type InvokeAuthorizationRequestEvent, type IssuanceOpts, type IssuerLocaleBrandingFromArgs, type IssuerType, type MapCredentialToAcceptArgs, type MappedCredentialToAccept, type NextEvent, OID4VCICallbackStateListener, type OID4VCIContext, OID4VCIHolder, OID4VCIHolderEvent, OID4VCIHolderLinkHandler, type OID4VCIHolderOptions, type OID4VCIMachine, OID4VCIMachineAddContactStates, type OID4VCIMachineContext, type OID4VCIMachineEventTypes, OID4VCIMachineEvents, OID4VCIMachineGuards, type OID4VCIMachineInstanceOpts, type OID4VCIMachineInterpreter, type OID4VCIMachineNavigationArgs, type OID4VCIMachineServiceDefinitions, OID4VCIMachineServices, type OID4VCIMachineState, type OID4VCIMachineStateNavigationListener, OID4VCIMachineStates, OID4VCIMachineVerifyPinStates, type OID4VCIProviderProps, type OID4VCIStateMachine, type Oid4vciCombineDisplayLocalesFromArgs, type Oid4vciCredentialDisplayLocalesFromArgs, type Oid4vciCredentialLocaleBrandingFromArgs, type Oid4vciGetCredentialBrandingFromArgs, type Oid4vciIssuerCredentialSubjectLocalesFromArgs, type OnContactIdentityCreatedArgs, type OnCredentialStoredArgs, type OnIdentifierCreatedArgs, type PrepareStartArgs, type PreviousEvent, type RequestData, RequestType, type RequiredContext, type SdJwtCombineDisplayLocalesFromArgs, type SdJwtCredentialClaimLocalesFromArgs, type SdJwtCredentialDisplayLocalesFromArgs, type SdJwtCredentialLocaleBrandingFromArgs, type SdJwtGetCredentialBrandingFromArgs, type SelectAppLocaleBrandingArgs, type SelectCredentialsEvent, type SendAuthorizationChallengeRequestArgs, type SendAuthorizationResponseArgs, type SendNotificationArgs, type SetAuthorizationCodeURLEvent, type SiopV2AuthorizationRequestData, type StartFirstPartApplicationMachine, type StartResult, type StoreCredentialBrandingArgs, type StoreCredentialsArgs, type StoreIssuerBrandingArgs, SupportedLanguage, type VerificationCodeEvent, type VerificationResult, type VerificationSubResult, type VerifyCredentialArgs, type VerifyCredentialToAcceptArgs, type VerifyEBSICredentialIssuerArgs, type VerifyEBSICredentialIssuerResult, type VerifyMdocArgs, type VerifySDJWTCredentialArgs, createConfig, extractCredentialFromResponse, getBasicIssuerLocaleBranding, getCredentialBranding, getCredentialConfigsBasedOnFormatPref, getCredentialConfigsSupported, getCredentialConfigsSupportedBySingleTypeOrId, getCredentialConfigsSupportedMerged, getIdentifierOpts, getIssuanceCryptoSuite, getIssuanceMethod, getIssuanceOpts, getSiopRequest, issuerLocaleBrandingFrom, mapCredentialToAccept, oid4vciCombineDisplayLocalesFrom, oid4vciCredentialDisplayLocalesFrom, oid4vciCredentialLocaleBrandingFrom, oid4vciGetCredentialBrandingFrom, oid4vciHolderContextMethods, oid4vciIssuerCredentialSubjectLocalesFrom, sdJwtCombineDisplayLocalesFrom, sdJwtCredentialClaimLocalesFrom, sdJwtCredentialDisplayLocalesFrom, sdJwtCredentialLocaleBrandingFrom, sdJwtGetCredentialBrandingFrom, selectCredentialLocaleBranding, sendAuthorizationChallengeRequest, sendAuthorizationResponse, signCallback, startFirstPartApplicationMachine, verifyCredentialToAccept };
|
|
796
|
+
export { type AccessTokenOpts, type AddContactIdentityArgs, type AssertValidCredentialsArgs, type Attribute, type AuthorizationResponseEvent, type ContactAliasEvent, type ContactConsentEvent, type CreateConfigArgs, type CreateContactEvent, type CreateCredentialsToSelectFromArgs, type CreateFirstPartyMachineOpts, type CreateIdentifierArgs, type CreateIdentifierCreateOpts, type CreateIdentifierOpts, type CreateOID4VCIMachineOpts, type CredentialToAccept, type CredentialToSelectFromResult, type CredentialVerificationError, type DeclineEvent, type DefaultIssuanceOpts, type DidAgents, type DynamicRegistrationClientMetadataDisplay, type ErrorDetails, type FirstPartyDeclineEvent, type FirstPartyMachineContext, type FirstPartyMachineEventTypes, FirstPartyMachineEvents, type FirstPartyMachineInterpreter, type FirstPartyMachineNavigationArgs, type FirstPartyMachineServiceDefinitions, FirstPartyMachineServices, type FirstPartyMachineState, type FirstPartyMachineStateNavigationListener, FirstPartyMachineStateTypes, type FirstPartyMachineStates, type FirstPartyMachineStatesConfig, type FirstPartyNextEvent, type FirstPartyPreviousEvent, type FirstPartySelectCredentialsEvent, type FirstPartyStateMachine, type GetAuthenticationKeyArgs, type GetBasicIssuerLocaleBrandingArgs, type GetContactArgs, type GetCredentialArgs, type GetCredentialBrandingArgs, type GetCredentialConfigsSupportedArgs, type GetCredentialConfigsSupportedBySingleTypeOrIdArgs, type GetCredentialsArgs, type GetDefaultIssuanceOptsArgs, type GetFederationTrustArgs, type GetIdentifierArgs, type GetIssuanceCryptoSuiteArgs, type GetIssuanceDidMethodArgs, type GetIssuanceOptsArgs, type GetIssuerBrandingArgs, type GetIssuerMetadataArgs, type GetMachineArgs, type GetOrCreatePrimaryIdentifierArgs, type GetPreferredCredentialFormatsArgs, type GetSiopRequestArgs, type IOID4VCIHolder, IdentifierAliasEnum, type InstanceFirstPartyMachineOpts, type InvokeAuthorizationRequestEvent, type IssuanceOpts, type IssuerLocaleBrandingFromArgs, type IssuerType, type MapCredentialToAcceptArgs, type MappedCredentialToAccept, type NextEvent, OID4VCICallbackStateListener, type OID4VCIContext, OID4VCIHolder, OID4VCIHolderEvent, OID4VCIHolderLinkHandler, type OID4VCIHolderOptions, type OID4VCIMachine, OID4VCIMachineAddContactStates, type OID4VCIMachineContext, type OID4VCIMachineEventTypes, OID4VCIMachineEvents, OID4VCIMachineGuards, type OID4VCIMachineInstanceOpts, type OID4VCIMachineInterpreter, type OID4VCIMachineNavigationArgs, type OID4VCIMachineServiceDefinitions, OID4VCIMachineServices, type OID4VCIMachineState, type OID4VCIMachineStateNavigationListener, OID4VCIMachineStates, OID4VCIMachineVerifyPinStates, type OID4VCIProviderProps, type OID4VCIStateMachine, type Oid4vciCombineDisplayLocalesFromArgs, type Oid4vciCredentialDisplayLocalesFromArgs, type Oid4vciCredentialLocaleBrandingFromArgs, type Oid4vciGetCredentialBrandingFromArgs, type Oid4vciIssuerCredentialSubjectLocalesFromArgs, type OnContactIdentityCreatedArgs, type OnCredentialStoredArgs, type OnIdentifierCreatedArgs, type PrepareAuthorizationRequestArgs, type PrepareAuthorizationResult, type PrepareStartArgs, type PreviousEvent, type RequestData, RequestType, type RequiredContext, type SdJwtCombineDisplayLocalesFromArgs, type SdJwtCredentialClaimLocalesFromArgs, type SdJwtCredentialDisplayLocalesFromArgs, type SdJwtCredentialLocaleBrandingFromArgs, type SdJwtGetCredentialBrandingFromArgs, type SelectAppLocaleBrandingArgs, type SelectCredentialsEvent, type SendAuthorizationChallengeRequestArgs, type SendAuthorizationResponseArgs, type SendNotificationArgs, type SetAuthorizationCodeURLEvent, type SiopV2AuthorizationRequestData, type StartFirstPartApplicationMachine, type StartResult, type StoreCredentialBrandingArgs, type StoreCredentialsArgs, type StoreIssuerBrandingArgs, SupportedLanguage, type VerificationCodeEvent, type VerificationResult, type VerificationSubResult, type VerifyCredentialArgs, type VerifyCredentialToAcceptArgs, type VerifyEBSICredentialIssuerArgs, type VerifyEBSICredentialIssuerResult, type VerifyMdocArgs, type VerifySDJWTCredentialArgs, createConfig, extractCredentialFromResponse, getBasicIssuerLocaleBranding, getCredentialBranding, getCredentialConfigsBasedOnFormatPref, getCredentialConfigsSupported, getCredentialConfigsSupportedBySingleTypeOrId, getCredentialConfigsSupportedMerged, getIdentifierOpts, getIssuanceCryptoSuite, getIssuanceMethod, getIssuanceOpts, getSiopRequest, issuerLocaleBrandingFrom, mapCredentialToAccept, oid4vciCombineDisplayLocalesFrom, oid4vciCredentialDisplayLocalesFrom, oid4vciCredentialLocaleBrandingFrom, oid4vciGetCredentialBrandingFrom, oid4vciHolderContextMethods, oid4vciIssuerCredentialSubjectLocalesFrom, sdJwtCombineDisplayLocalesFrom, sdJwtCredentialClaimLocalesFrom, sdJwtCredentialDisplayLocalesFrom, sdJwtCredentialLocaleBrandingFrom, sdJwtGetCredentialBrandingFrom, selectCredentialLocaleBranding, sendAuthorizationChallengeRequest, sendAuthorizationResponse, signCallback, startFirstPartApplicationMachine, verifyCredentialToAccept };
|
package/dist/index.d.ts
CHANGED
|
@@ -129,6 +129,7 @@ interface IOID4VCIHolder extends IPluginMethodMap {
|
|
|
129
129
|
oid4vciHolderGetMachineInterpreter(args: GetMachineArgs, context: RequiredContext): Promise<OID4VCIMachine>;
|
|
130
130
|
oid4vciHolderStart(args: PrepareStartArgs, context: RequiredContext): Promise<StartResult>;
|
|
131
131
|
oid4vciHolderCreateCredentialsToSelectFrom(args: CreateCredentialsToSelectFromArgs, context: RequiredContext): Promise<Array<CredentialToSelectFromResult>>;
|
|
132
|
+
oid4vciHolderPrepareAuthorizationRequest(args: PrepareAuthorizationRequestArgs, context: RequiredContext): Promise<PrepareAuthorizationResult>;
|
|
132
133
|
oid4vciHolderGetContact(args: GetContactArgs, context: RequiredContext): Promise<Party | undefined>;
|
|
133
134
|
oid4vciHolderGetCredentials(args: GetCredentialsArgs, context: RequiredContext): Promise<Array<MappedCredentialToAccept>>;
|
|
134
135
|
oid4vciHolderGetCredential(args: GetCredentialArgs, context: RequiredContext): Promise<MappedCredentialToAccept>;
|
|
@@ -177,6 +178,7 @@ type GetMachineArgs = {
|
|
|
177
178
|
firstPartyStateNavigationListener?: FirstPartyMachineStateNavigationListener;
|
|
178
179
|
};
|
|
179
180
|
type PrepareStartArgs = Pick<OID4VCIMachineContext, 'requestData' | 'authorizationRequestOpts' | 'didMethodPreferences' | 'issuanceOpt' | 'accessTokenOpts'>;
|
|
181
|
+
type PrepareAuthorizationRequestArgs = Pick<OID4VCIMachineContext, 'openID4VCIClientState' | 'contact'>;
|
|
180
182
|
type CreateCredentialsToSelectFromArgs = Pick<OID4VCIMachineContext, 'credentialsSupported' | 'credentialBranding' | 'selectedCredentials' | 'locale' | 'openID4VCIClientState'>;
|
|
181
183
|
type GetContactArgs = Pick<OID4VCIMachineContext, 'serverMetadata'>;
|
|
182
184
|
type GetCredentialsArgs = Pick<OID4VCIMachineContext, 'verificationCode' | 'openID4VCIClientState' | 'selectedCredentials' | 'didMethodPreferences' | 'issuanceOpt' | 'accessTokenOpts'>;
|
|
@@ -266,6 +268,7 @@ declare enum OID4VCIMachineStates {
|
|
|
266
268
|
selectCredentials = "selectCredentials",
|
|
267
269
|
transitionFromSelectingCredentials = "transitionFromSelectingCredentials",
|
|
268
270
|
verifyPin = "verifyPin",
|
|
271
|
+
prepareAuthorizationRequest = "prepareAuthorizationRequest",
|
|
269
272
|
initiateAuthorizationRequest = "initiateAuthorizationRequest",
|
|
270
273
|
waitForAuthorizationResponse = "waitForAuthorizationResponse",
|
|
271
274
|
getCredentials = "getCredentials",
|
|
@@ -373,6 +376,7 @@ declare enum OID4VCIMachineServices {
|
|
|
373
376
|
getFederationTrust = "getFederationTrust",
|
|
374
377
|
addContactIdentity = "addContactIdentity",
|
|
375
378
|
createCredentialsToSelectFrom = "createCredentialsToSelectFrom",
|
|
379
|
+
prepareAuthorizationRequest = "prepareAuthorizationRequest",
|
|
376
380
|
getIssuerBranding = "getIssuerBranding",
|
|
377
381
|
storeIssuerBranding = "storeIssuerBranding",
|
|
378
382
|
getCredentials = "getCredentials",
|
|
@@ -448,12 +452,14 @@ type OID4VCIMachine = {
|
|
|
448
452
|
interpreter: OID4VCIMachineInterpreter;
|
|
449
453
|
};
|
|
450
454
|
type StartResult = {
|
|
451
|
-
authorizationCodeURL?: string;
|
|
452
455
|
credentialBranding?: Record<string, Array<IBasicCredentialLocaleBranding>>;
|
|
453
456
|
credentialsSupported: Record<string, CredentialConfigurationSupported>;
|
|
454
457
|
serverMetadata: EndpointMetadataResult;
|
|
455
458
|
oid4vciClientState: OpenID4VCIClientState;
|
|
456
459
|
};
|
|
460
|
+
type PrepareAuthorizationResult = {
|
|
461
|
+
authorizationCodeURL?: string;
|
|
462
|
+
};
|
|
457
463
|
type SelectAppLocaleBrandingArgs = {
|
|
458
464
|
locale?: string;
|
|
459
465
|
localeBranding?: Array<IBasicCredentialLocaleBranding | IBasicIssuerLocaleBranding>;
|
|
@@ -699,6 +705,7 @@ declare class OID4VCIHolder implements IAgentPlugin {
|
|
|
699
705
|
* @private
|
|
700
706
|
*/
|
|
701
707
|
private oid4vciHolderStart;
|
|
708
|
+
private oid4vciHolderPrepareAuthorizationRequest;
|
|
702
709
|
private oid4vciHolderCreateCredentialsToSelectFrom;
|
|
703
710
|
private oid4vciHolderGetContact;
|
|
704
711
|
private oid4vciHolderGetCredentials;
|
|
@@ -786,4 +793,4 @@ declare class OID4VCIHolderLinkHandler extends LinkHandlerAdapter {
|
|
|
786
793
|
}): Promise<void>;
|
|
787
794
|
}
|
|
788
795
|
|
|
789
|
-
export { type AccessTokenOpts, type AddContactIdentityArgs, type AssertValidCredentialsArgs, type Attribute, type AuthorizationResponseEvent, type ContactAliasEvent, type ContactConsentEvent, type CreateConfigArgs, type CreateContactEvent, type CreateCredentialsToSelectFromArgs, type CreateFirstPartyMachineOpts, type CreateIdentifierArgs, type CreateIdentifierCreateOpts, type CreateIdentifierOpts, type CreateOID4VCIMachineOpts, type CredentialToAccept, type CredentialToSelectFromResult, type CredentialVerificationError, type DeclineEvent, type DefaultIssuanceOpts, type DidAgents, type DynamicRegistrationClientMetadataDisplay, type ErrorDetails, type FirstPartyDeclineEvent, type FirstPartyMachineContext, type FirstPartyMachineEventTypes, FirstPartyMachineEvents, type FirstPartyMachineInterpreter, type FirstPartyMachineNavigationArgs, type FirstPartyMachineServiceDefinitions, FirstPartyMachineServices, type FirstPartyMachineState, type FirstPartyMachineStateNavigationListener, FirstPartyMachineStateTypes, type FirstPartyMachineStates, type FirstPartyMachineStatesConfig, type FirstPartyNextEvent, type FirstPartyPreviousEvent, type FirstPartySelectCredentialsEvent, type FirstPartyStateMachine, type GetAuthenticationKeyArgs, type GetBasicIssuerLocaleBrandingArgs, type GetContactArgs, type GetCredentialArgs, type GetCredentialBrandingArgs, type GetCredentialConfigsSupportedArgs, type GetCredentialConfigsSupportedBySingleTypeOrIdArgs, type GetCredentialsArgs, type GetDefaultIssuanceOptsArgs, type GetFederationTrustArgs, type GetIdentifierArgs, type GetIssuanceCryptoSuiteArgs, type GetIssuanceDidMethodArgs, type GetIssuanceOptsArgs, type GetIssuerBrandingArgs, type GetIssuerMetadataArgs, type GetMachineArgs, type GetOrCreatePrimaryIdentifierArgs, type GetPreferredCredentialFormatsArgs, type GetSiopRequestArgs, type IOID4VCIHolder, IdentifierAliasEnum, type InstanceFirstPartyMachineOpts, type InvokeAuthorizationRequestEvent, type IssuanceOpts, type IssuerLocaleBrandingFromArgs, type IssuerType, type MapCredentialToAcceptArgs, type MappedCredentialToAccept, type NextEvent, OID4VCICallbackStateListener, type OID4VCIContext, OID4VCIHolder, OID4VCIHolderEvent, OID4VCIHolderLinkHandler, type OID4VCIHolderOptions, type OID4VCIMachine, OID4VCIMachineAddContactStates, type OID4VCIMachineContext, type OID4VCIMachineEventTypes, OID4VCIMachineEvents, OID4VCIMachineGuards, type OID4VCIMachineInstanceOpts, type OID4VCIMachineInterpreter, type OID4VCIMachineNavigationArgs, type OID4VCIMachineServiceDefinitions, OID4VCIMachineServices, type OID4VCIMachineState, type OID4VCIMachineStateNavigationListener, OID4VCIMachineStates, OID4VCIMachineVerifyPinStates, type OID4VCIProviderProps, type OID4VCIStateMachine, type Oid4vciCombineDisplayLocalesFromArgs, type Oid4vciCredentialDisplayLocalesFromArgs, type Oid4vciCredentialLocaleBrandingFromArgs, type Oid4vciGetCredentialBrandingFromArgs, type Oid4vciIssuerCredentialSubjectLocalesFromArgs, type OnContactIdentityCreatedArgs, type OnCredentialStoredArgs, type OnIdentifierCreatedArgs, type PrepareStartArgs, type PreviousEvent, type RequestData, RequestType, type RequiredContext, type SdJwtCombineDisplayLocalesFromArgs, type SdJwtCredentialClaimLocalesFromArgs, type SdJwtCredentialDisplayLocalesFromArgs, type SdJwtCredentialLocaleBrandingFromArgs, type SdJwtGetCredentialBrandingFromArgs, type SelectAppLocaleBrandingArgs, type SelectCredentialsEvent, type SendAuthorizationChallengeRequestArgs, type SendAuthorizationResponseArgs, type SendNotificationArgs, type SetAuthorizationCodeURLEvent, type SiopV2AuthorizationRequestData, type StartFirstPartApplicationMachine, type StartResult, type StoreCredentialBrandingArgs, type StoreCredentialsArgs, type StoreIssuerBrandingArgs, SupportedLanguage, type VerificationCodeEvent, type VerificationResult, type VerificationSubResult, type VerifyCredentialArgs, type VerifyCredentialToAcceptArgs, type VerifyEBSICredentialIssuerArgs, type VerifyEBSICredentialIssuerResult, type VerifyMdocArgs, type VerifySDJWTCredentialArgs, createConfig, extractCredentialFromResponse, getBasicIssuerLocaleBranding, getCredentialBranding, getCredentialConfigsBasedOnFormatPref, getCredentialConfigsSupported, getCredentialConfigsSupportedBySingleTypeOrId, getCredentialConfigsSupportedMerged, getIdentifierOpts, getIssuanceCryptoSuite, getIssuanceMethod, getIssuanceOpts, getSiopRequest, issuerLocaleBrandingFrom, mapCredentialToAccept, oid4vciCombineDisplayLocalesFrom, oid4vciCredentialDisplayLocalesFrom, oid4vciCredentialLocaleBrandingFrom, oid4vciGetCredentialBrandingFrom, oid4vciHolderContextMethods, oid4vciIssuerCredentialSubjectLocalesFrom, sdJwtCombineDisplayLocalesFrom, sdJwtCredentialClaimLocalesFrom, sdJwtCredentialDisplayLocalesFrom, sdJwtCredentialLocaleBrandingFrom, sdJwtGetCredentialBrandingFrom, selectCredentialLocaleBranding, sendAuthorizationChallengeRequest, sendAuthorizationResponse, signCallback, startFirstPartApplicationMachine, verifyCredentialToAccept };
|
|
796
|
+
export { type AccessTokenOpts, type AddContactIdentityArgs, type AssertValidCredentialsArgs, type Attribute, type AuthorizationResponseEvent, type ContactAliasEvent, type ContactConsentEvent, type CreateConfigArgs, type CreateContactEvent, type CreateCredentialsToSelectFromArgs, type CreateFirstPartyMachineOpts, type CreateIdentifierArgs, type CreateIdentifierCreateOpts, type CreateIdentifierOpts, type CreateOID4VCIMachineOpts, type CredentialToAccept, type CredentialToSelectFromResult, type CredentialVerificationError, type DeclineEvent, type DefaultIssuanceOpts, type DidAgents, type DynamicRegistrationClientMetadataDisplay, type ErrorDetails, type FirstPartyDeclineEvent, type FirstPartyMachineContext, type FirstPartyMachineEventTypes, FirstPartyMachineEvents, type FirstPartyMachineInterpreter, type FirstPartyMachineNavigationArgs, type FirstPartyMachineServiceDefinitions, FirstPartyMachineServices, type FirstPartyMachineState, type FirstPartyMachineStateNavigationListener, FirstPartyMachineStateTypes, type FirstPartyMachineStates, type FirstPartyMachineStatesConfig, type FirstPartyNextEvent, type FirstPartyPreviousEvent, type FirstPartySelectCredentialsEvent, type FirstPartyStateMachine, type GetAuthenticationKeyArgs, type GetBasicIssuerLocaleBrandingArgs, type GetContactArgs, type GetCredentialArgs, type GetCredentialBrandingArgs, type GetCredentialConfigsSupportedArgs, type GetCredentialConfigsSupportedBySingleTypeOrIdArgs, type GetCredentialsArgs, type GetDefaultIssuanceOptsArgs, type GetFederationTrustArgs, type GetIdentifierArgs, type GetIssuanceCryptoSuiteArgs, type GetIssuanceDidMethodArgs, type GetIssuanceOptsArgs, type GetIssuerBrandingArgs, type GetIssuerMetadataArgs, type GetMachineArgs, type GetOrCreatePrimaryIdentifierArgs, type GetPreferredCredentialFormatsArgs, type GetSiopRequestArgs, type IOID4VCIHolder, IdentifierAliasEnum, type InstanceFirstPartyMachineOpts, type InvokeAuthorizationRequestEvent, type IssuanceOpts, type IssuerLocaleBrandingFromArgs, type IssuerType, type MapCredentialToAcceptArgs, type MappedCredentialToAccept, type NextEvent, OID4VCICallbackStateListener, type OID4VCIContext, OID4VCIHolder, OID4VCIHolderEvent, OID4VCIHolderLinkHandler, type OID4VCIHolderOptions, type OID4VCIMachine, OID4VCIMachineAddContactStates, type OID4VCIMachineContext, type OID4VCIMachineEventTypes, OID4VCIMachineEvents, OID4VCIMachineGuards, type OID4VCIMachineInstanceOpts, type OID4VCIMachineInterpreter, type OID4VCIMachineNavigationArgs, type OID4VCIMachineServiceDefinitions, OID4VCIMachineServices, type OID4VCIMachineState, type OID4VCIMachineStateNavigationListener, OID4VCIMachineStates, OID4VCIMachineVerifyPinStates, type OID4VCIProviderProps, type OID4VCIStateMachine, type Oid4vciCombineDisplayLocalesFromArgs, type Oid4vciCredentialDisplayLocalesFromArgs, type Oid4vciCredentialLocaleBrandingFromArgs, type Oid4vciGetCredentialBrandingFromArgs, type Oid4vciIssuerCredentialSubjectLocalesFromArgs, type OnContactIdentityCreatedArgs, type OnCredentialStoredArgs, type OnIdentifierCreatedArgs, type PrepareAuthorizationRequestArgs, type PrepareAuthorizationResult, type PrepareStartArgs, type PreviousEvent, type RequestData, RequestType, type RequiredContext, type SdJwtCombineDisplayLocalesFromArgs, type SdJwtCredentialClaimLocalesFromArgs, type SdJwtCredentialDisplayLocalesFromArgs, type SdJwtCredentialLocaleBrandingFromArgs, type SdJwtGetCredentialBrandingFromArgs, type SelectAppLocaleBrandingArgs, type SelectCredentialsEvent, type SendAuthorizationChallengeRequestArgs, type SendAuthorizationResponseArgs, type SendNotificationArgs, type SetAuthorizationCodeURLEvent, type SiopV2AuthorizationRequestData, type StartFirstPartApplicationMachine, type StartResult, type StoreCredentialBrandingArgs, type StoreCredentialsArgs, type StoreIssuerBrandingArgs, SupportedLanguage, type VerificationCodeEvent, type VerificationResult, type VerificationSubResult, type VerifyCredentialArgs, type VerifyCredentialToAcceptArgs, type VerifyEBSICredentialIssuerArgs, type VerifyEBSICredentialIssuerResult, type VerifyMdocArgs, type VerifySDJWTCredentialArgs, createConfig, extractCredentialFromResponse, getBasicIssuerLocaleBranding, getCredentialBranding, getCredentialConfigsBasedOnFormatPref, getCredentialConfigsSupported, getCredentialConfigsSupportedBySingleTypeOrId, getCredentialConfigsSupportedMerged, getIdentifierOpts, getIssuanceCryptoSuite, getIssuanceMethod, getIssuanceOpts, getSiopRequest, issuerLocaleBrandingFrom, mapCredentialToAccept, oid4vciCombineDisplayLocalesFrom, oid4vciCredentialDisplayLocalesFrom, oid4vciCredentialLocaleBrandingFrom, oid4vciGetCredentialBrandingFrom, oid4vciHolderContextMethods, oid4vciIssuerCredentialSubjectLocalesFrom, sdJwtCombineDisplayLocalesFrom, sdJwtCredentialClaimLocalesFrom, sdJwtCredentialDisplayLocalesFrom, sdJwtCredentialLocaleBrandingFrom, sdJwtGetCredentialBrandingFrom, selectCredentialLocaleBranding, sendAuthorizationChallengeRequest, sendAuthorizationResponse, signCallback, startFirstPartApplicationMachine, verifyCredentialToAccept };
|
package/dist/index.js
CHANGED
|
@@ -61,8 +61,7 @@ import { SupportedDidMethodEnum as SupportedDidMethodEnum2 } from "@sphereon/ssi
|
|
|
61
61
|
import { isManagedIdentifierDidOpts, isManagedIdentifierDidResult as isManagedIdentifierDidResult2, isManagedIdentifierJwkResult, isManagedIdentifierKidResult, isManagedIdentifierResult as isManagedIdentifierResult2, isManagedIdentifierX5cOpts, isManagedIdentifierX5cResult } from "@sphereon/ssi-sdk-ext.identifier-resolution";
|
|
62
62
|
import { signatureAlgorithmFromKey } from "@sphereon/ssi-sdk-ext.key-utils";
|
|
63
63
|
import { defaultHasher as defaultHasher2 } from "@sphereon/ssi-sdk.core";
|
|
64
|
-
import { ensureRawDocument } from "@sphereon/ssi-sdk.data-store-types";
|
|
65
|
-
import { ConnectionType, CorrelationIdentifierType, CredentialCorrelationType, IdentityOrigin } from "@sphereon/ssi-sdk.data-store-types";
|
|
64
|
+
import { ConnectionType, CorrelationIdentifierType, CredentialCorrelationType, ensureRawDocument, IdentityOrigin } from "@sphereon/ssi-sdk.data-store-types";
|
|
66
65
|
import { CredentialMapper as CredentialMapper2, CredentialRole, JoseSignatureAlgorithm as JoseSignatureAlgorithm2, Loggers, parseDid } from "@sphereon/ssi-types";
|
|
67
66
|
import { asArray as asArray2, computeEntryHash } from "@veramo/utils";
|
|
68
67
|
import fetch from "cross-fetch";
|
|
@@ -105,6 +104,7 @@ var OID4VCIMachineStates = /* @__PURE__ */ (function(OID4VCIMachineStates2) {
|
|
|
105
104
|
OID4VCIMachineStates2["selectCredentials"] = "selectCredentials";
|
|
106
105
|
OID4VCIMachineStates2["transitionFromSelectingCredentials"] = "transitionFromSelectingCredentials";
|
|
107
106
|
OID4VCIMachineStates2["verifyPin"] = "verifyPin";
|
|
107
|
+
OID4VCIMachineStates2["prepareAuthorizationRequest"] = "prepareAuthorizationRequest";
|
|
108
108
|
OID4VCIMachineStates2["initiateAuthorizationRequest"] = "initiateAuthorizationRequest";
|
|
109
109
|
OID4VCIMachineStates2["waitForAuthorizationResponse"] = "waitForAuthorizationResponse";
|
|
110
110
|
OID4VCIMachineStates2["getCredentials"] = "getCredentials";
|
|
@@ -169,6 +169,7 @@ var OID4VCIMachineServices = /* @__PURE__ */ (function(OID4VCIMachineServices2)
|
|
|
169
169
|
OID4VCIMachineServices2["getFederationTrust"] = "getFederationTrust";
|
|
170
170
|
OID4VCIMachineServices2["addContactIdentity"] = "addContactIdentity";
|
|
171
171
|
OID4VCIMachineServices2["createCredentialsToSelectFrom"] = "createCredentialsToSelectFrom";
|
|
172
|
+
OID4VCIMachineServices2["prepareAuthorizationRequest"] = "prepareAuthorizationRequest";
|
|
172
173
|
OID4VCIMachineServices2["getIssuerBranding"] = "getIssuerBranding";
|
|
173
174
|
OID4VCIMachineServices2["storeIssuerBranding"] = "storeIssuerBranding";
|
|
174
175
|
OID4VCIMachineServices2["getCredentials"] = "getCredentials";
|
|
@@ -310,9 +311,7 @@ var oid4vciRequireAuthorizationGuard = /* @__PURE__ */ __name((ctx, _event) => {
|
|
|
310
311
|
if (!openID4VCIClientState) {
|
|
311
312
|
throw Error("Missing openID4VCI client state in context");
|
|
312
313
|
}
|
|
313
|
-
if (
|
|
314
|
-
return false;
|
|
315
|
-
} else if (openID4VCIClientState.authorizationRequestOpts) {
|
|
314
|
+
if (openID4VCIClientState.authorizationURL && openID4VCIClientState.authorizationRequestOpts) {
|
|
316
315
|
return !ctx.openID4VCIClientState?.authorizationCodeResponse;
|
|
317
316
|
} else if (openID4VCIClientState.credentialOffer?.supportedFlows?.includes(AuthzFlowType.AUTHORIZATION_CODE_FLOW)) {
|
|
318
317
|
return !ctx.openID4VCIClientState?.authorizationCodeResponse;
|
|
@@ -363,7 +362,6 @@ var createOID4VCIMachine = /* @__PURE__ */ __name((opts) => {
|
|
|
363
362
|
onDone: {
|
|
364
363
|
target: OID4VCIMachineStates.createCredentialsToSelectFrom,
|
|
365
364
|
actions: assign({
|
|
366
|
-
authorizationCodeURL: /* @__PURE__ */ __name((_ctx, _event) => _event.data.authorizationCodeURL, "authorizationCodeURL"),
|
|
367
365
|
credentialBranding: /* @__PURE__ */ __name((_ctx, _event) => _event.data.credentialBranding ?? {}, "credentialBranding"),
|
|
368
366
|
credentialsSupported: /* @__PURE__ */ __name((_ctx, _event) => _event.data.credentialsSupported, "credentialsSupported"),
|
|
369
367
|
serverMetadata: /* @__PURE__ */ __name((_ctx, _event) => _event.data.serverMetadata, "serverMetadata"),
|
|
@@ -600,6 +598,10 @@ var createOID4VCIMachine = /* @__PURE__ */ __name((opts) => {
|
|
|
600
598
|
target: OID4VCIMachineStates.startFirstPartApplicationFlow,
|
|
601
599
|
cond: OID4VCIMachineGuards.isFirstPartyApplication
|
|
602
600
|
},
|
|
601
|
+
{
|
|
602
|
+
target: OID4VCIMachineStates.prepareAuthorizationRequest,
|
|
603
|
+
cond: OID4VCIMachineGuards.requireAuthorizationGuard
|
|
604
|
+
},
|
|
603
605
|
{
|
|
604
606
|
target: OID4VCIMachineStates.initiateAuthorizationRequest,
|
|
605
607
|
cond: OID4VCIMachineGuards.requireAuthorizationGuard
|
|
@@ -675,12 +677,16 @@ var createOID4VCIMachine = /* @__PURE__ */ __name((opts) => {
|
|
|
675
677
|
target: OID4VCIMachineStates.startFirstPartApplicationFlow,
|
|
676
678
|
cond: OID4VCIMachineGuards.isFirstPartyApplication
|
|
677
679
|
},
|
|
680
|
+
{
|
|
681
|
+
target: OID4VCIMachineStates.prepareAuthorizationRequest,
|
|
682
|
+
cond: OID4VCIMachineGuards.requireAuthorizationGuard
|
|
683
|
+
},
|
|
678
684
|
{
|
|
679
685
|
target: OID4VCIMachineStates.verifyPin,
|
|
680
686
|
cond: OID4VCIMachineGuards.requirePinGuard
|
|
681
687
|
},
|
|
682
688
|
{
|
|
683
|
-
target: OID4VCIMachineStates.
|
|
689
|
+
target: OID4VCIMachineStates.prepareAuthorizationRequest,
|
|
684
690
|
cond: OID4VCIMachineGuards.requireAuthorizationGuard
|
|
685
691
|
},
|
|
686
692
|
{
|
|
@@ -688,6 +694,28 @@ var createOID4VCIMachine = /* @__PURE__ */ __name((opts) => {
|
|
|
688
694
|
}
|
|
689
695
|
]
|
|
690
696
|
},
|
|
697
|
+
[OID4VCIMachineStates.prepareAuthorizationRequest]: {
|
|
698
|
+
id: OID4VCIMachineStates.prepareAuthorizationRequest,
|
|
699
|
+
invoke: {
|
|
700
|
+
src: OID4VCIMachineServices.prepareAuthorizationRequest,
|
|
701
|
+
onDone: {
|
|
702
|
+
target: OID4VCIMachineStates.initiateAuthorizationRequest,
|
|
703
|
+
actions: assign({
|
|
704
|
+
authorizationCodeURL: /* @__PURE__ */ __name((_ctx, _event) => _event.data.authorizationCodeURL, "authorizationCodeURL")
|
|
705
|
+
})
|
|
706
|
+
},
|
|
707
|
+
onError: {
|
|
708
|
+
target: OID4VCIMachineStates.handleError,
|
|
709
|
+
actions: assign({
|
|
710
|
+
error: /* @__PURE__ */ __name((_ctx, _event) => ({
|
|
711
|
+
title: translate("oid4vci_machine_prepare_authorization_error_title"),
|
|
712
|
+
message: _event.data.message,
|
|
713
|
+
stack: _event.data.stack
|
|
714
|
+
}), "error")
|
|
715
|
+
})
|
|
716
|
+
}
|
|
717
|
+
}
|
|
718
|
+
},
|
|
691
719
|
[OID4VCIMachineStates.initiateAuthorizationRequest]: {
|
|
692
720
|
id: OID4VCIMachineStates.initiateAuthorizationRequest,
|
|
693
721
|
on: {
|
|
@@ -1666,7 +1694,7 @@ var mapCredentialToAccept = /* @__PURE__ */ __name(async (args) => {
|
|
|
1666
1694
|
});
|
|
1667
1695
|
let uniformVerifiableCredential;
|
|
1668
1696
|
if (CredentialMapper.isSdJwtDecodedCredential(wrappedVerifiableCredential.credential)) {
|
|
1669
|
-
uniformVerifiableCredential =
|
|
1697
|
+
uniformVerifiableCredential = sdJwtDecodedCredentialToUniformCredential(wrappedVerifiableCredential.credential);
|
|
1670
1698
|
} else if (CredentialMapper.isSdJwtEncoded(wrappedVerifiableCredential.credential)) {
|
|
1671
1699
|
if (!hasher) {
|
|
1672
1700
|
return Promise.reject("a hasher is required for encoded SD-JWT credentials");
|
|
@@ -2123,6 +2151,7 @@ var OID4VCIHolder = class _OID4VCIHolder {
|
|
|
2123
2151
|
oid4vciHolderStart: this.oid4vciHolderStart.bind(this),
|
|
2124
2152
|
oid4vciHolderGetIssuerMetadata: this.oid4vciHolderGetIssuerMetadata.bind(this),
|
|
2125
2153
|
oid4vciHolderGetMachineInterpreter: this.oid4vciHolderGetMachineInterpreter.bind(this),
|
|
2154
|
+
oid4vciHolderPrepareAuthorizationRequest: this.oid4vciHolderPrepareAuthorizationRequest.bind(this),
|
|
2126
2155
|
oid4vciHolderCreateCredentialsToSelectFrom: this.oid4vciHolderCreateCredentialsToSelectFrom.bind(this),
|
|
2127
2156
|
oid4vciHolderGetContact: this.oid4vciHolderGetContact.bind(this),
|
|
2128
2157
|
oid4vciHolderGetCredentials: this.oid4vciHolderGetCredentials.bind(this),
|
|
@@ -2227,6 +2256,7 @@ var OID4VCIHolder = class _OID4VCIHolder {
|
|
|
2227
2256
|
stateNavigationListener: opts.firstPartyStateNavigationListener
|
|
2228
2257
|
}, context),
|
|
2229
2258
|
[OID4VCIMachineServices.createCredentialsToSelectFrom]: (args) => this.oid4vciHolderCreateCredentialsToSelectFrom(args, context),
|
|
2259
|
+
[OID4VCIMachineServices.prepareAuthorizationRequest]: (args) => this.oid4vciHolderPrepareAuthorizationRequest(args, context),
|
|
2230
2260
|
[OID4VCIMachineServices.getContact]: (args) => this.oid4vciHolderGetContact(args, context),
|
|
2231
2261
|
[OID4VCIMachineServices.getCredentials]: (args) => this.oid4vciHolderGetCredentials({
|
|
2232
2262
|
accessTokenOpts: args.accessTokenOpts ?? opts.accessTokenOpts,
|
|
@@ -2311,7 +2341,7 @@ var OID4VCIHolder = class _OID4VCIHolder {
|
|
|
2311
2341
|
credentialIssuer: uri,
|
|
2312
2342
|
authorizationRequest: authorizationRequestOpts,
|
|
2313
2343
|
clientId: authorizationRequestOpts.clientId,
|
|
2314
|
-
createAuthorizationRequestURL:
|
|
2344
|
+
createAuthorizationRequestURL: false
|
|
2315
2345
|
});
|
|
2316
2346
|
} else {
|
|
2317
2347
|
logger.log(`Credential offer received: ${uri}`);
|
|
@@ -2319,7 +2349,7 @@ var OID4VCIHolder = class _OID4VCIHolder {
|
|
|
2319
2349
|
uri,
|
|
2320
2350
|
authorizationRequest: authorizationRequestOpts,
|
|
2321
2351
|
clientId: authorizationRequestOpts.clientId,
|
|
2322
|
-
createAuthorizationRequestURL:
|
|
2352
|
+
createAuthorizationRequestURL: false
|
|
2323
2353
|
});
|
|
2324
2354
|
}
|
|
2325
2355
|
}
|
|
@@ -2339,19 +2369,44 @@ var OID4VCIHolder = class _OID4VCIHolder {
|
|
|
2339
2369
|
credentialsSupported,
|
|
2340
2370
|
context
|
|
2341
2371
|
});
|
|
2342
|
-
const authorizationCodeURL = oid4vciClient.authorizationURL;
|
|
2343
|
-
if (authorizationCodeURL) {
|
|
2344
|
-
logger.log(`authorization code URL ${authorizationCodeURL}`);
|
|
2345
|
-
}
|
|
2346
2372
|
const oid4vciClientState = JSON.parse(await oid4vciClient.exportState());
|
|
2347
2373
|
return {
|
|
2348
|
-
authorizationCodeURL,
|
|
2349
2374
|
credentialBranding,
|
|
2350
2375
|
credentialsSupported,
|
|
2351
2376
|
serverMetadata,
|
|
2352
2377
|
oid4vciClientState
|
|
2353
2378
|
};
|
|
2354
2379
|
}
|
|
2380
|
+
async oid4vciHolderPrepareAuthorizationRequest(args, context) {
|
|
2381
|
+
const { openID4VCIClientState, contact } = args;
|
|
2382
|
+
if (!openID4VCIClientState) {
|
|
2383
|
+
return Promise.reject(Error("Missing openID4VCI client state in context"));
|
|
2384
|
+
}
|
|
2385
|
+
const clientId = contact?.identities.map((identity) => {
|
|
2386
|
+
const connectionConfig = identity.connection?.config;
|
|
2387
|
+
if (connectionConfig && "clientId" in connectionConfig) {
|
|
2388
|
+
return connectionConfig.clientId;
|
|
2389
|
+
}
|
|
2390
|
+
return void 0;
|
|
2391
|
+
}).find((clientId2) => clientId2);
|
|
2392
|
+
if (!clientId) {
|
|
2393
|
+
return Promise.reject(Error(`Missing client id in contact's connectionConfig`));
|
|
2394
|
+
}
|
|
2395
|
+
const client = await OpenID4VCIClient2.fromState({
|
|
2396
|
+
state: openID4VCIClientState
|
|
2397
|
+
});
|
|
2398
|
+
const authorizationCodeURL = await client.createAuthorizationRequestUrl({
|
|
2399
|
+
authorizationRequest: {
|
|
2400
|
+
clientId
|
|
2401
|
+
}
|
|
2402
|
+
});
|
|
2403
|
+
if (authorizationCodeURL) {
|
|
2404
|
+
logger.log(`authorization code URL ${authorizationCodeURL}`);
|
|
2405
|
+
}
|
|
2406
|
+
return {
|
|
2407
|
+
authorizationCodeURL
|
|
2408
|
+
};
|
|
2409
|
+
}
|
|
2355
2410
|
async oid4vciHolderCreateCredentialsToSelectFrom(args, context) {
|
|
2356
2411
|
const { credentialBranding, locale, selectedCredentials, credentialsSupported } = args;
|
|
2357
2412
|
logger.info(`Credentials supported ${Object.keys(credentialsSupported).join(", ")}`);
|