@pagopa/io-wallet-oauth2 1.5.6 → 1.5.7

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
@@ -676,22 +676,9 @@ async function verifyWalletAttestationJwt2(options) {
676
676
 
677
677
  // src/client-attestation/v1.4/z-wallet-attestation.ts
678
678
  import { z as z8 } from "zod";
679
- var zWalletAttestationStatusV1_4 = z8.object({
680
- status_list: z8.object({
681
- idx: z8.number().int(),
682
- uri: z8.string()
683
- })
684
- });
685
- var zEudiWalletInfoV1_4 = z8.object({
686
- general_info: z8.object({
687
- wallet_provider_name: z8.string(),
688
- wallet_solution_certification_information: z8.url(),
689
- wallet_solution_id: z8.string(),
690
- wallet_solution_version: z8.string()
691
- })
692
- });
693
679
  var zWalletAttestationJwtHeaderV1_4 = z8.looseObject({
694
680
  ...zJwtHeader.shape,
681
+ kid: z8.string(),
695
682
  trust_chain: zTrustChain.optional(),
696
683
  typ: z8.literal("oauth-client-attestation+jwt"),
697
684
  x5c: zCertificateChain
@@ -701,12 +688,10 @@ var zWalletAttestationJwtPayloadV1_4 = z8.looseObject({
701
688
  cnf: z8.object({
702
689
  jwk: zJwk
703
690
  }),
704
- eudi_wallet_info: zEudiWalletInfoV1_4.optional(),
705
691
  exp: z8.number().int(),
706
692
  iat: z8.number().int(),
707
693
  iss: z8.string(),
708
694
  nbf: z8.number().optional(),
709
- status: zWalletAttestationStatusV1_4,
710
695
  sub: z8.string(),
711
696
  wallet_link: z8.url(),
712
697
  wallet_name: z8.string()
@@ -2126,11 +2111,19 @@ import {
2126
2111
  addSecondsToDate as addSecondsToDate6,
2127
2112
  dateToSeconds as dateToSeconds7
2128
2113
  } from "@pagopa/io-wallet-utils";
2114
+ var DEFAULT_EXPIRATION_SECONDS = 3600;
2115
+ var MAX_EXPIRATION_SECONDS = 86400;
2129
2116
  var createWalletAttestationJwt3 = async (options) => {
2130
2117
  try {
2131
2118
  const { signJwt } = options.callbacks;
2132
2119
  const iat = /* @__PURE__ */ new Date();
2133
- const exp = options.expiresAt ?? addSecondsToDate6(iat, 3600);
2120
+ const exp = options.expiresAt ?? addSecondsToDate6(iat, DEFAULT_EXPIRATION_SECONDS);
2121
+ if (exp <= iat) {
2122
+ throw new ValidationError6("exp must be after iat");
2123
+ }
2124
+ if (exp > addSecondsToDate6(iat, MAX_EXPIRATION_SECONDS)) {
2125
+ throw new ValidationError6("exp must not be more than 24 hours after iat");
2126
+ }
2134
2127
  if (options.nbf && options.nbf >= exp) {
2135
2128
  throw new ValidationError6("nbf must be before exp");
2136
2129
  }
@@ -2140,14 +2133,10 @@ var createWalletAttestationJwt3 = async (options) => {
2140
2133
  exp: dateToSeconds7(exp),
2141
2134
  iat: dateToSeconds7(iat),
2142
2135
  iss: options.issuer,
2143
- status: options.status,
2144
2136
  sub: dpopJwkThumbprint,
2145
2137
  wallet_link: options.walletLink,
2146
2138
  wallet_name: options.walletName,
2147
- ...options.nbf && { nbf: dateToSeconds7(options.nbf) },
2148
- ...options.eudiWalletInfo && {
2149
- eudi_wallet_info: options.eudiWalletInfo
2150
- }
2139
+ ...options.nbf && { nbf: dateToSeconds7(options.nbf) }
2151
2140
  };
2152
2141
  const header = {
2153
2142
  alg: options.signer.alg,