mirror of
				https://github.com/zadam/trilium.git
				synced 2025-11-03 21:19:01 +01:00 
			
		
		
		
	
		
			
				
	
	
		
			17 lines
		
	
	
		
			541 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
			
		
		
	
	
			17 lines
		
	
	
		
			541 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
import { doubleCsrf } from "csrf-csrf";
 | 
						|
import sessionSecret from "../services/session_secret.js";
 | 
						|
import { isElectron } from "../services/utils.js";
 | 
						|
 | 
						|
const doubleCsrfUtilities = doubleCsrf({
 | 
						|
    getSecret: () => sessionSecret,
 | 
						|
    cookieOptions: {
 | 
						|
        path: "/",
 | 
						|
        secure: false,
 | 
						|
        sameSite: "strict",
 | 
						|
        httpOnly: !isElectron // set to false for Electron, see https://github.com/TriliumNext/Notes/pull/966
 | 
						|
    },
 | 
						|
    cookieName: "_csrf"
 | 
						|
});
 | 
						|
 | 
						|
export const { generateToken, doubleCsrfProtection } = doubleCsrfUtilities;
 |