@sphereon/ssi-sdk.oid4vci-holder 0.34.1-feat.SSISDK.35.63 → 0.34.1-feature.DIIPv4.29
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 +54 -77
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -6
- package/dist/index.d.ts +3 -6
- package/dist/index.js +33 -56
- package/dist/index.js.map +1 -1
- package/package.json +24 -25
- package/src/agent/OID4VCIHolder.ts +21 -35
- package/src/services/OID4VCIHolderService.ts +5 -27
- package/src/types/FirstPartyMachine.ts +0 -2
- package/src/types/IOID4VCIHolder.ts +1 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sphereon/ssi-sdk.oid4vci-holder",
|
|
3
|
-
"version": "0.34.1-
|
|
3
|
+
"version": "0.34.1-feature.DIIPv4.29+2593a430",
|
|
4
4
|
"source": "src/index.ts",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -26,41 +26,40 @@
|
|
|
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-next.2",
|
|
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
|
-
"@sphereon/ssi-sdk-ext.identifier-resolution": "0.
|
|
35
|
-
"@sphereon/ssi-sdk-ext.jwt-service": "0.
|
|
36
|
-
"@sphereon/ssi-sdk-ext.key-utils": "0.
|
|
37
|
-
"@sphereon/ssi-sdk.contact-manager": "0.34.1-
|
|
38
|
-
"@sphereon/ssi-sdk.core": "0.34.1-
|
|
39
|
-
"@sphereon/ssi-sdk.credential-store": "0.34.1-
|
|
40
|
-
"@sphereon/ssi-sdk.credential-validation": "0.34.1-
|
|
41
|
-
"@sphereon/ssi-sdk.data-store": "0.34.1-
|
|
42
|
-
"@sphereon/ssi-sdk.issuance-branding": "0.34.1-
|
|
43
|
-
"@sphereon/ssi-sdk.mdl-mdoc": "0.34.1-
|
|
44
|
-
"@sphereon/ssi-sdk.oidf-client": "0.34.1-
|
|
45
|
-
"@sphereon/ssi-sdk.sd-jwt": "0.34.1-
|
|
46
|
-
"@sphereon/ssi-sdk.siopv2-oid4vp-common": "0.34.1-
|
|
47
|
-
"@sphereon/ssi-sdk.siopv2-oid4vp-op-auth": "0.34.1-
|
|
48
|
-
"@sphereon/ssi-sdk.xstate-machine-persistence": "0.34.1-
|
|
49
|
-
"@sphereon/ssi-types": "0.34.1-
|
|
31
|
+
"@sphereon/oid4vci-client": "0.19.1-next.2",
|
|
32
|
+
"@sphereon/oid4vci-common": "0.19.1-next.2",
|
|
33
|
+
"@sphereon/ssi-sdk-ext.did-utils": "0.29.1-next.3",
|
|
34
|
+
"@sphereon/ssi-sdk-ext.identifier-resolution": "0.29.1-next.3",
|
|
35
|
+
"@sphereon/ssi-sdk-ext.jwt-service": "0.29.1-next.3",
|
|
36
|
+
"@sphereon/ssi-sdk-ext.key-utils": "0.29.1-next.3",
|
|
37
|
+
"@sphereon/ssi-sdk.contact-manager": "0.34.1-feature.DIIPv4.29+2593a430",
|
|
38
|
+
"@sphereon/ssi-sdk.core": "0.34.1-feature.DIIPv4.29+2593a430",
|
|
39
|
+
"@sphereon/ssi-sdk.credential-store": "0.34.1-feature.DIIPv4.29+2593a430",
|
|
40
|
+
"@sphereon/ssi-sdk.credential-validation": "0.34.1-feature.DIIPv4.29+2593a430",
|
|
41
|
+
"@sphereon/ssi-sdk.data-store": "0.34.1-feature.DIIPv4.29+2593a430",
|
|
42
|
+
"@sphereon/ssi-sdk.issuance-branding": "0.34.1-feature.DIIPv4.29+2593a430",
|
|
43
|
+
"@sphereon/ssi-sdk.mdl-mdoc": "0.34.1-feature.DIIPv4.29+2593a430",
|
|
44
|
+
"@sphereon/ssi-sdk.oidf-client": "0.34.1-feature.DIIPv4.29+2593a430",
|
|
45
|
+
"@sphereon/ssi-sdk.sd-jwt": "0.34.1-feature.DIIPv4.29+2593a430",
|
|
46
|
+
"@sphereon/ssi-sdk.siopv2-oid4vp-common": "0.34.1-feature.DIIPv4.29+2593a430",
|
|
47
|
+
"@sphereon/ssi-sdk.siopv2-oid4vp-op-auth": "0.34.1-feature.DIIPv4.29+2593a430",
|
|
48
|
+
"@sphereon/ssi-sdk.xstate-machine-persistence": "0.34.1-feature.DIIPv4.29+2593a430",
|
|
49
|
+
"@sphereon/ssi-types": "0.34.1-feature.DIIPv4.29+2593a430",
|
|
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",
|
|
56
55
|
"i18n-js": "^3.9.2",
|
|
57
56
|
"lodash.memoize": "^4.1.2",
|
|
58
57
|
"uuid": "^9.0.1",
|
|
59
58
|
"xstate": "^4.38.3"
|
|
60
59
|
},
|
|
61
60
|
"devDependencies": {
|
|
62
|
-
"@sphereon/oid4vc-common": "0.19.1-
|
|
63
|
-
"@sphereon/ssi-sdk-ext.did-resolver-jwk": "0.
|
|
61
|
+
"@sphereon/oid4vc-common": "0.19.1-next.2",
|
|
62
|
+
"@sphereon/ssi-sdk-ext.did-resolver-jwk": "0.29.1-next.3",
|
|
64
63
|
"@sphereon/ssi-sdk.siopv2-oid4vp-common": "workspace:*",
|
|
65
64
|
"@types/i18n-js": "^3.8.9",
|
|
66
65
|
"@types/lodash.memoize": "^4.1.9",
|
|
@@ -90,5 +89,5 @@
|
|
|
90
89
|
"OID4VCI",
|
|
91
90
|
"State Machine"
|
|
92
91
|
],
|
|
93
|
-
"gitHead": "
|
|
92
|
+
"gitHead": "2593a430ac4faca47b620a3e12b297899518f2af"
|
|
94
93
|
}
|
|
@@ -4,8 +4,8 @@ import {
|
|
|
4
4
|
AuthorizationRequestOpts,
|
|
5
5
|
AuthorizationServerClientOpts,
|
|
6
6
|
AuthorizationServerOpts,
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
CredentialConfigurationSupportedJwtVcJsonLdAndLdpVcV1_0_13,
|
|
8
|
+
CredentialDefinitionJwtVcJsonLdAndLdpVcV1_0_13,
|
|
9
9
|
CredentialOfferRequestWithBaseUrl,
|
|
10
10
|
DefaultURISchemes,
|
|
11
11
|
EndpointMetadataResult,
|
|
@@ -30,7 +30,6 @@ 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'
|
|
34
33
|
import {
|
|
35
34
|
ConnectionType,
|
|
36
35
|
CorrelationIdentifierType,
|
|
@@ -74,18 +73,6 @@ import { asArray, computeEntryHash } from '@veramo/utils'
|
|
|
74
73
|
import { decodeJWT } from 'did-jwt'
|
|
75
74
|
import { v4 as uuidv4 } from 'uuid'
|
|
76
75
|
import { OID4VCIMachine } from '../machines/oid4vciMachine'
|
|
77
|
-
import {
|
|
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'
|
|
89
76
|
import {
|
|
90
77
|
AddContactIdentityArgs,
|
|
91
78
|
AssertValidCredentialsArgs,
|
|
@@ -124,6 +111,19 @@ import {
|
|
|
124
111
|
VerifyEBSICredentialIssuerArgs,
|
|
125
112
|
VerifyEBSICredentialIssuerResult,
|
|
126
113
|
} 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) => {
|
|
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:
|
|
173
|
+
issuer: { ...resolution, 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> = ['
|
|
232
|
+
private readonly vcFormatPreferences: Array<string> = ['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,21 +939,7 @@ 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
|
-
const
|
|
943
|
-
let issuerVC
|
|
944
|
-
if ('credential' in credentialResponse) {
|
|
945
|
-
issuerVC = credentialResponse.credential as OriginalVerifiableCredential
|
|
946
|
-
} else if (
|
|
947
|
-
'credentials' in credentialResponse &&
|
|
948
|
-
credentialResponse.credentials &&
|
|
949
|
-
Array.isArray(credentialResponse.credentials) &&
|
|
950
|
-
credentialResponse.credentials.length > 0
|
|
951
|
-
) {
|
|
952
|
-
issuerVC = credentialResponse.credentials[0].credential as OriginalVerifiableCredential // FIXME SSISDK-13
|
|
953
|
-
}
|
|
954
|
-
if (!issuerVC) {
|
|
955
|
-
return Promise.reject(Error('No credential found in credential response'))
|
|
956
|
-
}
|
|
942
|
+
const issuerVC = mappedCredentialToAccept.credentialToAccept.credentialResponse.credential as OriginalVerifiableCredential
|
|
957
943
|
const wrappedIssuerVC = CredentialMapper.toWrappedVerifiableCredential(issuerVC, { hasher: this.hasher ?? defaultHasher })
|
|
958
944
|
console.log(`Wrapped VC: ${wrappedIssuerVC.type}, ${wrappedIssuerVC.format}`)
|
|
959
945
|
// 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!)
|
|
@@ -1183,9 +1169,9 @@ export class OID4VCIHolder implements IAgentPlugin {
|
|
|
1183
1169
|
return undefined
|
|
1184
1170
|
}
|
|
1185
1171
|
|
|
1186
|
-
private getCredentialDefinition(issuanceOpt: IssuanceOpts):
|
|
1172
|
+
private getCredentialDefinition(issuanceOpt: IssuanceOpts): CredentialDefinitionJwtVcJsonLdAndLdpVcV1_0_13 | undefined {
|
|
1187
1173
|
if (issuanceOpt.format == 'ldp_vc' || issuanceOpt.format == 'jwt_vc_json-ld') {
|
|
1188
|
-
return (issuanceOpt as
|
|
1174
|
+
return (issuanceOpt as CredentialConfigurationSupportedJwtVcJsonLdAndLdpVcV1_0_13).credential_definition
|
|
1189
1175
|
}
|
|
1190
1176
|
return undefined
|
|
1191
1177
|
}
|
|
@@ -2,7 +2,7 @@ import { LOG } from '@sphereon/oid4vci-client'
|
|
|
2
2
|
import {
|
|
3
3
|
CredentialConfigurationSupported,
|
|
4
4
|
CredentialSupportedSdJwtVc,
|
|
5
|
-
|
|
5
|
+
CredentialConfigurationSupportedSdJwtVcV1_0_13,
|
|
6
6
|
CredentialOfferFormatV1_0_11,
|
|
7
7
|
CredentialResponse,
|
|
8
8
|
getSupportedCredentials,
|
|
@@ -72,8 +72,8 @@ export const getCredentialBranding = async (args: GetCredentialBrandingArgs): Pr
|
|
|
72
72
|
await Promise.all(
|
|
73
73
|
Object.entries(credentialsSupported).map(async ([configId, credentialsConfigSupported]): Promise<void> => {
|
|
74
74
|
let sdJwtTypeMetadata: SdJwtTypeMetadata | undefined
|
|
75
|
-
if (credentialsConfigSupported.format === '
|
|
76
|
-
const vct = (<CredentialSupportedSdJwtVc |
|
|
75
|
+
if (credentialsConfigSupported.format === 'vc+sd-jwt') {
|
|
76
|
+
const vct = (<CredentialSupportedSdJwtVc | CredentialConfigurationSupportedSdJwtVcV1_0_13>credentialsConfigSupported).vct
|
|
77
77
|
if (vct.startsWith('http')) {
|
|
78
78
|
try {
|
|
79
79
|
sdJwtTypeMetadata = await context.agent.fetchSdJwtTypeMetadataFromVctUrl({ vct })
|
|
@@ -153,18 +153,7 @@ export const selectCredentialLocaleBranding = async (
|
|
|
153
153
|
export const verifyCredentialToAccept = async (args: VerifyCredentialToAcceptArgs): Promise<VerificationResult> => {
|
|
154
154
|
const { mappedCredential, hasher, onVerifyEBSICredentialIssuer, schemaValidation, context } = args
|
|
155
155
|
|
|
156
|
-
const
|
|
157
|
-
let credential
|
|
158
|
-
if ('credential' in credentialResponse) {
|
|
159
|
-
credential = credentialResponse.credential as OriginalVerifiableCredential
|
|
160
|
-
} else if (
|
|
161
|
-
'credentials' in credentialResponse &&
|
|
162
|
-
credentialResponse.credentials &&
|
|
163
|
-
Array.isArray(credentialResponse.credentials) &&
|
|
164
|
-
credentialResponse.credentials.length > 0
|
|
165
|
-
) {
|
|
166
|
-
credential = credentialResponse.credentials[0].credential as OriginalVerifiableCredential // FIXME SSISDK-13 (no multi-credential support yet)
|
|
167
|
-
}
|
|
156
|
+
const credential = mappedCredential.credentialToAccept.credentialResponse.credential as OriginalVerifiableCredential
|
|
168
157
|
if (!credential) {
|
|
169
158
|
return Promise.reject(Error('No credential found in credential response'))
|
|
170
159
|
}
|
|
@@ -217,17 +206,7 @@ export const mapCredentialToAccept = async (args: MapCredentialToAcceptArgs): Pr
|
|
|
217
206
|
const { credentialToAccept, hasher } = args
|
|
218
207
|
|
|
219
208
|
const credentialResponse: CredentialResponse = credentialToAccept.credentialResponse
|
|
220
|
-
|
|
221
|
-
if ('credential' in credentialResponse) {
|
|
222
|
-
verifiableCredential = credentialResponse.credential
|
|
223
|
-
} else if (
|
|
224
|
-
'credentials' in credentialResponse &&
|
|
225
|
-
credentialResponse.credentials &&
|
|
226
|
-
Array.isArray(credentialResponse.credentials) &&
|
|
227
|
-
credentialResponse.credentials.length > 0
|
|
228
|
-
) {
|
|
229
|
-
verifiableCredential = credentialResponse.credentials[0].credential // FIXME SSISDK-13 (no multi-credential support yet)
|
|
230
|
-
}
|
|
209
|
+
const verifiableCredential: W3CVerifiableCredential | undefined = credentialResponse.credential
|
|
231
210
|
if (!verifiableCredential) {
|
|
232
211
|
return Promise.reject(Error('No credential found in credential response'))
|
|
233
212
|
}
|
|
@@ -602,7 +581,6 @@ export const getIssuanceCryptoSuite = async (opts: GetIssuanceCryptoSuiteArgs):
|
|
|
602
581
|
case 'jwt_vc_json':
|
|
603
582
|
case 'jwt_vc':
|
|
604
583
|
case 'vc+sd-jwt':
|
|
605
|
-
case 'dc+sd-jwt':
|
|
606
584
|
case 'mso_mdoc': {
|
|
607
585
|
const supportedPreferences: Array<JoseSignatureAlgorithm | JoseSignatureAlgorithmString> = jwtCryptographicSuitePreferences.filter(
|
|
608
586
|
(suite: JoseSignatureAlgorithm | JoseSignatureAlgorithmString) => signing_algs_supported.includes(suite),
|
|
@@ -6,7 +6,6 @@ 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'
|
|
10
9
|
|
|
11
10
|
export enum FirstPartyMachineStateTypes {
|
|
12
11
|
sendAuthorizationChallengeRequest = 'sendAuthorizationChallengeRequest',
|
|
@@ -151,7 +150,6 @@ export type SiopV2AuthorizationRequestData = {
|
|
|
151
150
|
clientId?: string
|
|
152
151
|
entityId?: string
|
|
153
152
|
presentationDefinitions?: PresentationDefinitionWithLocation[]
|
|
154
|
-
dcqlQuery: DcqlQuery
|
|
155
153
|
}
|
|
156
154
|
|
|
157
155
|
export type FirstPartyMachineNavigationArgs = {
|
|
@@ -7,7 +7,6 @@ import {
|
|
|
7
7
|
CredentialConfigurationSupported,
|
|
8
8
|
CredentialOfferRequestWithBaseUrl,
|
|
9
9
|
CredentialResponse,
|
|
10
|
-
CredentialResponseV1_0_15,
|
|
11
10
|
CredentialsSupportedDisplay,
|
|
12
11
|
EndpointMetadataResult,
|
|
13
12
|
ExperimentalSubjectIssuance,
|
|
@@ -378,7 +377,6 @@ export enum OID4VCIMachineGuards {
|
|
|
378
377
|
requirePinGuard = 'oid4vciRequirePinGuard',
|
|
379
378
|
requireAuthorizationGuard = 'oid4vciRequireAuthorizationGuard',
|
|
380
379
|
noAuthorizationGuard = 'oid4vciNoAuthorizationGuard',
|
|
381
|
-
hasNonceEndpointGuard = 'oid4vciHasNonceEndpointGuard ',
|
|
382
380
|
hasAuthorizationResponse = 'oid4vciHasAuthorizationResponse',
|
|
383
381
|
hasNoContactIdentityGuard = 'oid4vciHasNoContactIdentityGuard',
|
|
384
382
|
verificationCodeGuard = 'oid4vciVerificationCodeGuard',
|
|
@@ -503,7 +501,7 @@ export type CredentialToAccept = {
|
|
|
503
501
|
id?: string
|
|
504
502
|
types: string[]
|
|
505
503
|
issuanceOpt: IssuanceOpts
|
|
506
|
-
credentialResponse:
|
|
504
|
+
credentialResponse: CredentialResponse
|
|
507
505
|
}
|
|
508
506
|
|
|
509
507
|
export type GetCredentialConfigsSupportedArgs = {
|