@openid4vc/openid4vci 0.3.0-alpha-20251017122507 → 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.d.mts CHANGED
@@ -7,7 +7,7 @@ import * as zod_v4_core0 from "zod/v4/core";
7
7
 
8
8
  //#region src/version.d.ts
9
9
  declare enum Openid4vciDraftVersion {
10
- Draft16 = "Draft16",
10
+ V1 = "V1",
11
11
  Draft15 = "Draft15",
12
12
  Draft14 = "Draft14",
13
13
  Draft11 = "Draft11",
@@ -1160,8 +1160,8 @@ declare const zCredentialIssuerMetadataDisplayEntry: z.ZodObject<{
1160
1160
  }, z.core.$loose>>;
1161
1161
  }, z.core.$loose>;
1162
1162
  type CredentialIssuerMetadataDisplayEntry = z.infer<typeof zCredentialIssuerMetadataDisplayEntry>;
1163
- type CredentialIssuerMetadata = z.infer<typeof zCredentialIssuerMetadataDraft14Draft15Draft16>;
1164
- declare const zCredentialIssuerMetadataDraft14Draft15Draft16: z.ZodObject<{
1163
+ type CredentialIssuerMetadata = z.infer<typeof zCredentialIssuerMetadataDraft14Draft15V1>;
1164
+ declare const zCredentialIssuerMetadataDraft14Draft15V1: z.ZodObject<{
1165
1165
  credential_issuer: z.ZodString;
1166
1166
  authorization_servers: z.ZodOptional<z.ZodArray<z.ZodString>>;
1167
1167
  credential_endpoint: z.ZodString;
@@ -1176,7 +1176,6 @@ declare const zCredentialIssuerMetadataDraft14Draft15Draft16: z.ZodObject<{
1176
1176
  batch_credential_issuance: z.ZodOptional<z.ZodObject<{
1177
1177
  batch_size: z.ZodNumber;
1178
1178
  }, z.core.$loose>>;
1179
- signed_metadata: z.ZodOptional<z.ZodString>;
1180
1179
  display: z.ZodOptional<z.ZodArray<z.ZodObject<{
1181
1180
  name: z.ZodOptional<z.ZodString>;
1182
1181
  locale: z.ZodOptional<z.ZodString>;
@@ -2337,10 +2336,10 @@ declare const zCredentialResponse: z.ZodObject<{
2337
2336
  credentials: z.ZodOptional<z.ZodUnion<readonly [z.ZodArray<z.ZodObject<{
2338
2337
  credential: z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodAny>]>;
2339
2338
  }, z.core.$strip>>, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodAny>]>>]>>;
2340
- interval: z.ZodOptional<z.ZodNumber>;
2341
2339
  notification_id: z.ZodOptional<z.ZodString>;
2342
- credential: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodAny>]>>;
2343
2340
  transaction_id: z.ZodOptional<z.ZodString>;
2341
+ interval: z.ZodOptional<z.ZodNumber>;
2342
+ credential: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodAny>]>>;
2344
2343
  c_nonce: z.ZodOptional<z.ZodString>;
2345
2344
  c_nonce_expires_in: z.ZodOptional<z.ZodNumber>;
2346
2345
  }, z.core.$loose>;
@@ -2357,8 +2356,9 @@ declare const zDeferredCredentialResponse: z.ZodObject<{
2357
2356
  credentials: z.ZodOptional<z.ZodUnion<readonly [z.ZodArray<z.ZodObject<{
2358
2357
  credential: z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodAny>]>;
2359
2358
  }, z.core.$strip>>, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodAny>]>>]>>;
2360
- interval: z.ZodOptional<z.ZodNumber>;
2361
2359
  notification_id: z.ZodOptional<z.ZodString>;
2360
+ transaction_id: z.ZodOptional<z.ZodString>;
2361
+ interval: z.ZodOptional<z.ZodNumber>;
2362
2362
  }, z.core.$loose>;
2363
2363
  type DeferredCredentialResponse = z.infer<typeof zDeferredCredentialResponse>;
2364
2364
  //#endregion
@@ -3680,10 +3680,20 @@ interface CreateCredentialResponseOptions {
3680
3680
  */
3681
3681
  additionalPayload?: Record<string, unknown>;
3682
3682
  }
3683
- type CreateDeferredCredentialResponseOptions = {
3684
- credentials?: DeferredCredentialResponse['credentials'];
3685
- interval?: number;
3683
+ type CreateDeferredCredentialResponseOptions = ({
3684
+ credentials: DeferredCredentialResponse['credentials'];
3686
3685
  notificationId?: string;
3686
+ transactionId?: never;
3687
+ interval?: never;
3688
+ } | {
3689
+ /**
3690
+ * The `transaction_id` used to identify the deferred issuance transaction.
3691
+ */
3692
+ transactionId: string;
3693
+ interval: number;
3694
+ credentials?: never;
3695
+ notificationId?: never;
3696
+ }) & {
3687
3697
  /**
3688
3698
  * Additional payload to include in the deferred credential response
3689
3699
  */
@@ -3851,7 +3861,6 @@ declare class Openid4vciIssuer {
3851
3861
  [x: string]: unknown;
3852
3862
  batch_size: number;
3853
3863
  } | undefined;
3854
- signed_metadata?: string | undefined;
3855
3864
  display?: {
3856
3865
  [x: string]: unknown;
3857
3866
  name?: string | undefined;
@@ -4237,10 +4246,10 @@ declare class Openid4vciIssuer {
4237
4246
  credentials?: {
4238
4247
  credential: string | Record<string, any>;
4239
4248
  }[] | (string | Record<string, any>)[] | undefined;
4240
- interval?: number | undefined;
4241
4249
  notification_id?: string | undefined;
4242
- credential?: string | Record<string, any> | undefined;
4243
4250
  transaction_id?: string | undefined;
4251
+ interval?: number | undefined;
4252
+ credential?: string | Record<string, any> | undefined;
4244
4253
  c_nonce?: string | undefined;
4245
4254
  c_nonce_expires_in?: number | undefined;
4246
4255
  };
@@ -4252,8 +4261,9 @@ declare class Openid4vciIssuer {
4252
4261
  credentials?: {
4253
4262
  credential: string | Record<string, any>;
4254
4263
  }[] | (string | Record<string, any>)[] | undefined;
4255
- interval?: number | undefined;
4256
4264
  notification_id?: string | undefined;
4265
+ transaction_id?: string | undefined;
4266
+ interval?: number | undefined;
4257
4267
  };
4258
4268
  /**
4259
4269
  * @throws ValidationError - when validation of the nonce response fails
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { ContentType, Fetch, FetchHeaders, HttpMethod, InferOutputUnion, Oid4vcTsConfig, OrPromise, StringWithAutoCompletion, getGlobalConfig, setGlobalConfig } from "@openid4vc/utils";
2
- import * as _openid4vc_oauth20 from "@openid4vc/oauth2";
2
+ import * as _openid4vc_oauth23 from "@openid4vc/oauth2";
3
3
  import { AuthorizationCodeGrantIdentifier, AuthorizationServerMetadata, CallbackContext, CreateAuthorizationRequestUrlOptions, CreateClientAttestationJwtOptions, CreatePkceReturn, Jwk, JwtSigner, PreAuthorizedCodeGrantIdentifier, RequestDpopOptions, ResourceRequestResponseNotOk, ResourceRequestResponseOk, RetrieveAuthorizationCodeAccessTokenOptions, RetrievePreAuthorizedCodeAccessTokenOptions, authorizationCodeGrantIdentifier, preAuthorizedCodeGrantIdentifier } from "@openid4vc/oauth2";
4
4
  import * as zod0 from "zod";
5
5
  import z from "zod";
@@ -7,7 +7,7 @@ import * as zod_v4_core0 from "zod/v4/core";
7
7
 
8
8
  //#region src/version.d.ts
9
9
  declare enum Openid4vciDraftVersion {
10
- Draft16 = "Draft16",
10
+ V1 = "V1",
11
11
  Draft15 = "Draft15",
12
12
  Draft14 = "Draft14",
13
13
  Draft11 = "Draft11",
@@ -1160,8 +1160,8 @@ declare const zCredentialIssuerMetadataDisplayEntry: z.ZodObject<{
1160
1160
  }, z.core.$loose>>;
1161
1161
  }, z.core.$loose>;
1162
1162
  type CredentialIssuerMetadataDisplayEntry = z.infer<typeof zCredentialIssuerMetadataDisplayEntry>;
1163
- type CredentialIssuerMetadata = z.infer<typeof zCredentialIssuerMetadataDraft14Draft15Draft16>;
1164
- declare const zCredentialIssuerMetadataDraft14Draft15Draft16: z.ZodObject<{
1163
+ type CredentialIssuerMetadata = z.infer<typeof zCredentialIssuerMetadataDraft14Draft15V1>;
1164
+ declare const zCredentialIssuerMetadataDraft14Draft15V1: z.ZodObject<{
1165
1165
  credential_issuer: z.ZodString;
1166
1166
  authorization_servers: z.ZodOptional<z.ZodArray<z.ZodString>>;
1167
1167
  credential_endpoint: z.ZodString;
@@ -1176,7 +1176,6 @@ declare const zCredentialIssuerMetadataDraft14Draft15Draft16: z.ZodObject<{
1176
1176
  batch_credential_issuance: z.ZodOptional<z.ZodObject<{
1177
1177
  batch_size: z.ZodNumber;
1178
1178
  }, z.core.$loose>>;
1179
- signed_metadata: z.ZodOptional<z.ZodString>;
1180
1179
  display: z.ZodOptional<z.ZodArray<z.ZodObject<{
1181
1180
  name: z.ZodOptional<z.ZodString>;
1182
1181
  locale: z.ZodOptional<z.ZodString>;
@@ -2337,10 +2336,10 @@ declare const zCredentialResponse: z.ZodObject<{
2337
2336
  credentials: z.ZodOptional<z.ZodUnion<readonly [z.ZodArray<z.ZodObject<{
2338
2337
  credential: z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodAny>]>;
2339
2338
  }, z.core.$strip>>, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodAny>]>>]>>;
2340
- interval: z.ZodOptional<z.ZodNumber>;
2341
2339
  notification_id: z.ZodOptional<z.ZodString>;
2342
- credential: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodAny>]>>;
2343
2340
  transaction_id: z.ZodOptional<z.ZodString>;
2341
+ interval: z.ZodOptional<z.ZodNumber>;
2342
+ credential: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodAny>]>>;
2344
2343
  c_nonce: z.ZodOptional<z.ZodString>;
2345
2344
  c_nonce_expires_in: z.ZodOptional<z.ZodNumber>;
2346
2345
  }, z.core.$loose>;
@@ -2357,8 +2356,9 @@ declare const zDeferredCredentialResponse: z.ZodObject<{
2357
2356
  credentials: z.ZodOptional<z.ZodUnion<readonly [z.ZodArray<z.ZodObject<{
2358
2357
  credential: z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodAny>]>;
2359
2358
  }, z.core.$strip>>, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodAny>]>>]>>;
2360
- interval: z.ZodOptional<z.ZodNumber>;
2361
2359
  notification_id: z.ZodOptional<z.ZodString>;
2360
+ transaction_id: z.ZodOptional<z.ZodString>;
2361
+ interval: z.ZodOptional<z.ZodNumber>;
2362
2362
  }, z.core.$loose>;
2363
2363
  type DeferredCredentialResponse = z.infer<typeof zDeferredCredentialResponse>;
2364
2364
  //#endregion
@@ -2725,7 +2725,7 @@ interface ParseKeyAttestationJwtOptions {
2725
2725
  declare function parseKeyAttestationJwt({
2726
2726
  keyAttestationJwt,
2727
2727
  use
2728
- }: ParseKeyAttestationJwtOptions): _openid4vc_oauth20.DecodeJwtResult<zod0.ZodObject<{
2728
+ }: ParseKeyAttestationJwtOptions): _openid4vc_oauth23.DecodeJwtResult<zod0.ZodObject<{
2729
2729
  typ: zod0.ZodUnion<[zod0.ZodLiteral<"keyattestation+jwt">, zod0.ZodLiteral<"key-attestation+jwt">]>;
2730
2730
  alg: zod0.ZodString;
2731
2731
  kid: zod0.ZodOptional<zod0.ZodString>;
@@ -2997,7 +2997,7 @@ declare function verifyKeyAttestationJwt(options: VerifyKeyAttestationJwtOptions
2997
2997
  status?: Record<string, any> | undefined;
2998
2998
  trust_chain?: [string, ...string[]] | undefined;
2999
2999
  };
3000
- signer: _openid4vc_oauth20.JwtSignerWithJwk;
3000
+ signer: _openid4vc_oauth23.JwtSignerWithJwk;
3001
3001
  }>;
3002
3002
  //#endregion
3003
3003
  //#region src/metadata/credential-issuer/credential-configurations.d.ts
@@ -3162,7 +3162,7 @@ declare class Openid4vciClient {
3162
3162
  };
3163
3163
  dpop: {
3164
3164
  nonce: string | undefined;
3165
- signer: _openid4vc_oauth20.JwtSignerJwk;
3165
+ signer: _openid4vc_oauth23.JwtSignerJwk;
3166
3166
  } | undefined;
3167
3167
  }>;
3168
3168
  /**
@@ -3221,7 +3221,7 @@ declare class Openid4vciClient {
3221
3221
  issuerMetadata: IssuerMetadataResult;
3222
3222
  }): Promise<{
3223
3223
  authorizationServer: string;
3224
- accessTokenResponse: _openid4vc_oauth20.AccessTokenResponse;
3224
+ accessTokenResponse: _openid4vc_oauth23.AccessTokenResponse;
3225
3225
  dpop?: RequestDpopOptions;
3226
3226
  }>;
3227
3227
  /**
@@ -3241,7 +3241,7 @@ declare class Openid4vciClient {
3241
3241
  issuerMetadata: IssuerMetadataResult;
3242
3242
  }): Promise<{
3243
3243
  authorizationServer: string;
3244
- accessTokenResponse: _openid4vc_oauth20.AccessTokenResponse;
3244
+ accessTokenResponse: _openid4vc_oauth23.AccessTokenResponse;
3245
3245
  dpop?: RequestDpopOptions;
3246
3246
  }>;
3247
3247
  /**
@@ -3296,7 +3296,7 @@ declare class Openid4vciClient {
3296
3296
  additionalRequestPayload,
3297
3297
  accessToken,
3298
3298
  dpop
3299
- }: Pick<SendNotificationOptions, 'accessToken' | 'additionalRequestPayload' | 'issuerMetadata' | 'dpop' | 'notification'>): Promise<_openid4vc_oauth20.ResourceRequestResponseOk>;
3299
+ }: Pick<SendNotificationOptions, 'accessToken' | 'additionalRequestPayload' | 'issuerMetadata' | 'dpop' | 'notification'>): Promise<_openid4vc_oauth23.ResourceRequestResponseOk>;
3300
3300
  }
3301
3301
  //#endregion
3302
3302
  //#region ../oauth2/src/common/jwk/z-jwk.d.ts
@@ -3680,10 +3680,20 @@ interface CreateCredentialResponseOptions {
3680
3680
  */
3681
3681
  additionalPayload?: Record<string, unknown>;
3682
3682
  }
3683
- type CreateDeferredCredentialResponseOptions = {
3684
- credentials?: DeferredCredentialResponse['credentials'];
3685
- interval?: number;
3683
+ type CreateDeferredCredentialResponseOptions = ({
3684
+ credentials: DeferredCredentialResponse['credentials'];
3686
3685
  notificationId?: string;
3686
+ transactionId?: never;
3687
+ interval?: never;
3688
+ } | {
3689
+ /**
3690
+ * The `transaction_id` used to identify the deferred issuance transaction.
3691
+ */
3692
+ transactionId: string;
3693
+ interval: number;
3694
+ credentials?: never;
3695
+ notificationId?: never;
3696
+ }) & {
3687
3697
  /**
3688
3698
  * Additional payload to include in the deferred credential response
3689
3699
  */
@@ -3851,7 +3861,6 @@ declare class Openid4vciIssuer {
3851
3861
  [x: string]: unknown;
3852
3862
  batch_size: number;
3853
3863
  } | undefined;
3854
- signed_metadata?: string | undefined;
3855
3864
  display?: {
3856
3865
  [x: string]: unknown;
3857
3866
  name?: string | undefined;
@@ -3966,7 +3975,7 @@ declare class Openid4vciIssuer {
3966
3975
  status?: Record<string, any> | undefined;
3967
3976
  trust_chain?: [string, ...string[]] | undefined;
3968
3977
  };
3969
- signer: _openid4vc_oauth20.JwtSignerWithJwk;
3978
+ signer: _openid4vc_oauth23.JwtSignerWithJwk;
3970
3979
  keyAttestation: {
3971
3980
  header: {
3972
3981
  [x: string]: unknown;
@@ -4088,7 +4097,7 @@ declare class Openid4vciIssuer {
4088
4097
  status?: Record<string, any> | undefined;
4089
4098
  trust_chain?: [string, ...string[]] | undefined;
4090
4099
  };
4091
- signer: _openid4vc_oauth20.JwtSignerWithJwk;
4100
+ signer: _openid4vc_oauth23.JwtSignerWithJwk;
4092
4101
  } | undefined;
4093
4102
  }>;
4094
4103
  /**
@@ -4218,7 +4227,7 @@ declare class Openid4vciIssuer {
4218
4227
  status?: Record<string, any> | undefined;
4219
4228
  trust_chain?: [string, ...string[]] | undefined;
4220
4229
  };
4221
- signer: _openid4vc_oauth20.JwtSignerWithJwk;
4230
+ signer: _openid4vc_oauth23.JwtSignerWithJwk;
4222
4231
  }>;
4223
4232
  /**
4224
4233
  * @throws Oauth2ServerErrorResponseError - when validation of the credential request fails
@@ -4237,10 +4246,10 @@ declare class Openid4vciIssuer {
4237
4246
  credentials?: {
4238
4247
  credential: string | Record<string, any>;
4239
4248
  }[] | (string | Record<string, any>)[] | undefined;
4240
- interval?: number | undefined;
4241
4249
  notification_id?: string | undefined;
4242
- credential?: string | Record<string, any> | undefined;
4243
4250
  transaction_id?: string | undefined;
4251
+ interval?: number | undefined;
4252
+ credential?: string | Record<string, any> | undefined;
4244
4253
  c_nonce?: string | undefined;
4245
4254
  c_nonce_expires_in?: number | undefined;
4246
4255
  };
@@ -4252,8 +4261,9 @@ declare class Openid4vciIssuer {
4252
4261
  credentials?: {
4253
4262
  credential: string | Record<string, any>;
4254
4263
  }[] | (string | Record<string, any>)[] | undefined;
4255
- interval?: number | undefined;
4256
4264
  notification_id?: string | undefined;
4265
+ transaction_id?: string | undefined;
4266
+ interval?: number | undefined;
4257
4267
  };
4258
4268
  /**
4259
4269
  * @throws ValidationError - when validation of the nonce response fails
@@ -4353,7 +4363,7 @@ declare class Openid4vciIssuer {
4353
4363
  status?: Record<string, any> | undefined;
4354
4364
  trust_chain?: [string, ...string[]] | undefined;
4355
4365
  };
4356
- signer: _openid4vc_oauth20.JwtSignerWithJwk;
4366
+ signer: _openid4vc_oauth23.JwtSignerWithJwk;
4357
4367
  };
4358
4368
  clientAttestationPop: {
4359
4369
  header: {
@@ -4442,7 +4452,7 @@ declare class Openid4vciIssuer {
4442
4452
  status?: Record<string, any> | undefined;
4443
4453
  trust_chain?: [string, ...string[]] | undefined;
4444
4454
  };
4445
- signer: _openid4vc_oauth20.JwtSignerWithJwk;
4455
+ signer: _openid4vc_oauth23.JwtSignerWithJwk;
4446
4456
  };
4447
4457
  }>;
4448
4458
  }
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,9 +752,7 @@ 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,
@@ -934,7 +931,7 @@ function credentialsSupportedToCredentialConfigurationsSupported(credentialsSupp
934
931
  //#region src/credential-request/format-payload.ts
935
932
  function getCredentialRequestFormatPayloadForCredentialConfigurationId(options) {
936
933
  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 {
934
+ if ((0, __openid4vc_utils.zIs)(zLegacySdJwtVcCredentialIssuerMetadataV1, credentialConfiguration) || (0, __openid4vc_utils.zIs)(zLegacySdJwtVcCredentialIssuerMetadataDraft14, credentialConfiguration)) return {
938
935
  format: credentialConfiguration.format,
939
936
  vct: credentialConfiguration.vct
940
937
  };
@@ -1159,12 +1156,12 @@ const zOauth2ErrorResponse = zod.default.object({
1159
1156
  const zCredentialEncoding = zod.default.union([zod.default.string(), zod.default.record(zod.default.string(), zod.default.any())]);
1160
1157
  const zBaseCredentialResponse = zod.default.object({
1161
1158
  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()
1159
+ notification_id: zod.default.string().optional(),
1160
+ transaction_id: zod.default.string().optional(),
1161
+ interval: zod.default.number().int().positive().optional()
1164
1162
  }).loose();
1165
1163
  const zCredentialResponse = zBaseCredentialResponse.extend({
1166
1164
  credential: zod.default.optional(zCredentialEncoding),
1167
- transaction_id: zod.default.string().optional(),
1168
1165
  c_nonce: zod.default.string().optional(),
1169
1166
  c_nonce_expires_in: zod.default.number().int().optional()
1170
1167
  }).loose().superRefine((value, ctx) => {
@@ -1191,15 +1188,26 @@ const zCredentialErrorResponse = zod.default.object({
1191
1188
  c_nonce: zod.default.string().optional(),
1192
1189
  c_nonce_expires_in: zod.default.number().int().optional()
1193
1190
  }).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.` });
1191
+ const zDeferredCredentialResponse = zBaseCredentialResponse.superRefine((value, ctx) => {
1192
+ const { credentials, transaction_id, interval, notification_id } = value;
1193
+ if ([credentials, transaction_id].filter((i) => i !== void 0).length !== 1) ctx.addIssue({
1194
+ code: "custom",
1195
+ message: `Exactly one of 'credentials', or 'transaction_id' MUST be defined.`
1196
+ });
1197
+ if (transaction_id && !interval) ctx.addIssue({
1198
+ code: "custom",
1199
+ message: `'interval' MUST be defined when 'transaction_id' is defined.`
1200
+ });
1201
+ if (notification_id && credentials) ctx.addIssue({
1202
+ code: "custom",
1203
+ message: `'notification_id' MUST NOT be defined when 'credentials' is not defined.`
1204
+ });
1205
+ });
1198
1206
 
1199
1207
  //#endregion
1200
1208
  //#region src/credential-request/retrieve-credentials.ts
1201
1209
  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.");
1210
+ 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
1211
  getCredentialConfigurationSupportedById(options.issuerMetadata.credentialIssuer.credential_configurations_supported, options.credentialConfigurationId);
1204
1212
  const credentialRequest = {
1205
1213
  ...options.additionalRequestPayload,
@@ -1216,7 +1224,7 @@ async function retrieveCredentialsWithCredentialConfigurationId(options) {
1216
1224
  });
1217
1225
  }
1218
1226
  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.");
1227
+ 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
1228
  const credentialRequest = {
1221
1229
  ...options.formatPayload,
1222
1230
  ...options.additionalRequestPayload,
@@ -1298,7 +1306,7 @@ async function retrieveDeferredCredentials(options) {
1298
1306
  deferredCredentialErrorResponseResult
1299
1307
  };
1300
1308
  }
1301
- const deferredCredentialResponseResult = (0, __openid4vc_utils.isResponseContentType)(__openid4vc_utils.ContentType.Json, resourceResponse.response) ? zDeferredCredentialResponse.safeParse(await resourceResponse.response.clone().json()) : void 0;
1309
+ 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
1310
  if (!deferredCredentialResponseResult?.success) return {
1303
1311
  ...resourceResponse,
1304
1312
  ok: false,
@@ -1716,7 +1724,7 @@ var Openid4vciClient = class {
1716
1724
  */
1717
1725
  async retrieveCredentials({ issuerMetadata, proof, proofs, credentialConfigurationId, additionalRequestPayload, accessToken, dpop }) {
1718
1726
  let credentialResponse;
1719
- if (issuerMetadata.originalDraftVersion === Openid4vciDraftVersion.Draft15 || issuerMetadata.originalDraftVersion === Openid4vciDraftVersion.Draft16) credentialResponse = await retrieveCredentialsWithCredentialConfigurationId({
1727
+ if (issuerMetadata.originalDraftVersion === Openid4vciDraftVersion.Draft15 || issuerMetadata.originalDraftVersion === Openid4vciDraftVersion.V1) credentialResponse = await retrieveCredentialsWithCredentialConfigurationId({
1720
1728
  accessToken,
1721
1729
  credentialConfigurationId,
1722
1730
  issuerMetadata,
@@ -1791,6 +1799,7 @@ function createDeferredCredentialResponse(options) {
1791
1799
  return (0, __openid4vc_utils.parseWithErrorHandling)(zDeferredCredentialResponse, {
1792
1800
  credentials: options.credentials,
1793
1801
  notification_id: options.notificationId,
1802
+ transaction_id: options.transactionId,
1794
1803
  interval: options.interval,
1795
1804
  ...options.additionalPayload
1796
1805
  });