cookie-parser icon indicating copy to clipboard operation
cookie-parser copied to clipboard

Encrypted Cookies

Open nburoojy opened this issue 9 years ago • 7 comments

We would like to encrypt cookie contents instead of encode+sign. Would this feature fall within the scope of cookie-parser?

For reference, a similar feature has been requested in cookie-session and cookies: https://github.com/expressjs/cookie-session/issues/9 https://github.com/expressjs/cookies/issues/42

nburoojy avatar Aug 30 '14 16:08 nburoojy

Whenever expressjs/cookies#42 lands

Fishrock123 avatar Aug 30 '14 17:08 Fishrock123

Hi, I write https://github.com/hex7c0/cookie-encryption. maybe for @jonathanong can be useful for his implementation

hex7c0 avatar Sep 07 '14 11:09 hex7c0

I was also looking for this option and didn't find anything. I made a super-easy to use express middleware to achieve transparently cookie encryption / decryption: cookie-encrypter.

var app = express();
app.use(cookieParser(secretKey));
app.use(cookieEncrypter(secretKey));

Hope this helps

ebourmalo avatar Apr 21 '16 13:04 ebourmalo

hi, this is support for laravel encrypted cookie?

aviqbaihaqy avatar Jun 04 '18 15:06 aviqbaihaqy

Hey, I'm going to attempt to add support for cookie encryption. I am also going to modify the README to highlight the difference between signing and encrypting, and to give tips on creating strong keys.

FadhiliNjagi avatar Mar 25 '23 09:03 FadhiliNjagi

I'm trying to add cookie encryption to the main express repo, but I run into this when I go to create a PR:

image

I even created and published a whole npm package just to handle encryption, kind of like cookie-signature. The idea is to add the encryption bit to the main express repo and the decryption bit here. The cookie-encryptor library works, but it is essentially hacking around by creating a middleware that overwrites the res.cookie method. I wanted to add "native" support. Please help.

FadhiliNjagi avatar Mar 28 '23 21:03 FadhiliNjagi

I am now able to open a PR. Must be a one-time thing.

FadhiliNjagi avatar Mar 29 '23 04:03 FadhiliNjagi