signedcookie

package
v0.0.25 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2024 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SecretSize = 32 // SecretSize is the size, in bytes, of a cookie secret.
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

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

func NewManager

func NewManager(secrets Secrets) (*Manager, error)

func (Manager) Delete added in v0.0.2

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

func (Manager) Get added in v0.0.2

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

func (Manager) Read

func (m Manager) Read(signedValue string) (string, error)

func (Manager) Set added in v0.0.2

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

func (Manager) Sign

func (m Manager) Sign(rawValue string) (string, error)

type Secrets added in v0.0.2

type Secrets []string

Secrets is a latest-first list of 32-byte, base64-encoded secrets.

type SignedCookie added in v0.0.20

type SignedCookie[T any] struct {
	Manager    *Manager
	TTL        time.Duration
	BaseCookie *http.Cookie
}

func (*SignedCookie[T]) Delete added in v0.0.20

func (ac *SignedCookie[T]) Delete(w http.ResponseWriter, r *http.Request) error

func (*SignedCookie[T]) Get added in v0.0.20

func (ac *SignedCookie[T]) Get(r *http.Request) (*T, error)

func (*SignedCookie[T]) Set added in v0.0.20

func (ac *SignedCookie[T]) Set(w http.ResponseWriter, r *http.Request, value *T, overrideBaseCookie *http.Cookie) error

Jump to

Keyboard shortcuts

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