package hub import ( "net/http" "time" ) func (a *App) getCookie(r *http.Request, name string) string { if c, err := r.Cookie(name); err == nil { return c.Value } return "" } func (a *App) setCookie(w http.ResponseWriter, name, value string) { http.SetCookie(w, &http.Cookie{ Name: name, Value: value, Path: "/", Secure: !a.insecure, SameSite: http.SameSiteStrictMode, HttpOnly: true, MaxAge: 86400 * 365 * 10, }) } func (a *App) deleteCookie(w http.ResponseWriter, name string) { http.SetCookie(w, &http.Cookie{ Name: name, Value: "", Path: "/", Expires: time.Unix(0, 0), }) }