token

package
v0.0.0-...-520c0ad Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2017 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidKID     = TokenError{"Invalid key identifier"}
	ErrInvalidISS     = TokenError{"Invalid Team ID"}
	ErrInvalidPEM     = TokenError{"Invalid PEM file"}
	ErrInvalidPEMType = TokenError{"Invalid PEM type"}
	ErrMissingPEM     = TokenError{"PEM signature is missing"}
)

Functions

This section is empty.

Types

type Token

type Token struct {
	sync.Mutex

	TeamID   string
	KeyID    string
	IssuedAt int64

	SigningKey *ecdsa.PrivateKey
	JWT        string
}

func NewToken

func NewToken(privateKeyFilename, teamID, keyID string) (*Token, error)

func (*Token) Expired

func (token *Token) Expired() bool

Checks expiration

func (*Token) RefreshJWT

func (token *Token) RefreshJWT() bool

Refresh JWT value if token is expired

func (*Token) SignJWT

func (token *Token) SignJWT() error

Updates IssuedAt value and prepares JWT string

type TokenError

type TokenError struct {
	Reason string
}

func (TokenError) Error

func (err TokenError) Error() string

Jump to

Keyboard shortcuts

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