Socket
Socket
Sign inDemoInstall

egg-cookies

Package Overview
Dependencies
15
Maintainers
5
Versions
35
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

egg-cookies

cookies module for egg


Version published
Maintainers
5
Weekly downloads
17,167
decreased by-19.13%

Weekly downloads

Readme

Source

egg-cookies

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

Last updated on 19 Feb 2024

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc