@xarenas107/nuxt-uncsrf
v2.2.1
Published
Nuxt module for csrf protection
Downloads
43
Readme
Nuxt Unscrf
My new Nuxt module for doing amazing things.
🚀 Features
- ⛰ Nuxt 3 ready
- 👌 Zero config: Configuration for common use cases
- ⚡ Nitro ready: Customizable nitro storage.
- ⚙️ Auto import: Provide auto import functions.
- 🦾 Type strong: Written in typescript
📦 Install
npm i @xarenas107/nuxt-uncsrf -D
🦄 Usage
Add
@xarenas107/nuxt-uncsrf
to themodules
section ofnuxt.config.ts
.
export default defineNuxtConfig({
modules: [
'@xarenas107/nuxt-uncsrf'
]
})
By default csrf protection is applied to all routes except for /_nuxt
and /__nuxt
with GET
method. If you need more control, use nitro route rules.
Use false to disable protection
routeRules:{
'/locale/**': {
uncsrf: false,
}
}
You can customize storage
// define storage on `nuxt.config.ts`
export default defineNuxtConfig({
uncsrf:{
storage:{
driver:'memory'
}
}
})
Or use a previously defined storage'
export default defineNuxtConfig({
nitro:{
storage:{
'security':{
driver:'memory',
}
}
},
uncsrf:{
storage:'security'
}
})
That's it! You can now use @nuxt/uncsrf in your Nuxt app ✨