state

package
v0.0.0-...-d22e7c3 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2020 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultStateExpiryTime = time.Minute * 5
	MinStateExpiryTime     = time.Minute * 1
	MaxStateExpiryTime     = time.Minute * 30
)

default state expiry time

Variables

View Source
var (
	ErrStateNotFound         = errors.New("state: not found")
	ErrCreatedByEmpty        = errors.New("state: created by is empty")
	ErrExpiryTimeMoreThanMax = errors.New("state: expiry time is more than max expiry time allowed")
	ErrExpiryTimeLessThanMin = errors.New("state: expiry time is  less than min expiry time allowed")
)

error list of state

Functions

This section is empty.

Types

type State

type State struct {
	// CreatedBy define by whom the state is created
	CreatedBy string
	// CreatedByHashID is a hash of user id used externally
	CreatedByHashID string
	// Authentication data of state
	Authentication authentity.Authentication
	// metadata that want to be stored in the creation of state
	MetaData   map[string]string
	ExpiryTime time.Duration
	ExpiredAt  time.Time
	CreatedAt  time.Time
}

State data

func New

func New() State

New to create a new state

func (State) IsExpired

func (s State) IsExpired() (bool, error)

IsExpired to check whether the state is expired or not

func (State) Validate

func (s State) Validate() error

Validate state

Jump to

Keyboard shortcuts

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