session

package
v0.0.0-...-96f436b Latest Latest
Warning

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

Go to latest
Published: May 19, 2024 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Encode

func Encode(values Values, sess *sessions.Session) error

func Get

func Get(c echo.Context) (*sessions.Session, error)

func NewStore

func NewStore(cfg *Config) *sessions.CookieStore

NewStore creates a new cookie session store.

Types

type Config

type Config struct {
	SigningKey    Key          `yaml:"signing_key"`
	EncryptionKey Key          `yaml:"encrypt_key"`
	Cookie        CookieConfig `yaml:"cookie"`
}

type CookieConfig

type CookieConfig struct {
	Path     string `yaml:"path"`
	Domain   string `yaml:"domain"`
	MaxAge   int    `yaml:"max_age"`
	Secure   bool   `yaml:"secure"`
	HttpOnly bool   `yaml:"http_only"`
	SameSite string `yaml:"same_site"`
}

func (CookieConfig) SessionOptions

func (c CookieConfig) SessionOptions() *sessions.Options

type Key

type Key []byte

func (*Key) UnmarshalYAML

func (k *Key) UnmarshalYAML(node *yaml.Node) error

type Values

type Values struct {
	Username string `json:"username" mapstructure:"username"`
	Image    string `json:"image" mapstructure:"image"`
	Room     string `json:"room" mapstructure:"room"`
}

func Decode

func Decode(sess *sessions.Session) (*Values, error)

Jump to

Keyboard shortcuts

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