@fastify/jwt
Advanced tools
Comparing version 7.2.2 to 7.2.3
{ | ||
"name": "@fastify/jwt", | ||
"version": "7.2.2", | ||
"version": "7.2.3", | ||
"description": "JWT utils for Fastify", | ||
"main": "jwt.js", | ||
"type": "commonjs", | ||
"types": "types/jwt.d.ts", | ||
@@ -7,0 +8,0 @@ "scripts": { |
@@ -279,3 +279,3 @@ # @fastify/jwt | ||
fastify.register(jwt, { | ||
secret: 'foobar' | ||
secret: 'foobar', | ||
cookie: { | ||
@@ -888,2 +888,2 @@ cookieName: 'token', | ||
Licensed under [MIT](./LICENSE). | ||
Licensed under [MIT](./LICENSE). |
@@ -124,2 +124,3 @@ import { | ||
notBefore: number | string; | ||
key?: string | Buffer | ||
} | ||
@@ -130,2 +131,3 @@ | ||
onlyCookie: boolean; | ||
key?: string | Buffer | ||
} | ||
@@ -132,0 +134,0 @@ |
import fastify from 'fastify'; | ||
import fastifyJwt, { FastifyJWTOptions, FastifyJwtNamespace, JWT } from '..' | ||
import fastifyJwt, { FastifyJWTOptions, FastifyJwtNamespace, JWT, SignOptions, VerifyOptions } from '..' | ||
import { expectAssignable, expectType } from 'tsd' | ||
@@ -169,1 +169,37 @@ | ||
expectType<JWT['verify']>(({} as FastifyJwtNamespace<{ jwtVerify: 'verify'}>).verify) | ||
let signOptions: SignOptions = { | ||
key: "supersecret", | ||
algorithm: "HS256", | ||
mutatePayload: true, | ||
expiresIn: 3600, | ||
notBefore: 0, | ||
} | ||
signOptions = { | ||
key: Buffer.from("supersecret", "utf-8"), | ||
algorithm: "HS256", | ||
mutatePayload: true, | ||
expiresIn: 3600, | ||
notBefore: 0, | ||
} | ||
let verifyOptions: VerifyOptions = { | ||
key: "supersecret", | ||
algorithms: ["HS256"], | ||
complete: true, | ||
cache: true, | ||
cacheTTL: 3600, | ||
maxAge: "1 hour", | ||
onlyCookie: false, | ||
} | ||
verifyOptions = { | ||
key: Buffer.from("supersecret", "utf-8"), | ||
algorithms: ["HS256"], | ||
complete: true, | ||
cache: 3600, | ||
cacheTTL: 3600, | ||
maxAge: 3600, | ||
onlyCookie: true, | ||
} |
166213
3810
888