I'm trying to sign cookies using keygrip, also check if cookie is tampered. But unable to connect them after reading documents. For example:
server.js
const cookieParser = require("cookie-parser");
const ck = require("cookies");
const kg = require("keygrip");
const keylist = ['key1', 'key2'];
const mykg = kg(keylist);
app.use(cookieParser());
app.use(ck()); // error: app.use() requires a middleware function
const httpSServer = httpS.createServer({...}, app);
httpSServer.listen(3001, ()=>{console.log('httpS is on 3001');});
How would I use cookies
and keygrip
in controller1.js?
const unsigned= { httpOnly: true, sameSite: 'Strict', secure: true};
// below is for signed: false
res.cookie('myID1', 'abc123', unsigned);