@fastify/csrf-protection
Advanced tools
Comparing version 6.4.0 to 6.4.1
{ | ||
"name": "@fastify/csrf-protection", | ||
"version": "6.4.0", | ||
"version": "6.4.1", | ||
"description": "A plugin for adding CSRF protection to Fastify.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -40,3 +40,12 @@ /// <reference types="node" /> | ||
sessionPlugin?: '@fastify/cookie'; | ||
csrfOpts: Omit<CSRFOptions, 'hmacKey'> & Required<Pick<CSRFOptions, 'hmacKey'>>; | ||
csrfOpts?: | ({ | ||
[k in keyof CSRFOptions]: k extends "userInfo" | ||
? true | ||
: CSRFOptions[k]; | ||
} & Required<Pick<CSRFOptions, "hmacKey">>) | ||
| ({ | ||
[k in keyof CSRFOptions]: k extends "userInfo" | ||
? false | ||
: CSRFOptions[k]; | ||
}); | ||
} | ||
@@ -43,0 +52,0 @@ |
@@ -56,5 +56,7 @@ import Fastify from 'fastify' | ||
fastify.register(FastifyCsrfProtection, { csrfOpts: { hmacKey: 'hmac' } }) | ||
expectError(fastify.register(FastifyCsrfProtection, { })) | ||
expectError(fastify.register(FastifyCsrfProtection, { csrfOpts: { }})) | ||
expectError(fastify.register(FastifyCsrfProtection, { sessionPlugin: '@fastify/cookie', csrfOpts: { }})) | ||
fastify.register(FastifyCsrfProtection, { }) | ||
fastify.register(FastifyCsrfProtection, { csrfOpts: { }}) | ||
expectError(fastify.register(FastifyCsrfProtection, { sessionPlugin: '@fastify/cookie', csrfOpts: { userInfo: true}})) | ||
fastify.register(FastifyCsrfProtection, { sessionPlugin: '@fastify/cookie', csrfOpts: { userInfo: true, hmacKey: 'key'}}) | ||
fastify.register(FastifyCsrfProtection, { sessionPlugin: '@fastify/cookie'}) | ||
fastify.register(FastifyCsrfProtection, { csrfOpts: { }, sessionPlugin: '@fastify/session' }) | ||
@@ -61,0 +63,0 @@ fastify.register(FastifyCsrfProtection, { csrfOpts: { }, sessionPlugin: '@fastify/secure-session' }) |
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
36797
763