package sessions import ( "net/http" "github.com/google/uuid" ) type SessionMgr struct { key string Values map[string]string } type session map[string]any type SessionCtxKey string var sessions map[string]session func (sm *SessionMgr) NewSession(w http.ResponseWriter, r http.Request) { token := uuid.NewString() // set secure cookie in http.ResponseWriter // TODO make secure http.SetCookie(w, &http.Cookie{ Name: "session_token", Value: token, }) sessions[token] = session{ "username": username, } // set request context }