auth

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LookupCurrentToken

func LookupCurrentToken() (string, error)

LookupCurrentToken retrieves the token for the current base URL.

Types

type Client

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

func NewClient

func NewClient(httpClient *http.Client) *Client

func (*Client) BaseURL

func (c *Client) BaseURL() string

func (*Client) PollDeviceAuth

func (c *Client) PollDeviceAuth(ctx context.Context, deviceCode string) (*DeviceAuthPoll, error)

func (*Client) StartDeviceAuth

func (c *Client) StartDeviceAuth(ctx context.Context) (*DeviceAuthStart, error)

type DeviceAuthPoll

type DeviceAuthPoll struct {
	AccessToken string `json:"access_token,omitempty"`
	TokenType   string `json:"token_type,omitempty"`
	ExpiresIn   int    `json:"expires_in,omitempty"`
	Scope       string `json:"scope,omitempty"`
	Error       string `json:"error,omitempty"`
}

type DeviceAuthStart

type DeviceAuthStart struct {
	DeviceCode              string `json:"device_code"`
	UserCode                string `json:"user_code"`
	VerificationURI         string `json:"verification_uri"`
	VerificationURIComplete string `json:"verification_uri_complete"`
	ExpiresIn               int    `json:"expires_in"`
	Interval                int    `json:"interval"`
}

type Store

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

Store manages CLI authentication tokens in the OS keyring.

func NewStore

func NewStore() *Store

NewStore returns a Store backed by the system keyring.

func NewStoreWithService

func NewStoreWithService(service string) *Store

NewStoreWithService returns a Store with a custom keyring service name (for testing).

func (*Store) DeleteToken

func (s *Store) DeleteToken(baseURL string) error

DeleteToken removes a stored token for the given base URL.

func (*Store) GetToken

func (s *Store) GetToken(baseURL string) (string, error)

GetToken retrieves a stored token for the given base URL. Returns an empty string (and no error) if no token is stored.

func (*Store) SaveToken

func (s *Store) SaveToken(baseURL, token string) error

SaveToken persists an access token for the given base URL.

Jump to

Keyboard shortcuts

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