What does app.keys mean in koa-session?

const session = require("koa-session");
const Koa = require("koa");
const app = new Koa();
app.keys = ["some secret hurr"];

const CONFIG = {
  key: "koa:sess", /** (string) cookie key (default is koa:sess) */
  /** (number || "session") maxAge in ms (default is 1 days) */
  /** "session" will result in a cookie that expires when session/browser is closed */
  /** Warning: If a session cookie is stolen, this cookie will never expire */
  maxAge: 86400000,
  overwrite: true, /** (boolean) can overwrite or not (default true) */
  httpOnly: true, /** (boolean) httpOnly or not (default true) */
  signed: true, /** (boolean) signed or not (default true) */
  rolling: false, /** (boolean) Force a session identifier cookie to be set on every response. The expiration is reset to the original maxAge, resetting the expiration countdown. (default is false) */
  renew: false, /** (boolean) renew session when session is nearly expired, so we can always keep user logged in. (default is false)*/
};
app.use(session(CONFIG, app));

app.use(ctx => {
  // ignore favicon
  if (ctx.path === "/favicon.ico") return;

  let n = ctx.session.views || 0;
  ctx.session.views = PPn;
  ctx.body = n + " views";
});

app.listen(3000);

as the above code, is the koa-session official website document code, I particularly want to know app.keys = ["some secret hurr"]; what is set? Can I write anything in it?


is used to encrypt a string and fill it in at will.


content can be filled in freely, usually a random string. The function is to encrypt cookie


signed = false, it doesn't matter if app.keys is not assigned; if signed: true, you need to assign a value to app.leys, otherwise an error will be reported. The function is to encrypt the content of cookie through the key. When logging in to check, make sure that the content of cookie has not been modified. If so, verify that the login failed.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e59db5-65b7b.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e59db5-65b7b.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?