@sphereon/ssi-sdk.oid4vci-holder 0.34.1-feature.SSISDK.47.43 → 0.34.1-feature.SSISDK.50.100
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 +407 -397
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +9 -6
- package/dist/index.d.ts +9 -6
- package/dist/index.js +516 -506
- package/dist/index.js.map +1 -1
- package/package.json +25 -24
- package/src/agent/OID4VCIHolder.ts +24 -23
- package/src/services/OID4VCIHolderService.ts +38 -21
- package/src/types/FirstPartyMachine.ts +3 -2
- package/src/types/IOID4VCIHolder.ts +3 -1
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.50.100+f7758c66",
|
|
4
4
|
"source": "src/index.ts",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -26,40 +26,41 @@
|
|
|
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-
|
|
29
|
+
"@sphereon/did-auth-siop": "0.19.1-feature.SSISDK.45.92",
|
|
30
30
|
"@sphereon/kmp-mdoc-core": "0.2.0-SNAPSHOT.26",
|
|
31
|
-
"@sphereon/oid4vci-client": "0.19.1-
|
|
32
|
-
"@sphereon/oid4vci-common": "0.19.1-
|
|
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": "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-feature.SSISDK.45.92",
|
|
32
|
+
"@sphereon/oid4vci-common": "0.19.1-feature.SSISDK.45.92",
|
|
33
|
+
"@sphereon/ssi-sdk-ext.did-utils": "0.34.1-feature.SSISDK.50.100+f7758c66",
|
|
34
|
+
"@sphereon/ssi-sdk-ext.identifier-resolution": "0.34.1-feature.SSISDK.50.100+f7758c66",
|
|
35
|
+
"@sphereon/ssi-sdk-ext.jwt-service": "0.34.1-feature.SSISDK.50.100+f7758c66",
|
|
36
|
+
"@sphereon/ssi-sdk-ext.key-utils": "0.34.1-feature.SSISDK.50.100+f7758c66",
|
|
37
|
+
"@sphereon/ssi-sdk.contact-manager": "0.34.1-feature.SSISDK.50.100+f7758c66",
|
|
38
|
+
"@sphereon/ssi-sdk.core": "0.34.1-feature.SSISDK.50.100+f7758c66",
|
|
39
|
+
"@sphereon/ssi-sdk.credential-store": "0.34.1-feature.SSISDK.50.100+f7758c66",
|
|
40
|
+
"@sphereon/ssi-sdk.credential-validation": "0.34.1-feature.SSISDK.50.100+f7758c66",
|
|
41
|
+
"@sphereon/ssi-sdk.data-store": "0.34.1-feature.SSISDK.50.100+f7758c66",
|
|
42
|
+
"@sphereon/ssi-sdk.issuance-branding": "0.34.1-feature.SSISDK.50.100+f7758c66",
|
|
43
|
+
"@sphereon/ssi-sdk.mdl-mdoc": "0.34.1-feature.SSISDK.50.100+f7758c66",
|
|
44
|
+
"@sphereon/ssi-sdk.oidf-client": "0.34.1-feature.SSISDK.50.100+f7758c66",
|
|
45
|
+
"@sphereon/ssi-sdk.sd-jwt": "0.34.1-feature.SSISDK.50.100+f7758c66",
|
|
46
|
+
"@sphereon/ssi-sdk.siopv2-oid4vp-common": "0.34.1-feature.SSISDK.50.100+f7758c66",
|
|
47
|
+
"@sphereon/ssi-sdk.siopv2-oid4vp-op-auth": "0.34.1-feature.SSISDK.50.100+f7758c66",
|
|
48
|
+
"@sphereon/ssi-sdk.xstate-machine-persistence": "0.34.1-feature.SSISDK.50.100+f7758c66",
|
|
49
|
+
"@sphereon/ssi-types": "0.34.1-feature.SSISDK.50.100+f7758c66",
|
|
50
50
|
"@veramo/core": "4.2.0",
|
|
51
51
|
"@veramo/data-store": "4.2.0",
|
|
52
52
|
"@veramo/utils": "4.2.0",
|
|
53
53
|
"ajv": "^8.17.1",
|
|
54
54
|
"ajv-formats": "^3.0.1",
|
|
55
|
+
"dcql": "1.0.1",
|
|
55
56
|
"i18n-js": "^3.9.2",
|
|
56
57
|
"lodash.memoize": "^4.1.2",
|
|
57
58
|
"uuid": "^9.0.1",
|
|
58
59
|
"xstate": "^4.38.3"
|
|
59
60
|
},
|
|
60
61
|
"devDependencies": {
|
|
61
|
-
"@sphereon/oid4vc-common": "0.19.1-
|
|
62
|
-
"@sphereon/ssi-sdk-ext.did-resolver-jwk": "0.34.1-feature.SSISDK.
|
|
62
|
+
"@sphereon/oid4vc-common": "0.19.1-feature.SSISDK.45.92",
|
|
63
|
+
"@sphereon/ssi-sdk-ext.did-resolver-jwk": "0.34.1-feature.SSISDK.50.100+f7758c66",
|
|
63
64
|
"@sphereon/ssi-sdk.siopv2-oid4vp-common": "workspace:*",
|
|
64
65
|
"@types/i18n-js": "^3.8.9",
|
|
65
66
|
"@types/lodash.memoize": "^4.1.9",
|
|
@@ -89,5 +90,5 @@
|
|
|
89
90
|
"OID4VCI",
|
|
90
91
|
"State Machine"
|
|
91
92
|
],
|
|
92
|
-
"gitHead": "
|
|
93
|
+
"gitHead": "f7758c6686c8af51167365b8ecf2aa383d4b69a6"
|
|
93
94
|
}
|
|
@@ -4,8 +4,8 @@ import {
|
|
|
4
4
|
AuthorizationRequestOpts,
|
|
5
5
|
AuthorizationServerClientOpts,
|
|
6
6
|
AuthorizationServerOpts,
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
CredentialConfigurationSupportedJwtVcJsonLdAndLdpVcV1_0_15,
|
|
8
|
+
CredentialDefinitionJwtVcJsonLdAndLdpVcV1_0_15,
|
|
9
9
|
CredentialOfferRequestWithBaseUrl,
|
|
10
10
|
DefaultURISchemes,
|
|
11
11
|
EndpointMetadataResult,
|
|
@@ -30,11 +30,11 @@ import {
|
|
|
30
30
|
} from '@sphereon/ssi-sdk-ext.identifier-resolution'
|
|
31
31
|
import { IJwtService, JwsHeader } from '@sphereon/ssi-sdk-ext.jwt-service'
|
|
32
32
|
import { signatureAlgorithmFromKey } from '@sphereon/ssi-sdk-ext.key-utils'
|
|
33
|
+
import { defaultHasher } from '@sphereon/ssi-sdk.core'
|
|
33
34
|
import {
|
|
34
35
|
ConnectionType,
|
|
35
36
|
CorrelationIdentifierType,
|
|
36
37
|
CredentialCorrelationType,
|
|
37
|
-
CredentialRole,
|
|
38
38
|
ensureRawDocument,
|
|
39
39
|
FindPartyArgs,
|
|
40
40
|
IBasicCredentialLocaleBranding,
|
|
@@ -54,10 +54,10 @@ import {
|
|
|
54
54
|
JoseSignatureAlgorithmString,
|
|
55
55
|
JwtDecodedVerifiableCredential,
|
|
56
56
|
Loggers,
|
|
57
|
-
OriginalVerifiableCredential,
|
|
58
57
|
parseDid,
|
|
59
58
|
SdJwtDecodedVerifiableCredentialPayload,
|
|
60
59
|
WrappedW3CVerifiableCredential,
|
|
60
|
+
CredentialRole,
|
|
61
61
|
} from '@sphereon/ssi-types'
|
|
62
62
|
import {
|
|
63
63
|
CredentialPayload,
|
|
@@ -73,6 +73,19 @@ import { asArray, computeEntryHash } from '@veramo/utils'
|
|
|
73
73
|
import { decodeJWT } from 'did-jwt'
|
|
74
74
|
import { v4 as uuidv4 } from 'uuid'
|
|
75
75
|
import { OID4VCIMachine } from '../machines/oid4vciMachine'
|
|
76
|
+
import {
|
|
77
|
+
extractCredentialFromResponse,
|
|
78
|
+
getBasicIssuerLocaleBranding,
|
|
79
|
+
getCredentialBranding,
|
|
80
|
+
getCredentialConfigsSupportedMerged,
|
|
81
|
+
getIdentifierOpts,
|
|
82
|
+
getIssuanceOpts,
|
|
83
|
+
mapCredentialToAccept,
|
|
84
|
+
selectCredentialLocaleBranding,
|
|
85
|
+
startFirstPartApplicationMachine,
|
|
86
|
+
verifyCredentialToAccept,
|
|
87
|
+
} from '../services/OID4VCIHolderService'
|
|
88
|
+
import 'cross-fetch/polyfill'
|
|
76
89
|
import {
|
|
77
90
|
AddContactIdentityArgs,
|
|
78
91
|
AssertValidCredentialsArgs,
|
|
@@ -111,19 +124,6 @@ import {
|
|
|
111
124
|
VerifyEBSICredentialIssuerArgs,
|
|
112
125
|
VerifyEBSICredentialIssuerResult,
|
|
113
126
|
} from '../types/IOID4VCIHolder'
|
|
114
|
-
import {
|
|
115
|
-
getBasicIssuerLocaleBranding,
|
|
116
|
-
getCredentialBranding,
|
|
117
|
-
getCredentialConfigsSupportedMerged,
|
|
118
|
-
getIdentifierOpts,
|
|
119
|
-
getIssuanceOpts,
|
|
120
|
-
mapCredentialToAccept,
|
|
121
|
-
selectCredentialLocaleBranding,
|
|
122
|
-
startFirstPartApplicationMachine,
|
|
123
|
-
verifyCredentialToAccept,
|
|
124
|
-
} from '../services/OID4VCIHolderService'
|
|
125
|
-
import 'cross-fetch/polyfill'
|
|
126
|
-
import { defaultHasher } from '@sphereon/ssi-sdk.core'
|
|
127
127
|
|
|
128
128
|
/**
|
|
129
129
|
* {@inheritDoc IOID4VCIHolder}
|
|
@@ -151,7 +151,7 @@ export function signCallback(
|
|
|
151
151
|
context: IAgentContext<IKeyManager & IDIDManager & IResolver & IIdentifierResolution & IJwtService>,
|
|
152
152
|
nonce?: string,
|
|
153
153
|
) {
|
|
154
|
-
return async (jwt: Jwt, kid?: string) => {
|
|
154
|
+
return async (jwt: Jwt, kid?: string, noIssPayloadUpdate?: boolean) => {
|
|
155
155
|
let resolution = await context.agent.identifierManagedGet(identifier)
|
|
156
156
|
const jwk = jwt.header.jwk ?? (resolution.method === 'jwk' ? resolution.jwk : undefined)
|
|
157
157
|
if (!resolution.issuer && !jwt.payload.iss) {
|
|
@@ -170,7 +170,7 @@ export function signCallback(
|
|
|
170
170
|
}
|
|
171
171
|
return (
|
|
172
172
|
await context.agent.jwtCreateJwsCompactSignature({
|
|
173
|
-
issuer: { ...resolution, noIssPayloadUpdate: false },
|
|
173
|
+
issuer: { ...resolution, noIssPayloadUpdate: noIssPayloadUpdate ?? false },
|
|
174
174
|
protectedHeader: header,
|
|
175
175
|
payload,
|
|
176
176
|
})
|
|
@@ -229,7 +229,7 @@ export class OID4VCIHolder implements IAgentPlugin {
|
|
|
229
229
|
oid4vciHolderStoreIssuerBranding: this.oid4vciHolderStoreIssuerBranding.bind(this),
|
|
230
230
|
}
|
|
231
231
|
|
|
232
|
-
private readonly vcFormatPreferences: Array<string> = ['vc+sd-jwt', 'mso_mdoc', 'jwt_vc_json', 'jwt_vc', 'ldp_vc']
|
|
232
|
+
private readonly vcFormatPreferences: Array<string> = ['dc+sd-jwt', 'vc+sd-jwt', 'mso_mdoc', 'jwt_vc_json', 'jwt_vc', 'ldp_vc']
|
|
233
233
|
private readonly jsonldCryptographicSuitePreferences: Array<string> = [
|
|
234
234
|
'Ed25519Signature2018',
|
|
235
235
|
'EcdsaSecp256k1Signature2019',
|
|
@@ -939,7 +939,8 @@ export class OID4VCIHolder implements IAgentPlugin {
|
|
|
939
939
|
? 'credential_accepted_holder_signed'
|
|
940
940
|
: 'credential_deleted_holder_signed'
|
|
941
941
|
logger.log(`Subject issuance/signing will be used, with event`, event)
|
|
942
|
-
|
|
942
|
+
|
|
943
|
+
const issuerVC = extractCredentialFromResponse(mappedCredentialToAccept.credentialToAccept.credentialResponse)
|
|
943
944
|
const wrappedIssuerVC = CredentialMapper.toWrappedVerifiableCredential(issuerVC, { hasher: this.hasher ?? defaultHasher })
|
|
944
945
|
console.log(`Wrapped VC: ${wrappedIssuerVC.type}, ${wrappedIssuerVC.format}`)
|
|
945
946
|
// We will use the subject of the VCI Issuer (the holder, as the issuer of the new credential, so the below is not a mistake!)
|
|
@@ -1169,9 +1170,9 @@ export class OID4VCIHolder implements IAgentPlugin {
|
|
|
1169
1170
|
return undefined
|
|
1170
1171
|
}
|
|
1171
1172
|
|
|
1172
|
-
private getCredentialDefinition(issuanceOpt: IssuanceOpts):
|
|
1173
|
+
private getCredentialDefinition(issuanceOpt: IssuanceOpts): CredentialDefinitionJwtVcJsonLdAndLdpVcV1_0_15 | undefined {
|
|
1173
1174
|
if (issuanceOpt.format == 'ldp_vc' || issuanceOpt.format == 'jwt_vc_json-ld') {
|
|
1174
|
-
return (issuanceOpt as
|
|
1175
|
+
return (issuanceOpt as CredentialConfigurationSupportedJwtVcJsonLdAndLdpVcV1_0_15).credential_definition
|
|
1175
1176
|
}
|
|
1176
1177
|
return undefined
|
|
1177
1178
|
}
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import { LOG } from '@sphereon/oid4vci-client'
|
|
2
2
|
import {
|
|
3
|
+
AuthorizationChallengeCodeResponse,
|
|
3
4
|
CredentialConfigurationSupported,
|
|
4
|
-
|
|
5
|
-
CredentialConfigurationSupportedSdJwtVcV1_0_13,
|
|
5
|
+
CredentialConfigurationSupportedSdJwtVcV1_0_15,
|
|
6
6
|
CredentialOfferFormatV1_0_11,
|
|
7
7
|
CredentialResponse,
|
|
8
|
+
CredentialResponseV1_0_15,
|
|
9
|
+
CredentialSupportedSdJwtVc,
|
|
8
10
|
getSupportedCredentials,
|
|
9
11
|
getTypesFromCredentialSupported,
|
|
10
12
|
getTypesFromObject,
|
|
11
13
|
MetadataDisplay,
|
|
12
14
|
OpenId4VCIVersion,
|
|
13
|
-
AuthorizationChallengeCodeResponse,
|
|
14
15
|
} from '@sphereon/oid4vci-common'
|
|
15
16
|
import { KeyUse } from '@sphereon/ssi-sdk-ext.did-resolver-jwk'
|
|
16
17
|
import { getOrCreatePrimaryIdentifier, SupportedDidMethodEnum } from '@sphereon/ssi-sdk-ext.did-utils'
|
|
@@ -23,6 +24,7 @@ import {
|
|
|
23
24
|
managedIdentifierToJwk,
|
|
24
25
|
} from '@sphereon/ssi-sdk-ext.identifier-resolution'
|
|
25
26
|
import { keyTypeFromCryptographicSuite } from '@sphereon/ssi-sdk-ext.key-utils'
|
|
27
|
+
import { defaultHasher } from '@sphereon/ssi-sdk.core'
|
|
26
28
|
import { IBasicCredentialLocaleBranding, IBasicIssuerLocaleBranding } from '@sphereon/ssi-sdk.data-store'
|
|
27
29
|
import {
|
|
28
30
|
CredentialMapper,
|
|
@@ -40,8 +42,12 @@ import {
|
|
|
40
42
|
} from '@sphereon/ssi-types'
|
|
41
43
|
import { asArray } from '@veramo/utils'
|
|
42
44
|
import { translate } from '../localization/Localization'
|
|
45
|
+
import { FirstPartyMachine } from '../machines/firstPartyMachine'
|
|
46
|
+
import { issuerLocaleBrandingFrom, oid4vciGetCredentialBrandingFrom, sdJwtGetCredentialBrandingFrom } from '../mappers/OIDC4VCIBrandingMapper'
|
|
47
|
+
import { FirstPartyMachineState, FirstPartyMachineStateTypes } from '../types/FirstPartyMachine'
|
|
43
48
|
import {
|
|
44
49
|
DidAgents,
|
|
50
|
+
GetBasicIssuerLocaleBrandingArgs,
|
|
45
51
|
GetCredentialBrandingArgs,
|
|
46
52
|
GetCredentialConfigsSupportedArgs,
|
|
47
53
|
GetCredentialConfigsSupportedBySingleTypeOrIdArgs,
|
|
@@ -49,22 +55,17 @@ import {
|
|
|
49
55
|
GetIssuanceCryptoSuiteArgs,
|
|
50
56
|
GetIssuanceDidMethodArgs,
|
|
51
57
|
GetIssuanceOptsArgs,
|
|
52
|
-
GetBasicIssuerLocaleBrandingArgs,
|
|
53
58
|
GetPreferredCredentialFormatsArgs,
|
|
54
59
|
IssuanceOpts,
|
|
55
60
|
MapCredentialToAcceptArgs,
|
|
56
61
|
MappedCredentialToAccept,
|
|
57
62
|
OID4VCIHolderEvent,
|
|
63
|
+
RequiredContext,
|
|
58
64
|
SelectAppLocaleBrandingArgs,
|
|
65
|
+
StartFirstPartApplicationMachine,
|
|
59
66
|
VerificationResult,
|
|
60
67
|
VerifyCredentialToAcceptArgs,
|
|
61
|
-
StartFirstPartApplicationMachine,
|
|
62
|
-
RequiredContext,
|
|
63
68
|
} from '../types/IOID4VCIHolder'
|
|
64
|
-
import { oid4vciGetCredentialBrandingFrom, sdJwtGetCredentialBrandingFrom, issuerLocaleBrandingFrom } from '../mappers/OIDC4VCIBrandingMapper'
|
|
65
|
-
import { FirstPartyMachine } from '../machines/firstPartyMachine'
|
|
66
|
-
import { FirstPartyMachineState, FirstPartyMachineStateTypes } from '../types/FirstPartyMachine'
|
|
67
|
-
import { defaultHasher } from '@sphereon/ssi-sdk.core'
|
|
68
69
|
|
|
69
70
|
export const getCredentialBranding = async (args: GetCredentialBrandingArgs): Promise<Record<string, Array<IBasicCredentialLocaleBranding>>> => {
|
|
70
71
|
const { credentialsSupported, context } = args
|
|
@@ -72,8 +73,8 @@ export const getCredentialBranding = async (args: GetCredentialBrandingArgs): Pr
|
|
|
72
73
|
await Promise.all(
|
|
73
74
|
Object.entries(credentialsSupported).map(async ([configId, credentialsConfigSupported]): Promise<void> => {
|
|
74
75
|
let sdJwtTypeMetadata: SdJwtTypeMetadata | undefined
|
|
75
|
-
if (credentialsConfigSupported.format === '
|
|
76
|
-
const vct = (<CredentialSupportedSdJwtVc |
|
|
76
|
+
if (credentialsConfigSupported.format === 'dc+sd-jwt') {
|
|
77
|
+
const vct = (<CredentialSupportedSdJwtVc | CredentialConfigurationSupportedSdJwtVcV1_0_15>credentialsConfigSupported).vct
|
|
77
78
|
if (vct.startsWith('http')) {
|
|
78
79
|
try {
|
|
79
80
|
sdJwtTypeMetadata = await context.agent.fetchSdJwtTypeMetadataFromVctUrl({ vct })
|
|
@@ -153,10 +154,7 @@ export const selectCredentialLocaleBranding = async (
|
|
|
153
154
|
export const verifyCredentialToAccept = async (args: VerifyCredentialToAcceptArgs): Promise<VerificationResult> => {
|
|
154
155
|
const { mappedCredential, hasher, onVerifyEBSICredentialIssuer, schemaValidation, context } = args
|
|
155
156
|
|
|
156
|
-
const credential = mappedCredential.credentialToAccept.credentialResponse
|
|
157
|
-
if (!credential) {
|
|
158
|
-
return Promise.reject(Error('No credential found in credential response'))
|
|
159
|
-
}
|
|
157
|
+
const credential = extractCredentialFromResponse(mappedCredential.credentialToAccept.credentialResponse)
|
|
160
158
|
|
|
161
159
|
const wrappedVC = CredentialMapper.toWrappedVerifiableCredential(credential, { hasher: hasher ?? defaultHasher })
|
|
162
160
|
if (
|
|
@@ -205,11 +203,7 @@ export const verifyCredentialToAccept = async (args: VerifyCredentialToAcceptArg
|
|
|
205
203
|
export const mapCredentialToAccept = async (args: MapCredentialToAcceptArgs): Promise<MappedCredentialToAccept> => {
|
|
206
204
|
const { credentialToAccept, hasher } = args
|
|
207
205
|
|
|
208
|
-
const
|
|
209
|
-
const verifiableCredential: W3CVerifiableCredential | undefined = credentialResponse.credential
|
|
210
|
-
if (!verifiableCredential) {
|
|
211
|
-
return Promise.reject(Error('No credential found in credential response'))
|
|
212
|
-
}
|
|
206
|
+
const verifiableCredential = extractCredentialFromResponse(credentialToAccept.credentialResponse) as W3CVerifiableCredential
|
|
213
207
|
|
|
214
208
|
const wrappedVerifiableCredential: WrappedVerifiableCredential = CredentialMapper.toWrappedVerifiableCredential(
|
|
215
209
|
verifiableCredential as OriginalVerifiableCredential,
|
|
@@ -240,6 +234,7 @@ export const mapCredentialToAccept = async (args: MapCredentialToAcceptArgs): Pr
|
|
|
240
234
|
? uniformVerifiableCredential.decodedPayload.iss
|
|
241
235
|
: uniformVerifiableCredential.issuer.id
|
|
242
236
|
|
|
237
|
+
const credentialResponse = credentialToAccept.credentialResponse as CredentialResponseV1_0_15
|
|
243
238
|
return {
|
|
244
239
|
correlationId,
|
|
245
240
|
credentialToAccept,
|
|
@@ -250,6 +245,27 @@ export const mapCredentialToAccept = async (args: MapCredentialToAcceptArgs): Pr
|
|
|
250
245
|
}
|
|
251
246
|
}
|
|
252
247
|
|
|
248
|
+
export const extractCredentialFromResponse = (credentialResponse: CredentialResponse): OriginalVerifiableCredential => {
|
|
249
|
+
let credential: OriginalVerifiableCredential | undefined
|
|
250
|
+
|
|
251
|
+
if ('credential' in credentialResponse) {
|
|
252
|
+
credential = credentialResponse.credential as OriginalVerifiableCredential
|
|
253
|
+
} else if (
|
|
254
|
+
'credentials' in credentialResponse &&
|
|
255
|
+
credentialResponse.credentials &&
|
|
256
|
+
Array.isArray(credentialResponse.credentials) &&
|
|
257
|
+
credentialResponse.credentials.length > 0
|
|
258
|
+
) {
|
|
259
|
+
credential = credentialResponse.credentials[0].credential as OriginalVerifiableCredential // FIXME SSISDK-13 (no multi-credential support yet)
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
if (!credential) {
|
|
263
|
+
throw new Error('No credential found in credential response')
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
return credential
|
|
267
|
+
}
|
|
268
|
+
|
|
253
269
|
export const getIdentifierOpts = async (args: GetIdentifierArgs): Promise<ManagedIdentifierResult> => {
|
|
254
270
|
const { issuanceOpt, context } = args
|
|
255
271
|
const { identifier: identifierArg } = issuanceOpt
|
|
@@ -581,6 +597,7 @@ export const getIssuanceCryptoSuite = async (opts: GetIssuanceCryptoSuiteArgs):
|
|
|
581
597
|
case 'jwt_vc_json':
|
|
582
598
|
case 'jwt_vc':
|
|
583
599
|
case 'vc+sd-jwt':
|
|
600
|
+
case 'dc+sd-jwt':
|
|
584
601
|
case 'mso_mdoc': {
|
|
585
602
|
const supportedPreferences: Array<JoseSignatureAlgorithm | JoseSignatureAlgorithmString> = jwtCryptographicSuitePreferences.filter(
|
|
586
603
|
(suite: JoseSignatureAlgorithm | JoseSignatureAlgorithmString) => signing_algs_supported.includes(suite),
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { BaseActionObject, Interpreter, ResolveTypegenMeta, ServiceMap, State, StateMachine, StatesConfig, TypegenDisabled } from 'xstate'
|
|
2
2
|
import { OpenID4VCIClientState } from '@sphereon/oid4vci-client'
|
|
3
3
|
import { DidAuthConfig, Party } from '@sphereon/ssi-sdk.data-store'
|
|
4
|
-
import {
|
|
4
|
+
import { RPRegistrationMetadataPayload } from '@sphereon/did-auth-siop'
|
|
5
5
|
import { UniqueDigitalCredential } from '@sphereon/ssi-sdk.credential-store'
|
|
6
6
|
import { AuthorizationChallengeCodeResponse } from '@sphereon/oid4vci-common'
|
|
7
7
|
import { IIdentifier } from '@veramo/core'
|
|
8
8
|
import { ErrorDetails, RequiredContext } from './IOID4VCIHolder'
|
|
9
|
+
import { DcqlQuery } from 'dcql'
|
|
9
10
|
|
|
10
11
|
export enum FirstPartyMachineStateTypes {
|
|
11
12
|
sendAuthorizationChallengeRequest = 'sendAuthorizationChallengeRequest',
|
|
@@ -149,7 +150,7 @@ export type SiopV2AuthorizationRequestData = {
|
|
|
149
150
|
clientIdScheme?: string
|
|
150
151
|
clientId?: string
|
|
151
152
|
entityId?: string
|
|
152
|
-
|
|
153
|
+
dcqlQuery: DcqlQuery
|
|
153
154
|
}
|
|
154
155
|
|
|
155
156
|
export type FirstPartyMachineNavigationArgs = {
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
CredentialConfigurationSupported,
|
|
8
8
|
CredentialOfferRequestWithBaseUrl,
|
|
9
9
|
CredentialResponse,
|
|
10
|
+
CredentialResponseV1_0_15,
|
|
10
11
|
CredentialsSupportedDisplay,
|
|
11
12
|
EndpointMetadataResult,
|
|
12
13
|
ExperimentalSubjectIssuance,
|
|
@@ -377,6 +378,7 @@ export enum OID4VCIMachineGuards {
|
|
|
377
378
|
requirePinGuard = 'oid4vciRequirePinGuard',
|
|
378
379
|
requireAuthorizationGuard = 'oid4vciRequireAuthorizationGuard',
|
|
379
380
|
noAuthorizationGuard = 'oid4vciNoAuthorizationGuard',
|
|
381
|
+
hasNonceEndpointGuard = 'oid4vciHasNonceEndpointGuard ',
|
|
380
382
|
hasAuthorizationResponse = 'oid4vciHasAuthorizationResponse',
|
|
381
383
|
hasNoContactIdentityGuard = 'oid4vciHasNoContactIdentityGuard',
|
|
382
384
|
verificationCodeGuard = 'oid4vciVerificationCodeGuard',
|
|
@@ -501,7 +503,7 @@ export type CredentialToAccept = {
|
|
|
501
503
|
id?: string
|
|
502
504
|
types: string[]
|
|
503
505
|
issuanceOpt: IssuanceOpts
|
|
504
|
-
credentialResponse: CredentialResponse
|
|
506
|
+
credentialResponse: CredentialResponseV1_0_15 | CredentialResponse
|
|
505
507
|
}
|
|
506
508
|
|
|
507
509
|
export type GetCredentialConfigsSupportedArgs = {
|