authprompt

package
v0.7.28 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNeedsAuth = errors.New("authentication required")

ErrNeedsAuth is returned by Resolve* functions when no credentials are available in env vars or config, indicating that the caller should prompt the user interactively.

Functions

func AnthropicBaseURL

func AnthropicBaseURL() string

AnthropicBaseURL returns the configured Anthropic base URL from the environment.

func CircleCIBaseURL

func CircleCIBaseURL() string

CircleCIBaseURL returns the configured CircleCI base URL from the environment.

func GitHubBaseURL

func GitHubBaseURL() string

GitHubBaseURL returns the configured GitHub API URL from the environment.

func ResolveAnthropicClient

func ResolveAnthropicClient() (*anthropic.Client, error)

ResolveAnthropicClient returns an Anthropic client if credentials are available in env vars or config. Returns ErrNeedsAuth when the caller must prompt.

func ResolveCircleCIClient

func ResolveCircleCIClient() (*circleci.Client, error)

ResolveCircleCIClient returns a CircleCI client if credentials are available in env vars or config. Returns ErrNeedsAuth when the caller must prompt.

func ResolveGitHubClient

func ResolveGitHubClient() (*github.Client, error)

ResolveGitHubClient returns a GitHub client if credentials are available in env vars or config. Returns ErrNeedsAuth when the caller must prompt.

func SaveAnthropicKey

func SaveAnthropicKey(key string) error

SaveAnthropicKey persists an Anthropic API key to the config file.

func SaveCircleCIToken

func SaveCircleCIToken(token string) error

SaveCircleCIToken persists a CircleCI token to the config file.

func SaveGitHubToken

func SaveGitHubToken(token string) error

SaveGitHubToken persists a GitHub token to the config file.

func ValidateAPIKey

func ValidateAPIKey(ctx context.Context, apiKey, baseURL string) error

ValidateAPIKey calls POST /v1/messages/count_tokens to confirm the Anthropic key is accepted. A 429 response is treated as valid.

func ValidateCircleCIToken

func ValidateCircleCIToken(ctx context.Context, token, baseURL string) error

ValidateCircleCIToken calls GET /api/v2/me to confirm the token is accepted. A 429 response is treated as valid (rate-limited but authenticated).

func ValidateGitHubToken

func ValidateGitHubToken(ctx context.Context, token, baseURL string) error

ValidateGitHubToken calls GET /user to confirm the token is accepted. A 429 response is treated as valid (rate-limited but authenticated).

Types

This section is empty.

Jump to

Keyboard shortcuts

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