@openid4vc/openid4vci 0.3.0-alpha-20251017121147 → 0.3.0-alpha-20251021081452

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.mjs CHANGED
@@ -4,7 +4,7 @@ import z from "zod";
4
4
 
5
5
  //#region src/version.ts
6
6
  let Openid4vciDraftVersion = /* @__PURE__ */ function(Openid4vciDraftVersion$1) {
7
- Openid4vciDraftVersion$1["Draft16"] = "Draft16";
7
+ Openid4vciDraftVersion$1["V1"] = "V1";
8
8
  Openid4vciDraftVersion$1["Draft15"] = "Draft15";
9
9
  Openid4vciDraftVersion$1["Draft14"] = "Draft14";
10
10
  Openid4vciDraftVersion$1["Draft11"] = "Draft11";
@@ -17,23 +17,23 @@ const zTxCode = z.object({
17
17
  input_mode: z.union([z.literal("numeric"), z.literal("text")]).optional(),
18
18
  length: z.number().int().optional(),
19
19
  description: z.string().max(300).optional()
20
- }).passthrough();
20
+ }).loose();
21
21
  const zCredentialOfferGrants = z.object({
22
22
  authorization_code: z.object({
23
23
  issuer_state: z.string().optional(),
24
24
  authorization_server: zHttpsUrl.optional()
25
- }).passthrough().optional(),
25
+ }).loose().optional(),
26
26
  [preAuthorizedCodeGrantIdentifier]: z.object({
27
27
  "pre-authorized_code": z.string(),
28
28
  tx_code: zTxCode.optional(),
29
29
  authorization_server: zHttpsUrl.optional()
30
- }).passthrough().optional()
31
- }).passthrough();
30
+ }).loose().optional()
31
+ }).loose();
32
32
  const zCredentialOfferObjectDraft14 = z.object({
33
33
  credential_issuer: zHttpsUrl,
34
34
  credential_configuration_ids: z.array(z.string()),
35
35
  grants: z.optional(zCredentialOfferGrants)
36
- }).passthrough();
36
+ }).loose();
37
37
  const zCredentialOfferObjectDraft11To14 = z.object({
38
38
  credential_issuer: zHttpsUrl,
39
39
  credentials: z.array(z.string({ message: "Only string credential identifiers are supported for draft 11 credential offers" })),
@@ -42,9 +42,9 @@ const zCredentialOfferObjectDraft11To14 = z.object({
42
42
  [preAuthorizedCodeGrantIdentifier]: z.object({
43
43
  "pre-authorized_code": z.string(),
44
44
  user_pin_required: z.optional(z.boolean())
45
- }).passthrough().optional()
45
+ }).loose().optional()
46
46
  }))
47
- }).passthrough().transform(({ credentials, grants,...rest }) => {
47
+ }).loose().transform(({ credentials, grants,...rest }) => {
48
48
  const v14 = {
49
49
  ...rest,
50
50
  credential_configuration_ids: credentials
@@ -151,14 +151,15 @@ const zCredentialConfigurationSupportedClaimsDescriptionDraft14 = z.object({
151
151
  display: z.array(z.object({
152
152
  name: z.string().optional(),
153
153
  locale: z.string().optional()
154
- }).passthrough()).optional()
155
- }).passthrough();
154
+ }).loose()).optional()
155
+ }).loose();
156
156
  const zCredentialConfigurationSupportedClaimsDraft14 = z.record(z.string(), z.union([zCredentialConfigurationSupportedClaimsDescriptionDraft14, z.lazy(() => zCredentialConfigurationSupportedClaimsDraft14)]));
157
- const zClaimsDescriptionPath = z.array(z.union([
157
+ const zClaimDescriptionPathValue = z.union([
158
158
  z.string(),
159
159
  z.number().int().nonnegative(),
160
160
  z.null()
161
- ])).nonempty();
161
+ ]);
162
+ const zClaimsDescriptionPath = z.tuple([zClaimDescriptionPathValue], zClaimDescriptionPathValue);
162
163
  const zMsoMdocClaimsDescriptionPath = z.tuple([z.string(), z.string()], { message: "mso_mdoc claims description path MUST be an array with exactly two string elements, pointing to the namespace and element identifier within an mdoc credential" });
163
164
  const zIssuerMetadataClaimsDescription = z.object({
164
165
  path: zClaimsDescriptionPath,
@@ -166,8 +167,8 @@ const zIssuerMetadataClaimsDescription = z.object({
166
167
  display: z.array(z.object({
167
168
  name: z.string().optional(),
168
169
  locale: z.string().optional()
169
- }).passthrough()).optional()
170
- }).passthrough();
170
+ }).loose()).optional()
171
+ }).loose();
171
172
  const zMsoMdocIssuerMetadataClaimsDescription = zIssuerMetadataClaimsDescription.extend({ path: zMsoMdocClaimsDescriptionPath });
172
173
 
173
174
  //#endregion
@@ -175,7 +176,7 @@ const zMsoMdocIssuerMetadataClaimsDescription = zIssuerMetadataClaimsDescription
175
176
  const zKeyAttestationJwtHeader = z.object({
176
177
  ...zJwtHeader.shape,
177
178
  typ: z.literal("keyattestation+jwt").or(z.literal("key-attestation+jwt"))
178
- }).passthrough().refine(({ kid, jwk }) => jwk === void 0 || kid === void 0, { message: `Both 'jwk' and 'kid' are defined. Only one is allowed` }).refine(({ trust_chain, kid }) => !trust_chain || !kid, { message: `When 'trust_chain' is provided, 'kid' is required` });
179
+ }).loose().refine(({ kid, jwk }) => jwk === void 0 || kid === void 0, { message: `Both 'jwk' and 'kid' are defined. Only one is allowed` }).refine(({ trust_chain, kid }) => !trust_chain || !kid, { message: `When 'trust_chain' is provided, 'kid' is required` });
179
180
  const zIso18045 = z.enum([
180
181
  "iso_18045_high",
181
182
  "iso_18045_moderate",
@@ -189,13 +190,13 @@ const zKeyAttestationJwtPayload = z.object({
189
190
  attested_keys: z.array(zJwk),
190
191
  key_storage: z.optional(zIso18045OrStringArray),
191
192
  user_authentication: z.optional(zIso18045OrStringArray),
192
- certification: z.optional(z.string().url())
193
- }).passthrough();
193
+ certification: z.optional(z.url())
194
+ }).loose();
194
195
  const zKeyAttestationJwtPayloadForUse = (use) => z.object({
195
196
  ...zKeyAttestationJwtPayload.shape,
196
197
  nonce: use === "proof_type.attestation" ? z.string({ message: `Nonce must be defined when key attestation is used as 'proof_type.attestation' directly` }) : z.optional(z.string()),
197
198
  exp: use === "proof_type.jwt" ? zInteger : z.optional(zInteger)
198
- }).passthrough();
199
+ }).loose();
199
200
 
200
201
  //#endregion
201
202
  //#region src/metadata/credential-issuer/z-credential-configuration-supported-common.ts
@@ -205,12 +206,12 @@ const zCredentialConfigurationSupportedDisplayEntry = z.object({
205
206
  logo: z.object({
206
207
  uri: z.string().optional(),
207
208
  alt_text: z.string().optional()
208
- }).passthrough().optional(),
209
+ }).loose().optional(),
209
210
  description: z.string().optional(),
210
211
  background_color: z.string().optional(),
211
- background_image: z.object({ uri: z.string().optional() }).passthrough().optional(),
212
+ background_image: z.object({ uri: z.string().optional() }).loose().optional(),
212
213
  text_color: z.string().optional()
213
- }).passthrough();
214
+ }).loose();
214
215
  const zCredentialConfigurationSupportedCommonCredentialMetadata = z.object({ display: z.array(zCredentialConfigurationSupportedDisplayEntry).optional() });
215
216
  const zCredentialConfigurationSupportedCommon = z.object({
216
217
  format: z.string(),
@@ -226,11 +227,11 @@ const zCredentialConfigurationSupportedCommon = z.object({
226
227
  key_attestations_required: z.object({
227
228
  key_storage: zIso18045OrStringArray.optional(),
228
229
  user_authentication: zIso18045OrStringArray.optional()
229
- }).passthrough().optional()
230
+ }).loose().optional()
230
231
  })).optional(),
231
232
  credential_metadata: zCredentialConfigurationSupportedCommonCredentialMetadata.optional(),
232
233
  claims: z.optional(z.never())
233
- }).passthrough();
234
+ }).loose();
234
235
  const zCredentialConfigurationSupportedCommonDraft15 = z.object({
235
236
  format: z.string(),
236
237
  scope: z.string().optional(),
@@ -245,11 +246,11 @@ const zCredentialConfigurationSupportedCommonDraft15 = z.object({
245
246
  key_attestations_required: z.object({
246
247
  key_storage: zIso18045OrStringArray.optional(),
247
248
  user_authentication: zIso18045OrStringArray.optional()
248
- }).passthrough().optional()
249
+ }).loose().optional()
249
250
  })).optional(),
250
251
  display: z.array(zCredentialConfigurationSupportedDisplayEntry).optional(),
251
252
  credential_metadata: z.optional(z.never())
252
- }).passthrough();
253
+ }).loose();
253
254
 
254
255
  //#endregion
255
256
  //#region src/formats/credential/mso-mdoc/z-mso-mdoc.ts
@@ -303,7 +304,7 @@ const zLegacySdJwtVcFormatIdentifier = z.literal("vc+sd-jwt");
303
304
  * of the OpenID for Verifiable Presentations specification. Please update your
304
305
  * implementations accordingly.
305
306
  */
306
- const zLegacySdJwtVcCredentialIssuerMetadataDraft16 = zCredentialConfigurationSupportedCommon.extend({
307
+ const zLegacySdJwtVcCredentialIssuerMetadataV1 = zCredentialConfigurationSupportedCommon.extend({
307
308
  vct: z.string(),
308
309
  format: zLegacySdJwtVcFormatIdentifier,
309
310
  order: z.optional(z.array(z.string())),
@@ -342,8 +343,8 @@ const zCredentialSubjectLeafTypeDraft14 = z.object({
342
343
  display: z.array(z.object({
343
344
  name: z.string().optional(),
344
345
  locale: z.string().optional()
345
- }).passthrough()).optional()
346
- }).passthrough();
346
+ }).loose()).optional()
347
+ }).loose();
347
348
  const zClaimValueSchemaDraft14 = z.union([
348
349
  z.array(z.any()),
349
350
  z.record(z.string(), z.any()),
@@ -352,14 +353,14 @@ const zClaimValueSchemaDraft14 = z.union([
352
353
  const zW3cVcCredentialSubjectDraft14 = z.record(z.string(), zClaimValueSchemaDraft14);
353
354
  const zW3cVcJsonLdCredentialDefinition = z.object({
354
355
  "@context": z.array(z.string()),
355
- type: z.array(z.string()).nonempty()
356
- }).passthrough();
356
+ type: z.tuple([z.string()], z.string())
357
+ }).loose();
357
358
  const zW3cVcJsonLdCredentialDefinitionDraft14 = zW3cVcJsonLdCredentialDefinition.extend({ credentialSubject: zW3cVcCredentialSubjectDraft14.optional() });
358
359
 
359
360
  //#endregion
360
361
  //#region src/formats/credential/w3c-vc/z-w3c-jwt-vc-json.ts
361
362
  const zJwtVcJsonFormatIdentifier = z.literal("jwt_vc_json");
362
- const zJwtVcJsonCredentialDefinition = z.object({ type: z.array(z.string()).nonempty() }).passthrough();
363
+ const zJwtVcJsonCredentialDefinition = z.object({ type: z.tuple([z.string()], z.string()) }).loose();
363
364
  const zJwtVcJsonCredentialDefinitionDraft14 = zJwtVcJsonCredentialDefinition.extend({ credentialSubject: zW3cVcCredentialSubjectDraft14.optional() });
364
365
  const zJwtVcJsonCredentialIssuerMetadata = zCredentialConfigurationSupportedCommon.extend({
365
366
  format: zJwtVcJsonFormatIdentifier,
@@ -379,9 +380,9 @@ const zJwtVcJsonCredentialIssuerMetadataDraft14 = zCredentialConfigurationSuppor
379
380
  const zJwtVcJsonCredentialIssuerMetadataDraft11 = z.object({
380
381
  format: zJwtVcJsonFormatIdentifier,
381
382
  order: z.array(z.string()).optional(),
382
- types: z.array(z.string()),
383
+ types: z.tuple([z.string()], z.string()),
383
384
  credentialSubject: zW3cVcCredentialSubjectDraft14.optional()
384
- }).passthrough();
385
+ }).loose();
385
386
  const zJwtVcJsonCredentialIssuerMetadataDraft11To14 = zJwtVcJsonCredentialIssuerMetadataDraft11.transform(({ types, credentialSubject,...rest }) => ({
386
387
  ...rest,
387
388
  credential_definition: {
@@ -389,7 +390,7 @@ const zJwtVcJsonCredentialIssuerMetadataDraft11To14 = zJwtVcJsonCredentialIssuer
389
390
  ...credentialSubject ? { credentialSubject } : {}
390
391
  }
391
392
  }));
392
- const zJwtVcJsonCredentialIssuerMetadataDraft14To11 = zJwtVcJsonCredentialIssuerMetadataDraft14.passthrough().transform(({ credential_definition: { type,...credentialDefinition },...rest }) => ({
393
+ const zJwtVcJsonCredentialIssuerMetadataDraft14To11 = zJwtVcJsonCredentialIssuerMetadataDraft14.loose().transform(({ credential_definition: { type,...credentialDefinition },...rest }) => ({
393
394
  ...rest,
394
395
  types: type,
395
396
  ...credentialDefinition
@@ -400,9 +401,9 @@ const zJwtVcJsonCredentialRequestFormatDraft14 = z.object({
400
401
  });
401
402
  const zJwtVcJsonCredentialRequestDraft11 = z.object({
402
403
  format: zJwtVcJsonFormatIdentifier,
403
- types: z.array(z.string()),
404
+ types: z.tuple([z.string()], z.string()),
404
405
  credentialSubject: z.optional(zW3cVcCredentialSubjectDraft14)
405
- }).passthrough();
406
+ }).loose();
406
407
  const zJwtVcJsonCredentialRequestDraft11To14 = zJwtVcJsonCredentialRequestDraft11.transform(({ types, credentialSubject,...rest }) => {
407
408
  return {
408
409
  ...rest,
@@ -412,7 +413,7 @@ const zJwtVcJsonCredentialRequestDraft11To14 = zJwtVcJsonCredentialRequestDraft1
412
413
  }
413
414
  };
414
415
  });
415
- const zJwtVcJsonCredentialRequestDraft14To11 = zJwtVcJsonCredentialRequestFormatDraft14.passthrough().transform(({ credential_definition: { type,...credentialDefinition },...rest }) => ({
416
+ const zJwtVcJsonCredentialRequestDraft14To11 = zJwtVcJsonCredentialRequestFormatDraft14.loose().transform(({ credential_definition: { type,...credentialDefinition },...rest }) => ({
416
417
  ...rest,
417
418
  types: type,
418
419
  ...credentialDefinition
@@ -440,9 +441,9 @@ const zJwtVcJsonLdCredentialIssuerMetadataDraft11 = z.object({
440
441
  order: z.array(z.string()).optional(),
441
442
  format: zJwtVcJsonLdFormatIdentifier,
442
443
  "@context": z.array(z.string()),
443
- types: z.array(z.string()),
444
+ types: z.tuple([z.string()], z.string()),
444
445
  credentialSubject: zW3cVcCredentialSubjectDraft14.optional()
445
- }).passthrough();
446
+ }).loose();
446
447
  const zJwtVcJsonLdCredentialIssuerMetadataDraft11To14 = zJwtVcJsonLdCredentialIssuerMetadataDraft11.transform(({ "@context": context, types, credentialSubject,...rest }) => ({
447
448
  ...rest,
448
449
  credential_definition: {
@@ -451,7 +452,7 @@ const zJwtVcJsonLdCredentialIssuerMetadataDraft11To14 = zJwtVcJsonLdCredentialIs
451
452
  ...credentialSubject ? { credentialSubject } : {}
452
453
  }
453
454
  }));
454
- const zJwtVcJsonLdCredentialIssuerMetadataDraft14To11 = zJwtVcJsonLdCredentialIssuerMetadataDraft14.passthrough().transform(({ credential_definition: { type,...credentialDefinition },...rest }) => ({
455
+ const zJwtVcJsonLdCredentialIssuerMetadataDraft14To11 = zJwtVcJsonLdCredentialIssuerMetadataDraft14.loose().transform(({ credential_definition: { type,...credentialDefinition },...rest }) => ({
455
456
  ...rest,
456
457
  ...credentialDefinition,
457
458
  types: type
@@ -464,10 +465,10 @@ const zJwtVcJsonLdCredentialRequestDraft11 = z.object({
464
465
  format: zJwtVcJsonLdFormatIdentifier,
465
466
  credential_definition: z.object({
466
467
  "@context": z.array(z.string()),
467
- types: z.array(z.string()),
468
+ types: z.tuple([z.string()], z.string()),
468
469
  credentialSubject: z.optional(zW3cVcCredentialSubjectDraft14)
469
- }).passthrough()
470
- }).passthrough();
470
+ }).loose()
471
+ }).loose();
471
472
  const zJwtVcJsonLdCredentialRequestDraft11To14 = zJwtVcJsonLdCredentialRequestDraft11.transform(({ credential_definition: { types,...restCredentialDefinition },...rest }) => ({
472
473
  ...rest,
473
474
  credential_definition: {
@@ -475,7 +476,7 @@ const zJwtVcJsonLdCredentialRequestDraft11To14 = zJwtVcJsonLdCredentialRequestDr
475
476
  type: types
476
477
  }
477
478
  }));
478
- const zJwtVcJsonLdCredentialRequestDraft14To11 = zJwtVcJsonLdCredentialRequestFormatDraft14.passthrough().transform(({ credential_definition: { type,...restCredentialDefinition },...rest }) => ({
479
+ const zJwtVcJsonLdCredentialRequestDraft14To11 = zJwtVcJsonLdCredentialRequestFormatDraft14.loose().transform(({ credential_definition: { type,...restCredentialDefinition },...rest }) => ({
479
480
  ...rest,
480
481
  credential_definition: {
481
482
  ...restCredentialDefinition,
@@ -505,9 +506,9 @@ const zLdpVcCredentialIssuerMetadataDraft11 = z.object({
505
506
  order: z.array(z.string()).optional(),
506
507
  format: zLdpVcFormatIdentifier,
507
508
  "@context": z.array(z.string()),
508
- types: z.array(z.string()),
509
+ types: z.tuple([z.string()], z.string()),
509
510
  credentialSubject: zW3cVcCredentialSubjectDraft14.optional()
510
- }).passthrough();
511
+ }).loose();
511
512
  const zLdpVcCredentialIssuerMetadataDraft11To14 = zLdpVcCredentialIssuerMetadataDraft11.transform(({ "@context": context, types, credentialSubject,...rest }) => ({
512
513
  ...rest,
513
514
  credential_definition: {
@@ -516,7 +517,7 @@ const zLdpVcCredentialIssuerMetadataDraft11To14 = zLdpVcCredentialIssuerMetadata
516
517
  ...credentialSubject ? { credentialSubject } : {}
517
518
  }
518
519
  }));
519
- const zLdpVcCredentialIssuerMetadataDraft14To11 = zLdpVcCredentialIssuerMetadataDraft14.passthrough().transform(({ credential_definition: { type,...credentialDefinition },...rest }) => ({
520
+ const zLdpVcCredentialIssuerMetadataDraft14To11 = zLdpVcCredentialIssuerMetadataDraft14.loose().transform(({ credential_definition: { type,...credentialDefinition },...rest }) => ({
520
521
  ...rest,
521
522
  ...credentialDefinition,
522
523
  types: type
@@ -529,10 +530,10 @@ const zLdpVcCredentialRequestDraft11 = z.object({
529
530
  format: zLdpVcFormatIdentifier,
530
531
  credential_definition: z.object({
531
532
  "@context": z.array(z.string()),
532
- types: z.array(z.string()),
533
+ types: z.tuple([z.string()], z.string()),
533
534
  credentialSubject: zW3cVcCredentialSubjectDraft14.optional()
534
535
  })
535
- }).passthrough();
536
+ }).loose();
536
537
  const zLdpVcCredentialRequestDraft11To14 = zLdpVcCredentialRequestDraft11.transform(({ credential_definition: { types,...restCredentialDefinition },...rest }) => ({
537
538
  ...rest,
538
539
  credential_definition: {
@@ -540,7 +541,7 @@ const zLdpVcCredentialRequestDraft11To14 = zLdpVcCredentialRequestDraft11.transf
540
541
  type: types
541
542
  }
542
543
  }));
543
- const zLdpVcCredentialRequestDraft14To11 = zLdpVcCredentialRequestFormatDraft14.passthrough().transform(({ credential_definition: { type,...restCredentialDefinition },...rest }) => ({
544
+ const zLdpVcCredentialRequestDraft14To11 = zLdpVcCredentialRequestFormatDraft14.loose().transform(({ credential_definition: { type,...restCredentialDefinition },...rest }) => ({
544
545
  ...rest,
545
546
  credential_definition: {
546
547
  ...restCredentialDefinition,
@@ -551,7 +552,7 @@ const zLdpVcCredentialRequestDraft14To11 = zLdpVcCredentialRequestFormatDraft14.
551
552
  //#endregion
552
553
  //#region src/formats/credential/w3c-vc/z-w3c-sd-jwt-vc.ts
553
554
  const zSdJwtW3VcFormatIdentifier = z.literal("vc+sd-jwt");
554
- const zSdJwtW3VcCredentialDefinition = z.object({ type: z.array(z.string()).nonempty() }).passthrough();
555
+ const zSdJwtW3VcCredentialDefinition = z.object({ type: z.tuple([z.string()], z.string()) }).loose();
555
556
  const zSdJwtW3VcCredentialIssuerMetadata = zCredentialConfigurationSupportedCommon.extend({
556
557
  format: zSdJwtW3VcFormatIdentifier,
557
558
  credential_definition: zSdJwtW3VcCredentialDefinition,
@@ -580,7 +581,7 @@ const allCredentialIssuerMetadataFormats = [
580
581
  zJwtVcJsonCredentialIssuerMetadata,
581
582
  zSdJwtW3VcCredentialIssuerMetadata,
582
583
  zSdJwtW3VcCredentialIssuerMetadataDraft15,
583
- zLegacySdJwtVcCredentialIssuerMetadataDraft16,
584
+ zLegacySdJwtVcCredentialIssuerMetadataV1,
584
585
  zSdJwtDcCredentialIssuerMetadataDraft15,
585
586
  zMsoMdocCredentialIssuerMetadataDraft15,
586
587
  zJwtVcJsonLdCredentialIssuerMetadataDraft15,
@@ -596,9 +597,12 @@ const allCredentialIssuerMetadataFormatIdentifiers = allCredentialIssuerMetadata
596
597
  const zCredentialConfigurationSupportedWithFormats = z.union([zCredentialConfigurationSupportedCommon, zCredentialConfigurationSupportedCommonDraft15]).transform((data, ctx) => {
597
598
  if (!allCredentialIssuerMetadataFormatIdentifiers.includes(data.format)) return data;
598
599
  const validators = allCredentialIssuerMetadataFormats.filter((formatValidator) => formatValidator.shape.format.value === data.format);
599
- const result = z.object({}).passthrough().and(validators.length > 1 ? z.union(validators) : validators[0]).safeParse(data);
600
+ const result = z.object({}).loose().and(validators.length > 1 ? z.union(validators) : validators[0]).safeParse(data);
600
601
  if (result.success) return result.data;
601
- for (const issue of result.error.issues) ctx.addIssue(issue);
602
+ for (const issue of result.error.issues) ctx.addIssue({
603
+ ...issue,
604
+ code: issue.code
605
+ });
602
606
  return z.NEVER;
603
607
  });
604
608
  const zCredentialIssuerMetadataDisplayEntry = z.object({
@@ -607,9 +611,9 @@ const zCredentialIssuerMetadataDisplayEntry = z.object({
607
611
  logo: z.object({
608
612
  uri: z.string().optional(),
609
613
  alt_text: z.string().optional()
610
- }).passthrough().optional()
611
- }).passthrough();
612
- const zCredentialIssuerMetadataDraft14Draft15Draft16 = z.object({
614
+ }).loose().optional()
615
+ }).loose();
616
+ const zCredentialIssuerMetadataDraft14Draft15V1 = z.object({
613
617
  credential_issuer: zHttpsUrl,
614
618
  authorization_servers: z.array(zHttpsUrl).optional(),
615
619
  credential_endpoint: zHttpsUrl,
@@ -620,22 +624,21 @@ const zCredentialIssuerMetadataDraft14Draft15Draft16 = z.object({
620
624
  alg_values_supported: z.array(z.string()),
621
625
  enc_values_supported: z.array(z.string()),
622
626
  encryption_required: z.boolean()
623
- }).passthrough().optional(),
624
- batch_credential_issuance: z.object({ batch_size: z.number().positive() }).passthrough().optional(),
625
- signed_metadata: zCompactJwt.optional(),
627
+ }).loose().optional(),
628
+ batch_credential_issuance: z.object({ batch_size: z.number().positive() }).loose().optional(),
626
629
  display: z.array(zCredentialIssuerMetadataDisplayEntry).optional(),
627
630
  credential_configurations_supported: z.record(z.string(), zCredentialConfigurationSupportedWithFormats)
628
- }).passthrough();
631
+ }).loose();
629
632
  const zCredentialConfigurationSupportedDraft11To16 = z.object({
630
633
  id: z.string().optional(),
631
634
  format: z.string(),
632
635
  cryptographic_suites_supported: z.array(z.string()).optional(),
633
636
  display: z.array(z.object({
634
- logo: z.object({ url: z.string().url().optional() }).passthrough().optional(),
635
- background_image: z.object({ url: z.string().url().optional() }).passthrough().optional()
636
- }).passthrough()).optional(),
637
+ logo: z.object({ url: z.url().optional() }).loose().optional(),
638
+ background_image: z.object({ url: z.url().optional() }).loose().optional()
639
+ }).loose()).optional(),
637
640
  claims: z.any().optional()
638
- }).passthrough().transform(({ cryptographic_suites_supported, display, claims, id,...rest }) => ({
641
+ }).loose().transform(({ cryptographic_suites_supported, display, claims, id,...rest }) => ({
639
642
  ...rest,
640
643
  ...cryptographic_suites_supported ? { credential_signing_alg_values_supported: cryptographic_suites_supported } : {},
641
644
  ...claims || display ? { credential_metadata: {
@@ -655,13 +658,16 @@ const zCredentialConfigurationSupportedDraft11To16 = z.object({
655
658
  if (!Object.keys(formatSpecificTransformations).includes(data.format)) return data;
656
659
  const result = formatSpecificTransformations[data.format].safeParse(data);
657
660
  if (result.success) return result.data;
658
- for (const issue of result.error.issues) ctx.addIssue(issue);
661
+ for (const issue of result.error.issues) ctx.addIssue({
662
+ ...issue,
663
+ code: issue.code
664
+ });
659
665
  return z.NEVER;
660
666
  }).pipe(zCredentialConfigurationSupportedWithFormats);
661
- const zCredentialConfigurationSupportedDraft16To11 = zCredentialConfigurationSupportedWithFormats.transform(({ credential_metadata,...rest }) => ({
667
+ const zCredentialConfigurationSupportedV1ToDraft11 = zCredentialConfigurationSupportedWithFormats.transform(({ credential_metadata,...rest }) => ({
662
668
  ...credential_metadata,
663
669
  ...rest
664
- })).and(z.object({ id: z.string() }).passthrough()).transform(({ id, credential_signing_alg_values_supported, display, proof_types_supported, scope,...rest }) => ({
670
+ })).and(z.object({ id: z.string() }).loose()).transform(({ id, credential_signing_alg_values_supported, display, proof_types_supported, scope,...rest }) => ({
665
671
  ...rest,
666
672
  ...credential_signing_alg_values_supported ? { cryptographic_suites_supported: credential_signing_alg_values_supported } : {},
667
673
  ...display ? { display: display.map(({ logo, background_image,...displayRest }) => {
@@ -688,28 +694,28 @@ const zCredentialConfigurationSupportedDraft16To11 = zCredentialConfigurationSup
688
694
  zLdpVcFormatIdentifier.value,
689
695
  zJwtVcJsonFormatIdentifier.value,
690
696
  zJwtVcJsonLdFormatIdentifier.value
691
- ].includes(input)) }).passthrough()
697
+ ].includes(input)) }).loose()
692
698
  ]));
693
699
  const zCredentialIssuerMetadataDraft11To16 = z.object({
694
700
  authorization_server: z.string().optional(),
695
- credentials_supported: z.array(z.object({ id: z.string().optional() }).passthrough())
696
- }).passthrough().transform(({ authorization_server, credentials_supported,...rest }) => {
701
+ credentials_supported: z.array(z.object({ id: z.string().optional() }).loose())
702
+ }).loose().transform(({ authorization_server, credentials_supported,...rest }) => {
697
703
  return {
698
704
  ...rest,
699
705
  ...authorization_server ? { authorization_servers: [authorization_server] } : {},
700
706
  credential_configurations_supported: Object.fromEntries(credentials_supported.map((supported) => supported.id ? [supported.id, supported] : void 0).filter((i) => i !== void 0))
701
707
  };
702
- }).pipe(z.object({ credential_configurations_supported: z.record(z.string(), zCredentialConfigurationSupportedDraft11To16) }).passthrough()).pipe(zCredentialIssuerMetadataDraft14Draft15Draft16);
703
- const zCredentialIssuerMetadataWithDraft11 = zCredentialIssuerMetadataDraft14Draft15Draft16.transform((issuerMetadata) => ({
708
+ }).pipe(z.object({ credential_configurations_supported: z.record(z.string(), zCredentialConfigurationSupportedDraft11To16) }).loose()).pipe(zCredentialIssuerMetadataDraft14Draft15V1);
709
+ const zCredentialIssuerMetadataWithDraft11 = zCredentialIssuerMetadataDraft14Draft15V1.transform((issuerMetadata) => ({
704
710
  ...issuerMetadata,
705
711
  ...issuerMetadata.authorization_servers ? { authorization_server: issuerMetadata.authorization_servers[0] } : {},
706
712
  credentials_supported: Object.entries(issuerMetadata.credential_configurations_supported).map(([id, value]) => ({
707
713
  ...value,
708
714
  id
709
715
  }))
710
- })).pipe(zCredentialIssuerMetadataDraft14Draft15Draft16.extend({ credentials_supported: z.array(zCredentialConfigurationSupportedDraft16To11) }));
711
- const zCredentialIssuerMetadata = z.union([zCredentialIssuerMetadataDraft14Draft15Draft16, zCredentialIssuerMetadataDraft11To16]);
712
- const zCredentialIssuerMetadataWithDraftVersion = z.union([zCredentialIssuerMetadataDraft14Draft15Draft16.transform((credentialIssuerMetadata) => {
716
+ })).pipe(zCredentialIssuerMetadataDraft14Draft15V1.extend({ credentials_supported: z.array(zCredentialConfigurationSupportedV1ToDraft11) }));
717
+ const zCredentialIssuerMetadata = z.union([zCredentialIssuerMetadataDraft14Draft15V1, zCredentialIssuerMetadataDraft11To16]);
718
+ const zCredentialIssuerMetadataWithDraftVersion = z.union([zCredentialIssuerMetadataDraft14Draft15V1.transform((credentialIssuerMetadata) => {
713
719
  const credentialConfigurations = Object.values(credentialIssuerMetadata.credential_configurations_supported);
714
720
  const isDraft15 = credentialConfigurations.some((configuration) => {
715
721
  const knownConfiguration = configuration;
@@ -720,9 +726,7 @@ const zCredentialIssuerMetadataWithDraftVersion = z.union([zCredentialIssuerMeta
720
726
  });
721
727
  return {
722
728
  credentialIssuerMetadata,
723
- originalDraftVersion: credentialConfigurations.some((configuration) => {
724
- return configuration.credential_metadata;
725
- }) ? Openid4vciDraftVersion.Draft16 : isDraft15 ? Openid4vciDraftVersion.Draft15 : Openid4vciDraftVersion.Draft14
729
+ originalDraftVersion: credentialConfigurations.some((configuration) => configuration.credential_metadata) ? Openid4vciDraftVersion.V1 : isDraft15 ? Openid4vciDraftVersion.Draft15 : Openid4vciDraftVersion.Draft14
726
730
  };
727
731
  }), zCredentialIssuerMetadataDraft11To16.transform((credentialIssuerMetadata) => ({
728
732
  credentialIssuerMetadata,
@@ -901,7 +905,7 @@ function credentialsSupportedToCredentialConfigurationsSupported(credentialsSupp
901
905
  //#region src/credential-request/format-payload.ts
902
906
  function getCredentialRequestFormatPayloadForCredentialConfigurationId(options) {
903
907
  const credentialConfiguration = getCredentialConfigurationSupportedById(options.issuerMetadata.credentialIssuer.credential_configurations_supported, options.credentialConfigurationId);
904
- if (zIs(zLegacySdJwtVcCredentialIssuerMetadataDraft16, credentialConfiguration) || zIs(zLegacySdJwtVcCredentialIssuerMetadataDraft14, credentialConfiguration)) return {
908
+ if (zIs(zLegacySdJwtVcCredentialIssuerMetadataV1, credentialConfiguration) || zIs(zLegacySdJwtVcCredentialIssuerMetadataDraft14, credentialConfiguration)) return {
905
909
  format: credentialConfiguration.format,
906
910
  vct: credentialConfiguration.vct
907
911
  };
@@ -956,16 +960,16 @@ const zCredentialRequestProofJwt = z.object({
956
960
  const zCredentialRequestJwtProofTypeHeader = zJwtHeader.merge(z.object({
957
961
  key_attestation: z.optional(zCompactJwt),
958
962
  typ: z.literal("openid4vci-proof+jwt")
959
- })).passthrough().refine(({ kid, jwk }) => jwk === void 0 || kid === void 0, { message: `Both 'jwk' and 'kid' are defined. Only one is allowed` }).refine(({ trust_chain, kid }) => !trust_chain || !kid, { message: `When 'trust_chain' is provided, 'kid' is required` });
963
+ })).loose().refine(({ kid, jwk }) => jwk === void 0 || kid === void 0, { message: `Both 'jwk' and 'kid' are defined. Only one is allowed` }).refine(({ trust_chain, kid }) => !trust_chain || !kid, { message: `When 'trust_chain' is provided, 'kid' is required` });
960
964
  const zCredentialRequestJwtProofTypePayload = z.object({
961
965
  ...zJwtPayload.shape,
962
966
  aud: zHttpsUrl,
963
967
  iat: zInteger
964
- }).passthrough();
968
+ }).loose();
965
969
 
966
970
  //#endregion
967
971
  //#region src/credential-request/z-credential-request-common.ts
968
- const zCredentialRequestProofCommon = z.object({ proof_type: z.string() }).passthrough();
972
+ const zCredentialRequestProofCommon = z.object({ proof_type: z.string() }).loose();
969
973
  const allCredentialRequestProofs = [zCredentialRequestProofJwt, zCredentialRequestProofAttestation];
970
974
  const zCredentialRequestProof = z.union([zCredentialRequestProofCommon, z.discriminatedUnion("proof_type", allCredentialRequestProofs)]);
971
975
  const zCredentialRequestProofsCommon = z.record(z.string(), z.array(z.unknown()));
@@ -980,8 +984,8 @@ const zCredentialRequestCommon = z.object({
980
984
  jwk: zJwk,
981
985
  alg: z.string(),
982
986
  enc: z.string()
983
- }).passthrough().optional()
984
- }).passthrough().refine(({ proof, proofs }) => !(proof !== void 0 && proofs !== void 0), { message: `Both 'proof' and 'proofs' are defined. Only one is allowed` });
987
+ }).loose().optional()
988
+ }).loose().refine(({ proof, proofs }) => !(proof !== void 0 && proofs !== void 0), { message: `Both 'proof' and 'proofs' are defined. Only one is allowed` });
985
989
 
986
990
  //#endregion
987
991
  //#region src/credential-request/z-credential-request.ts
@@ -1008,12 +1012,15 @@ const zCredentialRequestFormat = z.object({
1008
1012
  format: z.string(),
1009
1013
  credential_identifier: z.never({ message: "'credential_identifier' cannot be defined when 'format' is set." }).optional(),
1010
1014
  credential_configuration_id: z.never({ message: "'credential_configuration_id' cannot be defined when 'format' is set." }).optional()
1011
- }).passthrough();
1015
+ }).loose();
1012
1016
  const zCredentialRequestDraft14WithFormat = zCredentialRequestCommon.and(zCredentialRequestFormat).transform((data, ctx) => {
1013
1017
  if (!allCredentialRequestFormatIdentifiers.includes(data.format)) return data;
1014
- const result = z.object({}).passthrough().and(z.union(allCredentialRequestFormats)).safeParse(data);
1018
+ const result = z.object({}).loose().and(z.union(allCredentialRequestFormats)).safeParse(data);
1015
1019
  if (result.success) return result.data;
1016
- for (const issue of result.error.issues) ctx.addIssue(issue);
1020
+ for (const issue of result.error.issues) ctx.addIssue({
1021
+ ...issue,
1022
+ code: issue.code
1023
+ });
1017
1024
  return z.NEVER;
1018
1025
  });
1019
1026
  const zCredentialRequestDraft15 = z.union([zCredentialRequestCommon.and(zAuthorizationDetailsCredentialRequest), zCredentialRequestCommon.and(zCredentialRequestCredentialConfigurationId)]);
@@ -1027,10 +1034,22 @@ const zCredentialRequestDraft11To14 = zCredentialRequestCommon.and(zCredentialRe
1027
1034
  if (!Object.keys(formatSpecificTransformations).includes(data.format)) return data;
1028
1035
  const result = formatSpecificTransformations[data.format].safeParse(data);
1029
1036
  if (result.success) return result.data;
1030
- for (const issue of result.error.issues) ctx.addIssue(issue);
1037
+ for (const issue of result.error.issues) ctx.addIssue({
1038
+ ...issue,
1039
+ code: issue.code
1040
+ });
1031
1041
  return z.NEVER;
1032
1042
  }).pipe(zCredentialRequestDraft14);
1033
- const zCredentialRequestDraft14To11 = zCredentialRequestDraft14.refine((data) => data.credential_identifier === void 0, `'credential_identifier' is not supported in OpenID4VCI draft 11`).transform((data, ctx) => {
1043
+ const zCredentialRequestDraft14To11 = zCredentialRequestDraft14.transform((data, ctx) => {
1044
+ if (data.credential_identifier !== void 0) {
1045
+ ctx.addIssue({
1046
+ code: "custom",
1047
+ continue: false,
1048
+ message: `'credential_identifier' is not supported in OpenID4VCI draft 11`,
1049
+ path: ["credential_identifier"]
1050
+ });
1051
+ return z.NEVER;
1052
+ }
1034
1053
  const formatSpecificTransformations = {
1035
1054
  [zLdpVcFormatIdentifier.value]: zLdpVcCredentialRequestDraft14To11,
1036
1055
  [zJwtVcJsonFormatIdentifier.value]: zJwtVcJsonCredentialRequestDraft14To11,
@@ -1039,7 +1058,10 @@ const zCredentialRequestDraft14To11 = zCredentialRequestDraft14.refine((data) =>
1039
1058
  if (!Object.keys(formatSpecificTransformations).includes(data.format)) return data;
1040
1059
  const result = formatSpecificTransformations[data.format].safeParse(data);
1041
1060
  if (result.success) return result.data;
1042
- for (const issue of result.error.issues) ctx.addIssue(issue);
1061
+ for (const issue of result.error.issues) ctx.addIssue({
1062
+ ...issue,
1063
+ code: issue.code
1064
+ });
1043
1065
  return z.NEVER;
1044
1066
  });
1045
1067
  const zCredentialRequest = z.union([
@@ -1053,7 +1075,7 @@ const zDeferredCredentialRequest = z.object({
1053
1075
  jwk: zJwk,
1054
1076
  alg: z.string(),
1055
1077
  enc: z.string()
1056
- }).passthrough().optional()
1078
+ }).loose().optional()
1057
1079
  });
1058
1080
 
1059
1081
  //#endregion
@@ -1098,40 +1120,40 @@ let Oauth2ErrorCodes$1 = /* @__PURE__ */ function(Oauth2ErrorCodes$2) {
1098
1120
  return Oauth2ErrorCodes$2;
1099
1121
  }({});
1100
1122
  const zOauth2ErrorResponse = z.object({
1101
- error: z.union([z.nativeEnum(Oauth2ErrorCodes$1), z.string()]),
1123
+ error: z.union([z.enum(Oauth2ErrorCodes$1), z.string()]),
1102
1124
  error_description: z.string().optional(),
1103
1125
  error_uri: z.string().optional()
1104
- }).passthrough();
1126
+ }).loose();
1105
1127
 
1106
1128
  //#endregion
1107
1129
  //#region src/credential-request/z-credential-response.ts
1108
1130
  const zCredentialEncoding = z.union([z.string(), z.record(z.string(), z.any())]);
1109
1131
  const zBaseCredentialResponse = z.object({
1110
1132
  credentials: z.union([z.array(z.object({ credential: zCredentialEncoding })), z.array(zCredentialEncoding)]).optional(),
1111
- interval: z.number().int().positive().optional(),
1112
- notification_id: z.string().optional()
1113
- }).passthrough();
1133
+ notification_id: z.string().optional(),
1134
+ transaction_id: z.string().optional(),
1135
+ interval: z.number().int().positive().optional()
1136
+ }).loose();
1114
1137
  const zCredentialResponse = zBaseCredentialResponse.extend({
1115
1138
  credential: z.optional(zCredentialEncoding),
1116
- transaction_id: z.string().optional(),
1117
1139
  c_nonce: z.string().optional(),
1118
1140
  c_nonce_expires_in: z.number().int().optional()
1119
- }).passthrough().superRefine((value, ctx) => {
1141
+ }).loose().superRefine((value, ctx) => {
1120
1142
  const { credential, credentials, transaction_id, interval, notification_id } = value;
1121
1143
  if ([
1122
1144
  credential,
1123
1145
  credentials,
1124
1146
  transaction_id
1125
1147
  ].filter((i) => i !== void 0).length !== 1) ctx.addIssue({
1126
- code: z.ZodIssueCode.custom,
1148
+ code: "custom",
1127
1149
  message: `Exactly one of 'credential', 'credentials', or 'transaction_id' MUST be defined.`
1128
1150
  });
1129
1151
  if (transaction_id && !interval) ctx.addIssue({
1130
- code: z.ZodIssueCode.custom,
1152
+ code: "custom",
1131
1153
  message: `'interval' MUST be defined when 'transaction_id' is defined.`
1132
1154
  });
1133
1155
  if (notification_id && !(credentials || credential)) ctx.addIssue({
1134
- code: z.ZodIssueCode.custom,
1156
+ code: "custom",
1135
1157
  message: `'notification_id' MUST NOT be defined when 'credential' or 'credentials' are not defined.`
1136
1158
  });
1137
1159
  });
@@ -1139,16 +1161,27 @@ const zCredentialErrorResponse = z.object({
1139
1161
  ...zOauth2ErrorResponse.shape,
1140
1162
  c_nonce: z.string().optional(),
1141
1163
  c_nonce_expires_in: z.number().int().optional()
1142
- }).passthrough();
1143
- const zDeferredCredentialResponse = zBaseCredentialResponse.refine((value) => {
1144
- const { credentials, interval } = value;
1145
- return [credentials, interval].filter((i) => i !== void 0).length === 1;
1146
- }, { message: `Exactly one of 'credentials' or 'interval' MUST be defined.` });
1164
+ }).loose();
1165
+ const zDeferredCredentialResponse = zBaseCredentialResponse.superRefine((value, ctx) => {
1166
+ const { credentials, transaction_id, interval, notification_id } = value;
1167
+ if ([credentials, transaction_id].filter((i) => i !== void 0).length !== 1) ctx.addIssue({
1168
+ code: "custom",
1169
+ message: `Exactly one of 'credentials', or 'transaction_id' MUST be defined.`
1170
+ });
1171
+ if (transaction_id && !interval) ctx.addIssue({
1172
+ code: "custom",
1173
+ message: `'interval' MUST be defined when 'transaction_id' is defined.`
1174
+ });
1175
+ if (notification_id && credentials) ctx.addIssue({
1176
+ code: "custom",
1177
+ message: `'notification_id' MUST NOT be defined when 'credentials' is not defined.`
1178
+ });
1179
+ });
1147
1180
 
1148
1181
  //#endregion
1149
1182
  //#region src/credential-request/retrieve-credentials.ts
1150
1183
  async function retrieveCredentialsWithCredentialConfigurationId(options) {
1151
- if (options.issuerMetadata.originalDraftVersion !== Openid4vciDraftVersion.Draft15 && options.issuerMetadata.originalDraftVersion !== Openid4vciDraftVersion.Draft16) throw new Openid4vciError("Requesting credentials based on credential configuration ID is not supported in OpenID4VCI below draft 15. Make sure to provide the format and format specific claims in the request.");
1184
+ if (options.issuerMetadata.originalDraftVersion !== Openid4vciDraftVersion.Draft15 && options.issuerMetadata.originalDraftVersion !== Openid4vciDraftVersion.V1) throw new Openid4vciError("Requesting credentials based on credential configuration ID is not supported in OpenID4VCI below draft 15. Make sure to provide the format and format specific claims in the request.");
1152
1185
  getCredentialConfigurationSupportedById(options.issuerMetadata.credentialIssuer.credential_configurations_supported, options.credentialConfigurationId);
1153
1186
  const credentialRequest = {
1154
1187
  ...options.additionalRequestPayload,
@@ -1165,7 +1198,7 @@ async function retrieveCredentialsWithCredentialConfigurationId(options) {
1165
1198
  });
1166
1199
  }
1167
1200
  async function retrieveCredentialsWithFormat(options) {
1168
- if (options.issuerMetadata.originalDraftVersion === Openid4vciDraftVersion.Draft15 || options.issuerMetadata.originalDraftVersion === Openid4vciDraftVersion.Draft16) throw new Openid4vciError("Requesting credentials based on format is not supported in OpenID4VCI draft 15. Provide the credential configuration id directly in the request.");
1201
+ if (options.issuerMetadata.originalDraftVersion === Openid4vciDraftVersion.Draft15 || options.issuerMetadata.originalDraftVersion === Openid4vciDraftVersion.V1) throw new Openid4vciError("Requesting credentials based on format is not supported on OpenID4VCI above draft 15. Provide the credential configuration id directly in the request.");
1169
1202
  const credentialRequest = {
1170
1203
  ...options.formatPayload,
1171
1204
  ...options.additionalRequestPayload,
@@ -1247,7 +1280,7 @@ async function retrieveDeferredCredentials(options) {
1247
1280
  deferredCredentialErrorResponseResult
1248
1281
  };
1249
1282
  }
1250
- const deferredCredentialResponseResult = isResponseContentType(ContentType.Json, resourceResponse.response) ? zDeferredCredentialResponse.safeParse(await resourceResponse.response.clone().json()) : void 0;
1283
+ const deferredCredentialResponseResult = isResponseContentType(ContentType.Json, resourceResponse.response) ? zDeferredCredentialResponse.refine((response) => response.credentials || response.transaction_id === options.transactionId, { error: `Transaction id in deferred credential response does not match transaction id in deferred credential request '${options.transactionId}'` }).safeParse(await resourceResponse.response.clone().json()) : void 0;
1251
1284
  if (!deferredCredentialResponseResult?.success) return {
1252
1285
  ...resourceResponse,
1253
1286
  ok: false,
@@ -1365,7 +1398,7 @@ async function resolveIssuerMetadata(credentialIssuer, options) {
1365
1398
  const zNonceResponse = z.object({
1366
1399
  c_nonce: z.string(),
1367
1400
  c_nonce_expires_in: z.optional(zInteger)
1368
- }).passthrough();
1401
+ }).loose();
1369
1402
 
1370
1403
  //#endregion
1371
1404
  //#region src/nonce/nonce-request.ts
@@ -1404,8 +1437,8 @@ const zNotificationRequest = z.object({
1404
1437
  notification_id: z.string(),
1405
1438
  event: zNotificationEvent,
1406
1439
  event_description: z.optional(z.string())
1407
- }).passthrough();
1408
- const zNotificationErrorResponse = z.object({ error: z.enum(["invalid_notification_id", "invalid_notification_request"]) }).passthrough();
1440
+ }).loose();
1441
+ const zNotificationErrorResponse = z.object({ error: z.enum(["invalid_notification_id", "invalid_notification_request"]) }).loose();
1409
1442
 
1410
1443
  //#endregion
1411
1444
  //#region src/notification/notification.ts
@@ -1665,7 +1698,7 @@ var Openid4vciClient = class {
1665
1698
  */
1666
1699
  async retrieveCredentials({ issuerMetadata, proof, proofs, credentialConfigurationId, additionalRequestPayload, accessToken, dpop }) {
1667
1700
  let credentialResponse;
1668
- if (issuerMetadata.originalDraftVersion === Openid4vciDraftVersion.Draft15 || issuerMetadata.originalDraftVersion === Openid4vciDraftVersion.Draft16) credentialResponse = await retrieveCredentialsWithCredentialConfigurationId({
1701
+ if (issuerMetadata.originalDraftVersion === Openid4vciDraftVersion.Draft15 || issuerMetadata.originalDraftVersion === Openid4vciDraftVersion.V1) credentialResponse = await retrieveCredentialsWithCredentialConfigurationId({
1669
1702
  accessToken,
1670
1703
  credentialConfigurationId,
1671
1704
  issuerMetadata,
@@ -1740,6 +1773,7 @@ function createDeferredCredentialResponse(options) {
1740
1773
  return parseWithErrorHandling(zDeferredCredentialResponse, {
1741
1774
  credentials: options.credentials,
1742
1775
  notification_id: options.notificationId,
1776
+ transaction_id: options.transactionId,
1743
1777
  interval: options.interval,
1744
1778
  ...options.additionalPayload
1745
1779
  });