cookie

package
v0.0.0-...-e9a390c Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2026 License: Apache-2.0 Imports: 9 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CookieTool

type CookieTool struct {
	// Returns a list of cipher.Block object that should be used for
	// processing cookies. Cookies will be decrypted with all the keys
	// in order to find one that is valid and will be encrypted with the
	// first in the list. This allows rotation of keys without disruption.
	AESKeys func(context.Context) ([]cipher.Block, error)
}

Handles the encrypting and decrypting of data in cookies.

func (*CookieTool) Decode

func (c *CookieTool) Decode(
	ctx context.Context,
	cookie string,
	v interface{},
) error

Decodes the given cookie contents into the given interface value. If the cookie is not valid or can not be decoded then an error will be returned.

func (*CookieTool) Encode

func (c *CookieTool) Encode(
	ctx context.Context,
	v interface{},
) (
	string,
	error,
)

Like decodeCookie except this is used for encoding.

type Time

type Time struct {
	time.Time
}

Acts like a time.Time object, but encodes to and from a unix epoch to save space. Because this converts to float and back it will lose precision in the sub-second values, typically at most in the micro second range.

func (*Time) MarshalText

func (t *Time) MarshalText() ([]byte, error)

func (*Time) UnmarshalText

func (t *Time) UnmarshalText(raw []byte) error

Jump to

Keyboard shortcuts

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