Skip to content

Instantly share code, notes, and snippets.

Created Jun 26, 2018
What would you like to do?
func RegisterSession() gin.HandlerFunc {
letterBytes := "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
b := make([]byte, 32)
for i := range b {
b[i] = letterBytes[rand.Intn(len(letterBytes))]
store := cookie.NewStore([]byte("goblog"), b)
return sessions.Sessions("sess", store)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment