expressjs / csurf

CSRF token middleware
MIT License
2.3k stars 216 forks source link

feat: expose generate/verify middlewares #240

Open sushantdhiman opened 3 years ago

sushantdhiman commented 3 years ago

Fixes #10

Default exported function now returns a middleware function with two extra members generate and verify. Properties generate and verify are both middleware functions, which can be used to separate token generation and token verification process. Please check tests and Readme for example.

This should be a non breaking change, as you can still use app.use(csurf()) without any other modification.

sushantdhiman commented 3 years ago

Hi @dougwilson, Anything I can do to get this merged?

sushantdhiman commented 3 years ago

Any comments from maintainers of this project?

sushantdhiman commented 3 years ago

This fix is available as csurf-sep on npm, if anyone needs this fix

https://www.npmjs.com/package/csurf-sep

sushantdhiman commented 2 years ago

I am no longer using express/csurf but would like to get this merged. Is there any thing I can do to get this reviewed sooner? If this fix is not required I can close this PR?