token

package
v0.0.0-...-3b01d6c Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2020 License: AGPL-3.0 Imports: 10 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidToken = errors.New("link token invalid")
)

Functions

This section is empty.

Types

type Token

type Token struct {
	Data    TokenData `json:"data"`
	Expires int       `json:"expires"`
}

func NewToken

func NewToken(data TokenData, expires int) *Token

type TokenCodec

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

func NewTokenCodec

func NewTokenCodec(keyVersion int, key string) *TokenCodec

func (*TokenCodec) DecodeToken

func (c *TokenCodec) DecodeToken(tokenString string, tokenData TokenData) (*Token, error)

func (*TokenCodec) EncodeToken

func (c *TokenCodec) EncodeToken(token *Token) (string, error)

type TokenData

type TokenData interface {
	json.Marshaler
	json.Unmarshaler
}

type UserTokenData

type UserTokenData struct {
	User string `json:"user"`
}

func (*UserTokenData) MarshalJSON

func (d *UserTokenData) MarshalJSON() ([]byte, error)

func (*UserTokenData) UnmarshalJSON

func (d *UserTokenData) UnmarshalJSON(data []byte) error

Jump to

Keyboard shortcuts

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