session

package
v0.0.0-...-83625b3 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2018 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	MalformedSessionDataError        = errors.New("malformed session data")
	SignatureVerificationFailedError = errors.New("signature verification failed")
)

Functions

func EncodeSession

func EncodeSession(s Session, key SecretKey) string

Types

type SecretKey

type SecretKey []byte

SecretKey will be used to sign and verify the cookies.

func MustParse

func MustParse(encoded string) SecretKey

func (SecretKey) Sign

func (s SecretKey) Sign(message []byte) []byte

func (SecretKey) Verify

func (s SecretKey) Verify(message []byte, signature []byte) bool

type Session

type Session map[string]string

Session represents a session which will be stored in the session cookies.

func DecodeSession

func DecodeSession(encoded string, key SecretKey) (Session, error)

func (Session) Id

func (s Session) Id() string

Id returns the session ID. If there isn't one, it generates it.

func (Session) Reset

func (s Session) Reset()

Jump to

Keyboard shortcuts

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