Versions in this module Expand all Collapse all v0 v0.10.0 Jun 24, 2026 v0.9.0 Jun 24, 2026 Changes in this version + const ClientID + var ErrNoCredentials = errors.New("not authenticated — run `truestamp auth login` (or set TRUESTAMP_API_KEY)") + var ErrNoSession = errors.New("no oauth session stored") + var ErrSessionExpired = errors.New("OAuth session expired or revoked — run `truestamp auth login`") + var Scopes = []string + func AuthorizeRequest(ctx context.Context, req *http.Request) error + func IsInvalidGrant(err error) bool + func Logout(ctx context.Context, store Store) (revoked bool, err error) + func NewRetryTransport(base http.RoundTripper) http.RoundTripper + func SetDefault(a Authorizer) + type Authorizer interface + AccessTokenExpiry func() time.Time + Authorize func(ctx context.Context, req *http.Request) error + BearerToken func(ctx context.Context) (string, error) + ForceRefresh func(ctx context.Context) error + Mode func() Mode + func APIKeyAuthorizer(key string) Authorizer + func Default() Authorizer + func Resolve(creds Credentials, store Store) Authorizer + type Credentials struct + APIKey string + APIKeyExplicit bool + type Discovery struct + AuthorizationEndpoint string + CodeChallengeMethodsSupported []string + GrantTypesSupported []string + Issuer string + RegistrationEndpoint string + ResponseTypesSupported []string + RevocationEndpoint string + ScopesSupported []string + TokenEndpoint string + TokenEndpointAuthMethodsSupported []string + func Fetch(ctx context.Context, baseOrigin string) (*Discovery, error) + func (d *Discovery) Validate(baseOrigin string) error + type LoginOptions struct + Open func(string) error + Out io.Writer + type Mode int + const ModeAPIKey + const ModeNone + const ModeOAuth + func (m Mode) String() string + type Session struct + AccessToken string + AuthURL string + Expiry time.Time + Issuer string + RefreshToken string + RevocationURL string + Scope string + TokenType string + TokenURL string + func Login(ctx context.Context, baseOrigin string, store Store, opts LoginOptions) (*Session, error) + type Store struct + func NewStore(baseURL string) Store + func (s Store) Clear() error + func (s Store) Load() (Session, error) + func (s Store) Location() string + func (s Store) Save(sess Session) error