Comparing version 0.12.3 to 0.12.4
@@ -89,11 +89,12 @@ const assert = require('assert'); | ||
function parseSignedCookies(cconf, input){ | ||
for(let key in input.cookies) | ||
// TODO 's:' needed?? | ||
if(input.cookies[key].substr(0, 2) == 's:'){ | ||
let val = cookieSignature.unsign(input.cookies[key].substr(2), cconf.secret); | ||
if(val){ | ||
input.signedCookies[key] = val; | ||
delete input.cookies[key]; | ||
} | ||
if(!cconf?.secret) | ||
return; | ||
for(let key in input.cookies){ | ||
var val = cookieSignature.unsign(input.cookies[key], cconf?.secret); | ||
if(val){ | ||
input.signedCookies[key] = val; | ||
delete input.cookies[key]; | ||
} | ||
} | ||
} | ||
@@ -100,0 +101,0 @@ |
@@ -156,10 +156,10 @@ const { sign } = require('cookie-signature'); | ||
if(opts.signed && !this.conf.cookie?.secret) | ||
value = String(value); | ||
if(value && opts.signed && !this.conf.cookie?.secret) | ||
throw new Error('Trying to sign cookies when secret is not defined'); | ||
value = String(value); | ||
if(opts.signed && value) | ||
value = sign(value, this.conf.cookie.secret); | ||
if(opts.signed) | ||
value = 's:' + sign(value, this.conf.cookie.secret); | ||
if('maxAge' in opts) { | ||
@@ -166,0 +166,0 @@ opts.expires = new Date(Date.now() + opts.maxAge); |
{ | ||
"name": "nodecaf", | ||
"version": "0.12.3", | ||
"version": "0.12.4", | ||
"description": "Nodecaf is a light framework for developing RESTful Apps in a quick and convenient manner.", | ||
@@ -5,0 +5,0 @@ "main": "lib/main.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
38630