@sphereon/ssi-sdk.oid4vci-holder 0.32.1-next.54 → 0.33.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent/OID4VCIHolder.d.ts +1 -0
- package/dist/agent/OID4VCIHolder.d.ts.map +1 -1
- package/dist/agent/OID4VCIHolder.js +23 -10
- package/dist/agent/OID4VCIHolder.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/link-handler/index.d.ts.map +1 -1
- package/dist/link-handler/index.js.map +1 -1
- package/dist/machines/firstPartyMachine.d.ts.map +1 -1
- package/dist/machines/firstPartyMachine.js +10 -10
- package/dist/machines/firstPartyMachine.js.map +1 -1
- package/dist/machines/oid4vciMachine.d.ts.map +1 -1
- package/dist/machines/oid4vciMachine.js +3 -3
- package/dist/machines/oid4vciMachine.js.map +1 -1
- package/dist/mappers/OIDC4VCIBrandingMapper.d.ts.map +1 -1
- package/dist/mappers/OIDC4VCIBrandingMapper.js +1 -1
- package/dist/mappers/OIDC4VCIBrandingMapper.js.map +1 -1
- package/dist/services/FirstPartyMachineServices.d.ts.map +1 -1
- package/dist/services/FirstPartyMachineServices.js +3 -2
- package/dist/services/FirstPartyMachineServices.js.map +1 -1
- package/dist/services/OID4VCIHolderService.d.ts.map +1 -1
- package/dist/services/OID4VCIHolderService.js +4 -3
- package/dist/services/OID4VCIHolderService.js.map +1 -1
- package/dist/types/FirstPartyMachine.d.ts.map +1 -1
- package/dist/types/FirstPartyMachine.js.map +1 -1
- package/dist/types/IOID4VCIHolder.d.ts +6 -6
- package/dist/types/IOID4VCIHolder.d.ts.map +1 -1
- package/dist/types/IOID4VCIHolder.js.map +1 -1
- package/package.json +26 -25
- package/src/agent/OID4VCIHolder.ts +33 -11
- package/src/index.ts +1 -0
- package/src/link-handler/index.ts +6 -8
- package/src/machines/firstPartyMachine.ts +60 -69
- package/src/machines/oid4vciMachine.ts +9 -11
- package/src/mappers/OIDC4VCIBrandingMapper.ts +26 -25
- package/src/services/FirstPartyMachineServices.ts +11 -10
- package/src/services/OID4VCIHolderService.ts +25 -24
- package/src/types/FirstPartyMachine.ts +56 -64
- package/src/types/IOID4VCIHolder.ts +35 -32
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
getTypesFromObject,
|
|
11
11
|
MetadataDisplay,
|
|
12
12
|
OpenId4VCIVersion,
|
|
13
|
-
AuthorizationChallengeCodeResponse
|
|
13
|
+
AuthorizationChallengeCodeResponse,
|
|
14
14
|
} from '@sphereon/oid4vci-common'
|
|
15
15
|
import { KeyUse } from '@sphereon/ssi-sdk-ext.did-resolver-jwk'
|
|
16
16
|
import { getOrCreatePrimaryIdentifier, SupportedDidMethodEnum } from '@sphereon/ssi-sdk-ext.did-utils'
|
|
@@ -26,6 +26,7 @@ import { keyTypeFromCryptographicSuite } from '@sphereon/ssi-sdk-ext.key-utils'
|
|
|
26
26
|
import { IBasicCredentialLocaleBranding, IBasicIssuerLocaleBranding } from '@sphereon/ssi-sdk.data-store'
|
|
27
27
|
import {
|
|
28
28
|
CredentialMapper,
|
|
29
|
+
Hasher,
|
|
29
30
|
IVerifiableCredential,
|
|
30
31
|
JoseSignatureAlgorithm,
|
|
31
32
|
JoseSignatureAlgorithmString,
|
|
@@ -58,15 +59,12 @@ import {
|
|
|
58
59
|
VerificationResult,
|
|
59
60
|
VerifyCredentialToAcceptArgs,
|
|
60
61
|
StartFirstPartApplicationMachine,
|
|
61
|
-
RequiredContext
|
|
62
|
+
RequiredContext,
|
|
62
63
|
} from '../types/IOID4VCIHolder'
|
|
63
|
-
import {
|
|
64
|
-
oid4vciGetCredentialBrandingFrom,
|
|
65
|
-
sdJwtGetCredentialBrandingFrom,
|
|
66
|
-
issuerLocaleBrandingFrom
|
|
67
|
-
} from '../mappers/OIDC4VCIBrandingMapper'
|
|
64
|
+
import { oid4vciGetCredentialBrandingFrom, sdJwtGetCredentialBrandingFrom, issuerLocaleBrandingFrom } from '../mappers/OIDC4VCIBrandingMapper'
|
|
68
65
|
import { FirstPartyMachine } from '../machines/firstPartyMachine'
|
|
69
66
|
import { FirstPartyMachineState, FirstPartyMachineStateTypes } from '../types/FirstPartyMachine'
|
|
67
|
+
import { defaultHasher } from '@sphereon/ssi-sdk.core'
|
|
70
68
|
|
|
71
69
|
export const getCredentialBranding = async (args: GetCredentialBrandingArgs): Promise<Record<string, Array<IBasicCredentialLocaleBranding>>> => {
|
|
72
70
|
const { credentialsSupported, context } = args
|
|
@@ -88,14 +86,14 @@ export const getCredentialBranding = async (args: GetCredentialBrandingArgs): Pr
|
|
|
88
86
|
if (sdJwtTypeMetadata) {
|
|
89
87
|
mappedLocaleBranding = await sdJwtGetCredentialBrandingFrom({
|
|
90
88
|
credentialDisplay: sdJwtTypeMetadata.display,
|
|
91
|
-
claimsMetadata: sdJwtTypeMetadata.claims
|
|
89
|
+
claimsMetadata: sdJwtTypeMetadata.claims,
|
|
92
90
|
})
|
|
93
91
|
} else {
|
|
94
92
|
mappedLocaleBranding = await oid4vciGetCredentialBrandingFrom({
|
|
95
93
|
credentialDisplay: credentialsConfigSupported.display,
|
|
96
94
|
issuerCredentialSubject:
|
|
97
|
-
|
|
98
|
-
|
|
95
|
+
// @ts-ignore // FIXME SPRIND-123 add proper support for type recognition as claim display can be located elsewhere for v13
|
|
96
|
+
credentialsSupported.claims !== undefined ? credentialsConfigSupported.claims : credentialsConfigSupported.credentialSubject,
|
|
99
97
|
})
|
|
100
98
|
}
|
|
101
99
|
// TODO we should make the mapper part of the plugin, so that the logic for getting the branding becomes more clear and easier to use
|
|
@@ -160,7 +158,7 @@ export const verifyCredentialToAccept = async (args: VerifyCredentialToAcceptArg
|
|
|
160
158
|
return Promise.reject(Error('No credential found in credential response'))
|
|
161
159
|
}
|
|
162
160
|
|
|
163
|
-
const wrappedVC = CredentialMapper.toWrappedVerifiableCredential(credential, { hasher })
|
|
161
|
+
const wrappedVC = CredentialMapper.toWrappedVerifiableCredential(credential, { hasher: hasher ?? defaultHasher })
|
|
164
162
|
if (
|
|
165
163
|
wrappedVC.decoded?.iss?.includes('did:ebsi:') ||
|
|
166
164
|
(typeof wrappedVC.decoded?.vc?.issuer === 'string'
|
|
@@ -226,7 +224,7 @@ export const mapCredentialToAccept = async (args: MapCredentialToAcceptArgs): Pr
|
|
|
226
224
|
if (!hasher) {
|
|
227
225
|
return Promise.reject('a hasher is required for encoded SD-JWT credentials')
|
|
228
226
|
}
|
|
229
|
-
const asyncHasher = (data: string, algorithm: string) => Promise.resolve(hasher(data, algorithm))
|
|
227
|
+
const asyncHasher: Hasher = (data: string | ArrayBuffer, algorithm: string) => Promise.resolve(hasher(data, algorithm))
|
|
230
228
|
const decodedSdJwt = await CredentialMapper.decodeSdJwtVcAsync(wrappedVerifiableCredential.credential, asyncHasher)
|
|
231
229
|
uniformVerifiableCredential = sdJwtDecodedCredentialToUniformCredential(<SdJwtDecodedVerifiableCredential>decodedSdJwt)
|
|
232
230
|
} else if (CredentialMapper.isMsoMdocDecodedCredential(wrappedVerifiableCredential.credential)) {
|
|
@@ -621,7 +619,10 @@ export const getIssuanceCryptoSuite = async (opts: GetIssuanceCryptoSuiteArgs):
|
|
|
621
619
|
}
|
|
622
620
|
}
|
|
623
621
|
|
|
624
|
-
export const startFirstPartApplicationMachine = async (
|
|
622
|
+
export const startFirstPartApplicationMachine = async (
|
|
623
|
+
args: StartFirstPartApplicationMachine,
|
|
624
|
+
context: RequiredContext,
|
|
625
|
+
): Promise<AuthorizationChallengeCodeResponse | string> => {
|
|
625
626
|
const { openID4VCIClientState, stateNavigationListener, contact } = args
|
|
626
627
|
|
|
627
628
|
if (!openID4VCIClientState) {
|
|
@@ -636,8 +637,8 @@ export const startFirstPartApplicationMachine = async (args: StartFirstPartAppli
|
|
|
636
637
|
openID4VCIClientState,
|
|
637
638
|
contact,
|
|
638
639
|
agentContext: context,
|
|
639
|
-
stateNavigationListener
|
|
640
|
-
})
|
|
640
|
+
stateNavigationListener,
|
|
641
|
+
})
|
|
641
642
|
|
|
642
643
|
return new Promise((resolve, reject) => {
|
|
643
644
|
try {
|
|
@@ -645,20 +646,20 @@ export const startFirstPartApplicationMachine = async (args: StartFirstPartAppli
|
|
|
645
646
|
if (state.matches(FirstPartyMachineStateTypes.done)) {
|
|
646
647
|
const authorizationCodeResponse = state.context.authorizationCodeResponse
|
|
647
648
|
if (!authorizationCodeResponse) {
|
|
648
|
-
reject(Error('No authorizationCodeResponse acquired'))
|
|
649
|
+
reject(Error('No authorizationCodeResponse acquired'))
|
|
649
650
|
}
|
|
650
|
-
resolve(authorizationCodeResponse!)
|
|
651
|
+
resolve(authorizationCodeResponse!)
|
|
651
652
|
} else if (state.matches(FirstPartyMachineStateTypes.aborted)) {
|
|
652
|
-
resolve(FirstPartyMachineStateTypes.aborted)
|
|
653
|
+
resolve(FirstPartyMachineStateTypes.aborted)
|
|
653
654
|
} else if (state.matches(FirstPartyMachineStateTypes.declined)) {
|
|
654
|
-
resolve(FirstPartyMachineStateTypes.declined)
|
|
655
|
+
resolve(FirstPartyMachineStateTypes.declined)
|
|
655
656
|
} else if (state.matches(FirstPartyMachineStateTypes.error)) {
|
|
656
|
-
reject(state.context.error)
|
|
657
|
+
reject(state.context.error)
|
|
657
658
|
}
|
|
658
659
|
})
|
|
659
|
-
firstPartyMachineInstance.start()
|
|
660
|
+
firstPartyMachineInstance.start()
|
|
660
661
|
} catch (error) {
|
|
661
|
-
reject(error)
|
|
662
|
+
reject(error)
|
|
662
663
|
}
|
|
663
|
-
})
|
|
664
|
-
}
|
|
664
|
+
})
|
|
665
|
+
}
|
|
@@ -1,18 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
BaseActionObject,
|
|
3
|
-
Interpreter,
|
|
4
|
-
ResolveTypegenMeta,
|
|
5
|
-
ServiceMap, State,
|
|
6
|
-
StateMachine,
|
|
7
|
-
StatesConfig,
|
|
8
|
-
TypegenDisabled
|
|
9
|
-
} from 'xstate'
|
|
1
|
+
import { BaseActionObject, Interpreter, ResolveTypegenMeta, ServiceMap, State, StateMachine, StatesConfig, TypegenDisabled } from 'xstate'
|
|
10
2
|
import { OpenID4VCIClientState } from '@sphereon/oid4vci-client'
|
|
11
3
|
import { DidAuthConfig, Party } from '@sphereon/ssi-sdk.data-store'
|
|
12
|
-
import {
|
|
13
|
-
PresentationDefinitionWithLocation,
|
|
14
|
-
RPRegistrationMetadataPayload
|
|
15
|
-
} from '@sphereon/did-auth-siop'
|
|
4
|
+
import { PresentationDefinitionWithLocation, RPRegistrationMetadataPayload } from '@sphereon/did-auth-siop'
|
|
16
5
|
import { UniqueDigitalCredential } from '@sphereon/ssi-sdk.credential-store'
|
|
17
6
|
import { AuthorizationChallengeCodeResponse } from '@sphereon/oid4vci-common'
|
|
18
7
|
import { IIdentifier } from '@veramo/core'
|
|
@@ -27,7 +16,7 @@ export enum FirstPartyMachineStateTypes {
|
|
|
27
16
|
error = 'error',
|
|
28
17
|
done = 'done',
|
|
29
18
|
aborted = 'aborted',
|
|
30
|
-
declined = 'declined'
|
|
19
|
+
declined = 'declined',
|
|
31
20
|
}
|
|
32
21
|
|
|
33
22
|
export enum FirstPartyMachineServices {
|
|
@@ -37,7 +26,7 @@ export enum FirstPartyMachineServices {
|
|
|
37
26
|
getSiopRequest = 'getSiopRequest',
|
|
38
27
|
}
|
|
39
28
|
|
|
40
|
-
export type FirstPartyMachineStates = Record<FirstPartyMachineStateTypes, {}
|
|
29
|
+
export type FirstPartyMachineStates = Record<FirstPartyMachineStateTypes, {}>
|
|
41
30
|
|
|
42
31
|
export type FirstPartyMachineContext = {
|
|
43
32
|
openID4VCIClientState: OpenID4VCIClientState
|
|
@@ -50,115 +39,118 @@ export type FirstPartyMachineContext = {
|
|
|
50
39
|
authorizationRequestData?: SiopV2AuthorizationRequestData
|
|
51
40
|
presentationDuringIssuanceSession?: string
|
|
52
41
|
authorizationCodeResponse?: AuthorizationChallengeCodeResponse
|
|
53
|
-
error?: ErrorDetails
|
|
54
|
-
}
|
|
42
|
+
error?: ErrorDetails
|
|
43
|
+
}
|
|
55
44
|
|
|
56
45
|
export enum FirstPartyMachineEvents {
|
|
57
46
|
NEXT = 'NEXT',
|
|
58
47
|
PREVIOUS = 'PREVIOUS',
|
|
59
48
|
DECLINE = 'DECLINE',
|
|
60
|
-
SET_SELECTED_CREDENTIALS = 'SET_SELECTED_CREDENTIALS'
|
|
49
|
+
SET_SELECTED_CREDENTIALS = 'SET_SELECTED_CREDENTIALS',
|
|
61
50
|
}
|
|
62
51
|
|
|
63
|
-
export type FirstPartyNextEvent = {type: FirstPartyMachineEvents.NEXT}
|
|
64
|
-
export type FirstPartyPreviousEvent = {type: FirstPartyMachineEvents.PREVIOUS}
|
|
65
|
-
export type FirstPartyDeclineEvent = {type: FirstPartyMachineEvents.DECLINE}
|
|
52
|
+
export type FirstPartyNextEvent = { type: FirstPartyMachineEvents.NEXT }
|
|
53
|
+
export type FirstPartyPreviousEvent = { type: FirstPartyMachineEvents.PREVIOUS }
|
|
54
|
+
export type FirstPartyDeclineEvent = { type: FirstPartyMachineEvents.DECLINE }
|
|
66
55
|
export type FirstPartySelectCredentialsEvent = {
|
|
67
|
-
type: FirstPartyMachineEvents.SET_SELECTED_CREDENTIALS
|
|
68
|
-
data: Array<UniqueDigitalCredential
|
|
69
|
-
}
|
|
56
|
+
type: FirstPartyMachineEvents.SET_SELECTED_CREDENTIALS
|
|
57
|
+
data: Array<UniqueDigitalCredential>
|
|
58
|
+
}
|
|
70
59
|
|
|
71
|
-
export type FirstPartyMachineEventTypes =
|
|
72
|
-
FirstPartyNextEvent |
|
|
73
|
-
FirstPartyPreviousEvent |
|
|
74
|
-
FirstPartyDeclineEvent |
|
|
75
|
-
FirstPartySelectCredentialsEvent
|
|
60
|
+
export type FirstPartyMachineEventTypes = FirstPartyNextEvent | FirstPartyPreviousEvent | FirstPartyDeclineEvent | FirstPartySelectCredentialsEvent
|
|
76
61
|
|
|
77
62
|
export type FirstPartyMachineStatesConfig = StatesConfig<
|
|
78
63
|
FirstPartyMachineContext,
|
|
79
64
|
{
|
|
80
|
-
states: FirstPartyMachineStates
|
|
65
|
+
states: FirstPartyMachineStates
|
|
81
66
|
},
|
|
82
67
|
FirstPartyMachineEventTypes,
|
|
83
68
|
any
|
|
84
|
-
|
|
69
|
+
>
|
|
85
70
|
|
|
86
71
|
export type CreateFirstPartyMachineOpts = {
|
|
87
72
|
openID4VCIClientState: OpenID4VCIClientState
|
|
88
73
|
contact: Party
|
|
89
74
|
agentContext: RequiredContext
|
|
90
|
-
machineId?: string
|
|
91
|
-
}
|
|
75
|
+
machineId?: string
|
|
76
|
+
}
|
|
92
77
|
|
|
93
78
|
export type FirstPartyStateMachine = StateMachine<
|
|
94
79
|
FirstPartyMachineContext,
|
|
95
80
|
any,
|
|
96
81
|
FirstPartyMachineEventTypes,
|
|
97
82
|
{
|
|
98
|
-
value: any
|
|
99
|
-
context: FirstPartyMachineContext
|
|
83
|
+
value: any
|
|
84
|
+
context: FirstPartyMachineContext
|
|
100
85
|
},
|
|
101
86
|
BaseActionObject,
|
|
102
87
|
ServiceMap,
|
|
103
88
|
ResolveTypegenMeta<TypegenDisabled, FirstPartyMachineEventTypes, BaseActionObject, ServiceMap>
|
|
104
|
-
|
|
89
|
+
>
|
|
105
90
|
|
|
106
91
|
export type FirstPartyMachineInterpreter = Interpreter<
|
|
107
92
|
FirstPartyMachineContext,
|
|
108
93
|
any,
|
|
109
94
|
FirstPartyMachineEventTypes,
|
|
110
95
|
{
|
|
111
|
-
value: any
|
|
112
|
-
context: FirstPartyMachineContext
|
|
96
|
+
value: any
|
|
97
|
+
context: FirstPartyMachineContext
|
|
113
98
|
},
|
|
114
99
|
any
|
|
115
|
-
|
|
100
|
+
>
|
|
116
101
|
|
|
117
|
-
export type FirstPartyMachineStateNavigationListener = (
|
|
102
|
+
export type FirstPartyMachineStateNavigationListener = (
|
|
103
|
+
firstPartyMachine: FirstPartyMachineInterpreter,
|
|
104
|
+
state: FirstPartyMachineState,
|
|
105
|
+
navigation?: any,
|
|
106
|
+
) => Promise<void>
|
|
118
107
|
|
|
119
108
|
export type InstanceFirstPartyMachineOpts = {
|
|
120
|
-
services?: any
|
|
121
|
-
guards?: any
|
|
122
|
-
subscription?: () => void
|
|
123
|
-
requireCustomNavigationHook?: boolean
|
|
109
|
+
services?: any
|
|
110
|
+
guards?: any
|
|
111
|
+
subscription?: () => void
|
|
112
|
+
requireCustomNavigationHook?: boolean
|
|
124
113
|
stateNavigationListener?: FirstPartyMachineStateNavigationListener
|
|
125
|
-
} & CreateFirstPartyMachineOpts
|
|
114
|
+
} & CreateFirstPartyMachineOpts
|
|
126
115
|
|
|
127
116
|
export type FirstPartyMachineState = State<
|
|
128
117
|
FirstPartyMachineContext,
|
|
129
118
|
FirstPartyMachineEventTypes,
|
|
130
119
|
any,
|
|
131
120
|
{
|
|
132
|
-
value: any
|
|
133
|
-
context: FirstPartyMachineContext
|
|
121
|
+
value: any
|
|
122
|
+
context: FirstPartyMachineContext
|
|
134
123
|
},
|
|
135
124
|
any
|
|
136
|
-
|
|
125
|
+
>
|
|
137
126
|
|
|
138
|
-
export type FirstPartyMachineServiceDefinitions = Record<
|
|
139
|
-
keyof typeof FirstPartyMachineServices,
|
|
140
|
-
(...args: Array<any>) => any
|
|
141
|
-
>;
|
|
127
|
+
export type FirstPartyMachineServiceDefinitions = Record<keyof typeof FirstPartyMachineServices, (...args: Array<any>) => any>
|
|
142
128
|
|
|
143
|
-
export type SendAuthorizationChallengeRequestArgs = Pick<
|
|
129
|
+
export type SendAuthorizationChallengeRequestArgs = Pick<
|
|
130
|
+
FirstPartyMachineContext,
|
|
131
|
+
'openID4VCIClientState' | 'authSession' | 'presentationDuringIssuanceSession'
|
|
132
|
+
>
|
|
144
133
|
|
|
145
|
-
export type SendAuthorizationResponseArgs = Pick<
|
|
134
|
+
export type SendAuthorizationResponseArgs = Pick<
|
|
135
|
+
FirstPartyMachineContext,
|
|
136
|
+
'authSession' | 'presentationUri' | 'didAuthConfig' | 'authorizationRequestData' | 'selectedCredentials'
|
|
137
|
+
>
|
|
146
138
|
|
|
147
139
|
export type CreateConfigArgs = Pick<FirstPartyMachineContext, 'presentationUri' | 'identifier'>
|
|
148
140
|
|
|
149
141
|
export type GetSiopRequestArgs = Pick<FirstPartyMachineContext, 'didAuthConfig' | 'presentationUri'>
|
|
150
142
|
|
|
151
143
|
export type SiopV2AuthorizationRequestData = {
|
|
152
|
-
correlationId: string
|
|
153
|
-
registrationMetadataPayload: RPRegistrationMetadataPayload
|
|
154
|
-
issuer?: string
|
|
155
|
-
name?: string
|
|
156
|
-
uri?: URL
|
|
157
|
-
clientIdScheme?: string
|
|
158
|
-
clientId?: string
|
|
159
|
-
entityId?: string
|
|
160
|
-
presentationDefinitions?: PresentationDefinitionWithLocation[]
|
|
161
|
-
}
|
|
144
|
+
correlationId: string
|
|
145
|
+
registrationMetadataPayload: RPRegistrationMetadataPayload
|
|
146
|
+
issuer?: string
|
|
147
|
+
name?: string
|
|
148
|
+
uri?: URL
|
|
149
|
+
clientIdScheme?: string
|
|
150
|
+
clientId?: string
|
|
151
|
+
entityId?: string
|
|
152
|
+
presentationDefinitions?: PresentationDefinitionWithLocation[]
|
|
153
|
+
}
|
|
162
154
|
|
|
163
155
|
export type FirstPartyMachineNavigationArgs = {
|
|
164
156
|
firstPartyMachine: FirstPartyMachineInterpreter
|
|
@@ -7,12 +7,12 @@ import {
|
|
|
7
7
|
CredentialConfigurationSupported,
|
|
8
8
|
CredentialOfferRequestWithBaseUrl,
|
|
9
9
|
CredentialResponse,
|
|
10
|
+
CredentialsSupportedDisplay,
|
|
10
11
|
EndpointMetadataResult,
|
|
11
12
|
ExperimentalSubjectIssuance,
|
|
13
|
+
IssuerCredentialSubject,
|
|
12
14
|
MetadataDisplay,
|
|
13
15
|
NotificationRequest,
|
|
14
|
-
CredentialsSupportedDisplay,
|
|
15
|
-
IssuerCredentialSubject,
|
|
16
16
|
} from '@sphereon/oid4vci-common'
|
|
17
17
|
import { DynamicRegistrationClientMetadata } from '@sphereon/oid4vc-common'
|
|
18
18
|
import { CreateOrGetIdentifierOpts, IdentifierProviderOpts, SupportedDidMethodEnum } from '@sphereon/ssi-sdk-ext.did-utils'
|
|
@@ -40,16 +40,16 @@ import { ISDJwtPlugin } from '@sphereon/ssi-sdk.sd-jwt'
|
|
|
40
40
|
import { ICredentialValidation, SchemaValidation } from '@sphereon/ssi-sdk.credential-validation'
|
|
41
41
|
import { IDidAuthSiopOpAuthenticator } from '@sphereon/ssi-sdk.siopv2-oid4vp-op-auth'
|
|
42
42
|
import {
|
|
43
|
-
|
|
43
|
+
HasherSync,
|
|
44
44
|
IVerifiableCredential,
|
|
45
45
|
JoseSignatureAlgorithm,
|
|
46
46
|
JoseSignatureAlgorithmString,
|
|
47
47
|
OriginalVerifiableCredential,
|
|
48
|
-
SdJwtTypeDisplayMetadata,
|
|
49
48
|
SdJwtClaimMetadata,
|
|
49
|
+
SdJwtTypeDisplayMetadata,
|
|
50
50
|
W3CVerifiableCredential,
|
|
51
51
|
WrappedVerifiableCredential,
|
|
52
|
-
WrappedVerifiablePresentation
|
|
52
|
+
WrappedVerifiablePresentation,
|
|
53
53
|
} from '@sphereon/ssi-types'
|
|
54
54
|
import {
|
|
55
55
|
IAgentContext,
|
|
@@ -110,7 +110,7 @@ export type OID4VCIHolderOptions = {
|
|
|
110
110
|
defaultAuthorizationRequestOptions?: AuthorizationRequestOpts
|
|
111
111
|
didMethodPreferences?: Array<SupportedDidMethodEnum>
|
|
112
112
|
jwtCryptographicSuitePreferences?: Array<JoseSignatureAlgorithm | JoseSignatureAlgorithmString>
|
|
113
|
-
hasher?:
|
|
113
|
+
hasher?: HasherSync
|
|
114
114
|
}
|
|
115
115
|
|
|
116
116
|
export type OnContactIdentityCreatedArgs = {
|
|
@@ -173,7 +173,9 @@ export type SendNotificationArgs = Pick<
|
|
|
173
173
|
'credentialsToAccept' | 'serverMetadata' | 'credentialsSupported' | 'openID4VCIClientState'
|
|
174
174
|
> & { notificationRequest?: NotificationRequest; stored: boolean }
|
|
175
175
|
export type GetFederationTrustArgs = Pick<OID4VCIMachineContext, 'requestData' | 'trustAnchors' | 'serverMetadata'>
|
|
176
|
-
export type StartFirstPartApplicationMachine = Pick<OID4VCIMachineContext, 'openID4VCIClientState' | 'contact'> & {
|
|
176
|
+
export type StartFirstPartApplicationMachine = Pick<OID4VCIMachineContext, 'openID4VCIClientState' | 'contact'> & {
|
|
177
|
+
stateNavigationListener?: FirstPartyMachineStateNavigationListener
|
|
178
|
+
}
|
|
177
179
|
|
|
178
180
|
export enum OID4VCIHolderEvent {
|
|
179
181
|
CONTACT_IDENTITY_CREATED = 'contact_identity_created',
|
|
@@ -199,7 +201,7 @@ export enum SupportedLanguage {
|
|
|
199
201
|
export type VerifyCredentialToAcceptArgs = {
|
|
200
202
|
mappedCredential: MappedCredentialToAccept
|
|
201
203
|
onVerifyEBSICredentialIssuer?: (args: VerifyEBSICredentialIssuerArgs) => Promise<VerifyEBSICredentialIssuerResult>
|
|
202
|
-
hasher?:
|
|
204
|
+
hasher?: HasherSync
|
|
203
205
|
schemaValidation?: SchemaValidation
|
|
204
206
|
context: RequiredContext
|
|
205
207
|
}
|
|
@@ -319,7 +321,11 @@ export type CreateOID4VCIMachineOpts = {
|
|
|
319
321
|
issuanceOpt?: IssuanceOpts
|
|
320
322
|
}
|
|
321
323
|
|
|
322
|
-
export type OID4VCIMachineStateNavigationListener = (
|
|
324
|
+
export type OID4VCIMachineStateNavigationListener = (
|
|
325
|
+
oid4vciMachine: OID4VCIMachineInterpreter,
|
|
326
|
+
state: OID4VCIMachineState,
|
|
327
|
+
navigation?: any,
|
|
328
|
+
) => Promise<void>
|
|
323
329
|
|
|
324
330
|
export type OID4VCIMachineInstanceOpts = {
|
|
325
331
|
services?: any
|
|
@@ -378,7 +384,7 @@ export enum OID4VCIMachineGuards {
|
|
|
378
384
|
hasSelectedCredentialsGuard = 'oid4vciHasSelectedCredentialsGuard',
|
|
379
385
|
isOIDFOriginGuard = 'oid4vciIsOIDFOriginGuard',
|
|
380
386
|
contactHasLowTrustGuard = 'oid4vciContactHasLowTrustGuard',
|
|
381
|
-
isFirstPartyApplication = 'oid4vciIsFirstPartyApplication'
|
|
387
|
+
isFirstPartyApplication = 'oid4vciIsFirstPartyApplication',
|
|
382
388
|
}
|
|
383
389
|
|
|
384
390
|
export enum OID4VCIMachineServices {
|
|
@@ -394,13 +400,10 @@ export enum OID4VCIMachineServices {
|
|
|
394
400
|
storeCredentialBranding = 'storeCredentialBranding',
|
|
395
401
|
sendNotification = 'sendNotification',
|
|
396
402
|
storeCredentials = 'storeCredentials',
|
|
397
|
-
startFirstPartApplicationFlow = 'startFirstPartApplicationFlow'
|
|
403
|
+
startFirstPartApplicationFlow = 'startFirstPartApplicationFlow',
|
|
398
404
|
}
|
|
399
405
|
|
|
400
|
-
export type OID4VCIMachineServiceDefinitions = Record<
|
|
401
|
-
keyof typeof OID4VCIMachineServices,
|
|
402
|
-
(...args: Array<any>) => any
|
|
403
|
-
>;
|
|
406
|
+
export type OID4VCIMachineServiceDefinitions = Record<keyof typeof OID4VCIMachineServices, (...args: Array<any>) => any>
|
|
404
407
|
|
|
405
408
|
export type NextEvent = { type: OID4VCIMachineEvents.NEXT }
|
|
406
409
|
export type PreviousEvent = { type: OID4VCIMachineEvents.PREVIOUS }
|
|
@@ -411,8 +414,8 @@ export type VerificationCodeEvent = { type: OID4VCIMachineEvents.SET_VERIFICATIO
|
|
|
411
414
|
export type ContactConsentEvent = { type: OID4VCIMachineEvents.SET_CONTACT_CONSENT; data: boolean }
|
|
412
415
|
export type ContactAliasEvent = { type: OID4VCIMachineEvents.SET_CONTACT_ALIAS; data: string }
|
|
413
416
|
export type SetAuthorizationCodeURLEvent = { type: OID4VCIMachineEvents.SET_AUTHORIZATION_CODE_URL; data: string }
|
|
414
|
-
export type InvokeAuthorizationRequestEvent = { type: OID4VCIMachineEvents.INVOKED_AUTHORIZATION_CODE_REQUEST
|
|
415
|
-
export type AuthorizationResponseEvent = { type: OID4VCIMachineEvents.PROVIDE_AUTHORIZATION_CODE_RESPONSE
|
|
417
|
+
export type InvokeAuthorizationRequestEvent = { type: OID4VCIMachineEvents.INVOKED_AUTHORIZATION_CODE_REQUEST; data: string }
|
|
418
|
+
export type AuthorizationResponseEvent = { type: OID4VCIMachineEvents.PROVIDE_AUTHORIZATION_CODE_RESPONSE; data: string | AuthorizationResponse }
|
|
416
419
|
|
|
417
420
|
export type OID4VCIMachineEventTypes =
|
|
418
421
|
| NextEvent
|
|
@@ -539,7 +542,7 @@ export type GetPreferredCredentialFormatsArgs = {
|
|
|
539
542
|
|
|
540
543
|
export type MapCredentialToAcceptArgs = {
|
|
541
544
|
credentialToAccept: CredentialToAccept
|
|
542
|
-
hasher?:
|
|
545
|
+
hasher?: HasherSync
|
|
543
546
|
}
|
|
544
547
|
|
|
545
548
|
export type GetDefaultIssuanceOptsArgs = {
|
|
@@ -632,7 +635,7 @@ export type CredentialVerificationError = {
|
|
|
632
635
|
|
|
633
636
|
export type VerifyMdocArgs = { credential: string }
|
|
634
637
|
|
|
635
|
-
export type VerifySDJWTCredentialArgs = { credential: string; hasher?:
|
|
638
|
+
export type VerifySDJWTCredentialArgs = { credential: string; hasher?: HasherSync }
|
|
636
639
|
|
|
637
640
|
export interface VerifyCredentialArgs {
|
|
638
641
|
credential: OriginalVerifiableCredential
|
|
@@ -720,17 +723,17 @@ export type DidAgents = TAgent<IResolver & IDIDManager>
|
|
|
720
723
|
|
|
721
724
|
export type RequiredContext = IAgentContext<
|
|
722
725
|
IIssuanceBranding &
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
726
|
+
IContactManager &
|
|
727
|
+
ICredentialValidation &
|
|
728
|
+
ICredentialVerifier &
|
|
729
|
+
ICredentialIssuer &
|
|
730
|
+
ICredentialStore &
|
|
731
|
+
IIdentifierResolution &
|
|
732
|
+
IJwtService &
|
|
733
|
+
IDIDManager &
|
|
734
|
+
IResolver &
|
|
735
|
+
IKeyManager &
|
|
736
|
+
ISDJwtPlugin &
|
|
737
|
+
ImDLMdoc &
|
|
738
|
+
IDidAuthSiopOpAuthenticator
|
|
736
739
|
>
|