Documentation
¶
Overview ¶
Package providerauth owns renewable credentials for provider inference. It does not read or reuse Starmap catalog-acquisition credentials.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrSourceRequired reports a missing credential source. ErrSourceRequired = errors.New("provider credential source is required") // ErrTokenEmpty reports a credential source that returned no token value. ErrTokenEmpty = errors.New("provider credential token is empty") // ErrTokenExpiryRequired reports a renewable token without an expiry. ErrTokenExpiryRequired = errors.New("provider credential token expiry is required") // ErrTokenStale reports a credential source that returned a token too close // to expiry for a new inference request. ErrTokenStale = errors.New("provider credential token is stale") // ErrCredentialRedirect reports an attempt to reuse renewable provider // credentials on an HTTP redirect. ErrCredentialRedirect = errors.New("provider credential redirect is not allowed") )
Functions ¶
func NewBearerTransport ¶
func NewBearerTransport(base http.RoundTripper, source Source) http.RoundTripper
NewBearerTransport returns a transport that obtains a bearer token for each request. The source can cache a fresh token between requests.
Types ¶
type RefreshOptions ¶
RefreshOptions configures a refreshable credential source.
type Source ¶
Source supplies provider inference bearer tokens.
func NewAzureDefaultSource ¶
NewAzureDefaultSource uses Azure DefaultAzureCredential for Azure OpenAI inference.
func NewGoogleDefaultSource ¶
NewGoogleDefaultSource uses Google Application Default Credentials for Vertex AI inference.
func NewRefreshingSource ¶
func NewRefreshingSource(upstream Source, options RefreshOptions) (Source, error)
NewRefreshingSource caches a token and replaces it before expiry. One caller performs each refresh. Other callers can stop waiting through their own contexts.
type SourceFunc ¶
SourceFunc adapts a function to Source.