@sphereon/ssi-sdk.oid4vci-holder 0.34.1-feature.SSISDK.78.280 → 0.34.1-feature.SSISDK.82.and.SSISDK.70.345
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +34 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +18 -12
- package/dist/index.d.ts +18 -12
- package/dist/index.js +35 -13
- package/dist/index.js.map +1 -1
- package/package.json +24 -24
- package/src/agent/OID4VCIHolder.ts +24 -15
- package/src/link-handler/index.ts +5 -2
- package/src/machines/oid4vciMachine.ts +10 -1
- package/src/services/OID4VCIHolderService.ts +2 -4
- package/src/types/IOID4VCIHolder.ts +16 -11
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sphereon/ssi-sdk.oid4vci-holder",
|
|
3
|
-
"version": "0.34.1-feature.SSISDK.
|
|
3
|
+
"version": "0.34.1-feature.SSISDK.82.and.SSISDK.70.345+e5abbf1a",
|
|
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.19.1-next.
|
|
29
|
+
"@sphereon/did-auth-siop": "0.19.1-next.234",
|
|
30
30
|
"@sphereon/kmp-mdoc-core": "0.2.0-SNAPSHOT.26",
|
|
31
|
-
"@sphereon/oid4vci-client": "0.19.1-next.
|
|
32
|
-
"@sphereon/oid4vci-common": "0.19.1-next.
|
|
33
|
-
"@sphereon/ssi-sdk-ext.did-utils": "0.34.1-feature.SSISDK.
|
|
34
|
-
"@sphereon/ssi-sdk-ext.identifier-resolution": "0.34.1-feature.SSISDK.
|
|
35
|
-
"@sphereon/ssi-sdk-ext.jwt-service": "0.34.1-feature.SSISDK.
|
|
36
|
-
"@sphereon/ssi-sdk-ext.key-utils": "0.34.1-feature.SSISDK.
|
|
37
|
-
"@sphereon/ssi-sdk.contact-manager": "0.34.1-feature.SSISDK.
|
|
38
|
-
"@sphereon/ssi-sdk.core": "0.34.1-feature.SSISDK.
|
|
39
|
-
"@sphereon/ssi-sdk.credential-store": "0.34.1-feature.SSISDK.
|
|
40
|
-
"@sphereon/ssi-sdk.credential-validation": "0.34.1-feature.SSISDK.
|
|
41
|
-
"@sphereon/ssi-sdk.data-store-types": "0.34.1-feature.SSISDK.
|
|
42
|
-
"@sphereon/ssi-sdk.issuance-branding": "0.34.1-feature.SSISDK.
|
|
43
|
-
"@sphereon/ssi-sdk.mdl-mdoc": "0.34.1-feature.SSISDK.
|
|
44
|
-
"@sphereon/ssi-sdk.oidf-client": "0.34.1-feature.SSISDK.
|
|
45
|
-
"@sphereon/ssi-sdk.sd-jwt": "0.34.1-feature.SSISDK.
|
|
46
|
-
"@sphereon/ssi-sdk.siopv2-oid4vp-common": "0.34.1-feature.SSISDK.
|
|
47
|
-
"@sphereon/ssi-sdk.siopv2-oid4vp-op-auth": "0.34.1-feature.SSISDK.
|
|
48
|
-
"@sphereon/ssi-sdk.xstate-machine-persistence": "0.34.1-feature.SSISDK.
|
|
49
|
-
"@sphereon/ssi-types": "0.34.1-feature.SSISDK.
|
|
31
|
+
"@sphereon/oid4vci-client": "0.19.1-next.234",
|
|
32
|
+
"@sphereon/oid4vci-common": "0.19.1-next.234",
|
|
33
|
+
"@sphereon/ssi-sdk-ext.did-utils": "0.34.1-feature.SSISDK.82.and.SSISDK.70.345+e5abbf1a",
|
|
34
|
+
"@sphereon/ssi-sdk-ext.identifier-resolution": "0.34.1-feature.SSISDK.82.and.SSISDK.70.345+e5abbf1a",
|
|
35
|
+
"@sphereon/ssi-sdk-ext.jwt-service": "0.34.1-feature.SSISDK.82.and.SSISDK.70.345+e5abbf1a",
|
|
36
|
+
"@sphereon/ssi-sdk-ext.key-utils": "0.34.1-feature.SSISDK.82.and.SSISDK.70.345+e5abbf1a",
|
|
37
|
+
"@sphereon/ssi-sdk.contact-manager": "0.34.1-feature.SSISDK.82.and.SSISDK.70.345+e5abbf1a",
|
|
38
|
+
"@sphereon/ssi-sdk.core": "0.34.1-feature.SSISDK.82.and.SSISDK.70.345+e5abbf1a",
|
|
39
|
+
"@sphereon/ssi-sdk.credential-store": "0.34.1-feature.SSISDK.82.and.SSISDK.70.345+e5abbf1a",
|
|
40
|
+
"@sphereon/ssi-sdk.credential-validation": "0.34.1-feature.SSISDK.82.and.SSISDK.70.345+e5abbf1a",
|
|
41
|
+
"@sphereon/ssi-sdk.data-store-types": "0.34.1-feature.SSISDK.82.and.SSISDK.70.345+e5abbf1a",
|
|
42
|
+
"@sphereon/ssi-sdk.issuance-branding": "0.34.1-feature.SSISDK.82.and.SSISDK.70.345+e5abbf1a",
|
|
43
|
+
"@sphereon/ssi-sdk.mdl-mdoc": "0.34.1-feature.SSISDK.82.and.SSISDK.70.345+e5abbf1a",
|
|
44
|
+
"@sphereon/ssi-sdk.oidf-client": "0.34.1-feature.SSISDK.82.and.SSISDK.70.345+e5abbf1a",
|
|
45
|
+
"@sphereon/ssi-sdk.sd-jwt": "0.34.1-feature.SSISDK.82.and.SSISDK.70.345+e5abbf1a",
|
|
46
|
+
"@sphereon/ssi-sdk.siopv2-oid4vp-common": "0.34.1-feature.SSISDK.82.and.SSISDK.70.345+e5abbf1a",
|
|
47
|
+
"@sphereon/ssi-sdk.siopv2-oid4vp-op-auth": "0.34.1-feature.SSISDK.82.and.SSISDK.70.345+e5abbf1a",
|
|
48
|
+
"@sphereon/ssi-sdk.xstate-machine-persistence": "0.34.1-feature.SSISDK.82.and.SSISDK.70.345+e5abbf1a",
|
|
49
|
+
"@sphereon/ssi-types": "0.34.1-feature.SSISDK.82.and.SSISDK.70.345+e5abbf1a",
|
|
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.19.1-next.
|
|
63
|
-
"@sphereon/ssi-sdk-ext.did-resolver-jwk": "0.34.1-feature.SSISDK.
|
|
62
|
+
"@sphereon/oid4vc-common": "0.19.1-next.234",
|
|
63
|
+
"@sphereon/ssi-sdk-ext.did-resolver-jwk": "0.34.1-feature.SSISDK.82.and.SSISDK.70.345+e5abbf1a",
|
|
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": "e5abbf1a0404fbc2aeb350a248183f70598ffbc0"
|
|
94
94
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { CredentialOfferClient, MetadataClient, OpenID4VCIClient } from '@sphereon/oid4vci-client'
|
|
1
|
+
import { CredentialOfferClient, MetadataClient, OpenID4VCIClient, OpenID4VCIClientV1_0_15 } from '@sphereon/oid4vci-client'
|
|
2
2
|
import {
|
|
3
|
-
|
|
3
|
+
AuthorizationDetailsV1_0_15,
|
|
4
4
|
AuthorizationRequestOpts,
|
|
5
5
|
AuthorizationServerClientOpts,
|
|
6
6
|
AuthorizationServerOpts,
|
|
@@ -123,6 +123,7 @@ import {
|
|
|
123
123
|
VerificationResult,
|
|
124
124
|
VerifyEBSICredentialIssuerArgs,
|
|
125
125
|
VerifyEBSICredentialIssuerResult,
|
|
126
|
+
WalletType,
|
|
126
127
|
} from '../types/IOID4VCIHolder'
|
|
127
128
|
|
|
128
129
|
/**
|
|
@@ -378,11 +379,9 @@ export class OID4VCIHolder implements IAgentPlugin {
|
|
|
378
379
|
}
|
|
379
380
|
|
|
380
381
|
const authorizationRequestOpts = { ...this.defaultAuthorizationRequestOpts, ...args.authorizationRequestOpts } satisfies AuthorizationRequestOpts
|
|
381
|
-
//
|
|
382
|
+
// TODO: Previously we filtered the details first against our vcformat prefs. However auth details does not have the notion of formats anymore
|
|
382
383
|
authorizationRequestOpts.authorizationDetails = authorizationRequestOpts?.authorizationDetails
|
|
383
|
-
? asArray(authorizationRequestOpts.authorizationDetails)
|
|
384
|
-
(detail) => typeof detail === 'string' || this.vcFormatPreferences.includes(detail.format),
|
|
385
|
-
)
|
|
384
|
+
? asArray(authorizationRequestOpts.authorizationDetails)
|
|
386
385
|
: undefined
|
|
387
386
|
|
|
388
387
|
if (!authorizationRequestOpts.redirectUri) {
|
|
@@ -394,18 +393,19 @@ export class OID4VCIHolder implements IAgentPlugin {
|
|
|
394
393
|
authorizationRequestOpts.clientId = authorizationRequestOpts.redirectUri
|
|
395
394
|
}
|
|
396
395
|
|
|
396
|
+
// TODO: This entire filter and formats population should not work anymore, as the auth details no longer have the format property.
|
|
397
397
|
let formats: string[] = this.vcFormatPreferences
|
|
398
398
|
const authFormats = authorizationRequestOpts?.authorizationDetails
|
|
399
|
-
?.map((detail:
|
|
399
|
+
?.map((detail: AuthorizationDetailsV1_0_15) => (typeof detail === 'object' && 'format' in detail && detail.format ? detail.format : undefined))
|
|
400
400
|
.filter((format) => !!format)
|
|
401
401
|
.map((format) => format as string)
|
|
402
402
|
if (authFormats && authFormats.length > 0) {
|
|
403
403
|
formats = Array.from(new Set(authFormats))
|
|
404
404
|
}
|
|
405
|
-
let oid4vciClient:
|
|
405
|
+
let oid4vciClient: OpenID4VCIClientV1_0_15
|
|
406
406
|
let offer: CredentialOfferRequestWithBaseUrl | undefined
|
|
407
407
|
if (requestData.existingClientState) {
|
|
408
|
-
oid4vciClient = await
|
|
408
|
+
oid4vciClient = await OpenID4VCIClientV1_0_15.fromState({ state: requestData.existingClientState })
|
|
409
409
|
offer = oid4vciClient.credentialOffer
|
|
410
410
|
} else {
|
|
411
411
|
offer = requestData.credentialOffer
|
|
@@ -427,7 +427,7 @@ export class OID4VCIHolder implements IAgentPlugin {
|
|
|
427
427
|
if (!offer) {
|
|
428
428
|
// else no offer, meaning we have an issuer URL
|
|
429
429
|
logger.log(`Issuer url received (no credential offer): ${uri}`)
|
|
430
|
-
oid4vciClient = await
|
|
430
|
+
oid4vciClient = await OpenID4VCIClientV1_0_15.fromCredentialIssuer({
|
|
431
431
|
credentialIssuer: uri,
|
|
432
432
|
authorizationRequest: authorizationRequestOpts,
|
|
433
433
|
clientId: authorizationRequestOpts.clientId,
|
|
@@ -435,7 +435,7 @@ export class OID4VCIHolder implements IAgentPlugin {
|
|
|
435
435
|
})
|
|
436
436
|
} else {
|
|
437
437
|
logger.log(`Credential offer received: ${uri}`)
|
|
438
|
-
oid4vciClient = await
|
|
438
|
+
oid4vciClient = await OpenID4VCIClientV1_0_15.fromURI({
|
|
439
439
|
uri,
|
|
440
440
|
authorizationRequest: authorizationRequestOpts,
|
|
441
441
|
clientId: authorizationRequestOpts.clientId,
|
|
@@ -449,7 +449,7 @@ export class OID4VCIHolder implements IAgentPlugin {
|
|
|
449
449
|
configurationIds = offer.original_credential_offer.credential_configuration_ids
|
|
450
450
|
} else {
|
|
451
451
|
configurationIds = asArray(authorizationRequestOpts.authorizationDetails)
|
|
452
|
-
.filter((authDetails): authDetails is Exclude<
|
|
452
|
+
// .filter((authDetails): authDetails is Exclude<AuthorizationDetailsV1_0_15, string> => typeof authDetails !== 'string')
|
|
453
453
|
.map((authReqOpts) => authReqOpts.credential_configuration_id)
|
|
454
454
|
.filter((id): id is string => !!id)
|
|
455
455
|
}
|
|
@@ -616,14 +616,14 @@ export class OID4VCIHolder implements IAgentPlugin {
|
|
|
616
616
|
}
|
|
617
617
|
|
|
618
618
|
private async oid4vciHolderGetCredentials(args: GetCredentialsArgs, context: RequiredContext): Promise<Array<MappedCredentialToAccept>> {
|
|
619
|
-
const { verificationCode, openID4VCIClientState, didMethodPreferences
|
|
619
|
+
const { verificationCode, openID4VCIClientState, didMethodPreferences, issuanceOpt, accessTokenOpts, walletType } = args
|
|
620
620
|
logger.debug(`Getting credentials`, issuanceOpt, accessTokenOpts)
|
|
621
621
|
|
|
622
622
|
if (!openID4VCIClientState) {
|
|
623
623
|
return Promise.reject(Error('Missing openID4VCI client state in context'))
|
|
624
624
|
}
|
|
625
625
|
|
|
626
|
-
const client = await
|
|
626
|
+
const client = await OpenID4VCIClientV1_0_15.fromState({ state: openID4VCIClientState })
|
|
627
627
|
const credentialsSupported = await getCredentialConfigsSupportedMerged({
|
|
628
628
|
client,
|
|
629
629
|
vcFormatPreferences: this.vcFormatPreferences,
|
|
@@ -635,7 +635,7 @@ export class OID4VCIHolder implements IAgentPlugin {
|
|
|
635
635
|
credentialsSupported,
|
|
636
636
|
serverMetadata,
|
|
637
637
|
context,
|
|
638
|
-
didMethodPreferences:
|
|
638
|
+
didMethodPreferences: this.selectDidMethodPreferences(didMethodPreferences, walletType),
|
|
639
639
|
jwtCryptographicSuitePreferences: this.jwtCryptographicSuitePreferences,
|
|
640
640
|
jsonldCryptographicSuitePreferences: this.jsonldCryptographicSuitePreferences,
|
|
641
641
|
...(issuanceOpt && { forceIssuanceOpt: issuanceOpt }),
|
|
@@ -660,6 +660,15 @@ export class OID4VCIHolder implements IAgentPlugin {
|
|
|
660
660
|
return allCredentials
|
|
661
661
|
}
|
|
662
662
|
|
|
663
|
+
private selectDidMethodPreferences(didMethodPreferences: Array<SupportedDidMethodEnum> | undefined, walletType: WalletType) {
|
|
664
|
+
const supportedDidMethodEnums =
|
|
665
|
+
Array.isArray(didMethodPreferences) && didMethodPreferences.length > 0 ? didMethodPreferences : this.didMethodPreferences
|
|
666
|
+
if (walletType === 'ORGANIZATIONAL') {
|
|
667
|
+
return [SupportedDidMethodEnum.DID_WEB, ...supportedDidMethodEnums]
|
|
668
|
+
}
|
|
669
|
+
return supportedDidMethodEnums
|
|
670
|
+
}
|
|
671
|
+
|
|
663
672
|
private async oid4vciHolderGetCredential(args: GetCredentialArgs, context: RequiredContext): Promise<MappedCredentialToAccept> {
|
|
664
673
|
const { issuanceOpt, pin, client, accessTokenOpts } = args
|
|
665
674
|
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 } from '../types/IOID4VCIHolder'
|
|
6
|
+
import { GetMachineArgs, IOID4VCIHolder, OID4VCIMachineEvents, OID4VCIMachineStateNavigationListener, WalletType } from '../types/IOID4VCIHolder'
|
|
7
7
|
import { FirstPartyMachineStateNavigationListener } from '../types/FirstPartyMachine'
|
|
8
8
|
|
|
9
9
|
/**
|
|
@@ -14,6 +14,7 @@ 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
|
|
17
18
|
private readonly authorizationRequestOpts?: AuthorizationRequestOpts
|
|
18
19
|
private readonly clientOpts?: AuthorizationServerClientOpts
|
|
19
20
|
private readonly trustAnchors?: Array<string>
|
|
@@ -21,7 +22,7 @@ export class OID4VCIHolderLinkHandler extends LinkHandlerAdapter {
|
|
|
21
22
|
constructor(
|
|
22
23
|
args: Pick<
|
|
23
24
|
GetMachineArgs,
|
|
24
|
-
'stateNavigationListener' | 'authorizationRequestOpts' | 'clientOpts' | 'trustAnchors' | 'firstPartyStateNavigationListener'
|
|
25
|
+
'stateNavigationListener' | 'authorizationRequestOpts' | 'clientOpts' | 'trustAnchors' | 'firstPartyStateNavigationListener' | 'walletType'
|
|
25
26
|
> & {
|
|
26
27
|
priority?: number | DefaultLinkPriorities
|
|
27
28
|
protocols?: Array<string | RegExp>
|
|
@@ -33,6 +34,7 @@ export class OID4VCIHolderLinkHandler extends LinkHandlerAdapter {
|
|
|
33
34
|
this.authorizationRequestOpts = args.authorizationRequestOpts
|
|
34
35
|
this.clientOpts = args.clientOpts
|
|
35
36
|
this.context = args.context
|
|
37
|
+
this.walletType = args.walletType ?? 'NATURAL_PERSON'
|
|
36
38
|
this.noStateMachinePersistence = args.noStateMachinePersistence === true
|
|
37
39
|
this.stateNavigationListener = args.stateNavigationListener
|
|
38
40
|
this.firstPartyStateNavigationListener = args.firstPartyStateNavigationListener
|
|
@@ -68,6 +70,7 @@ export class OID4VCIHolderLinkHandler extends LinkHandlerAdapter {
|
|
|
68
70
|
...((clientOpts.clientId || clientOpts.clientAssertionType) && { clientOpts: clientOpts as AuthorizationServerClientOpts }),
|
|
69
71
|
stateNavigationListener: this.stateNavigationListener,
|
|
70
72
|
firstPartyStateNavigationListener: this.firstPartyStateNavigationListener,
|
|
73
|
+
walletType: this.walletType,
|
|
71
74
|
})
|
|
72
75
|
|
|
73
76
|
const interpreter = oid4vciMachine.interpreter
|
|
@@ -99,7 +99,7 @@ const oid4vciRequireAuthorizationGuard = (ctx: OID4VCIMachineContext, _event: OI
|
|
|
99
99
|
throw Error('Missing openID4VCI client state in context')
|
|
100
100
|
}
|
|
101
101
|
|
|
102
|
-
if (openID4VCIClientState.authorizationRequestOpts) {
|
|
102
|
+
if (openID4VCIClientState.authorizationURL && openID4VCIClientState.authorizationRequestOpts) {
|
|
103
103
|
// We have authz options or there is not credential offer to begin with.
|
|
104
104
|
// We require authz as long as we do not have the authz code response
|
|
105
105
|
return !ctx.openID4VCIClientState?.authorizationCodeResponse
|
|
@@ -126,6 +126,7 @@ 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',
|
|
129
130
|
trustAnchors: opts?.trustAnchors ?? [],
|
|
130
131
|
issuanceOpt: opts?.issuanceOpt,
|
|
131
132
|
didMethodPreferences: opts?.didMethodPreferences,
|
|
@@ -440,6 +441,10 @@ const createOID4VCIMachine = (opts?: CreateOID4VCIMachineOpts): OID4VCIStateMach
|
|
|
440
441
|
target: OID4VCIMachineStates.startFirstPartApplicationFlow,
|
|
441
442
|
cond: OID4VCIMachineGuards.isFirstPartyApplication,
|
|
442
443
|
},
|
|
444
|
+
{
|
|
445
|
+
target: OID4VCIMachineStates.prepareAuthorizationRequest,
|
|
446
|
+
cond: OID4VCIMachineGuards.requireAuthorizationGuard,
|
|
447
|
+
},
|
|
443
448
|
{
|
|
444
449
|
target: OID4VCIMachineStates.initiateAuthorizationRequest,
|
|
445
450
|
cond: OID4VCIMachineGuards.requireAuthorizationGuard,
|
|
@@ -512,6 +517,10 @@ const createOID4VCIMachine = (opts?: CreateOID4VCIMachineOpts): OID4VCIStateMach
|
|
|
512
517
|
target: OID4VCIMachineStates.startFirstPartApplicationFlow,
|
|
513
518
|
cond: OID4VCIMachineGuards.isFirstPartyApplication,
|
|
514
519
|
},
|
|
520
|
+
{
|
|
521
|
+
target: OID4VCIMachineStates.prepareAuthorizationRequest,
|
|
522
|
+
cond: OID4VCIMachineGuards.requireAuthorizationGuard,
|
|
523
|
+
},
|
|
515
524
|
{
|
|
516
525
|
target: OID4VCIMachineStates.verifyPin,
|
|
517
526
|
cond: OID4VCIMachineGuards.requirePinGuard,
|
|
@@ -209,9 +209,7 @@ export const mapCredentialToAccept = async (args: MapCredentialToAcceptArgs): Pr
|
|
|
209
209
|
)
|
|
210
210
|
let uniformVerifiableCredential: IVerifiableCredential
|
|
211
211
|
if (CredentialMapper.isSdJwtDecodedCredential(wrappedVerifiableCredential.credential)) {
|
|
212
|
-
uniformVerifiableCredential =
|
|
213
|
-
<SdJwtDecodedVerifiableCredential>wrappedVerifiableCredential.credential,
|
|
214
|
-
)
|
|
212
|
+
uniformVerifiableCredential = sdJwtDecodedCredentialToUniformCredential(<SdJwtDecodedVerifiableCredential>wrappedVerifiableCredential.credential)
|
|
215
213
|
} else if (CredentialMapper.isSdJwtEncoded(wrappedVerifiableCredential.credential)) {
|
|
216
214
|
if (!hasher) {
|
|
217
215
|
return Promise.reject('a hasher is required for encoded SD-JWT credentials')
|
|
@@ -384,7 +382,7 @@ export const getCredentialConfigsSupportedBySingleTypeOrId = async (
|
|
|
384
382
|
}
|
|
385
383
|
|
|
386
384
|
if (configurationId) {
|
|
387
|
-
const allSupported = client.getCredentialsSupported(format)
|
|
385
|
+
const allSupported = client.getCredentialsSupported(undefined, format)
|
|
388
386
|
return Object.fromEntries(
|
|
389
387
|
Object.entries(allSupported).filter(
|
|
390
388
|
([id, supported]) => id === configurationId || supported.id === configurationId || createIdFromTypes(supported) === configurationId,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DynamicRegistrationClientMetadata } from '@sphereon/oid4vc-common'
|
|
2
|
+
import { OpenID4VCIClientState, OpenID4VCIClientV1_0_15 } from '@sphereon/oid4vci-client'
|
|
2
3
|
import {
|
|
3
4
|
AuthorizationRequestOpts,
|
|
4
5
|
AuthorizationResponse,
|
|
@@ -15,7 +16,6 @@ import {
|
|
|
15
16
|
MetadataDisplay,
|
|
16
17
|
NotificationRequest,
|
|
17
18
|
} from '@sphereon/oid4vci-common'
|
|
18
|
-
import { DynamicRegistrationClientMetadata } from '@sphereon/oid4vc-common'
|
|
19
19
|
import { CreateOrGetIdentifierOpts, IdentifierProviderOpts, SupportedDidMethodEnum } from '@sphereon/ssi-sdk-ext.did-utils'
|
|
20
20
|
import {
|
|
21
21
|
IIdentifierResolution,
|
|
@@ -26,6 +26,7 @@ import {
|
|
|
26
26
|
import { IJwtService } from '@sphereon/ssi-sdk-ext.jwt-service'
|
|
27
27
|
import { IContactManager } from '@sphereon/ssi-sdk.contact-manager'
|
|
28
28
|
import { ICredentialStore } from '@sphereon/ssi-sdk.credential-store'
|
|
29
|
+
import { ICredentialValidation, SchemaValidation } from '@sphereon/ssi-sdk.credential-validation'
|
|
29
30
|
import {
|
|
30
31
|
DigitalCredential,
|
|
31
32
|
IBasicCredentialClaim,
|
|
@@ -38,7 +39,6 @@ import {
|
|
|
38
39
|
import { IIssuanceBranding } from '@sphereon/ssi-sdk.issuance-branding'
|
|
39
40
|
import { ImDLMdoc } from '@sphereon/ssi-sdk.mdl-mdoc'
|
|
40
41
|
import { ISDJwtPlugin } from '@sphereon/ssi-sdk.sd-jwt'
|
|
41
|
-
import { ICredentialValidation, SchemaValidation } from '@sphereon/ssi-sdk.credential-validation'
|
|
42
42
|
import { IDidAuthSiopOpAuthenticator } from '@sphereon/ssi-sdk.siopv2-oid4vp-op-auth'
|
|
43
43
|
import {
|
|
44
44
|
HasherSync,
|
|
@@ -136,6 +136,7 @@ export type OnIdentifierCreatedArgs = {
|
|
|
136
136
|
|
|
137
137
|
export type GetMachineArgs = {
|
|
138
138
|
requestData: RequestData
|
|
139
|
+
walletType: WalletType
|
|
139
140
|
trustAnchors?: Array<string>
|
|
140
141
|
authorizationRequestOpts?: AuthorizationRequestOpts
|
|
141
142
|
clientOpts?: AuthorizationServerClientOpts
|
|
@@ -157,7 +158,7 @@ export type CreateCredentialsToSelectFromArgs = Pick<
|
|
|
157
158
|
export type GetContactArgs = Pick<OID4VCIMachineContext, 'serverMetadata'>
|
|
158
159
|
export type GetCredentialsArgs = Pick<
|
|
159
160
|
OID4VCIMachineContext,
|
|
160
|
-
'verificationCode' | 'openID4VCIClientState' | 'selectedCredentials' | 'didMethodPreferences' | 'issuanceOpt' | 'accessTokenOpts'
|
|
161
|
+
'verificationCode' | 'openID4VCIClientState' | 'selectedCredentials' | 'didMethodPreferences' | 'issuanceOpt' | 'accessTokenOpts' | 'walletType'
|
|
161
162
|
>
|
|
162
163
|
export type AddContactIdentityArgs = Pick<OID4VCIMachineContext, 'credentialsToAccept' | 'contact'>
|
|
163
164
|
export type GetIssuerBrandingArgs = Pick<OID4VCIMachineContext, 'serverMetadata' | 'contact'>
|
|
@@ -233,6 +234,7 @@ export type OID4VCIMachineContext = {
|
|
|
233
234
|
openID4VCIClientState?: OpenID4VCIClientState
|
|
234
235
|
credentialToSelectFrom: Array<CredentialToSelectFromResult>
|
|
235
236
|
contactAlias: string
|
|
237
|
+
walletType: WalletType
|
|
236
238
|
contact?: Party
|
|
237
239
|
selectedCredentials: Array<string>
|
|
238
240
|
credentialsToAccept: Array<MappedCredentialToAccept>
|
|
@@ -316,6 +318,7 @@ export type OID4VCIStateMachine = StateMachine<
|
|
|
316
318
|
|
|
317
319
|
export type CreateOID4VCIMachineOpts = {
|
|
318
320
|
requestData: RequestData
|
|
321
|
+
walletType: WalletType
|
|
319
322
|
machineName?: string
|
|
320
323
|
locale?: string
|
|
321
324
|
trustAnchors?: Array<string>
|
|
@@ -514,7 +517,7 @@ export type CredentialToAccept = {
|
|
|
514
517
|
}
|
|
515
518
|
|
|
516
519
|
export type GetCredentialConfigsSupportedArgs = {
|
|
517
|
-
client:
|
|
520
|
+
client: OpenID4VCIClientV1_0_15
|
|
518
521
|
vcFormatPreferences: Array<string>
|
|
519
522
|
format?: Array<string>
|
|
520
523
|
types?: Array<Array<string>>
|
|
@@ -526,7 +529,7 @@ export type GetCredentialConfigsSupportedArgs = {
|
|
|
526
529
|
* It can potentially return multiple results mainly because of different formats.
|
|
527
530
|
*/
|
|
528
531
|
export type GetCredentialConfigsSupportedBySingleTypeOrIdArgs = {
|
|
529
|
-
client:
|
|
532
|
+
client: OpenID4VCIClientV1_0_15
|
|
530
533
|
vcFormatPreferences: Array<string>
|
|
531
534
|
format?: string[]
|
|
532
535
|
types?: string[]
|
|
@@ -561,7 +564,7 @@ export type GetDefaultIssuanceOptsArgs = {
|
|
|
561
564
|
}
|
|
562
565
|
|
|
563
566
|
export type DefaultIssuanceOpts = {
|
|
564
|
-
client:
|
|
567
|
+
client: OpenID4VCIClientV1_0_15
|
|
565
568
|
}
|
|
566
569
|
|
|
567
570
|
export type GetIdentifierArgs = {
|
|
@@ -598,7 +601,7 @@ export type CreateIdentifierCreateOpts = {
|
|
|
598
601
|
}
|
|
599
602
|
|
|
600
603
|
export type GetIssuanceOptsArgs = {
|
|
601
|
-
client:
|
|
604
|
+
client: OpenID4VCIClientV1_0_15
|
|
602
605
|
credentialsSupported: Record<string, CredentialConfigurationSupported>
|
|
603
606
|
serverMetadata: EndpointMetadataResult
|
|
604
607
|
context: RequiredContext
|
|
@@ -610,13 +613,13 @@ export type GetIssuanceOptsArgs = {
|
|
|
610
613
|
|
|
611
614
|
export type GetIssuanceDidMethodArgs = {
|
|
612
615
|
credentialSupported: CredentialConfigurationSupported
|
|
613
|
-
client:
|
|
616
|
+
client: OpenID4VCIClientV1_0_15
|
|
614
617
|
didMethodPreferences: Array<SupportedDidMethodEnum>
|
|
615
618
|
}
|
|
616
619
|
|
|
617
620
|
export type GetIssuanceCryptoSuiteArgs = {
|
|
618
621
|
credentialSupported: CredentialConfigurationSupported
|
|
619
|
-
client:
|
|
622
|
+
client: OpenID4VCIClientV1_0_15
|
|
620
623
|
jwtCryptographicSuitePreferences: Array<JoseSignatureAlgorithm | JoseSignatureAlgorithmString>
|
|
621
624
|
jsonldCryptographicSuitePreferences: Array<string>
|
|
622
625
|
}
|
|
@@ -624,7 +627,7 @@ export type GetIssuanceCryptoSuiteArgs = {
|
|
|
624
627
|
export type GetCredentialArgs = {
|
|
625
628
|
pin?: string
|
|
626
629
|
issuanceOpt: IssuanceOpts
|
|
627
|
-
client:
|
|
630
|
+
client: OpenID4VCIClientV1_0_15
|
|
628
631
|
accessTokenOpts?: AccessTokenOpts
|
|
629
632
|
}
|
|
630
633
|
|
|
@@ -728,6 +731,8 @@ export type DynamicRegistrationClientMetadataDisplay = Pick<
|
|
|
728
731
|
'client_name' | 'client_uri' | 'contacts' | 'tos_uri' | 'policy_uri' | 'logo_uri'
|
|
729
732
|
>
|
|
730
733
|
|
|
734
|
+
export type WalletType = 'NATURAL_PERSON' | 'ORGANIZATIONAL'
|
|
735
|
+
|
|
731
736
|
export type DidAgents = TAgent<IResolver & IDIDManager>
|
|
732
737
|
|
|
733
738
|
export type RequiredContext = IAgentContext<
|