|
|
2 anos atrás | |
|---|---|---|
| .. | ||
| lib | 2 anos atrás | |
| History.md | 2 anos atrás | |
| LICENSE | 2 anos atrás | |
| README.md | 2 anos atrás | |
| README.zh-CN.md | 2 anos atrás | |
| index.d.ts | 2 anos atrás | |
| package.json | 2 anos atrás | |
Extends pillarjs/cookies to adapt koa and egg with some additional features.
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);
dead-horse |
fengmk2 |
atian25 |
whxaxes |
xyeric |
jedmeng |
|---|---|---|---|---|---|
Junyan |
beliefgp |
snapre |
popomore |
ziyunfei |
brizer |
This project follows the git-contributor spec, auto updated at Mon Jun 20 2022 12:14:02 GMT+0800.