Documentation
¶
Overview ¶
Package credentials has the provider of credentials, such as a provider's API key, a tool's, a connector's client's secret, or how a connector's server is signed in to. Placeholders, such as ${OPENAI_API_KEY} or $OPENAI_API_KEY, are replaced with the credentials they name, so they're never stored with what uses them. One provider is shared by the registry, the toolkit and the connectors, which the server makes: env's, whose credentials are environment variables, or file's, which also keeps credentials in a file.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Expand ¶
func Expand(ctx context.Context, get func(context.Context, string) (string, error), value string) (string, error)
Expand returns the value with each placeholder, such as ${KEY} or $KEY, replaced with the credential which get returns, or an error, which is ErrNotFound with each credential which doesn't exist, so a provider's Expand can be its Get
Types ¶
type Provider ¶
type Provider interface {
// Get returns the credential with the key, or ErrNotFound when there's
// none
Get(ctx context.Context, key string) (string, error)
// Set sets the credential with the key, or returns ErrNotImplemented,
// when the provider can't keep credentials
Set(ctx context.Context, key, value string) error
// Delete deletes the credential with the key, or does nothing when
// there's none, or returns ErrNotImplemented, when the provider can't
// keep credentials
Delete(ctx context.Context, key string) error
// Expand returns the value with each placeholder replaced with its
// credential, or an error when a credential doesn't exist, which is
// ErrNotFound
Expand(ctx context.Context, value string) (string, error)
}
Provider gets, sets and deletes credentials by their keys, such as from the environment, a file, or a secrets manager, and expands placeholders
Directories
¶
| Path | Synopsis |
|---|---|
|
Package env is the provider of credentials whose credentials are environment variables, which is the registry's, the toolkit's and the connectors', unless they're given another.
|
Package env is the provider of credentials whose credentials are environment variables, which is the registry's, the toolkit's and the connectors', unless they're given another. |
|
Package file is the provider of credentials which are environment variables, or are kept in a file of JSON, which only its user can read, so credentials which are set, such as how a connector's server is signed in to, are kept once the process ends
|
Package file is the provider of credentials which are environment variables, or are kept in a file of JSON, which only its user can read, so credentials which are set, such as how a connector's server is signed in to, are kept once the process ends |