Documentation
¶
Index ¶
- func LoadToken(remote string) (string, error)
- func RecordAttempt(dir string, cfg Config, attemptErr error) error
- func SaveCredentials(remote string, credentials Credentials) error
- func SaveToken(remote, token string) error
- type BrowserCode
- type Cipher
- type Client
- type Config
- type Credentials
- type DeviceCode
- type Health
- type OAuth
- func (OAuth) BrowserAuthorization(clientID, redirectURI string) (BrowserCode, error)
- func (o OAuth) ExchangeWithPlatform(ctx context.Context, endpoint string, flow BrowserCode, code string) (Credentials, error)
- func (o OAuth) Refresh(ctx context.Context, clientID string, previous Credentials) (Credentials, error)
- func (o OAuth) RefreshWithPlatform(ctx context.Context, endpoint string, previous Credentials) (Credentials, error)
- func (o OAuth) Start(ctx context.Context, clientID string) (DeviceCode, error)
- func (o OAuth) Wait(ctx context.Context, clientID string, code DeviceCode) (string, error)
- func (o OAuth) WaitCredentials(ctx context.Context, clientID string, code DeviceCode) (Credentials, error)
- type Pairing
- type Row
- type State
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SaveCredentials ¶
func SaveCredentials(remote string, credentials Credentials) error
Types ¶
type BrowserCode ¶
type Cipher ¶
type Cipher struct {
Salt []byte
// contains filtered or unexported fields
}
Cipher holds a key derived on this device. Only its random salt may be shared.
func FromKey ¶
FromKey restores a cipher whose key was saved in the operating system credential store. The salt remains in the repository's .trace directory.
func LoadCipher ¶
func (*Cipher) KeyForCredentialStore ¶
type Client ¶
type Client struct {
HTTP *http.Client
Config Config
Token string
TokenProvider func(context.Context) (string, error)
Cipher *Cipher
TraceDir string
DB *sql.DB
Blobs *blob.Store
}
type Config ¶
type Config struct {
ConnectionExpiresAt int64 `json:"connection_expires_at,omitempty"`
ConnectionID string `json:"connection_id,omitempty"`
Endpoint string `json:"endpoint"`
Remote string `json:"remote"`
Mode string `json:"mode"`
ClientID string `json:"client_id,omitempty"`
GitHubApp bool `json:"github_app,omitempty"`
BrokerRefresh bool `json:"broker_refresh,omitempty"`
AutoSync bool `json:"auto_sync,omitempty"`
}
func (Config) CredentialKey ¶
CredentialKey keeps account-scoped connections separate from GitHub login credentials and from connections to another Trace server.
type Credentials ¶
type Credentials struct {
ConnectionID string `json:"connection_id,omitempty"`
AccessToken string `json:"access_token"`
RefreshToken string `json:"refresh_token,omitempty"`
ExpiresAt int64 `json:"expires_at,omitempty"`
RefreshExpiresAt int64 `json:"refresh_expires_at,omitempty"`
ProSyncKey string `json:"pro_sync_key,omitempty"`
}
func LoadConfigCredentials ¶
func LoadConfigCredentials(cfg Config) (Credentials, error)
LoadConfigCredentials migrates only a legacy entry whose identity matches the checkout. Never infer ownership from a project label shared by two accounts.
func LoadCredentials ¶
func LoadCredentials(remote string) (Credentials, error)
func WaitPairing ¶
type DeviceCode ¶
type Health ¶
type Health struct {
ConnectionID string `json:"connection_id,omitempty"`
LastAttempt int64 `json:"last_attempt"`
LastSuccess int64 `json:"last_success"`
LastError string `json:"last_error,omitempty"`
Action string `json:"action,omitempty"`
}
func ReadHealth ¶
type OAuth ¶
func (OAuth) BrowserAuthorization ¶
func (OAuth) BrowserAuthorization(clientID, redirectURI string) (BrowserCode, error)
func (OAuth) ExchangeWithPlatform ¶
func (o OAuth) ExchangeWithPlatform(ctx context.Context, endpoint string, flow BrowserCode, code string) (Credentials, error)
func (OAuth) Refresh ¶
func (o OAuth) Refresh(ctx context.Context, clientID string, previous Credentials) (Credentials, error)
func (OAuth) RefreshWithPlatform ¶
func (o OAuth) RefreshWithPlatform(ctx context.Context, endpoint string, previous Credentials) (Credentials, error)
func (OAuth) WaitCredentials ¶
func (o OAuth) WaitCredentials(ctx context.Context, clientID string, code DeviceCode) (Credentials, error)