securecookie v1.1.0 Release Notes

Release Date: 2020-02-22 // about 4 years ago
  • ➕ Add function MustGenerateRandomKey. This function calls GenerateRandomKey and panics if it returns an error. This function is intended to be used to initialize the key outside of any function like this:

    var cookiesKey = securecookie.MustGenerateRandomKey()var myCookie = securecookie.MustNew("myCookie", cookiesKey, securecookie.Params{ Path: "/sec", // cookie received only when URL starts with this pathDomain: "example.com", // cookie received only when URL domain matches this oneMaxAge: 3600, // cookie becomes invalid 3600 seconds after it is setHTTPOnly: true, // disallow access by remote javascript code Secure: true, // cookie received only with HTTPS, never with HTTP})func main() { ...}