Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Cookie based sessions for node.js.
More than likely, it is a bad idea to use this module, unless you know for sure that you are not going to store any sensitive information in the cookie.
Here's how to use it:
var Krumkake = require('krumkake'),
var http = require('http')
http.createServer(function(req, res) {
var session = new Krumkake(req, res, {
cookieName: 's', // defaults to 's'
expire: 60 * 60 * 2, // time in seconds, default 2 hours
keys: ['secret','keys']
})
// read session data with `get`
var val = session.get('some-key')
if (!val) {
// write session data with `set`
session.set('some-key', 'my data')
session.key('complex', { more: 'data' })
}
// remove data with `del`
session.del('complex')
}).listen(1337)
Initialize a new instance with the server request and response objects, and an
optional options
object. options
accepts the following properties:
cookieName
{String} Name to use for the cookieexpire
{Number} Time in seconds until the session expires (default 2 hours)keys
{Keygrip} A Keygrip instance used to
sign the session cookiekeys
{Array} An array of keys used to create a Keygrip instancecookies
{Cookies} A Cookies instance to
use to store the session cookieGets the data with the given key from the session cookie.
Gets all data from the session cookie as a hash.
Sets the given key-value pair on the session cookie.
If key
is an object, the key-value pairs of the object will be written to the
session cookie.
Removes the key-value pair with the given key from the session cookie. If key
is omitted, all keys are removed and the session cookie is expired immediately.
Removes all keys from the session cookie and expires the cookie immediately.
FAQs
Cookie based sessions for node.js
The npm package krumkake receives a total of 1 weekly downloads. As such, krumkake popularity was classified as not popular.
We found that krumkake demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.