Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

fastify-jwt

Package Overview
Dependencies
Maintainers
7
Versions
48
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fastify-jwt - npm Package Compare versions

Comparing version 0.7.0 to 0.8.0

7

jwt.js

@@ -212,3 +212,8 @@ 'use strict'

function verify (secretOrPublicKey, callback) {
jwt.verify(token, secretOrPublicKey, options, callback)
jwt.verify(token, secretOrPublicKey, options, (err, result) => {
if (err instanceof jwt.TokenExpiredError) {
return callback(new Unauthorized('Authorization token expired'))
}
callback(err, result)
})
}

@@ -215,0 +220,0 @@ ], function (err, result) {

2

package.json
{
"name": "fastify-jwt",
"version": "0.7.0",
"version": "0.8.0",
"description": "JWT utils for Fastify",

@@ -5,0 +5,0 @@ "main": "jwt.js",

@@ -1291,3 +1291,3 @@ 'use strict'

test('errors', function (t) {
t.plan(5)
t.plan(6)

@@ -1390,2 +1390,22 @@ const fastify = Fastify()

t.test('Expired token error', function (t) {
t.plan(2)
const expiredToken = fastify.jwt.sign({
exp: Math.floor(Date.now() / 1000) - 60,
foo: 'bar'
})
fastify.inject({
method: 'get',
url: '/verify',
headers: {
authorization: `Bearer ${expiredToken}`
}
}).then(function (response) {
const error = JSON.parse(response.payload)
t.is(error.message, 'Authorization token expired')
t.is(response.statusCode, 401)
})
})
t.test('requestVerify function: steed.waterfall error function loop test', function (t) {

@@ -1392,0 +1412,0 @@ t.plan(3)

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc