Socket
Socket
Sign inDemoInstall

egg-cookies

Package Overview
Dependencies
17
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
Install size
292 kB
Created

Changelog

Source

2.7.0 (2023-08-04)

Features

  • support function to set domain (#38) (c73b415)

2.6.1 / 2022-06-20

others

2.6.0 / 2022-06-20

features

2.5.0 / 2022-05-02

features

others

2.4.3 / 2022-04-29

fixes

2.4.2 / 2020-06-28

fixes

2.4.1 / 2020-06-28

fixes

2.4.0 / 2020-06-22

features

2.3.4 / 2020-06-12

fixes

2.3.3 / 2020-03-27

fixes

2.3.2 / 2020-02-19

fixes

2.3.1 / 2019-12-17

fixes

2.3.0 / 2019-12-06

features

others

2.2.7 / 2019-04-28

fixes

2.2.6 / 2018-09-07

  • fix: should still support 4, 6 (#16)

2.2.5 / 2018-09-07

  • chore(typings): Remove 'ctx' in EggCookie's declaration and add a missing unit test (#15)

2.2.4 / 2018-09-06

  • fix: public files && deps (#14)

2.2.3 / 2018-09-06

  • chore: adjust some dep && config (#13)
  • test: Add unit tests for ts (#12)
  • chore(typings): Extract 'EggCookies' for TypeScript intellisense (#11)

2.2.2 / 2017-12-14

fixes

others

2.2.1 / 2017-02-22

  • fix: emit on ctx.app (#5)

2.2.0 / 2017-02-21

  • feat: check cookie value's length (#4)
  • feat: support cookie.sameSite (#3)

2.1.0 / 2016-11-22

  • feat: cache keygrip (#2)

2.0.0 / 2016-11-22

  • refactor: rewrite keygrip and cookies for egg/koa (#1)
  • chore: add zh-CN readme

1.0.0 / 2016-07-15

  • init version

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


dead-horse


fengmk2


atian25


whxaxes


xyeric


jedmeng


Junyan


beliefgp


snapre


popomore


ziyunfei


brizer


xuezier

This project follows the git-contributor spec, auto updated at Mon Jun 20 2022 12:14:02 GMT+0800.

FAQs

Last updated on 20 Jun 2022

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