cookies

package
v0.60.0 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2026 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrValueTooLong = errors.New("cookie value too long")
	ErrInvalidValue = errors.New("invalid cookie value")
	ErrReadFail     = errors.New("read cookie failed")
	ErrWriteFail    = errors.New("write cookie failed")
)

Functions

func Read

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

Read will read the cookie from the request.

func ReadEncrypted

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

ReadEncrypted will read an encrypted cookie from the request.

func Write

func Write(res http.ResponseWriter, cookie http.Cookie) error

Write will write the given cookie to the response.

func WriteEncrypted

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

WriteEncrypted will write an encrypted cookie to the response.

Types

This section is empty.

Jump to

Keyboard shortcuts

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