token

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: May 21, 2018 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TokenExpired = 3000
)

Variables

View Source
var (
	AuthKeyNotPEM   = errors.New("authKey must be a valid p8 PEM file")
	AuthKeyNotECDSA = errors.New("authKey must be of type ecdsa.PrivateKey")
	AuthKeyNil      = errors.New("authKey was nil")
)

Functions

func AuthKeyFromData

func AuthKeyFromData(data []byte) (*ecdsa.PrivateKey, error)

func AuthKeyFromFile

func AuthKeyFromFile(fileName string) (*ecdsa.PrivateKey, error)

Types

type Token

type Token struct {
	sync.Mutex
	AuthKey  *ecdsa.PrivateKey
	KeyID    string
	TeamID   string
	Bearer   string
	IssuedAt int64
}

func NewToken

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

func (*Token) Expired

func (t *Token) Expired() bool

func (*Token) Generate

func (t *Token) Generate() (bool, error)

func (*Token) GenerateIfExpired

func (t *Token) GenerateIfExpired()

Jump to

Keyboard shortcuts

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