cookie

package
v0.0.0-...-a015d60 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 7, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrValueTooLong    = "cookie value too long"
	ErrInvalidDuration = "invalid duration"
	ErrInvalidValue    = "invalid cookie value"
	ErrInvSecretKey    = "invalid secret key"
)
View Source
const (
	DefaultSessionCookieName = "SESSION_ID"
)

Variables

This section is empty.

Functions

func DeleteCookie

func DeleteCookie(w http.ResponseWriter, name string, path string)

func Read

func Read(r *http.Request, base64Dec bool, name string) (string, error)

func ReadEncrypted

func ReadEncrypted(r *http.Request, name string, secretKey []byte) (string, error)

func ReadSessionCookie

func ReadSessionCookie(r *http.Request, sKey string) (string, error)

func ReadSigned

func ReadSigned(r *http.Request, name string, secretKey []byte) (string, error)

func Write

func Write(w http.ResponseWriter, base64Enc bool, cookie http.Cookie) error

func WriteEncrypted

func WriteEncrypted(w http.ResponseWriter, cookie http.Cookie, secretKey []byte) error

func WriteSessionCookie

func WriteSessionCookie(w http.ResponseWriter, sKey string, value string, duration int64) error

func WriteSigned

func WriteSigned(w http.ResponseWriter, cookie http.Cookie, secretKey []byte) error

Esempio: import "encoding/hex" secretKey, err = hex.DecodeString("13d6b4dff8f84a10851021ec8608f814570d562c92fe6b5ec4c9f595bcb3234b") 64-character hex string to give us a slice containing 32 random bytes

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL