@pagopa/io-wallet-oid4vci 1.5.2 → 1.5.3

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
@@ -83,6 +83,12 @@ var MissingDpopProofError = class extends Oid4vciError {
83
83
  this.name = "MissingDpopProofError";
84
84
  }
85
85
  };
86
+ var InvalidDpopProofError = class extends Oid4vciError {
87
+ constructor(message = "Credential request has an invalid 'DPoP' proof header", options) {
88
+ super(message, options);
89
+ this.name = "InvalidDpopProofError";
90
+ }
91
+ };
86
92
  var CredentialAuthorizationHeaderError = class extends Oid4vciError {
87
93
  constructor(message = "Credential request is missing required 'Authorization' header with DPoP scheme", options) {
88
94
  super(message, options);
@@ -954,14 +960,12 @@ function parseAuthorizationHeader(headers) {
954
960
  function parseDpopProof(headers) {
955
961
  const extracted = extractDpopJwtFromHeaders(headers);
956
962
  if (!extracted.valid) {
957
- throw new MissingDpopProofError(
963
+ throw new InvalidDpopProofError(
958
964
  "Credential request contains a 'DPoP' header, but the value is not a valid JWT format"
959
965
  );
960
966
  }
961
967
  if (!extracted.dpopJwt) {
962
- throw new MissingDpopProofError(
963
- "Credential request contains a 'DPoP' header, but the value is missing or empty"
964
- );
968
+ throw new MissingDpopProofError();
965
969
  }
966
970
  return extracted.dpopJwt;
967
971
  }
@@ -1036,7 +1040,7 @@ async function parseCredentialRequest(options) {
1036
1040
  isDeferredFlow
1037
1041
  });
1038
1042
  } catch (error) {
1039
- if (error instanceof ItWalletSpecsVersionError4 || error instanceof Oauth2JwtParseError || error instanceof ValidationError4 || error instanceof CredentialAuthorizationHeaderError || error instanceof MissingDpopProofError) {
1043
+ if (error instanceof ItWalletSpecsVersionError4 || error instanceof Oauth2JwtParseError || error instanceof ValidationError4 || error instanceof CredentialAuthorizationHeaderError || error instanceof MissingDpopProofError || error instanceof InvalidDpopProofError) {
1040
1044
  throw error;
1041
1045
  }
1042
1046
  throw new ParseCredentialRequestError(
@@ -1959,6 +1963,7 @@ export {
1959
1963
  CredentialOfferError,
1960
1964
  FetchCredentialResponseError,
1961
1965
  FetchMetadataError,
1966
+ InvalidDpopProofError,
1962
1967
  MissingDpopProofError,
1963
1968
  NonceRequestError,
1964
1969
  Oid4vciError,