Psifi-Solutions / csrf-csrf

A utility package to help implement stateless CSRF protection using the Double Submit Cookie Pattern in express.
Other
120 stars 18 forks source link

feat: allow customizable error #58

Closed psibean closed 7 months ago

psibean commented 7 months ago

Exposes the statusCode, message, and code parameters for the error initialization

This will fix issue #55

psibean commented 7 months ago

Looks good to me. One thing I'd add is that, since you are changing the interface, to allow adding a factory function instead of the CsrfErrorConfig (one or the other). Something like:

Could be useful, it's also a non-breaking (backwards compatible) change so will consider it separately from this one. 👍🏻 It's typically what the error handler middleware should be setup to do in any case.