auth

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CanLoadTicket

func CanLoadTicket() (ok bool, err error)

CanLoadTicket returns a boolean indicating if a cached ticket is present and can be loaded. Returns an error if an unexpected error occurs.

Types

type Ticket

type Ticket struct {
	Email      *string   `json:"email"`
	Name       string    `json:"nameOnPlatform"`
	ProfileID  string    `json:"profileId"`
	SessionID  string    `json:"sessionId"`
	Expiration time.Time `json:"expiration"`
	Token      string    `json:"ticket"`
}

func LoadTicket

func LoadTicket() (t *Ticket, err error)

LoadTicket deserializes the cached ticket file and returns it. Should be prefaced with calling CanLoadTicket().

func (*Ticket) IsExpired

func (t *Ticket) IsExpired() bool

IsExpired checks if this ticket expired by comparing its expiration with the current time.

func (*Ticket) Save

func (t *Ticket) Save() (err error)

Save serializes this ticket to a file which can be loaded by Load(). This is a means of caching, attempting to minimize authentication overhead for every request to the API.

Jump to

Keyboard shortcuts

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