token

package
v0.0.0-...-79ceddb Latest Latest
Warning

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

Go to latest
Published: Dec 23, 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
	S3AccessKey                string
	S3SecreKey                 string
	S3Bucket                   string
}

func ReadSettings

func ReadSettings() (Settings, error)

type Token

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

func New

func New(c *Config) *Token

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 TokenInterface

type TokenInterface interface {
	Validate(token *string) (bool, UserInfo, error)
	Save(b []byte) (string, error)
	Create(b64 string) (*Response, error)
}

type TokenMock

type TokenMock struct {
}

func (*TokenMock) Create

func (m *TokenMock) Create(b64 string) (*Response, error)

func (*TokenMock) Save

func (m *TokenMock) Save(b []byte) (string, error)

func (*TokenMock) Validate

func (m *TokenMock) 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