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

egg-cookies

Package Overview
Dependencies
Maintainers
5
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

egg-cookies

cookies module for egg

  • 2.2.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
26K
increased by32.64%
Maintainers
5
Weekly downloads
 
Created
Source

egg-cookies

NPM version build status Test coverage David deps Known Vulnerabilities npm download

Extends pillarjs/cookies to adapt koa and egg with some additional features.

Encrypt

egg-cookies provide an alternative encrypt mode like signed. An encrypt cookie's value will be encrypted base on keys. Anyone who don't have the keys are unable to know the original cookie's value.

const Cookies = require('egg-cookies');
const cookies = new Cookies(ctx, keys);

cookies.set('foo', 'bar', { encrypt: true });
cookies.get('foo', { encrypt: true });

Note: you should both indicating in get and set in pairs.

Browsers all had some limitation in cookie's length, so if set a cookie with an extremely long value(> 4093), egg-cookies will emit an cookieLimitExceed event. You can listen to this event and record.

const Cookies = require('egg-cookies');
const cookies = new Cookies(ctx, keys);

cookies.on('cookieLimitExceed', { name, value } => {
  // log
});

cookies.set('foo', longText);

FAQs

Package last updated on 21 Feb 2017

Did you know?

Socket

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.

Install

Related posts

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