Socket
Socket
Sign inDemoInstall

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 - npm Package Compare versions

Comparing version 2.2.7 to 2.3.0

10

History.md
2.3.0 / 2019-12-06
==================
**features**
* [[`d5e3d21`](http://github.com/eggjs/egg-cookies/commit/d5e3d215b1c51f70d932dba391d7da228a302312)] - feat: support SameSite=None (#18) (ziyunfei <<446240525@qq.com>>)
* [[`4dd74d2`](http://github.com/eggjs/egg-cookies/commit/4dd74d2078b5aea11f11b3b40605b702ca9ccd60)] - feat: allow set default cookie options on top level (#22) (fengmk2 <<fengmk2@gmail.com>>)
**others**
* [[`57a005f`](http://github.com/eggjs/egg-cookies/commit/57a005fd501dad5fdadc25ea94db5474fbd6ca8c)] - chore: add license decoration (#20) (刘放 <<brizer@users.noreply.github.com>>)
2.2.7 / 2019-04-28

@@ -3,0 +13,0 @@ ==================

2

index.d.ts

@@ -35,3 +35,3 @@ /**

*/
sameSite?: boolean;
sameSite?: boolean | string;
/**

@@ -38,0 +38,0 @@ * Encrypt the cookie's value or not

@@ -20,3 +20,3 @@ 'use strict';

const sameSiteRegExp = /^(?:lax|strict)$/i;
const sameSiteRegExp = /^(?:none|lax|strict)$/i;

@@ -23,0 +23,0 @@ class Cookie {

@@ -18,5 +18,7 @@ 'use strict';

class Cookies {
constructor(ctx, keys) {
constructor(ctx, keys, defaultCookieOptions) {
this[KEYS_ARRAY] = keys;
this._keys = keys;
// default cookie options
this._defaultCookieOptions = defaultCookieOptions;
this.ctx = ctx;

@@ -91,3 +93,3 @@ this.secure = this.ctx.secure;

set(name, value, opts) {
opts = opts || {};
opts = Object.assign({}, this._defaultCookieOptions, opts);
const signed = computeSigned(opts);

@@ -94,0 +96,0 @@ value = value || '';

{
"name": "egg-cookies",
"version": "2.2.7",
"version": "2.3.0",
"description": "cookies module for egg",

@@ -35,2 +35,3 @@ "files": [

"author": "fengmk2 <fengmk2@gmail.com> (https://fengmk2.com)",
"license": "MIT",
"scripts": {

@@ -47,4 +48,4 @@ "test": "npm run lint -- --fix && egg-bin test",

"ci": {
"version": "4, 6, 8, 10, 12"
"version": "4, 6, 8, 10, 12, 13"
}
}

@@ -31,3 +31,3 @@ # egg-cookies

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

@@ -34,0 +34,0 @@ cookies.set('foo', 'bar', { encrypt: true });

@@ -26,3 +26,3 @@ # egg-cookies

```js
ctx.cookies = new Cookies(ctx, keys);
ctx.cookies = new Cookies(ctx, keys[, defaultCookieOptions]);
ctx.cookies.get('key', 'value', options);

@@ -29,0 +29,0 @@ ctx.cookies.set('key', 'value', options);

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