token

package
v0.0.0-...-bab46ce Latest Latest
Warning

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

Go to latest
Published: May 2, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WriteSettings

func WriteSettings(settings Settings) error

Types

type Config

type Config struct {
	Client HTTPClient
	Out    io.Writer
}

type HTTPClient

type HTTPClient interface {
	Do(req *http.Request) (*http.Response, error)
}

type Response

type Response struct {
	Token     string `json:"token"`
	CreatedAt string `json:"created_at"`
	ExpiresAt string `json:"expires_at"`
}

type Settings

type Settings struct {
	Token                      string
	UUID                       string
	LastCheck                  time.Time
	LastVulcanVersion          string
	AuthorizeMetricsCollection int
	ClientId                   string
	Email                      string
	ContinuationToken          string
}

func ReadSettings

func ReadSettings() (Settings, error)

type Token

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

func New

func New(c *Config) (*Token, error)

func (*Token) Create

func (t *Token) Create(b64 string) (*Response, error)

func (*Token) Save

func (t *Token) Save(b []byte) (string, error)

func (*Token) Validate

func (t *Token) Validate(token *string) (bool, UserInfo, error)

type UserInfo

type UserInfo struct {
	Results struct {
		ClientID string `json:"client_id"`
		Email    string `json:"email"`
	} `json:"results"`
}

Jump to

Keyboard shortcuts

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