electrode-csrf-jwt
Advanced tools
Comparing version 1.1.2 to 1.2.0
@@ -5,6 +5,8 @@ "use strict"; | ||
const csrfExpress = require("./csrf-express"); | ||
const csrfKoa = require("./csrf-koa"); | ||
module.exports = { | ||
register: csrfHapi, | ||
expressMiddleware: csrfExpress | ||
expressMiddleware: csrfExpress, | ||
koaMiddleware: csrfKoa | ||
}; |
{ | ||
"name": "electrode-csrf-jwt", | ||
"version": "1.1.2", | ||
"version": "1.2.0", | ||
"description": "", | ||
@@ -9,3 +9,3 @@ "main": "lib/index.js", | ||
"test": "npm run lint && gulp test", | ||
"coverage": "istanbul cover -x lib/csrf-express.js node_modules/.bin/_mocha", | ||
"coverage": "istanbul cover -x lib/csrf-express.js lib/csrf-koa.js node_modules/.bin/_mocha", | ||
"prepublish": "npm test" | ||
@@ -45,2 +45,5 @@ }, | ||
"istanbul": "^0.4.5", | ||
"koa": "^2.0.0", | ||
"koa-bodyparser": "^3.2.0", | ||
"koa-router": "^7.0.1", | ||
"mocha": "^3.0.2", | ||
@@ -47,0 +50,0 @@ "vision": "^4.0.1" |
@@ -5,3 +5,3 @@ # Electrode CSRF JWT | ||
An electrode plugin that enables stateless CSRF protection using [JWT](https://github.com/auth0/node-jsonwebtoken) in Electrode, Express, or Hapi applications. | ||
An electrode plugin that enables stateless CSRF protection using [JWT](https://github.com/auth0/node-jsonwebtoken) in Electrode, Express, Hapi, or Koa 2 applications. | ||
@@ -59,3 +59,3 @@ ## Why do we need this module? | ||
This module can be used with either [Electrode](#electrode), [Express](#express), or [Hapi](#hapi). | ||
This module can be used with either [Electrode](#electrode), [Express](#express), [Hapi](#hapi), or [Koa 2](#koa-2). | ||
@@ -118,2 +118,20 @@ ### Electrode | ||
### Koa 2 | ||
#### Example `app.js` configuration | ||
```js | ||
const csrfMiddleware = require("electrode-csrf-jwt").koaMiddleware; | ||
const Koa = require("koa"); | ||
const app = new Koa(); | ||
const options = { | ||
secret: "shhhhh", | ||
expiresIn: 60 | ||
}; | ||
app.use(csrfMiddleware(options)); | ||
``` | ||
Built with :heart: by [Team Electrode](https://github.com/orgs/electrode-io/people) @WalmartLabs. | ||
@@ -120,0 +138,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
23305
16
555
142
13
14