Documentation ¶
Overview ¶
Package cookies provides helpers for reading and writing cookies with various security features.
Index ¶
- Variables
- func Read(r *http.Request, name string) (string, error)
- func ReadEncrypted(r *http.Request, name string, secretKey string) (string, error)
- func ReadSigned(r *http.Request, name string, secretKey string) (string, error)
- func Write(w http.ResponseWriter, cookie http.Cookie) error
- func WriteEncrypted(w http.ResponseWriter, cookie http.Cookie, secretKey string) error
- func WriteSigned(w http.ResponseWriter, cookie http.Cookie, secretKey string) error
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrValueTooLong is returned when the cookie value is too long ErrValueTooLong = errors.New("cookie value too long") // ErrInvalidValue is returned when the cookie value is invalid ErrInvalidValue = errors.New("invalid cookie value") )
Functions ¶
func ReadEncrypted ¶
ReadEncrypted reads an encrypted cookie from the request
func ReadSigned ¶
ReadSigned reads a signed cookie from the request
func Write ¶
func Write(w http.ResponseWriter, cookie http.Cookie) error
Write writes a cookie to the response
func WriteEncrypted ¶
WriteEncrypted writes an encrypted cookie to the response
func WriteSigned ¶
WriteSigned writes a signed cookie to the response
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.