Documentation
¶
Index ¶
- Constants
- func DeleteCookie(w http.ResponseWriter, name string, path string)
- func Read(r *http.Request, base64Dec bool, name string) (string, error)
- func ReadEncrypted(r *http.Request, name string, secretKey []byte) (string, error)
- func ReadSessionCookie(r *http.Request, sKey string) (string, error)
- func ReadSigned(r *http.Request, name string, secretKey []byte) (string, error)
- func Write(w http.ResponseWriter, base64Enc bool, cookie http.Cookie) error
- func WriteEncrypted(w http.ResponseWriter, cookie http.Cookie, secretKey []byte) error
- func WriteSessionCookie(w http.ResponseWriter, sKey string, value string, duration int64) error
- func WriteSigned(w http.ResponseWriter, cookie http.Cookie, secretKey []byte) error
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 ReadEncrypted ¶
func WriteEncrypted ¶
func WriteSessionCookie ¶
func WriteSigned ¶
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.
Click to show internal directories.
Click to hide internal directories.