@fastify/jwt
Advanced tools
Comparing version 6.0.0 to 6.1.0
@@ -78,2 +78,3 @@ 'use strict' | ||
trusted, | ||
decoratorName = 'user', | ||
verify: initialVerifyOptions = {}, | ||
@@ -135,3 +136,4 @@ ...pluginOptions | ||
verify: initialVerifyOptions, | ||
messages: messagesOptions | ||
messages: messagesOptions, | ||
decoratorName | ||
}, | ||
@@ -149,3 +151,3 @@ cookie, | ||
if (!fastify.jwt) { | ||
fastify.decorateRequest('user', null) | ||
fastify.decorateRequest(decoratorName, null) | ||
fastify.decorate('jwt', Object.create(null)) | ||
@@ -163,3 +165,3 @@ } | ||
} else { | ||
fastify.decorateRequest('user', null) | ||
fastify.decorateRequest(decoratorName, null) | ||
fastify.decorate('jwt', jwtDecorator) | ||
@@ -166,0 +168,0 @@ } |
{ | ||
"name": "@fastify/jwt", | ||
"version": "6.0.0", | ||
"version": "6.1.0", | ||
"description": "JWT utils for Fastify", | ||
@@ -5,0 +5,0 @@ "main": "jwt.js", |
@@ -5,3 +5,2 @@ # @fastify/jwt | ||
[![NPM version](https://img.shields.io/npm/v/@fastify/jwt.svg?style=flat)](https://www.npmjs.com/package/@fastify/jwt) | ||
[![Known Vulnerabilities](https://snyk.io/test/github/fastify/fastify-jwt/badge.svg)](https://snyk.io/test/github/fastify/fastify-jwt) | ||
[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat)](https://standardjs.com/) | ||
@@ -415,2 +414,15 @@ | ||
### `decoratorName` | ||
If this plugin is used together with fastify/passport, we might get an error as both plugins use the same name for a decorator. We can change the name of the decorator, or `user` will default | ||
#### Example | ||
```js | ||
const fastify = require('fastify') | ||
fastify.register(require('@fastify/jwt'), { | ||
secret: 'supersecret', | ||
decoratorName: 'customName' | ||
}) | ||
``` | ||
### `decode` | ||
@@ -417,0 +429,0 @@ |
Sorry, the diff of this file is too big to display
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
140662
3276
741
1