@fastify/csrf-protection
Advanced tools
Comparing version 6.3.0 to 6.4.0
'use strict' | ||
const assert = require('assert') | ||
const assert = require('node:assert') | ||
const fp = require('fastify-plugin') | ||
@@ -5,0 +5,0 @@ const CSRF = require('@fastify/csrf') |
{ | ||
"name": "@fastify/csrf-protection", | ||
"version": "6.3.0", | ||
"version": "6.4.0", | ||
"description": "A plugin for adding CSRF protection to Fastify.", | ||
"main": "index.js", | ||
"type": "commonjs", | ||
"types": "types/index.d.ts", | ||
@@ -36,13 +37,13 @@ "scripts": { | ||
"devDependencies": { | ||
"@fastify/cookie": "^8.0.0", | ||
"@fastify/cookie": "^9.0.4", | ||
"@fastify/pre-commit": "^2.0.2", | ||
"@fastify/secure-session": "^6.0.0", | ||
"@fastify/session": "^10.0.0", | ||
"@types/node": "^18.0.0", | ||
"@fastify/secure-session": "^7.0.0", | ||
"@fastify/session": "^10.3.0", | ||
"@types/node": "^20.1.0", | ||
"fastify": "^4.2.0", | ||
"proxyquire": "^2.1.3", | ||
"sinon": "^15.0.0", | ||
"sinon": "^17.0.0", | ||
"standard": "^17.0.0", | ||
"tap": "^16.0.0", | ||
"tsd": "^0.28.0" | ||
"tsd": "^0.29.0" | ||
}, | ||
@@ -49,0 +50,0 @@ "pre-commit": [ |
@@ -72,3 +72,3 @@ # @fastify/csrf-protection | ||
```js | ||
fastify.register(require('@fastify-session')) | ||
fastify.register(require('@fastify-session'), { secret: "a string which is longer than 32 characters" }) | ||
fastify.register(require('@fastify/csrf-protection'), { sessionPlugin: '@fastify/session' }) | ||
@@ -103,3 +103,3 @@ | ||
```js | ||
fastify.register(require('@fastify/secure-session')) | ||
fastify.register(require('@fastify/secure-session'), { secret: "a string which is longer than 32 characters" }) | ||
fastify.register(require('@fastify/csrf-protection'), { sessionPlugin: '@fastify/secure-session' }) | ||
@@ -106,0 +106,0 @@ |
@@ -9,2 +9,8 @@ import Fastify from 'fastify' | ||
declare module 'fastify' { | ||
interface Session { | ||
username: string | ||
} | ||
} | ||
async function run() { | ||
@@ -44,3 +50,3 @@ await fastify.register(FastifyCookie) | ||
getUserInfo(req) { | ||
return req.session.get('username') | ||
return req.session.get<'username', string>('username') | ||
} | ||
@@ -47,0 +53,0 @@ }) |
Sorry, the diff of this file is not supported yet
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
36423
13
752