var ( SessionLastUpdated = "__sess_last_updated" CookieIdName = "sess_sessionid" SqlTableName = "sess_session" SqlCreateSession = ` CREATE TABLE IF NOT EXISTS ` + SqlTableName + ` ( id BYTEA NOT NULL, name VARCHAR (255) NOT NULL, key TEXT NOT NULL, value TEXT NOT NULL, PRIMARY KEY (id, name, key) ) ` )
SetKeys sets the hash and block keys used to read and write the session cookie. A hash key is required and is used to to authenticate a cookie value using HMAC. It's recommend to be 32 or 64 bytes.
A block key is optional and is used to encrypt the cookie value. If it's set to nil, then encryption will not be used. This package uses AES, so the block key must have length 16, 24 or 32 bytes corresponding to AES-128, AES-192 or AES-256. If the block key violates these constraints, SetKeys will panic.
This method is exposed so that multiple instantiations of session stores can share the same cookie. This particularly useful if you want to be able to restart your web server without invalidating existing user sessions.
If this method is not called, then a fresh set of keys is created automatically, but will invalidate all existing user sessions.