From 9c7d970420bb7650d507e6781d7d094f040be025 Mon Sep 17 00:00:00 2001 From: Matteo Collina Date: Tue, 10 May 2022 23:38:36 +0200 Subject: [PATCH] Updated to Fastify v4 (#227) --- jwt.js | 14 +++++++------- package.json | 2 +- test/jwt.test.js | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/jwt.js b/jwt.js index 8270c58..c7947f0 100644 --- a/jwt.js +++ b/jwt.js @@ -126,17 +126,17 @@ function fastifyJwt (fastify, options, next) { } const jwtDecorator = { - decode: decode, + decode, options: { decode: decodeOptions, sign: initialSignOptions, verify: initialVerifyOptions, messages: messagesOptions }, - cookie: cookie, - sign: sign, - verify: verify, - lookupToken: lookupToken + cookie, + sign, + verify, + lookupToken } let jwtDecodeName = 'jwtDecode' @@ -501,6 +501,6 @@ function fastifyJwt (fastify, options, next) { } module.exports = fp(fastifyJwt, { - fastify: '>=3.0.0', - name: 'fastify-jwt' + fastify: '4.x', + name: '@fastify/jwt' }) diff --git a/package.json b/package.json index e81d10a..2695911 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,7 @@ "devDependencies": { "@fastify/cookie": "^6.0.0", "@types/node": "^17.0.21", - "fastify": "^3.27.2", + "fastify": "^4.0.0-rc.2", "pre-commit": "^1.2.2", "standard": "^17.0.0", "tap": "^16.0.0", diff --git a/test/jwt.test.js b/test/jwt.test.js index f8c920e..7bebd93 100644 --- a/test/jwt.test.js +++ b/test/jwt.test.js @@ -5,7 +5,7 @@ const Fastify = require('fastify') const { createSigner } = require('fast-jwt') const jwt = require('../jwt') const defaultExport = require('../jwt').default -const { fastifyJwt: namedExport } = require('../jwt') +const { '@fastify/jwt': namedExport } = require('../jwt') const helper = require('./helper')