@openid4vc/openid4vci 0.3.0-alpha-20251017122507 → 0.3.0-alpha-20251021082313

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.js CHANGED
@@ -30,7 +30,7 @@ zod = __toESM(zod);
30
30
 
31
31
  //#region src/version.ts
32
32
  let Openid4vciDraftVersion = /* @__PURE__ */ function(Openid4vciDraftVersion$1) {
33
- Openid4vciDraftVersion$1["Draft16"] = "Draft16";
33
+ Openid4vciDraftVersion$1["V1"] = "V1";
34
34
  Openid4vciDraftVersion$1["Draft15"] = "Draft15";
35
35
  Openid4vciDraftVersion$1["Draft14"] = "Draft14";
36
36
  Openid4vciDraftVersion$1["Draft11"] = "Draft11";
@@ -330,7 +330,7 @@ const zLegacySdJwtVcFormatIdentifier = zod.default.literal("vc+sd-jwt");
330
330
  * of the OpenID for Verifiable Presentations specification. Please update your
331
331
  * implementations accordingly.
332
332
  */
333
- const zLegacySdJwtVcCredentialIssuerMetadataDraft16 = zCredentialConfigurationSupportedCommon.extend({
333
+ const zLegacySdJwtVcCredentialIssuerMetadataV1 = zCredentialConfigurationSupportedCommon.extend({
334
334
  vct: zod.default.string(),
335
335
  format: zLegacySdJwtVcFormatIdentifier,
336
336
  order: zod.default.optional(zod.default.array(zod.default.string())),
@@ -607,7 +607,7 @@ const allCredentialIssuerMetadataFormats = [
607
607
  zJwtVcJsonCredentialIssuerMetadata,
608
608
  zSdJwtW3VcCredentialIssuerMetadata,
609
609
  zSdJwtW3VcCredentialIssuerMetadataDraft15,
610
- zLegacySdJwtVcCredentialIssuerMetadataDraft16,
610
+ zLegacySdJwtVcCredentialIssuerMetadataV1,
611
611
  zSdJwtDcCredentialIssuerMetadataDraft15,
612
612
  zMsoMdocCredentialIssuerMetadataDraft15,
613
613
  zJwtVcJsonLdCredentialIssuerMetadataDraft15,
@@ -639,7 +639,7 @@ const zCredentialIssuerMetadataDisplayEntry = zod.default.object({
639
639
  alt_text: zod.default.string().optional()
640
640
  }).loose().optional()
641
641
  }).loose();
642
- const zCredentialIssuerMetadataDraft14Draft15Draft16 = zod.default.object({
642
+ const zCredentialIssuerMetadataDraft14Draft15V1 = zod.default.object({
643
643
  credential_issuer: __openid4vc_utils.zHttpsUrl,
644
644
  authorization_servers: zod.default.array(__openid4vc_utils.zHttpsUrl).optional(),
645
645
  credential_endpoint: __openid4vc_utils.zHttpsUrl,
@@ -652,7 +652,6 @@ const zCredentialIssuerMetadataDraft14Draft15Draft16 = zod.default.object({
652
652
  encryption_required: zod.default.boolean()
653
653
  }).loose().optional(),
654
654
  batch_credential_issuance: zod.default.object({ batch_size: zod.default.number().positive() }).loose().optional(),
655
- signed_metadata: __openid4vc_oauth2.zCompactJwt.optional(),
656
655
  display: zod.default.array(zCredentialIssuerMetadataDisplayEntry).optional(),
657
656
  credential_configurations_supported: zod.default.record(zod.default.string(), zCredentialConfigurationSupportedWithFormats)
658
657
  }).loose();
@@ -691,7 +690,7 @@ const zCredentialConfigurationSupportedDraft11To16 = zod.default.object({
691
690
  });
692
691
  return zod.default.NEVER;
693
692
  }).pipe(zCredentialConfigurationSupportedWithFormats);
694
- const zCredentialConfigurationSupportedDraft16To11 = zCredentialConfigurationSupportedWithFormats.transform(({ credential_metadata,...rest }) => ({
693
+ const zCredentialConfigurationSupportedV1ToDraft11 = zCredentialConfigurationSupportedWithFormats.transform(({ credential_metadata,...rest }) => ({
695
694
  ...credential_metadata,
696
695
  ...rest
697
696
  })).and(zod.default.object({ id: zod.default.string() }).loose()).transform(({ id, credential_signing_alg_values_supported, display, proof_types_supported, scope,...rest }) => ({
@@ -732,17 +731,17 @@ const zCredentialIssuerMetadataDraft11To16 = zod.default.object({
732
731
  ...authorization_server ? { authorization_servers: [authorization_server] } : {},
733
732
  credential_configurations_supported: Object.fromEntries(credentials_supported.map((supported) => supported.id ? [supported.id, supported] : void 0).filter((i) => i !== void 0))
734
733
  };
735
- }).pipe(zod.default.object({ credential_configurations_supported: zod.default.record(zod.default.string(), zCredentialConfigurationSupportedDraft11To16) }).loose()).pipe(zCredentialIssuerMetadataDraft14Draft15Draft16);
736
- const zCredentialIssuerMetadataWithDraft11 = zCredentialIssuerMetadataDraft14Draft15Draft16.transform((issuerMetadata) => ({
734
+ }).pipe(zod.default.object({ credential_configurations_supported: zod.default.record(zod.default.string(), zCredentialConfigurationSupportedDraft11To16) }).loose()).pipe(zCredentialIssuerMetadataDraft14Draft15V1);
735
+ const zCredentialIssuerMetadataWithDraft11 = zCredentialIssuerMetadataDraft14Draft15V1.transform((issuerMetadata) => ({
737
736
  ...issuerMetadata,
738
737
  ...issuerMetadata.authorization_servers ? { authorization_server: issuerMetadata.authorization_servers[0] } : {},
739
738
  credentials_supported: Object.entries(issuerMetadata.credential_configurations_supported).map(([id, value]) => ({
740
739
  ...value,
741
740
  id
742
741
  }))
743
- })).pipe(zCredentialIssuerMetadataDraft14Draft15Draft16.extend({ credentials_supported: zod.default.array(zCredentialConfigurationSupportedDraft16To11) }));
744
- const zCredentialIssuerMetadata = zod.default.union([zCredentialIssuerMetadataDraft14Draft15Draft16, zCredentialIssuerMetadataDraft11To16]);
745
- const zCredentialIssuerMetadataWithDraftVersion = zod.default.union([zCredentialIssuerMetadataDraft14Draft15Draft16.transform((credentialIssuerMetadata) => {
742
+ })).pipe(zCredentialIssuerMetadataDraft14Draft15V1.extend({ credentials_supported: zod.default.array(zCredentialConfigurationSupportedV1ToDraft11) }));
743
+ const zCredentialIssuerMetadata = zod.default.union([zCredentialIssuerMetadataDraft14Draft15V1, zCredentialIssuerMetadataDraft11To16]);
744
+ const zCredentialIssuerMetadataWithDraftVersion = zod.default.union([zCredentialIssuerMetadataDraft14Draft15V1.transform((credentialIssuerMetadata) => {
746
745
  const credentialConfigurations = Object.values(credentialIssuerMetadata.credential_configurations_supported);
747
746
  const isDraft15 = credentialConfigurations.some((configuration) => {
748
747
  const knownConfiguration = configuration;
@@ -753,29 +752,83 @@ const zCredentialIssuerMetadataWithDraftVersion = zod.default.union([zCredential
753
752
  });
754
753
  return {
755
754
  credentialIssuerMetadata,
756
- originalDraftVersion: credentialConfigurations.some((configuration) => {
757
- return configuration.credential_metadata;
758
- }) ? Openid4vciDraftVersion.Draft16 : isDraft15 ? Openid4vciDraftVersion.Draft15 : Openid4vciDraftVersion.Draft14
755
+ originalDraftVersion: credentialConfigurations.some((configuration) => configuration.credential_metadata) ? Openid4vciDraftVersion.V1 : isDraft15 ? Openid4vciDraftVersion.Draft15 : Openid4vciDraftVersion.Draft14
759
756
  };
760
757
  }), zCredentialIssuerMetadataDraft11To16.transform((credentialIssuerMetadata) => ({
761
758
  credentialIssuerMetadata,
762
759
  originalDraftVersion: Openid4vciDraftVersion.Draft11
763
760
  }))]);
764
761
 
762
+ //#endregion
763
+ //#region src/metadata/credential-issuer/z-signed-credential-issuer-metadata.ts
764
+ const zSignedCredentialIssuerMetadataHeader = zod.default.object({
765
+ ...__openid4vc_oauth2.zJwtHeader.shape,
766
+ typ: zod.default.literal("openidvci-issuer-metadata+jwt")
767
+ }).loose();
768
+ const zSignedCredentialIssuerMetadataPayload = zod.default.object({
769
+ ...__openid4vc_oauth2.zJwtPayload.shape,
770
+ iat: __openid4vc_utils.zInteger,
771
+ sub: zod.default.string(),
772
+ ...zCredentialIssuerMetadataDraft14Draft15V1.shape
773
+ }).loose();
774
+
765
775
  //#endregion
766
776
  //#region src/metadata/credential-issuer/credential-issuer-metadata.ts
767
777
  const wellKnownCredentialIssuerSuffix = ".well-known/openid-credential-issuer";
768
778
  /**
769
779
  * @inheritdoc {@link fetchWellKnownMetadata}
770
780
  */
771
- async function fetchCredentialIssuerMetadata(credentialIssuer, fetch) {
781
+ async function fetchCredentialIssuerMetadata(credentialIssuer, options) {
772
782
  const parsedIssuerUrl = new __openid4vc_utils.URL(credentialIssuer);
773
783
  const legacyWellKnownMetadataUrl = (0, __openid4vc_utils.joinUriParts)(credentialIssuer, [wellKnownCredentialIssuerSuffix]);
774
784
  const wellKnownMetadataUrl = (0, __openid4vc_utils.joinUriParts)(parsedIssuerUrl.origin, [wellKnownCredentialIssuerSuffix, parsedIssuerUrl.pathname]);
775
- let result = await (0, __openid4vc_oauth2.fetchWellKnownMetadata)(wellKnownMetadataUrl, zCredentialIssuerMetadataWithDraftVersion, fetch);
776
- if (!result && legacyWellKnownMetadataUrl !== wellKnownMetadataUrl) result = await (0, __openid4vc_oauth2.fetchWellKnownMetadata)(legacyWellKnownMetadataUrl, zCredentialIssuerMetadataWithDraftVersion, fetch);
777
- if (result && result.credentialIssuerMetadata.credential_issuer !== credentialIssuer) throw new __openid4vc_oauth2.Oauth2Error(`The 'credential_issuer' parameter '${result.credentialIssuerMetadata.credential_issuer}' in the well known credential issuer metadata at '${wellKnownMetadataUrl}' does not match the provided credential issuer '${credentialIssuer}'.`);
778
- return result;
785
+ const acceptedContentType = options?.callbacks?.verifyJwt ? [__openid4vc_utils.ContentType.Jwt, __openid4vc_utils.ContentType.Json] : [__openid4vc_utils.ContentType.Json];
786
+ const responseSchema = zCredentialIssuerMetadataWithDraftVersion.or(__openid4vc_oauth2.zCompactJwt);
787
+ let result = await (0, __openid4vc_oauth2.fetchWellKnownMetadata)(wellKnownMetadataUrl, responseSchema, {
788
+ fetch: options?.callbacks?.fetch,
789
+ acceptedContentType
790
+ });
791
+ if (!result && legacyWellKnownMetadataUrl !== wellKnownMetadataUrl) result = await (0, __openid4vc_oauth2.fetchWellKnownMetadata)(legacyWellKnownMetadataUrl, responseSchema, {
792
+ fetch: options?.callbacks?.fetch,
793
+ acceptedContentType
794
+ });
795
+ let issuerMetadataWithVersion = null;
796
+ if (typeof result === "string") {
797
+ if (!options?.callbacks?.verifyJwt) throw new __openid4vc_oauth2.Oauth2Error(`Unable to verify signed credential issuer metadata, no 'verifyJwt' callback provided to fetch credential issuer metadata method.`);
798
+ const { header, payload, signature } = (0, __openid4vc_oauth2.decodeJwt)({
799
+ jwt: result,
800
+ headerSchema: zSignedCredentialIssuerMetadataHeader,
801
+ payloadSchema: zSignedCredentialIssuerMetadataPayload
802
+ });
803
+ if (payload.sub !== credentialIssuer) throw new __openid4vc_oauth2.Oauth2Error(`The 'sub' parameter '${payload.sub}' in the signed well known credential issuer metadata at '${wellKnownMetadataUrl}' does not match the provided credential issuer '${credentialIssuer}'.`);
804
+ const signer = (0, __openid4vc_oauth2.jwtSignerFromJwt)({
805
+ header,
806
+ payload
807
+ });
808
+ const verifyResult = await (0, __openid4vc_oauth2.verifyJwt)({
809
+ compact: result,
810
+ header,
811
+ payload,
812
+ verifyJwtCallback: options.callbacks.verifyJwt,
813
+ now: options.now,
814
+ signer,
815
+ errorMessage: "signed credential issuer metadata jwt verification failed"
816
+ });
817
+ issuerMetadataWithVersion = {
818
+ ...(0, __openid4vc_utils.parseWithErrorHandling)(zCredentialIssuerMetadataWithDraftVersion, payload, "Unable to determine version for signed issuer metadata"),
819
+ signed: {
820
+ signer: verifyResult.signer,
821
+ jwt: {
822
+ header,
823
+ payload,
824
+ signature,
825
+ compact: result
826
+ }
827
+ }
828
+ };
829
+ } else if (result) issuerMetadataWithVersion = result;
830
+ if (issuerMetadataWithVersion && issuerMetadataWithVersion.credentialIssuerMetadata.credential_issuer !== credentialIssuer) throw new __openid4vc_oauth2.Oauth2Error(`The 'credential_issuer' parameter '${issuerMetadataWithVersion.credentialIssuerMetadata.credential_issuer}' in the well known credential issuer metadata at '${wellKnownMetadataUrl}' does not match the provided credential issuer '${credentialIssuer}'.`);
831
+ return issuerMetadataWithVersion;
779
832
  }
780
833
  /**
781
834
  * Extract credential configuration supported entries where the `format` is known to this
@@ -934,7 +987,7 @@ function credentialsSupportedToCredentialConfigurationsSupported(credentialsSupp
934
987
  //#region src/credential-request/format-payload.ts
935
988
  function getCredentialRequestFormatPayloadForCredentialConfigurationId(options) {
936
989
  const credentialConfiguration = getCredentialConfigurationSupportedById(options.issuerMetadata.credentialIssuer.credential_configurations_supported, options.credentialConfigurationId);
937
- if ((0, __openid4vc_utils.zIs)(zLegacySdJwtVcCredentialIssuerMetadataDraft16, credentialConfiguration) || (0, __openid4vc_utils.zIs)(zLegacySdJwtVcCredentialIssuerMetadataDraft14, credentialConfiguration)) return {
990
+ if ((0, __openid4vc_utils.zIs)(zLegacySdJwtVcCredentialIssuerMetadataV1, credentialConfiguration) || (0, __openid4vc_utils.zIs)(zLegacySdJwtVcCredentialIssuerMetadataDraft14, credentialConfiguration)) return {
938
991
  format: credentialConfiguration.format,
939
992
  vct: credentialConfiguration.vct
940
993
  };
@@ -1159,12 +1212,12 @@ const zOauth2ErrorResponse = zod.default.object({
1159
1212
  const zCredentialEncoding = zod.default.union([zod.default.string(), zod.default.record(zod.default.string(), zod.default.any())]);
1160
1213
  const zBaseCredentialResponse = zod.default.object({
1161
1214
  credentials: zod.default.union([zod.default.array(zod.default.object({ credential: zCredentialEncoding })), zod.default.array(zCredentialEncoding)]).optional(),
1162
- interval: zod.default.number().int().positive().optional(),
1163
- notification_id: zod.default.string().optional()
1215
+ notification_id: zod.default.string().optional(),
1216
+ transaction_id: zod.default.string().optional(),
1217
+ interval: zod.default.number().int().positive().optional()
1164
1218
  }).loose();
1165
1219
  const zCredentialResponse = zBaseCredentialResponse.extend({
1166
1220
  credential: zod.default.optional(zCredentialEncoding),
1167
- transaction_id: zod.default.string().optional(),
1168
1221
  c_nonce: zod.default.string().optional(),
1169
1222
  c_nonce_expires_in: zod.default.number().int().optional()
1170
1223
  }).loose().superRefine((value, ctx) => {
@@ -1191,15 +1244,26 @@ const zCredentialErrorResponse = zod.default.object({
1191
1244
  c_nonce: zod.default.string().optional(),
1192
1245
  c_nonce_expires_in: zod.default.number().int().optional()
1193
1246
  }).loose();
1194
- const zDeferredCredentialResponse = zBaseCredentialResponse.refine((value) => {
1195
- const { credentials, interval } = value;
1196
- return [credentials, interval].filter((i) => i !== void 0).length === 1;
1197
- }, { message: `Exactly one of 'credentials' or 'interval' MUST be defined.` });
1247
+ const zDeferredCredentialResponse = zBaseCredentialResponse.superRefine((value, ctx) => {
1248
+ const { credentials, transaction_id, interval, notification_id } = value;
1249
+ if ([credentials, transaction_id].filter((i) => i !== void 0).length !== 1) ctx.addIssue({
1250
+ code: "custom",
1251
+ message: `Exactly one of 'credentials', or 'transaction_id' MUST be defined.`
1252
+ });
1253
+ if (transaction_id && !interval) ctx.addIssue({
1254
+ code: "custom",
1255
+ message: `'interval' MUST be defined when 'transaction_id' is defined.`
1256
+ });
1257
+ if (notification_id && credentials) ctx.addIssue({
1258
+ code: "custom",
1259
+ message: `'notification_id' MUST NOT be defined when 'credentials' is not defined.`
1260
+ });
1261
+ });
1198
1262
 
1199
1263
  //#endregion
1200
1264
  //#region src/credential-request/retrieve-credentials.ts
1201
1265
  async function retrieveCredentialsWithCredentialConfigurationId(options) {
1202
- 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.");
1266
+ 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.");
1203
1267
  getCredentialConfigurationSupportedById(options.issuerMetadata.credentialIssuer.credential_configurations_supported, options.credentialConfigurationId);
1204
1268
  const credentialRequest = {
1205
1269
  ...options.additionalRequestPayload,
@@ -1216,7 +1280,7 @@ async function retrieveCredentialsWithCredentialConfigurationId(options) {
1216
1280
  });
1217
1281
  }
1218
1282
  async function retrieveCredentialsWithFormat(options) {
1219
- 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.");
1283
+ 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.");
1220
1284
  const credentialRequest = {
1221
1285
  ...options.formatPayload,
1222
1286
  ...options.additionalRequestPayload,
@@ -1298,7 +1362,7 @@ async function retrieveDeferredCredentials(options) {
1298
1362
  deferredCredentialErrorResponseResult
1299
1363
  };
1300
1364
  }
1301
- const deferredCredentialResponseResult = (0, __openid4vc_utils.isResponseContentType)(__openid4vc_utils.ContentType.Json, resourceResponse.response) ? zDeferredCredentialResponse.safeParse(await resourceResponse.response.clone().json()) : void 0;
1365
+ const deferredCredentialResponseResult = (0, __openid4vc_utils.isResponseContentType)(__openid4vc_utils.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;
1302
1366
  if (!deferredCredentialResponseResult?.success) return {
1303
1367
  ...resourceResponse,
1304
1368
  ok: false,
@@ -1389,14 +1453,17 @@ async function verifyCredentialRequestJwtProof(options) {
1389
1453
  //#region src/metadata/fetch-issuer-metadata.ts
1390
1454
  async function resolveIssuerMetadata(credentialIssuer, options) {
1391
1455
  const allowAuthorizationMetadataFromCredentialIssuerMetadata = options?.allowAuthorizationMetadataFromCredentialIssuerMetadata ?? true;
1392
- const credentialIssuerMetadataWithDraftVersion = await fetchCredentialIssuerMetadata(credentialIssuer, options?.fetch);
1456
+ const credentialIssuerMetadataWithDraftVersion = await fetchCredentialIssuerMetadata(credentialIssuer, {
1457
+ callbacks: options?.callbacks,
1458
+ now: options?.now
1459
+ });
1393
1460
  if (!credentialIssuerMetadataWithDraftVersion) throw new __openid4vc_oauth2.Oauth2Error(`Well known credential issuer metadata for issuer '${credentialIssuer}' not found.`);
1394
- const { credentialIssuerMetadata, originalDraftVersion } = credentialIssuerMetadataWithDraftVersion;
1461
+ const { credentialIssuerMetadata, originalDraftVersion, signed } = credentialIssuerMetadataWithDraftVersion;
1395
1462
  const authorizationServers = credentialIssuerMetadata.authorization_servers ?? [credentialIssuer];
1396
1463
  const authoriationServersMetadata = [];
1397
1464
  for (const authorizationServer of authorizationServers) {
1398
1465
  if (options?.restrictToAuthorizationServers && !options.restrictToAuthorizationServers.includes(authorizationServer)) continue;
1399
- let authorizationServerMetadata = await (0, __openid4vc_oauth2.fetchAuthorizationServerMetadata)(authorizationServer, options?.fetch);
1466
+ let authorizationServerMetadata = await (0, __openid4vc_oauth2.fetchAuthorizationServerMetadata)(authorizationServer, options?.callbacks.fetch);
1400
1467
  if (!authorizationServerMetadata && authorizationServer === credentialIssuer && allowAuthorizationMetadataFromCredentialIssuerMetadata) authorizationServerMetadata = (0, __openid4vc_utils.parseWithErrorHandling)(__openid4vc_oauth2.zAuthorizationServerMetadata, {
1401
1468
  token_endpoint: credentialIssuerMetadata.token_endpoint,
1402
1469
  issuer: credentialIssuer
@@ -1407,6 +1474,7 @@ async function resolveIssuerMetadata(credentialIssuer, options) {
1407
1474
  return {
1408
1475
  originalDraftVersion,
1409
1476
  credentialIssuer: credentialIssuerMetadata,
1477
+ signedCredentialIssuer: signed,
1410
1478
  authorizationServers: authoriationServersMetadata
1411
1479
  };
1412
1480
  }
@@ -1512,7 +1580,7 @@ var Openid4vciClient = class {
1512
1580
  return resolveCredentialOffer(credentialOffer, { fetch: this.options.callbacks.fetch });
1513
1581
  }
1514
1582
  async resolveIssuerMetadata(credentialIssuer) {
1515
- return resolveIssuerMetadata(credentialIssuer, { fetch: this.options.callbacks.fetch });
1583
+ return resolveIssuerMetadata(credentialIssuer, { callbacks: this.options.callbacks });
1516
1584
  }
1517
1585
  /**
1518
1586
  * Retrieve an authorization code for a presentation during issuance session
@@ -1716,7 +1784,7 @@ var Openid4vciClient = class {
1716
1784
  */
1717
1785
  async retrieveCredentials({ issuerMetadata, proof, proofs, credentialConfigurationId, additionalRequestPayload, accessToken, dpop }) {
1718
1786
  let credentialResponse;
1719
- if (issuerMetadata.originalDraftVersion === Openid4vciDraftVersion.Draft15 || issuerMetadata.originalDraftVersion === Openid4vciDraftVersion.Draft16) credentialResponse = await retrieveCredentialsWithCredentialConfigurationId({
1787
+ if (issuerMetadata.originalDraftVersion === Openid4vciDraftVersion.Draft15 || issuerMetadata.originalDraftVersion === Openid4vciDraftVersion.V1) credentialResponse = await retrieveCredentialsWithCredentialConfigurationId({
1720
1788
  accessToken,
1721
1789
  credentialConfigurationId,
1722
1790
  issuerMetadata,
@@ -1791,6 +1859,7 @@ function createDeferredCredentialResponse(options) {
1791
1859
  return (0, __openid4vc_utils.parseWithErrorHandling)(zDeferredCredentialResponse, {
1792
1860
  credentials: options.credentials,
1793
1861
  notification_id: options.notificationId,
1862
+ transaction_id: options.transactionId,
1794
1863
  interval: options.interval,
1795
1864
  ...options.additionalPayload
1796
1865
  });
@@ -1846,6 +1915,28 @@ async function verifyCredentialRequestAttestationProof(options) {
1846
1915
  });
1847
1916
  }
1848
1917
 
1918
+ //#endregion
1919
+ //#region src/metadata/credential-issuer/signed-credential-issuer-metadata.ts
1920
+ async function createSignedCredentialIssuerMetadataJwt(options) {
1921
+ const header = (0, __openid4vc_utils.parseWithErrorHandling)(zSignedCredentialIssuerMetadataHeader, {
1922
+ ...(0, __openid4vc_oauth2.jwtHeaderFromJwtSigner)(options.signer),
1923
+ typ: "openidvci-issuer-metadata+jwt"
1924
+ });
1925
+ const payload = (0, __openid4vc_utils.parseWithErrorHandling)(zSignedCredentialIssuerMetadataPayload, {
1926
+ ...options.credentialIssuerMetadata,
1927
+ sub: options.credentialIssuerMetadata.credential_issuer,
1928
+ iat: (0, __openid4vc_utils.dateToSeconds)(options.issuedAt),
1929
+ exp: options.expiresAt ? (0, __openid4vc_utils.dateToSeconds)(options.expiresAt) : void 0,
1930
+ iss: options.issuer,
1931
+ ...options.additionalPayload
1932
+ });
1933
+ const { jwt } = await options.callbacks.signJwt(options.signer, {
1934
+ header,
1935
+ payload
1936
+ });
1937
+ return jwt;
1938
+ }
1939
+
1849
1940
  //#endregion
1850
1941
  //#region src/Openid4vciIssuer.ts
1851
1942
  var Openid4vciIssuer = class {
@@ -1864,6 +1955,15 @@ var Openid4vciIssuer = class {
1864
1955
  createCredentialIssuerMetadata(credentialIssuerMetadata) {
1865
1956
  return (0, __openid4vc_utils.parseWithErrorHandling)(zCredentialIssuerMetadata, credentialIssuerMetadata, "Error validating credential issuer metadata");
1866
1957
  }
1958
+ /**
1959
+ * Validates credential issuer metadata structure is correct and creates signed credential issuer metadata JWT
1960
+ */
1961
+ createSignedCredentialIssuerMetadataJwt(options) {
1962
+ return createSignedCredentialIssuerMetadataJwt({
1963
+ callbacks: this.options.callbacks,
1964
+ ...options
1965
+ });
1966
+ }
1867
1967
  async createCredentialOffer(options) {
1868
1968
  return createCredentialOffer({
1869
1969
  callbacks: this.options.callbacks,