@sphereon/ssi-sdk.oid4vci-holder 0.34.1-next.87 → 0.34.1-next.91

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sphereon/ssi-sdk.oid4vci-holder",
3
- "version": "0.34.1-next.87+8fbfff8c",
3
+ "version": "0.34.1-next.91+3c949810",
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-feature.SSISDK.45.86",
29
+ "@sphereon/did-auth-siop": "0.19.1-feature.SSISDK.45.90",
30
30
  "@sphereon/kmp-mdoc-core": "0.2.0-SNAPSHOT.26",
31
- "@sphereon/oid4vci-client": "0.19.1-feature.SSISDK.45.86",
32
- "@sphereon/oid4vci-common": "0.19.1-feature.SSISDK.45.86",
33
- "@sphereon/ssi-sdk-ext.did-utils": "0.34.1-next.87+8fbfff8c",
34
- "@sphereon/ssi-sdk-ext.identifier-resolution": "0.34.1-next.87+8fbfff8c",
35
- "@sphereon/ssi-sdk-ext.jwt-service": "0.34.1-next.87+8fbfff8c",
36
- "@sphereon/ssi-sdk-ext.key-utils": "0.34.1-next.87+8fbfff8c",
37
- "@sphereon/ssi-sdk.contact-manager": "0.34.1-next.87+8fbfff8c",
38
- "@sphereon/ssi-sdk.core": "0.34.1-next.87+8fbfff8c",
39
- "@sphereon/ssi-sdk.credential-store": "0.34.1-next.87+8fbfff8c",
40
- "@sphereon/ssi-sdk.credential-validation": "0.34.1-next.87+8fbfff8c",
41
- "@sphereon/ssi-sdk.data-store": "0.34.1-next.87+8fbfff8c",
42
- "@sphereon/ssi-sdk.issuance-branding": "0.34.1-next.87+8fbfff8c",
43
- "@sphereon/ssi-sdk.mdl-mdoc": "0.34.1-next.87+8fbfff8c",
44
- "@sphereon/ssi-sdk.oidf-client": "0.34.1-next.87+8fbfff8c",
45
- "@sphereon/ssi-sdk.sd-jwt": "0.34.1-next.87+8fbfff8c",
46
- "@sphereon/ssi-sdk.siopv2-oid4vp-common": "0.34.1-next.87+8fbfff8c",
47
- "@sphereon/ssi-sdk.siopv2-oid4vp-op-auth": "0.34.1-next.87+8fbfff8c",
48
- "@sphereon/ssi-sdk.xstate-machine-persistence": "0.34.1-next.87+8fbfff8c",
49
- "@sphereon/ssi-types": "0.34.1-next.87+8fbfff8c",
31
+ "@sphereon/oid4vci-client": "0.19.1-feature.SSISDK.45.90",
32
+ "@sphereon/oid4vci-common": "0.19.1-feature.SSISDK.45.90",
33
+ "@sphereon/ssi-sdk-ext.did-utils": "0.34.1-next.91+3c949810",
34
+ "@sphereon/ssi-sdk-ext.identifier-resolution": "0.34.1-next.91+3c949810",
35
+ "@sphereon/ssi-sdk-ext.jwt-service": "0.34.1-next.91+3c949810",
36
+ "@sphereon/ssi-sdk-ext.key-utils": "0.34.1-next.91+3c949810",
37
+ "@sphereon/ssi-sdk.contact-manager": "0.34.1-next.91+3c949810",
38
+ "@sphereon/ssi-sdk.core": "0.34.1-next.91+3c949810",
39
+ "@sphereon/ssi-sdk.credential-store": "0.34.1-next.91+3c949810",
40
+ "@sphereon/ssi-sdk.credential-validation": "0.34.1-next.91+3c949810",
41
+ "@sphereon/ssi-sdk.data-store": "0.34.1-next.91+3c949810",
42
+ "@sphereon/ssi-sdk.issuance-branding": "0.34.1-next.91+3c949810",
43
+ "@sphereon/ssi-sdk.mdl-mdoc": "0.34.1-next.91+3c949810",
44
+ "@sphereon/ssi-sdk.oidf-client": "0.34.1-next.91+3c949810",
45
+ "@sphereon/ssi-sdk.sd-jwt": "0.34.1-next.91+3c949810",
46
+ "@sphereon/ssi-sdk.siopv2-oid4vp-common": "0.34.1-next.91+3c949810",
47
+ "@sphereon/ssi-sdk.siopv2-oid4vp-op-auth": "0.34.1-next.91+3c949810",
48
+ "@sphereon/ssi-sdk.xstate-machine-persistence": "0.34.1-next.91+3c949810",
49
+ "@sphereon/ssi-types": "0.34.1-next.91+3c949810",
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-feature.SSISDK.45.86",
63
- "@sphereon/ssi-sdk-ext.did-resolver-jwk": "0.34.1-next.87+8fbfff8c",
62
+ "@sphereon/oid4vc-common": "0.19.1-feature.SSISDK.45.90",
63
+ "@sphereon/ssi-sdk-ext.did-resolver-jwk": "0.34.1-next.91+3c949810",
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": "8fbfff8ca6d490f1f01dd5401c2a30d7581cda59"
93
+ "gitHead": "3c9498100ca07dfc2ba7979e7347fb9b19c47d18"
94
94
  }
@@ -55,7 +55,6 @@ import {
55
55
  JoseSignatureAlgorithmString,
56
56
  JwtDecodedVerifiableCredential,
57
57
  Loggers,
58
- OriginalVerifiableCredential,
59
58
  parseDid,
60
59
  SdJwtDecodedVerifiableCredentialPayload,
61
60
  WrappedW3CVerifiableCredential,
@@ -75,6 +74,7 @@ import { decodeJWT } from 'did-jwt'
75
74
  import { v4 as uuidv4 } from 'uuid'
76
75
  import { OID4VCIMachine } from '../machines/oid4vciMachine'
77
76
  import {
77
+ extractCredentialFromResponse,
78
78
  getBasicIssuerLocaleBranding,
79
79
  getCredentialBranding,
80
80
  getCredentialConfigsSupportedMerged,
@@ -939,21 +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
- const credentialResponse = mappedCredentialToAccept.credentialToAccept.credentialResponse
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 (no multi-credential support yet)
953
- }
954
- if (!issuerVC) {
955
- return Promise.reject(Error('No credential found in credential response'))
956
- }
942
+
943
+ const issuerVC = extractCredentialFromResponse(mappedCredentialToAccept.credentialToAccept.credentialResponse)
957
944
  const wrappedIssuerVC = CredentialMapper.toWrappedVerifiableCredential(issuerVC, { hasher: this.hasher ?? defaultHasher })
958
945
  console.log(`Wrapped VC: ${wrappedIssuerVC.type}, ${wrappedIssuerVC.format}`)
959
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!)
@@ -1,16 +1,17 @@
1
1
  import { LOG } from '@sphereon/oid4vci-client'
2
2
  import {
3
+ AuthorizationChallengeCodeResponse,
3
4
  CredentialConfigurationSupported,
4
- CredentialSupportedSdJwtVc,
5
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
@@ -153,21 +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 credentialResponse = mappedCredential.credentialToAccept.credentialResponse
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
- }
168
- if (!credential) {
169
- return Promise.reject(Error('No credential found in credential response'))
170
- }
157
+ const credential = extractCredentialFromResponse(mappedCredential.credentialToAccept.credentialResponse)
171
158
 
172
159
  const wrappedVC = CredentialMapper.toWrappedVerifiableCredential(credential, { hasher: hasher ?? defaultHasher })
173
160
  if (
@@ -216,21 +203,7 @@ export const verifyCredentialToAccept = async (args: VerifyCredentialToAcceptArg
216
203
  export const mapCredentialToAccept = async (args: MapCredentialToAcceptArgs): Promise<MappedCredentialToAccept> => {
217
204
  const { credentialToAccept, hasher } = args
218
205
 
219
- const credentialResponse: CredentialResponse = credentialToAccept.credentialResponse
220
- let verifiableCredential: W3CVerifiableCredential | undefined
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
- }
231
- if (!verifiableCredential) {
232
- return Promise.reject(Error('No credential found in credential response'))
233
- }
206
+ const verifiableCredential = extractCredentialFromResponse(credentialToAccept.credentialResponse) as W3CVerifiableCredential
234
207
 
235
208
  const wrappedVerifiableCredential: WrappedVerifiableCredential = CredentialMapper.toWrappedVerifiableCredential(
236
209
  verifiableCredential as OriginalVerifiableCredential,
@@ -261,6 +234,7 @@ export const mapCredentialToAccept = async (args: MapCredentialToAcceptArgs): Pr
261
234
  ? uniformVerifiableCredential.decodedPayload.iss
262
235
  : uniformVerifiableCredential.issuer.id
263
236
 
237
+ const credentialResponse = credentialToAccept.credentialResponse as CredentialResponseV1_0_15
264
238
  return {
265
239
  correlationId,
266
240
  credentialToAccept,
@@ -271,6 +245,27 @@ export const mapCredentialToAccept = async (args: MapCredentialToAcceptArgs): Pr
271
245
  }
272
246
  }
273
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
+
274
269
  export const getIdentifierOpts = async (args: GetIdentifierArgs): Promise<ManagedIdentifierResult> => {
275
270
  const { issuanceOpt, context } = args
276
271
  const { identifier: identifierArg } = issuanceOpt
@@ -601,7 +596,7 @@ export const getIssuanceCryptoSuite = async (opts: GetIssuanceCryptoSuiteArgs):
601
596
  case 'jwt':
602
597
  case 'jwt_vc_json':
603
598
  case 'jwt_vc':
604
- case 'dc+sd-jwt':
599
+ case 'vc+sd-jwt':
605
600
  case 'dc+sd-jwt':
606
601
  case 'mso_mdoc': {
607
602
  const supportedPreferences: Array<JoseSignatureAlgorithm | JoseSignatureAlgorithmString> = jwtCryptographicSuitePreferences.filter(