cookie

package
v0.0.0-20260608 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

Manager handles signing and encrypting HTTP cookies.

func NewManager

func NewManager(appKey string) *Manager

NewManager creates a new Cookie Manager. The key should be exactly 32 bytes for AES-256.

func (*Manager) Decrypt

func (m *Manager) Decrypt(value string) (string, error)

Decrypt verifies the signature and decrypts the value.

func (*Manager) Encrypt

func (m *Manager) Encrypt(value string) (string, error)

Encrypt encrypts and signs a string value.

func (*Manager) Get

func (m *Manager) Get(r *http.Request, name string) (string, error)

Get retrieves and decrypts a cookie from the request.

func (*Manager) Set

func (m *Manager) Set(w http.ResponseWriter, cookie *http.Cookie) error

Set adds an encrypted and signed cookie to the response.

Jump to

Keyboard shortcuts

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