Versions in this module Expand all Collapse all v1 v1.2.0 Aug 1, 2025 Changes in this version + var DefaultOptions = &Options + var ErrDecryptionFailed = fmt.Errorf("the value could not be decrypted") + var ErrKeyLength = fmt.Errorf("the key must be %d bytes", chacha20poly1305.KeySize) + var ErrNoCodecs = fmt.Errorf("no codecs provided") + var ErrTimestampExpired = fmt.Errorf("the timestamp is expired") + var ErrTimestampInvalid = fmt.Errorf("the timestamp is invalid") + var ErrTimestampTooNew = fmt.Errorf("the timestamp is too new") + var ErrValueNotByte = fmt.Errorf("the value is not a []byte") + var ErrValueNotBytePtr = fmt.Errorf("the value is not a *[]byte") + var ErrValueTooLong = fmt.Errorf("the value is too long") + func DecodeMulti(name string, value string, dst any, codecs ...Codec) error + func EncodeMulti(name string, value any, codecs ...Codec) (string, error) + func GenerateRandomKey(length int) []byte + type Codec interface + Decode func(name, value string, dst any) (int64, error) + Encode func(name string, value any) (string, error) + type GobEncoder struct + func (e GobEncoder) Deserialize(src []byte, dst any) error + func (e GobEncoder) Serialize(src any) ([]byte, error) + type JSONEncoder struct + func (e JSONEncoder) Deserialize(src []byte, dst any) error + func (e JSONEncoder) Serialize(src any) ([]byte, error) + type MultiError []error + func (m MultiError) Error() string + type NopEncoder struct + func (e NopEncoder) Deserialize(src []byte, dst any) error + func (e NopEncoder) Serialize(src any) ([]byte, error) + type Options struct + MaxAge int64 + MaxLength int + MinAge int64 + RotatedKeys [][]byte + Serializer Serializer + TimeFunc func() int64 + type SecureCookie struct + func New(key []byte, options *Options) (*SecureCookie, error) + func (s *SecureCookie) Decode(name, value string, dst any) (int64, error) + func (s *SecureCookie) Encode(name string, value any) (string, error) + type Serializer interface + Deserialize func(src []byte, dst any) error + Serialize func(src any) ([]byte, error)