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

egg-cookies

Package Overview
Dependencies
Maintainers
0
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.10.1
  • latest
  • release-2.x
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
18K
decreased by-19.59%
Maintainers
0
Weekly downloads
 
Created
Source

egg-cookies@2

NPM version build status Test coverage 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[, defaultCookieOptions]);

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);

License

MIT

Contributors


fengmk2


dead-horse


semantic-release-bot


atian25


whxaxes


xyeric


jedmeng


Junyan


beliefgp


snapre


popomore


tang-xy


ziyunfei


brizer


xuezier


onlylovermb

This project follows the git-contributor spec, auto updated at Mon Feb 19 2024 17:41:40 GMT+0800.

FAQs

Package last updated on 06 Jul 2024

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