@pagopa/io-wallet-oauth2 1.1.1 → 1.1.2

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
@@ -69,10 +69,10 @@ var CreateTokenResponseError = class extends Oauth2Error {
69
69
  }
70
70
  };
71
71
  var ClientAttestationError = class extends Oauth2Error {
72
- constructor(message, originalError) {
72
+ constructor(message, cause) {
73
73
  super(message);
74
- this.originalError = originalError;
75
74
  this.name = "ClientAttestationError";
75
+ this.cause = cause;
76
76
  }
77
77
  };
78
78
 
@@ -1509,7 +1509,9 @@ async function createJarRequest(options) {
1509
1509
  // src/jar/fetch-jar-request-object.ts
1510
1510
  import {
1511
1511
  ContentType,
1512
- createFetcher as createFetcher3
1512
+ UnexpectedStatusCodeError as UnexpectedStatusCodeError3,
1513
+ createFetcher as createFetcher3,
1514
+ hasStatusOrThrow as hasStatusOrThrow3
1513
1515
  } from "@pagopa/io-wallet-utils";
1514
1516
  async function fetchJarRequestObject(options) {
1515
1517
  const { fetch, requestUri } = options;
@@ -1531,11 +1533,7 @@ async function fetchJarRequestObject(options) {
1531
1533
  `Fetching request_object from request_uri '${requestUri}' failed`
1532
1534
  );
1533
1535
  });
1534
- if (!response.ok) {
1535
- throw new Oauth2Error(
1536
- `Fetching request_object from request_uri '${requestUri}' failed with status code '${response.status}'.`
1537
- );
1538
- }
1536
+ await hasStatusOrThrow3(200, UnexpectedStatusCodeError3)(response);
1539
1537
  return await response.text();
1540
1538
  }
1541
1539
 
@@ -2009,10 +2007,10 @@ import {
2009
2007
  import {
2010
2008
  CONTENT_TYPES as CONTENT_TYPES3,
2011
2009
  HEADERS as HEADERS3,
2012
- UnexpectedStatusCodeError as UnexpectedStatusCodeError3,
2010
+ UnexpectedStatusCodeError as UnexpectedStatusCodeError4,
2013
2011
  ValidationError as ValidationError6,
2014
2012
  createFetcher as createFetcher4,
2015
- hasStatusOrThrow as hasStatusOrThrow3
2013
+ hasStatusOrThrow as hasStatusOrThrow4
2016
2014
  } from "@pagopa/io-wallet-utils";
2017
2015
  async function fetchMrtdPopInit(options) {
2018
2016
  try {
@@ -2029,7 +2027,7 @@ async function fetchMrtdPopInit(options) {
2029
2027
  },
2030
2028
  method: "POST"
2031
2029
  });
2032
- await hasStatusOrThrow3(202, UnexpectedStatusCodeError3)(response);
2030
+ await hasStatusOrThrow4(202, UnexpectedStatusCodeError4)(response);
2033
2031
  const responseJwt = await response.text();
2034
2032
  const jwt = decodeJwt({
2035
2033
  headerSchema: zMrtdPopInitResponseJwtHeader,
@@ -2052,7 +2050,7 @@ async function fetchMrtdPopInit(options) {
2052
2050
  signer
2053
2051
  };
2054
2052
  } catch (error) {
2055
- if (error instanceof UnexpectedStatusCodeError3 || error instanceof ValidationError6) {
2053
+ if (error instanceof UnexpectedStatusCodeError4 || error instanceof ValidationError6) {
2056
2054
  throw error;
2057
2055
  }
2058
2056
  throw new MrtdPopError(
@@ -2065,10 +2063,10 @@ async function fetchMrtdPopInit(options) {
2065
2063
  import {
2066
2064
  CONTENT_TYPES as CONTENT_TYPES4,
2067
2065
  HEADERS as HEADERS4,
2068
- UnexpectedStatusCodeError as UnexpectedStatusCodeError4,
2066
+ UnexpectedStatusCodeError as UnexpectedStatusCodeError5,
2069
2067
  ValidationError as ValidationError7,
2070
2068
  createFetcher as createFetcher5,
2071
- hasStatusOrThrow as hasStatusOrThrow4,
2069
+ hasStatusOrThrow as hasStatusOrThrow5,
2072
2070
  parseWithErrorHandling as parseWithErrorHandling9
2073
2071
  } from "@pagopa/io-wallet-utils";
2074
2072
  async function fetchMrtdPopVerify(options) {
@@ -2087,7 +2085,7 @@ async function fetchMrtdPopVerify(options) {
2087
2085
  },
2088
2086
  method: "POST"
2089
2087
  });
2090
- await hasStatusOrThrow4(202, UnexpectedStatusCodeError4)(response);
2088
+ await hasStatusOrThrow5(202, UnexpectedStatusCodeError5)(response);
2091
2089
  const parsed = parseWithErrorHandling9(
2092
2090
  zMrtdPopVerifyResponse,
2093
2091
  await response.json(),
@@ -2098,7 +2096,7 @@ async function fetchMrtdPopVerify(options) {
2098
2096
  redirectUri: parsed.redirect_uri
2099
2097
  };
2100
2098
  } catch (error) {
2101
- if (error instanceof UnexpectedStatusCodeError4 || error instanceof ValidationError7) {
2099
+ if (error instanceof UnexpectedStatusCodeError5 || error instanceof ValidationError7) {
2102
2100
  throw error;
2103
2101
  }
2104
2102
  throw new MrtdPopError(