@fastify/jwt
Advanced tools
Comparing version 6.5.0 to 6.6.0
20
jwt.js
@@ -197,8 +197,22 @@ 'use strict' | ||
let selectedDecoder = decoder | ||
if (options && typeof options !== 'function') { | ||
const localDecoder = createDecoder(options) | ||
return localDecoder(token) | ||
selectedDecoder = createDecoder(options) | ||
} | ||
return decoder(token) | ||
try { | ||
return selectedDecoder(token) | ||
} catch (error) { | ||
// Ignoring the else branch because it's not possible to test it, | ||
// it's just a safeguard for future changes in the fast-jwt library | ||
/* istanbul ignore next */ | ||
if (error.code === TokenError.codes.malformed) { | ||
throw new AuthorizationTokenInvalidError(error.message) | ||
} else if (error.code === TokenError.codes.invalidType) { | ||
throw new AuthorizationTokenInvalidError(error.message) | ||
} else { | ||
throw error | ||
} | ||
} | ||
} | ||
@@ -205,0 +219,0 @@ |
{ | ||
"name": "@fastify/jwt", | ||
"version": "6.5.0", | ||
"version": "6.6.0", | ||
"description": "JWT utils for Fastify", | ||
@@ -10,7 +10,7 @@ "main": "jwt.js", | ||
"lint:fix": "standard --fix", | ||
"test": "npm run lint && npm run unit && npm run test:typescript", | ||
"test": "npm run lint && npm run test:unit && npm run test:typescript", | ||
"test:typescript": "tsd", | ||
"unit": "tap -J test/*.test.js", | ||
"unit:report": "npm run unit -- --cov --coverage-report=html", | ||
"unit:verbose": "npm run unit -- -Rspec" | ||
"test:unit": "tap", | ||
"test:unit:report": "tap --cov --coverage-report=html", | ||
"test:unit:verbose": "tap -Rspec" | ||
}, | ||
@@ -48,3 +48,3 @@ "repository": { | ||
"tap": "^16.0.0", | ||
"tsd": "^0.24.1" | ||
"tsd": "^0.25.0" | ||
}, | ||
@@ -51,0 +51,0 @@ "tsd": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
151435
3520