@sphereon/ssi-sdk.siopv2-oid4vp-op-auth 0.34.1-feature.SSISDK.44.finish.dcql.315 → 0.34.1-feature.SSISDK.44.finish.dcql.317
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 +31 -51
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +31 -51
- package/dist/index.js.map +1 -1
- package/package.json +19 -19
- package/src/session/OID4VP.ts +38 -65
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sphereon/ssi-sdk.siopv2-oid4vp-op-auth",
|
|
3
|
-
"version": "0.34.1-feature.SSISDK.44.finish.dcql.
|
|
3
|
+
"version": "0.34.1-feature.SSISDK.44.finish.dcql.317+652e05fc",
|
|
4
4
|
"source": "src/index.ts",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -31,21 +31,21 @@
|
|
|
31
31
|
"@sphereon/oid4vc-common": "0.19.1-next.220",
|
|
32
32
|
"@sphereon/pex": "5.0.0-unstable.28",
|
|
33
33
|
"@sphereon/pex-models": "^2.3.2",
|
|
34
|
-
"@sphereon/ssi-sdk-ext.did-utils": "0.34.1-feature.SSISDK.44.finish.dcql.
|
|
35
|
-
"@sphereon/ssi-sdk-ext.identifier-resolution": "0.34.1-feature.SSISDK.44.finish.dcql.
|
|
36
|
-
"@sphereon/ssi-sdk-ext.jwt-service": "0.34.1-feature.SSISDK.44.finish.dcql.
|
|
37
|
-
"@sphereon/ssi-sdk.contact-manager": "0.34.1-feature.SSISDK.44.finish.dcql.
|
|
38
|
-
"@sphereon/ssi-sdk.core": "0.34.1-feature.SSISDK.44.finish.dcql.
|
|
39
|
-
"@sphereon/ssi-sdk.credential-store": "0.34.1-feature.SSISDK.44.finish.dcql.
|
|
40
|
-
"@sphereon/ssi-sdk.credential-validation": "0.34.1-feature.SSISDK.44.finish.dcql.
|
|
41
|
-
"@sphereon/ssi-sdk.data-store-types": "0.34.1-feature.SSISDK.44.finish.dcql.
|
|
42
|
-
"@sphereon/ssi-sdk.issuance-branding": "0.34.1-feature.SSISDK.44.finish.dcql.
|
|
43
|
-
"@sphereon/ssi-sdk.pd-manager": "0.34.1-feature.SSISDK.44.finish.dcql.
|
|
44
|
-
"@sphereon/ssi-sdk.presentation-exchange": "0.34.1-feature.SSISDK.44.finish.dcql.
|
|
45
|
-
"@sphereon/ssi-sdk.sd-jwt": "0.34.1-feature.SSISDK.44.finish.dcql.
|
|
46
|
-
"@sphereon/ssi-sdk.siopv2-oid4vp-common": "0.34.1-feature.SSISDK.44.finish.dcql.
|
|
47
|
-
"@sphereon/ssi-sdk.xstate-machine-persistence": "0.34.1-feature.SSISDK.44.finish.dcql.
|
|
48
|
-
"@sphereon/ssi-types": "0.34.1-feature.SSISDK.44.finish.dcql.
|
|
34
|
+
"@sphereon/ssi-sdk-ext.did-utils": "0.34.1-feature.SSISDK.44.finish.dcql.317+652e05fc",
|
|
35
|
+
"@sphereon/ssi-sdk-ext.identifier-resolution": "0.34.1-feature.SSISDK.44.finish.dcql.317+652e05fc",
|
|
36
|
+
"@sphereon/ssi-sdk-ext.jwt-service": "0.34.1-feature.SSISDK.44.finish.dcql.317+652e05fc",
|
|
37
|
+
"@sphereon/ssi-sdk.contact-manager": "0.34.1-feature.SSISDK.44.finish.dcql.317+652e05fc",
|
|
38
|
+
"@sphereon/ssi-sdk.core": "0.34.1-feature.SSISDK.44.finish.dcql.317+652e05fc",
|
|
39
|
+
"@sphereon/ssi-sdk.credential-store": "0.34.1-feature.SSISDK.44.finish.dcql.317+652e05fc",
|
|
40
|
+
"@sphereon/ssi-sdk.credential-validation": "0.34.1-feature.SSISDK.44.finish.dcql.317+652e05fc",
|
|
41
|
+
"@sphereon/ssi-sdk.data-store-types": "0.34.1-feature.SSISDK.44.finish.dcql.317+652e05fc",
|
|
42
|
+
"@sphereon/ssi-sdk.issuance-branding": "0.34.1-feature.SSISDK.44.finish.dcql.317+652e05fc",
|
|
43
|
+
"@sphereon/ssi-sdk.pd-manager": "0.34.1-feature.SSISDK.44.finish.dcql.317+652e05fc",
|
|
44
|
+
"@sphereon/ssi-sdk.presentation-exchange": "0.34.1-feature.SSISDK.44.finish.dcql.317+652e05fc",
|
|
45
|
+
"@sphereon/ssi-sdk.sd-jwt": "0.34.1-feature.SSISDK.44.finish.dcql.317+652e05fc",
|
|
46
|
+
"@sphereon/ssi-sdk.siopv2-oid4vp-common": "0.34.1-feature.SSISDK.44.finish.dcql.317+652e05fc",
|
|
47
|
+
"@sphereon/ssi-sdk.xstate-machine-persistence": "0.34.1-feature.SSISDK.44.finish.dcql.317+652e05fc",
|
|
48
|
+
"@sphereon/ssi-types": "0.34.1-feature.SSISDK.44.finish.dcql.317+652e05fc",
|
|
49
49
|
"@sphereon/wellknown-dids-client": "^0.1.3",
|
|
50
50
|
"@veramo/core": "4.2.0",
|
|
51
51
|
"@veramo/credential-w3c": "4.2.0",
|
|
@@ -59,8 +59,8 @@
|
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
61
|
"@sphereon/did-uni-client": "^0.6.3",
|
|
62
|
-
"@sphereon/ssi-sdk-ext.did-resolver-jwk": "0.34.1-feature.SSISDK.44.finish.dcql.
|
|
63
|
-
"@sphereon/ssi-sdk.agent-config": "0.34.1-feature.SSISDK.44.finish.dcql.
|
|
62
|
+
"@sphereon/ssi-sdk-ext.did-resolver-jwk": "0.34.1-feature.SSISDK.44.finish.dcql.317+652e05fc",
|
|
63
|
+
"@sphereon/ssi-sdk.agent-config": "0.34.1-feature.SSISDK.44.finish.dcql.317+652e05fc",
|
|
64
64
|
"@types/i18n-js": "^3.8.9",
|
|
65
65
|
"@types/lodash.memoize": "^4.1.9",
|
|
66
66
|
"@types/sha.js": "^2.4.4",
|
|
@@ -102,5 +102,5 @@
|
|
|
102
102
|
"OpenID Connect",
|
|
103
103
|
"Authenticator"
|
|
104
104
|
],
|
|
105
|
-
"gitHead": "
|
|
105
|
+
"gitHead": "652e05fcd2cf9e149125ada93fa20719258efc67"
|
|
106
106
|
}
|
package/src/session/OID4VP.ts
CHANGED
|
@@ -53,30 +53,6 @@ function extractOriginalCredential(
|
|
|
53
53
|
return credential as OriginalVerifiableCredential
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
/**
|
|
57
|
-
* Determines the format of a credential using CredentialMapper
|
|
58
|
-
*/
|
|
59
|
-
function detectCredentialFormat(credential: OriginalVerifiableCredential): string {
|
|
60
|
-
const documentFormat = CredentialMapper.detectDocumentType(credential)
|
|
61
|
-
|
|
62
|
-
switch (documentFormat) {
|
|
63
|
-
case DocumentFormat.JWT:
|
|
64
|
-
return 'jwt_vc_json'
|
|
65
|
-
case DocumentFormat.SD_JWT_VC:
|
|
66
|
-
return 'dc+sd-jwt'
|
|
67
|
-
case DocumentFormat.JSONLD:
|
|
68
|
-
return 'ldp_vc'
|
|
69
|
-
case DocumentFormat.MSO_MDOC:
|
|
70
|
-
return 'mso_mdoc'
|
|
71
|
-
case DocumentFormat.EIP712:
|
|
72
|
-
// EIP712 is a type of JSON-LD proof
|
|
73
|
-
return 'ldp_vc'
|
|
74
|
-
default:
|
|
75
|
-
// Default to JWT for unknown formats
|
|
76
|
-
return 'jwt_vc_json'
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
|
|
80
56
|
/**
|
|
81
57
|
* Gets the issuer/holder identifier from ManagedIdentifierOptsOrResult
|
|
82
58
|
*/
|
|
@@ -105,12 +81,12 @@ export async function createVerifiablePresentationForFormat(
|
|
|
105
81
|
const { nonce, audience, agent, clockSkew = CLOCK_SKEW } = context
|
|
106
82
|
|
|
107
83
|
const originalCredential = extractOriginalCredential(credential)
|
|
108
|
-
const
|
|
84
|
+
const documentFormat = CredentialMapper.detectDocumentType(originalCredential)
|
|
109
85
|
|
|
110
|
-
logger.debug(`Creating VP for format: ${
|
|
86
|
+
logger.debug(`Creating VP for format: ${documentFormat}`)
|
|
111
87
|
|
|
112
|
-
switch (
|
|
113
|
-
case
|
|
88
|
+
switch (documentFormat) {
|
|
89
|
+
case DocumentFormat.SD_JWT_VC: {
|
|
114
90
|
// SD-JWT with KB-JWT
|
|
115
91
|
const decodedSdJwt = await CredentialMapper.decodeSdJwtVcAsync(
|
|
116
92
|
typeof originalCredential === 'string' ? originalCredential : (originalCredential as SdJwtDecodedVerifiableCredential).compactSdJwtVc,
|
|
@@ -137,40 +113,7 @@ export async function createVerifiablePresentationForFormat(
|
|
|
137
113
|
return presentationResult.presentation
|
|
138
114
|
}
|
|
139
115
|
|
|
140
|
-
case
|
|
141
|
-
// JWT VC - create JWT VP with nonce and aud in payload
|
|
142
|
-
const vcJwt = typeof originalCredential === 'string' ? originalCredential : JSON.stringify(originalCredential)
|
|
143
|
-
|
|
144
|
-
const identifierString = getIdentifierString(identifier)
|
|
145
|
-
|
|
146
|
-
// Create VP JWT using agent method
|
|
147
|
-
const vpPayload = {
|
|
148
|
-
iss: identifierString,
|
|
149
|
-
aud: audience, // Client Identifier or Origin
|
|
150
|
-
nonce, // Authorization Request nonce
|
|
151
|
-
vp: {
|
|
152
|
-
'@context': ['https://www.w3.org/2018/credentials/v1'],
|
|
153
|
-
type: ['VerifiablePresentation'],
|
|
154
|
-
holder: identifierString,
|
|
155
|
-
verifiableCredential: [vcJwt],
|
|
156
|
-
},
|
|
157
|
-
iat: Math.floor(Date.now() / 1000 - clockSkew),
|
|
158
|
-
exp: Math.floor(Date.now() / 1000 + 600), // 10 minutes
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
// Use the agent's JWT creation capability
|
|
162
|
-
const vpJwt = await agent.createVerifiablePresentation({
|
|
163
|
-
presentation: vpPayload.vp,
|
|
164
|
-
proofFormat: 'jwt',
|
|
165
|
-
domain: audience,
|
|
166
|
-
challenge: nonce,
|
|
167
|
-
keyRef: identifier.kmsKeyRef || identifier.kid,
|
|
168
|
-
})
|
|
169
|
-
|
|
170
|
-
return vpJwt.proof?.jwt || vpJwt
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
case 'ldp_vc': {
|
|
116
|
+
case DocumentFormat.JSONLD: {
|
|
174
117
|
// JSON-LD VC - create JSON-LD VP with challenge and domain in proof
|
|
175
118
|
const vcObject = typeof originalCredential === 'string' ? JSON.parse(originalCredential) : originalCredential
|
|
176
119
|
|
|
@@ -190,7 +133,7 @@ export async function createVerifiablePresentationForFormat(
|
|
|
190
133
|
})
|
|
191
134
|
}
|
|
192
135
|
|
|
193
|
-
case
|
|
136
|
+
case DocumentFormat.MSO_MDOC: {
|
|
194
137
|
// ISO mdoc - create mdoc VP token
|
|
195
138
|
// This is a placeholder implementation
|
|
196
139
|
// Full implementation would require:
|
|
@@ -202,7 +145,37 @@ export async function createVerifiablePresentationForFormat(
|
|
|
202
145
|
return originalCredential
|
|
203
146
|
}
|
|
204
147
|
|
|
205
|
-
default:
|
|
206
|
-
|
|
148
|
+
default: {
|
|
149
|
+
// JWT VC - create JWT VP with nonce and aud in payload
|
|
150
|
+
const vcJwt = typeof originalCredential === 'string' ? originalCredential : JSON.stringify(originalCredential)
|
|
151
|
+
|
|
152
|
+
const identifierString = getIdentifierString(identifier)
|
|
153
|
+
|
|
154
|
+
// Create VP JWT using agent method
|
|
155
|
+
const vpPayload = {
|
|
156
|
+
iss: identifierString,
|
|
157
|
+
aud: audience, // Client Identifier or Origin
|
|
158
|
+
nonce, // Authorization Request nonce
|
|
159
|
+
vp: {
|
|
160
|
+
'@context': ['https://www.w3.org/2018/credentials/v1'],
|
|
161
|
+
type: ['VerifiablePresentation'],
|
|
162
|
+
holder: identifierString,
|
|
163
|
+
verifiableCredential: [vcJwt],
|
|
164
|
+
},
|
|
165
|
+
iat: Math.floor(Date.now() / 1000 - clockSkew),
|
|
166
|
+
exp: Math.floor(Date.now() / 1000 + 600 + clockSkew), // 10 minutes
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
// Use the agent's JWT creation capability
|
|
170
|
+
const vpJwt = await agent.createVerifiablePresentation({
|
|
171
|
+
presentation: vpPayload.vp,
|
|
172
|
+
proofFormat: 'jwt',
|
|
173
|
+
domain: audience,
|
|
174
|
+
challenge: nonce,
|
|
175
|
+
keyRef: identifier.kmsKeyRef || identifier.kid,
|
|
176
|
+
})
|
|
177
|
+
|
|
178
|
+
return vpJwt.proof?.jwt || vpJwt
|
|
179
|
+
}
|
|
207
180
|
}
|
|
208
181
|
}
|