@sphereon/ssi-sdk.oid4vci-holder 0.36.1-feature.SSISDK.82.and.SSISDK.70.35 → 0.36.1-next.11
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 +13 -19
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -9
- package/dist/index.d.ts +3 -9
- package/dist/index.js +13 -19
- package/dist/index.js.map +1 -1
- package/package.json +24 -24
- package/src/agent/OID4VCIHolder.ts +3 -13
- package/src/link-handler/index.ts +2 -5
- package/src/machines/oid4vciMachine.ts +9 -2
- package/src/services/OID4VCIHolderService.ts +1 -1
- package/src/types/IOID4VCIHolder.ts +1 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sphereon/ssi-sdk.oid4vci-holder",
|
|
3
|
-
"version": "0.36.1-
|
|
3
|
+
"version": "0.36.1-next.11+262d209a",
|
|
4
4
|
"source": "src/index.ts",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -26,27 +26,27 @@
|
|
|
26
26
|
"build": "tsup --config ../../tsup.config.ts --tsconfig ../../tsconfig.tsup.json"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@sphereon/did-auth-siop": "0.20.
|
|
29
|
+
"@sphereon/did-auth-siop": "0.20.1-next.3",
|
|
30
30
|
"@sphereon/kmp-mdoc-core": "0.2.0-SNAPSHOT.26",
|
|
31
|
-
"@sphereon/oid4vci-client": "0.20.
|
|
32
|
-
"@sphereon/oid4vci-common": "0.20.
|
|
33
|
-
"@sphereon/ssi-sdk-ext.did-utils": "0.36.1-
|
|
34
|
-
"@sphereon/ssi-sdk-ext.identifier-resolution": "0.36.1-
|
|
35
|
-
"@sphereon/ssi-sdk-ext.jwt-service": "0.36.1-
|
|
36
|
-
"@sphereon/ssi-sdk-ext.key-utils": "0.36.1-
|
|
37
|
-
"@sphereon/ssi-sdk.contact-manager": "0.36.1-
|
|
38
|
-
"@sphereon/ssi-sdk.core": "0.36.1-
|
|
39
|
-
"@sphereon/ssi-sdk.credential-store": "0.36.1-
|
|
40
|
-
"@sphereon/ssi-sdk.credential-validation": "0.36.1-
|
|
41
|
-
"@sphereon/ssi-sdk.data-store-types": "0.36.1-
|
|
42
|
-
"@sphereon/ssi-sdk.issuance-branding": "0.36.1-
|
|
43
|
-
"@sphereon/ssi-sdk.mdl-mdoc": "0.36.1-
|
|
44
|
-
"@sphereon/ssi-sdk.oidf-client": "0.36.1-
|
|
45
|
-
"@sphereon/ssi-sdk.sd-jwt": "0.36.1-
|
|
46
|
-
"@sphereon/ssi-sdk.siopv2-oid4vp-common": "0.36.1-
|
|
47
|
-
"@sphereon/ssi-sdk.siopv2-oid4vp-op-auth": "0.36.1-
|
|
48
|
-
"@sphereon/ssi-sdk.xstate-machine-persistence": "0.36.1-
|
|
49
|
-
"@sphereon/ssi-types": "0.36.1-
|
|
31
|
+
"@sphereon/oid4vci-client": "0.20.1-next.3",
|
|
32
|
+
"@sphereon/oid4vci-common": "0.20.1-next.3",
|
|
33
|
+
"@sphereon/ssi-sdk-ext.did-utils": "0.36.1-next.11+262d209a",
|
|
34
|
+
"@sphereon/ssi-sdk-ext.identifier-resolution": "0.36.1-next.11+262d209a",
|
|
35
|
+
"@sphereon/ssi-sdk-ext.jwt-service": "0.36.1-next.11+262d209a",
|
|
36
|
+
"@sphereon/ssi-sdk-ext.key-utils": "0.36.1-next.11+262d209a",
|
|
37
|
+
"@sphereon/ssi-sdk.contact-manager": "0.36.1-next.11+262d209a",
|
|
38
|
+
"@sphereon/ssi-sdk.core": "0.36.1-next.11+262d209a",
|
|
39
|
+
"@sphereon/ssi-sdk.credential-store": "0.36.1-next.11+262d209a",
|
|
40
|
+
"@sphereon/ssi-sdk.credential-validation": "0.36.1-next.11+262d209a",
|
|
41
|
+
"@sphereon/ssi-sdk.data-store-types": "0.36.1-next.11+262d209a",
|
|
42
|
+
"@sphereon/ssi-sdk.issuance-branding": "0.36.1-next.11+262d209a",
|
|
43
|
+
"@sphereon/ssi-sdk.mdl-mdoc": "0.36.1-next.11+262d209a",
|
|
44
|
+
"@sphereon/ssi-sdk.oidf-client": "0.36.1-next.11+262d209a",
|
|
45
|
+
"@sphereon/ssi-sdk.sd-jwt": "0.36.1-next.11+262d209a",
|
|
46
|
+
"@sphereon/ssi-sdk.siopv2-oid4vp-common": "0.36.1-next.11+262d209a",
|
|
47
|
+
"@sphereon/ssi-sdk.siopv2-oid4vp-op-auth": "0.36.1-next.11+262d209a",
|
|
48
|
+
"@sphereon/ssi-sdk.xstate-machine-persistence": "0.36.1-next.11+262d209a",
|
|
49
|
+
"@sphereon/ssi-types": "0.36.1-next.11+262d209a",
|
|
50
50
|
"@veramo/core": "4.2.0",
|
|
51
51
|
"@veramo/data-store": "4.2.0",
|
|
52
52
|
"@veramo/utils": "4.2.0",
|
|
@@ -59,8 +59,8 @@
|
|
|
59
59
|
"xstate": "^4.38.3"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
|
-
"@sphereon/oid4vc-common": "0.20.
|
|
63
|
-
"@sphereon/ssi-sdk-ext.did-resolver-jwk": "0.36.1-
|
|
62
|
+
"@sphereon/oid4vc-common": "0.20.1-feat.SSISDK.83.1",
|
|
63
|
+
"@sphereon/ssi-sdk-ext.did-resolver-jwk": "0.36.1-next.11+262d209a",
|
|
64
64
|
"@sphereon/ssi-sdk.siopv2-oid4vp-common": "workspace:*",
|
|
65
65
|
"@types/i18n-js": "^3.8.9",
|
|
66
66
|
"@types/lodash.memoize": "^4.1.9",
|
|
@@ -90,5 +90,5 @@
|
|
|
90
90
|
"OID4VCI",
|
|
91
91
|
"State Machine"
|
|
92
92
|
],
|
|
93
|
-
"gitHead": "
|
|
93
|
+
"gitHead": "262d209a803fecfba1ad5878724c4f6f91f86cec"
|
|
94
94
|
}
|
|
@@ -123,7 +123,6 @@ import {
|
|
|
123
123
|
VerificationResult,
|
|
124
124
|
VerifyEBSICredentialIssuerArgs,
|
|
125
125
|
VerifyEBSICredentialIssuerResult,
|
|
126
|
-
WalletType,
|
|
127
126
|
} from '../types/IOID4VCIHolder'
|
|
128
127
|
|
|
129
128
|
/**
|
|
@@ -494,7 +493,7 @@ export class OID4VCIHolder implements IAgentPlugin {
|
|
|
494
493
|
if (!clientId) {
|
|
495
494
|
return Promise.reject(Error(`Missing client id in contact's connectionConfig`))
|
|
496
495
|
}
|
|
497
|
-
const client = await
|
|
496
|
+
const client = await OpenID4VCIClient.fromState({ state: openID4VCIClientState })
|
|
498
497
|
const authorizationCodeURL = await client.createAuthorizationRequestUrl({
|
|
499
498
|
authorizationRequest: {
|
|
500
499
|
clientId: clientId,
|
|
@@ -618,7 +617,7 @@ export class OID4VCIHolder implements IAgentPlugin {
|
|
|
618
617
|
}
|
|
619
618
|
|
|
620
619
|
private async oid4vciHolderGetCredentials(args: GetCredentialsArgs, context: RequiredContext): Promise<Array<MappedCredentialToAccept>> {
|
|
621
|
-
const { verificationCode, openID4VCIClientState, didMethodPreferences, issuanceOpt, accessTokenOpts
|
|
620
|
+
const { verificationCode, openID4VCIClientState, didMethodPreferences = this.didMethodPreferences, issuanceOpt, accessTokenOpts } = args
|
|
622
621
|
logger.debug(`Getting credentials`, issuanceOpt, accessTokenOpts)
|
|
623
622
|
|
|
624
623
|
if (!openID4VCIClientState) {
|
|
@@ -637,7 +636,7 @@ export class OID4VCIHolder implements IAgentPlugin {
|
|
|
637
636
|
credentialsSupported,
|
|
638
637
|
serverMetadata,
|
|
639
638
|
context,
|
|
640
|
-
didMethodPreferences:
|
|
639
|
+
didMethodPreferences: Array.isArray(didMethodPreferences) && didMethodPreferences.length > 0 ? didMethodPreferences : this.didMethodPreferences,
|
|
641
640
|
jwtCryptographicSuitePreferences: this.jwtCryptographicSuitePreferences,
|
|
642
641
|
jsonldCryptographicSuitePreferences: this.jsonldCryptographicSuitePreferences,
|
|
643
642
|
...(issuanceOpt && { forceIssuanceOpt: issuanceOpt }),
|
|
@@ -662,15 +661,6 @@ export class OID4VCIHolder implements IAgentPlugin {
|
|
|
662
661
|
return allCredentials
|
|
663
662
|
}
|
|
664
663
|
|
|
665
|
-
private selectDidMethodPreferences(didMethodPreferences: Array<SupportedDidMethodEnum> | undefined, walletType: WalletType) {
|
|
666
|
-
const supportedDidMethodEnums =
|
|
667
|
-
Array.isArray(didMethodPreferences) && didMethodPreferences.length > 0 ? didMethodPreferences : this.didMethodPreferences
|
|
668
|
-
if (walletType === 'ORGANIZATIONAL') {
|
|
669
|
-
return [SupportedDidMethodEnum.DID_WEB, ...supportedDidMethodEnums]
|
|
670
|
-
}
|
|
671
|
-
return supportedDidMethodEnums
|
|
672
|
-
}
|
|
673
|
-
|
|
674
664
|
private async oid4vciHolderGetCredential(args: GetCredentialArgs, context: RequiredContext): Promise<MappedCredentialToAccept> {
|
|
675
665
|
const { issuanceOpt, pin, client, accessTokenOpts } = args
|
|
676
666
|
logger.info(`Getting credential`, issuanceOpt)
|
|
@@ -3,7 +3,7 @@ import { AuthorizationRequestOpts, AuthorizationServerClientOpts, AuthzFlowType,
|
|
|
3
3
|
import { DefaultLinkPriorities, LinkHandlerAdapter } from '@sphereon/ssi-sdk.core'
|
|
4
4
|
import { IMachineStatePersistence, interpreterStartOrResume, SerializableState } from '@sphereon/ssi-sdk.xstate-machine-persistence'
|
|
5
5
|
import { IAgentContext } from '@veramo/core'
|
|
6
|
-
import { GetMachineArgs, IOID4VCIHolder, OID4VCIMachineEvents, OID4VCIMachineStateNavigationListener
|
|
6
|
+
import { GetMachineArgs, IOID4VCIHolder, OID4VCIMachineEvents, OID4VCIMachineStateNavigationListener } from '../types/IOID4VCIHolder'
|
|
7
7
|
import { FirstPartyMachineStateNavigationListener } from '../types/FirstPartyMachine'
|
|
8
8
|
|
|
9
9
|
/**
|
|
@@ -14,7 +14,6 @@ export class OID4VCIHolderLinkHandler extends LinkHandlerAdapter {
|
|
|
14
14
|
private readonly stateNavigationListener?: OID4VCIMachineStateNavigationListener
|
|
15
15
|
private readonly firstPartyStateNavigationListener?: FirstPartyMachineStateNavigationListener
|
|
16
16
|
private readonly noStateMachinePersistence: boolean
|
|
17
|
-
private readonly walletType: WalletType
|
|
18
17
|
private readonly authorizationRequestOpts?: AuthorizationRequestOpts
|
|
19
18
|
private readonly clientOpts?: AuthorizationServerClientOpts
|
|
20
19
|
private readonly trustAnchors?: Array<string>
|
|
@@ -22,7 +21,7 @@ export class OID4VCIHolderLinkHandler extends LinkHandlerAdapter {
|
|
|
22
21
|
constructor(
|
|
23
22
|
args: Pick<
|
|
24
23
|
GetMachineArgs,
|
|
25
|
-
'stateNavigationListener' | 'authorizationRequestOpts' | 'clientOpts' | 'trustAnchors' | 'firstPartyStateNavigationListener'
|
|
24
|
+
'stateNavigationListener' | 'authorizationRequestOpts' | 'clientOpts' | 'trustAnchors' | 'firstPartyStateNavigationListener'
|
|
26
25
|
> & {
|
|
27
26
|
priority?: number | DefaultLinkPriorities
|
|
28
27
|
protocols?: Array<string | RegExp>
|
|
@@ -34,7 +33,6 @@ export class OID4VCIHolderLinkHandler extends LinkHandlerAdapter {
|
|
|
34
33
|
this.authorizationRequestOpts = args.authorizationRequestOpts
|
|
35
34
|
this.clientOpts = args.clientOpts
|
|
36
35
|
this.context = args.context
|
|
37
|
-
this.walletType = args.walletType ?? 'NATURAL_PERSON'
|
|
38
36
|
this.noStateMachinePersistence = args.noStateMachinePersistence === true
|
|
39
37
|
this.stateNavigationListener = args.stateNavigationListener
|
|
40
38
|
this.firstPartyStateNavigationListener = args.firstPartyStateNavigationListener
|
|
@@ -70,7 +68,6 @@ export class OID4VCIHolderLinkHandler extends LinkHandlerAdapter {
|
|
|
70
68
|
...((clientOpts.clientId || clientOpts.clientAssertionType) && { clientOpts: clientOpts as AuthorizationServerClientOpts }),
|
|
71
69
|
stateNavigationListener: this.stateNavigationListener,
|
|
72
70
|
firstPartyStateNavigationListener: this.firstPartyStateNavigationListener,
|
|
73
|
-
walletType: this.walletType,
|
|
74
71
|
})
|
|
75
72
|
|
|
76
73
|
const interpreter = oid4vciMachine.interpreter
|
|
@@ -126,7 +126,6 @@ const createOID4VCIMachine = (opts?: CreateOID4VCIMachineOpts): OID4VCIStateMach
|
|
|
126
126
|
// 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
|
|
127
127
|
accessTokenOpts: opts?.accessTokenOpts,
|
|
128
128
|
requestData: opts?.requestData,
|
|
129
|
-
walletType: opts?.walletType ?? 'NATURAL_PERSON',
|
|
130
129
|
trustAnchors: opts?.trustAnchors ?? [],
|
|
131
130
|
issuanceOpt: opts?.issuanceOpt,
|
|
132
131
|
didMethodPreferences: opts?.didMethodPreferences,
|
|
@@ -348,7 +347,7 @@ const createOID4VCIMachine = (opts?: CreateOID4VCIMachineOpts): OID4VCIStateMach
|
|
|
348
347
|
cond: OID4VCIMachineGuards.isFirstPartyApplication,
|
|
349
348
|
},
|
|
350
349
|
{
|
|
351
|
-
target: OID4VCIMachineStates.
|
|
350
|
+
target: OID4VCIMachineStates.initiateAuthorizationRequest,
|
|
352
351
|
cond: OID4VCIMachineGuards.requireAuthorizationGuard,
|
|
353
352
|
},
|
|
354
353
|
{
|
|
@@ -445,6 +444,10 @@ const createOID4VCIMachine = (opts?: CreateOID4VCIMachineOpts): OID4VCIStateMach
|
|
|
445
444
|
target: OID4VCIMachineStates.prepareAuthorizationRequest,
|
|
446
445
|
cond: OID4VCIMachineGuards.requireAuthorizationGuard,
|
|
447
446
|
},
|
|
447
|
+
{
|
|
448
|
+
target: OID4VCIMachineStates.initiateAuthorizationRequest,
|
|
449
|
+
cond: OID4VCIMachineGuards.requireAuthorizationGuard,
|
|
450
|
+
},
|
|
448
451
|
{
|
|
449
452
|
target: OID4VCIMachineStates.verifyPin,
|
|
450
453
|
cond: OID4VCIMachineGuards.requirePinGuard,
|
|
@@ -521,6 +524,10 @@ const createOID4VCIMachine = (opts?: CreateOID4VCIMachineOpts): OID4VCIStateMach
|
|
|
521
524
|
target: OID4VCIMachineStates.verifyPin,
|
|
522
525
|
cond: OID4VCIMachineGuards.requirePinGuard,
|
|
523
526
|
},
|
|
527
|
+
{
|
|
528
|
+
target: OID4VCIMachineStates.prepareAuthorizationRequest,
|
|
529
|
+
cond: OID4VCIMachineGuards.requireAuthorizationGuard,
|
|
530
|
+
},
|
|
524
531
|
{
|
|
525
532
|
target: OID4VCIMachineStates.getCredentials,
|
|
526
533
|
},
|
|
@@ -214,7 +214,7 @@ export const mapCredentialToAccept = async (args: MapCredentialToAcceptArgs): Pr
|
|
|
214
214
|
if (!hasher) {
|
|
215
215
|
return Promise.reject('a hasher is required for encoded SD-JWT credentials')
|
|
216
216
|
}
|
|
217
|
-
const asyncHasher: Hasher = (data: string | ArrayBuffer
|
|
217
|
+
const asyncHasher: Hasher = (data: string | ArrayBuffer, algorithm: string) => Promise.resolve(hasher(data, algorithm))
|
|
218
218
|
const decodedSdJwt = await CredentialMapper.decodeSdJwtVcAsync(wrappedVerifiableCredential.credential, asyncHasher)
|
|
219
219
|
uniformVerifiableCredential = sdJwtDecodedCredentialToUniformCredential(<SdJwtDecodedVerifiableCredential>decodedSdJwt)
|
|
220
220
|
} else if (CredentialMapper.isMsoMdocDecodedCredential(wrappedVerifiableCredential.credential)) {
|
|
@@ -136,7 +136,6 @@ export type OnIdentifierCreatedArgs = {
|
|
|
136
136
|
|
|
137
137
|
export type GetMachineArgs = {
|
|
138
138
|
requestData: RequestData
|
|
139
|
-
walletType: WalletType
|
|
140
139
|
trustAnchors?: Array<string>
|
|
141
140
|
authorizationRequestOpts?: AuthorizationRequestOpts
|
|
142
141
|
clientOpts?: AuthorizationServerClientOpts
|
|
@@ -158,7 +157,7 @@ export type CreateCredentialsToSelectFromArgs = Pick<
|
|
|
158
157
|
export type GetContactArgs = Pick<OID4VCIMachineContext, 'serverMetadata'>
|
|
159
158
|
export type GetCredentialsArgs = Pick<
|
|
160
159
|
OID4VCIMachineContext,
|
|
161
|
-
'verificationCode' | 'openID4VCIClientState' | 'selectedCredentials' | 'didMethodPreferences' | 'issuanceOpt' | 'accessTokenOpts'
|
|
160
|
+
'verificationCode' | 'openID4VCIClientState' | 'selectedCredentials' | 'didMethodPreferences' | 'issuanceOpt' | 'accessTokenOpts'
|
|
162
161
|
>
|
|
163
162
|
export type AddContactIdentityArgs = Pick<OID4VCIMachineContext, 'credentialsToAccept' | 'contact'>
|
|
164
163
|
export type GetIssuerBrandingArgs = Pick<OID4VCIMachineContext, 'serverMetadata' | 'contact'>
|
|
@@ -234,7 +233,6 @@ export type OID4VCIMachineContext = {
|
|
|
234
233
|
openID4VCIClientState?: OpenID4VCIClientState
|
|
235
234
|
credentialToSelectFrom: Array<CredentialToSelectFromResult>
|
|
236
235
|
contactAlias: string
|
|
237
|
-
walletType: WalletType
|
|
238
236
|
contact?: Party
|
|
239
237
|
selectedCredentials: Array<string>
|
|
240
238
|
credentialsToAccept: Array<MappedCredentialToAccept>
|
|
@@ -318,7 +316,6 @@ export type OID4VCIStateMachine = StateMachine<
|
|
|
318
316
|
|
|
319
317
|
export type CreateOID4VCIMachineOpts = {
|
|
320
318
|
requestData: RequestData
|
|
321
|
-
walletType: WalletType
|
|
322
319
|
machineName?: string
|
|
323
320
|
locale?: string
|
|
324
321
|
trustAnchors?: Array<string>
|
|
@@ -732,8 +729,6 @@ export type DynamicRegistrationClientMetadataDisplay = Pick<
|
|
|
732
729
|
'client_name' | 'client_uri' | 'contacts' | 'tos_uri' | 'policy_uri' | 'logo_uri'
|
|
733
730
|
>
|
|
734
731
|
|
|
735
|
-
export type WalletType = 'NATURAL_PERSON' | 'ORGANIZATIONAL'
|
|
736
|
-
|
|
737
732
|
export type DidAgents = TAgent<IResolver & IDIDManager>
|
|
738
733
|
|
|
739
734
|
export type RequiredContext = IAgentContext<
|