Create a new instance of CookieParser
The raw cookie header string from the request
The encryption instance for cookie operations
Attempts to decode a cookie by the name. When calling this method, you are assuming that the cookie was just stringified in the first place and not signed or encrypted.
The cookie key to decode
Whether the cookie value was stringified
The decoded cookie value or null if decoding fails
Attempts to unsign a cookie by the name. When calling this method, you are assuming that the cookie was signed in the first place.
The cookie key to unsign
The original cookie value or null if unsigning fails
Attempts to decrypt a cookie by the name. When calling this method, you are assuming that the cookie was encrypted in the first place.
The cookie key to decrypt
The decrypted cookie value or null if decryption fails
Returns an object of cookies key-value pair. Do note, the cookies are not decoded, unsigned or decrypted inside this list.
Raw cookies as key-value pairs
Cookie parser parses the HTTP
cookie
header and collects all cookies inside an object ofkey-value
pair, but doesn't attempt to decrypt or unsign or decode the individual values.The cookie values are lazily decrypted, or unsigned to avoid unncessary processing, which infact can be used as a means to burden the server by sending too many cookies which even doesn't belongs to the server.