Registry / web-framework / gorilla-sessions

gorilla-sessions

JSON →
library1.4.0gogounverified

Package sessions provides cookie and filesystem sessions and infrastructure for custom session backends.

go get github.com/gorilla/sessions
INSTALL
IMPORT
SIG · GORILLA-SESSIONS
G
gorilla-sessions
web-frameworkgov1.4.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

sessions
github.com/gorilla/sessions

Creates a cookie store and saves a session value.

package main import ( "net/http" "github.com/gorilla/sessions" ) var store = sessions.NewCookieStore([]byte("secret-key")) func handler(w http.ResponseWriter, r *http.Request) { session, _ := store.Get(r, "session-name") session.Values["foo"] = "bar" session.Save(r, w) } func main() { http.HandleFunc("/", handler) http.ListenAndServe(":8080", nil) }
Debug
Known issues
gotchaCookie store uses AES for encryption; key must be 16, 24, or 32 bytes
fix
Ensure the secret key is exactly 16, 24, or 32 bytes long
affects: all
Upgrade
Version history
1.4.0latest on pkg.go.dev
Audit
Dependencies

No dependency data recorded yet.

Agent activity
6 hits · last 30 days
node
6
Resources
gorilla-sessions — go get gorilla-sessions · libregistry