core

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: May 28, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildExceptKeys

func BuildExceptKeys(except []string) map[string]struct{}

func DecryptCookie

func DecryptCookie(data, key []byte) ([]byte, error)

func DecryptRequestCookies

func DecryptRequestCookies(header *fasthttp.RequestHeader, opts *Options)

func EncryptCookie

func EncryptCookie(data, key []byte) ([]byte, error)

func EncryptResponseCookies

func EncryptResponseCookies(header *fasthttp.ResponseHeader, opts *Options)

func GenerateKey

func GenerateKey(length ...int) []byte

Types

type CookieCodec

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

func NewCookieCodec

func NewCookieCodec(key []byte) (*CookieCodec, error)

func (*CookieCodec) Decrypt

func (c *CookieCodec) Decrypt(data, _ []byte) ([]byte, error)

func (*CookieCodec) Encrypt

func (c *CookieCodec) Encrypt(data, _ []byte) ([]byte, error)

type Cryptor

type Cryptor func(message, key []byte) ([]byte, error)

type Options

type Options struct {
	Key                    []byte
	Encryptor              Cryptor
	Decryptor              Cryptor
	ExceptKeys             map[string]struct{}
	EncryptKeys            bool
	EncryptValues          bool
	SuppressErrors         bool
	SkipUnencryptedCookies bool
}

func NewOptions

func NewOptions(
	key []byte,
	except []string,
	encryptor Cryptor,
	decryptor Cryptor,
	encryptKeys bool,
	encryptValues bool,
	suppressErrors bool,
	skipUnencryptedCookies bool,
	useDefaultEncryptor bool,
	useDefaultDecryptor bool,
) (Options, error)

Jump to

Keyboard shortcuts

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