credentials

package
v1.6.6 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2026 License: Apache-2.0 Imports: 4 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

Jump to

Keyboard shortcuts

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