Skip to content
RobeeeJay edited this page Aug 23, 2012 · 3 revisions

This module processes submitted cookies and places any values that have a correctly sha1 signed cohort into the request.signedcookies object. You MUST include the Cookies module for this to work, it merely builds on features inside that module.

new fw.SignedCookies({ signKey: "secret key" });

signKey is a string that was used to sign the cookie with. At the moment this will probably be the one signed by the SignedSessions module.

Simple Example

var stackFull = new fw.Stack();

stackFull.append(new fw.Cookies());
         .append(new fw.SignedCookies({ signKey: "the hobbit" }));

After the above, for a cookie submitted as part of the headers with a value "dog=cat" and a valid matching "sig.dog=3hdbIdanKX39adsUUHiuhlkjh" hash, then request.signedcookies.dog == "cat".

Yeah, I made that hash up by bashing my keyboard, sorry.

Clone this wiki locally