refactor(csrf): move csrf to own file

This commit is contained in:
Panagiotis Papadopoulos
2025-01-16 08:25:02 +01:00
parent edc6b983ac
commit e3d89ce2a5
2 changed files with 17 additions and 12 deletions

View File

@@ -0,0 +1,15 @@
import { doubleCsrf } from "csrf-csrf";
import sessionSecret from "../services/session_secret.js";
const doubleCsrfUtilities = doubleCsrf({
getSecret: () => sessionSecret,
cookieOptions: {
path: "", // empty, so cookie is valid only for the current path
secure: false,
sameSite: false,
httpOnly: false
},
cookieName: "_csrf"
});
export const { doubleCsrfProtection } = doubleCsrfUtilities;