cookies icon indicating copy to clipboard operation
cookies copied to clipboard

1.0.0

Open jonathanong opened this issue 11 years ago • 24 comments

basically hits all the 1.0.0 milestones

  • API has changed to var cookies = require('Cookies')([options], [keys]) then req.cookies = res.cookies = cookies(req, res).
  • automatically works as middleware, so you can do app.use(require('cookies')([keys]))
  • .get() and .set() now only set raw cookies
  • .sign() and .unsign() for signed cookies, with .encoded to optionally base64 encode as well. maybe a better name for .unsign()
  • .encode() and .decode() for base64 encoded cookies
  • .encrypt() and .decrypt() for encrypted cookies
  • .clear() to clear a cookie quickly

i found juggling all the options a little weird since you could have combos. thus i opted to have each of them be a pair of methods.

Option changes:

  • overwrite defaults to true

To do:

  • [ ] secure proxy stuff, waiting on @dougwilson on that :D
  • [ ] node 0.8 support as there seems to be an issue with buffers or something

Maybe:

  • I took out the framework tests (since i rewrote everything basically). might need to add those
  • Pretty sure this will break in connect2/express3 as it assumes you don't use the setHeader patch
  • A way to do iv's with encrypted cookies would be nice
  • More tests in general would be nice

To test, you need to install keygrip master and npm link it since i haven't published v2 yet

please test and give me feedback before i push v1

/cc @dougwilson @Fishrock123

jonathanong avatar Jun 19 '14 02:06 jonathanong

@jonathanong is this dependant on expressjs/keygrip#14 (keygrip 2.0.0) ?

Fishrock123 avatar Jun 19 '14 14:06 Fishrock123

is this dependant on expressjs/keygrip#14 (keygrip 2.0.0) ?

yes

dougwilson avatar Jun 19 '14 14:06 dougwilson

node 0.8 support as there seems to be an issue with buffers or something

Keygrip is 0.10+ anyways, so.. (Well, the current master is.)

Fishrock123 avatar Jun 19 '14 14:06 Fishrock123

Keygrip is 0.10+ anyways, so.. (Well, the current master is.)

See https://github.com/expressjs/keygrip/commit/71df3df32feec76ed9288d764bc4bd4fc475ba11#commitcomment-6552647

It can likely be made node 0.8, I just have to look into it. I just want them to release node 0.12 already!

dougwilson avatar Jun 19 '14 15:06 dougwilson

I just want them to release node 0.12 already!

Yeah, but we are honestly looking at months still. It isn't really that near ready. :/

Fishrock123 avatar Jun 19 '14 15:06 Fishrock123

Yeah, but we are honestly looking at months still.

Yea, that's what sucks :( If they did rel 0.12, I would be more willing to drop node 0.8 support for things is all :)

dougwilson avatar Jun 19 '14 15:06 dougwilson

I'm surprised people still use 0.8 - at this point it really isn't (that) more stable than 0.10, and npm is broken in it, etc.

Aside from a couple obscure minor performance regressions. (/off-topic rant)

Fishrock123 avatar Jun 19 '14 15:06 Fishrock123

There are certain private PaaS systems (not to name names) where the 0.10 on them is 0.10.1, which is extremely buggy, so there is no other choice.

dougwilson avatar Jun 19 '14 15:06 dougwilson

where the 0.10 on them is 0.10.1

oh god

Fishrock123 avatar Jun 19 '14 15:06 Fishrock123

oh god

it was also the release before Joyent turned off heartbeats, so it is vulnerable to heartbleed.

dougwilson avatar Jun 19 '14 15:06 dougwilson

Travis is just failing on 0.8 as of this time

cool :) just let it keep failing until i check out what it would take to make 0.8 work :)

dougwilson avatar Jun 19 '14 15:06 dougwilson

so aside from the keygrip stuff which can just easily disabled by checking whether the methods exist, the other issue seems to be something about missing this function in 0.8: http://nodejs.org/api/buffer.html#buffer_buf_copy_targetbuffer_targetstart_sourcestart_sourceend

screen shot 2014-06-21 at 9 01 14 pm

jonathanong avatar Jun 22 '14 04:06 jonathanong

buf.copy exists in node.js 0.8: https://github.com/joyent/node/blob/v0.8.26/lib/buffer.js#L515

dougwilson avatar Jun 22 '14 04:06 dougwilson

Looks like the error you posted is caused because at least one of the array elements you passed into Buffer.concat was not a Buffer: https://github.com/joyent/node/blob/v0.8.26/lib/buffer.js#L505

dougwilson avatar Jun 22 '14 04:06 dougwilson

Hmmm maybe crypto api changed then

jonathanong avatar Jun 22 '14 04:06 jonathanong

Maybe, haha. I plan to knock out the first todo tomorrow, perhaps I'll look into node.js 0.8 as well to determine if whatever the issue is can be made to work there or not.

dougwilson avatar Jun 22 '14 04:06 dougwilson

The current master keygrip has Node.js 0.8 support again, BTW.

dougwilson avatar Jul 06 '14 21:07 dougwilson

I'm sorry for asking, when do you plan to release v1.0.0?

cdesiles avatar Jul 09 '14 16:07 cdesiles

When the kinks are worked out.

dougwilson avatar Jul 09 '14 16:07 dougwilson

Waiting for 1.0.0~~~ :100:

fengmk2 avatar Aug 05 '14 02:08 fengmk2

Any progress?

fengmk2 avatar Sep 05 '14 06:09 fengmk2

stop? @jonathanong

fengmk2 avatar Apr 09 '15 08:04 fengmk2

@dougwilson what's the status on this? should i rebase? or did you have some ideas?

jonathanong avatar Jul 10 '15 06:07 jonathanong

@dougwilson any status updateS?

jonathanong avatar Jan 09 '16 19:01 jonathanong