Skip to content
This repository has been archived by the owner on Nov 7, 2023. It is now read-only.

Commit

Permalink
Add method to refresh csrf token (#1)
Browse files Browse the repository at this point in the history
* Add method to refresh csrf token

* Bump version
  • Loading branch information
ilanolkies authored May 7, 2021
1 parent 1146773 commit de6915c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@rsksmart/express-did-auth",
"version": "0.1.6",
"version": "0.1.7",
"description": "Authentication with Verifiable Credentials for Express.js",
"main": "lib/index.js",
"types": "lib/index.d.ts",
Expand Down Expand Up @@ -48,15 +48,13 @@
"js-sha3": "^0.8.0"
},
"devDependencies": {
"@types/jest": "^26.0.0",
"@typescript-eslint/eslint-plugin": "^3.3.0",
"@typescript-eslint/parser": "^3.3.0",
"@rsksmart/rif-id-ethr-did": "0.1.0",
"@rsksmart/rif-id-mnemonic": "0.1.0",
"@types/jest": "^26.0.0",
"@types/mockdate": "^2.0.0",
"@types/supertest": "^2.0.10",
"mockdate": "^3.0.2",
"supertest": "^5.0.0",
"@typescript-eslint/eslint-plugin": "^3.3.0",
"@typescript-eslint/parser": "^3.3.0",
"eslint": "^7.3.0",
"eslint-config-standard": "^14.1.1",
"eslint-plugin-import": "^2.21.2",
Expand All @@ -67,6 +65,8 @@
"eslint-plugin-standard": "^4.0.1",
"jest": "^26.1.0",
"jest-junit": "^11.0.1",
"mockdate": "^3.0.2",
"supertest": "^5.0.0",
"ts-jest": "^26.1.0",
"typescript": "^3.9.5"
}
Expand Down
4 changes: 4 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ export default function setupAppFactory (config: ExpressDidAuthConfig) {
res.status(403)
res.send(CSRF_ERROR_MESSAGE)
})

app.get('/refresh-csrf', (req, res) => {
res.status(200).send(req.csrfToken())
})
}

const authMiddleware = expressMiddlewareFactory(state, config)
Expand Down

0 comments on commit de6915c

Please sign in to comment.