Documentation
¶
Index ¶
- func BuildAuthorizeURL(apiKey, callbackURL string) string
- func FormatDeviceUserCode(code string) string
- func NewTokenCaptureServerForTest() (*tokenCaptureServer, error)
- func RequireAuth(store credentials.Store, profile string) (credentials.Credentials, error)
- type BrowserOpener
- type ClearResult
- type DeviceClient
- type DeviceCodeResponse
- type DeviceTokenResponse
- type LoginResult
- func CompleteLogin(ctx context.Context, store credentials.Store, ...) (LoginResult, error)
- func Login(ctx context.Context, store credentials.Store, profile, baseURL, apiKey string, ...) (LoginResult, error)
- func LoginWithDeviceFlow(ctx context.Context, store credentials.Store, ...) (LoginResult, error)
- type Member
- type SetKeyResult
- type SetResult
- type StatusResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildAuthorizeURL ¶
BuildAuthorizeURL builds the Trello authorization URL for interactive login.
func FormatDeviceUserCode ¶ added in v1.1.0
FormatDeviceUserCode inserts a dash: WDJBMJHT → WDJB-MJHT.
func NewTokenCaptureServerForTest ¶
func NewTokenCaptureServerForTest() (*tokenCaptureServer, error)
NewTokenCaptureServerForTest exposes callback-server creation for tests.
func RequireAuth ¶
func RequireAuth(store credentials.Store, profile string) (credentials.Credentials, error)
RequireAuth loads credentials for the given profile. Returns AUTH_REQUIRED if missing.
Types ¶
type BrowserOpener ¶
BrowserOpener opens the Trello authorize URL in a browser.
type ClearResult ¶
type ClearResult struct {
Configured bool `json:"configured"`
AuthMode *string `json:"authMode"` // Always null after clear
}
ClearResult is the response shape for auth clear.
func Clear ¶
func Clear(store credentials.Store, profile string) (ClearResult, error)
Clear removes stored credentials for the given profile.
type DeviceClient ¶ added in v1.1.0
type DeviceClient struct {
// contains filtered or unexported fields
}
DeviceClient communicates with the pairing service.
func NewDeviceClient ¶ added in v1.1.0
func NewDeviceClient(baseURL string) *DeviceClient
NewDeviceClient creates a client for the pairing service.
func (*DeviceClient) PollToken ¶ added in v1.1.0
func (c *DeviceClient) PollToken(deviceCode string) (*DeviceTokenResponse, error)
PollToken makes a single poll request for the token.
func (*DeviceClient) RequestCode ¶ added in v1.1.0
func (c *DeviceClient) RequestCode() (*DeviceCodeResponse, error)
RequestCode initiates a device authorization flow.
type DeviceCodeResponse ¶ added in v1.1.0
type DeviceCodeResponse struct {
DeviceCode string `json:"device_code"`
UserCode string `json:"user_code"`
VerificationURI string `json:"verification_uri"`
ExpiresIn int `json:"expires_in"`
Interval int `json:"interval"`
}
DeviceCodeResponse from the pairing service.
type DeviceTokenResponse ¶ added in v1.1.0
type DeviceTokenResponse struct {
AccessToken string `json:"access_token"`
APIKey string `json:"api_key"`
}
DeviceTokenResponse from the pairing service on successful exchange.
type LoginResult ¶
type LoginResult struct {
Configured bool `json:"configured"`
AuthMode *string `json:"authMode"`
Member *Member `json:"member"`
}
LoginResult is the response shape for auth login.
func CompleteLogin ¶
func CompleteLogin(ctx context.Context, store credentials.Store, profile, apiKey, token, baseURL, authMode string) (LoginResult, error)
CompleteLogin validates a captured token and stores credentials.
func Login ¶
func Login(ctx context.Context, store credentials.Store, profile, baseURL, apiKey string, openBrowser BrowserOpener, stderr io.Writer) (LoginResult, error)
Login performs the interactive browser authorization flow.
func LoginWithDeviceFlow ¶ added in v1.1.0
func LoginWithDeviceFlow(ctx context.Context, store credentials.Store, profile, baseURL, pairingServiceURL string, stderr io.Writer) (LoginResult, error)
LoginWithDeviceFlow runs the RFC 8628 device authorization flow.
type Member ¶
type Member struct {
ID string `json:"id"`
Username string `json:"username"`
FullName string `json:"fullName"`
}
Member represents a Trello member for auth status responses.
type SetKeyResult ¶
SetKeyResult is the response shape for auth set-key.
func SetKey ¶
func SetKey(store credentials.Store, profile, apiKey string) (SetKeyResult, error)
SetKey stores or updates only the API key for the given profile. If a token already exists, it is preserved so the profile remains configured.
type SetResult ¶
type SetResult struct {
Configured bool `json:"configured"`
AuthMode string `json:"authMode"`
Member interface{} `json:"-"` // Never included — auth set does not validate
}
SetResult is the response shape for auth set.
type StatusResult ¶
type StatusResult struct {
Configured bool `json:"configured"`
AuthMode *string `json:"authMode"`
Member *Member `json:"member"`
}
StatusResult is the response shape for auth status.
func Status ¶
func Status(ctx context.Context, store credentials.Store, profile, baseURL string) (StatusResult, error)
Status checks the current authentication state.