Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Purpose of the keys param? #43

Closed
alvarotrigo opened this issue Oct 6, 2015 · 2 comments
Closed

Purpose of the keys param? #43

alvarotrigo opened this issue Oct 6, 2015 · 2 comments
Assignees

Comments

@alvarotrigo
Copy link
Contributor

After reading the documentation I don't have it very clear what is the keys parameter for in the cookie-session configuration.

I'm not an expert on cookies and the description doesn't help me much on that regard.

keys
The list of keys to use to sign & verify cookie values. Set cookies are always signed with keys[0], while the other keys are valid for verification, allowing for key rotation.

But it seems to be a compulsory field, if I don't add it I get an error:

C:\inetpub\wwwroot\app\node_modules\cookie-session\index.js:55
if (!keys && opts.signed) throw new Error('.keys required.');

So I ended up using keys: ['key1', 'key2'] as in the examples, but I have no idea why.

@dougwilson
Copy link
Contributor

You only have to set it if you have signed: true set (which I is by default). You can just specify signed:false in your options and then not provide keys.

@dougwilson
Copy link
Contributor

P.S. this module needs a lot of documentation work, if you find things are you want to make a PR :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants