Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@sumor/token-middleware

Package Overview
Dependencies
Maintainers
0
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sumor/token-middleware - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

2

package.json
{
"name": "@sumor/token-middleware",
"description": "A token middleware for ExpressJS.",
"version": "1.0.0",
"version": "1.0.1",
"license": "MIT",

@@ -6,0 +6,0 @@ "repository": "sumor-cloud/token-middleware",

@@ -5,2 +5,3 @@ # token-middleware

[More Documentation](https://sumor.cloud/token-middleware)
A token middleware for ExpressJS.

@@ -23,3 +24,3 @@

Require Node.JS version 16.x or above
Require Node.JS version 18.x or above

@@ -26,0 +27,0 @@ ### require Node.JS ES module

@@ -5,3 +5,3 @@ import Token from './Token.js'

const cookie = parseCookie(req.headers.cookie)
req.token = new Token(() => {
req.token = new Token(id => {
let existingCookie = res.getHeader('Set-Cookie') || []

@@ -11,6 +11,4 @@ if (typeof existingCookie === 'string') {

}
res.setHeader('Set-Cookie', [
...existingCookie,
`t=${req.token.id}; Path=/; HttpOnly; Max-Age=86400`
])
const maxAge = 100 * 24 * 60 * 60
res.setHeader('Set-Cookie', [...existingCookie, `t=${id}; Path=/; HttpOnly; Max-Age=${maxAge}`])
})

@@ -17,0 +15,0 @@ req.token._id = cookie.t || null

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc