You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
this.keys but no opts means cookies don't get signed #53
This means that if this.keys is truthy, but opts is undefined, the signed variable will be true but the key still won't be signed. My expectation is they key should be signed if signed == true, and it shouldn't depend on the existence of opts.
That seems to make sense, though I'm not sure how easy this will be to fix without including it in the major version bump, because I wonder how many people have the keys set but no options given. I'll have to think about it some. Also input from @jonathanong
Cool, that was my suspicion. It seems weird that the existence of keys caused cookies to automatically sign. So I would almost say that the current behavior is intended: you only get signed cookies if you sent {signed: true} to .set. Does that sound right @jonathanong ?
// in my koa projectapp.keys=["secret1...","secret2..."]// example// set cookiesctx.cookies.set("name","jybill",{httpOnly: true});// notice: i dont have set signed option!!!// in fact, i will getset-cookie: name=jybill,httponly;set-cookie: name.sig=...
Activity
dougwilson commentedon Dec 9, 2014
That seems to make sense, though I'm not sure how easy this will be to fix without including it in the major version bump, because I wonder how many people have the
keysset but no options given. I'll have to think about it some. Also input from @jonathanongjonathanong commentedon Dec 9, 2014
Ha was gonna remove that in the next major
dougwilson commentedon Dec 9, 2014
Cool, that was my suspicion. It seems weird that the existence of
keyscaused cookies to automatically sign. So I would almost say that the current behavior is intended: you only get signed cookies if you sent{signed: true}to.set. Does that sound right @jonathanong ?jonathanong commentedon Dec 9, 2014
Current behavior is intended :( I wanted the next version to have
.sign()and.encrypt()as separate methodsJYbill commentedon May 22, 2025
i have same question
Perhaps it is more reasonable to set "signed"
cookies/index.js
Line 86 in ddc3b71