credentials

package
v0.3.27 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MCPCredentialScopePrefix       = "mcp."
	OpenAPICredentialScopePrefix   = "openapi."
	ShellBashCredentialScopePrefix = "shell-bash."
)
View Source
const SecretsMasterKeyEnv = "AGENTKIT_SECRETS_KEY"

SecretsMasterKeyEnv is the environment / credentials.config.env key for the AES-256 key used to encrypt secrets.enc.json. It is not subject to Prefix.

Variables

This section is empty.

Functions

func BaseProcessExecEnv added in v0.3.27

func BaseProcessExecEnv(workDir string) []string

BaseProcessExecEnv returns a minimal host environment for subprocesses (PATH, HOME, …).

func CollectEnvKeys added in v0.3.11

func CollectEnvKeys(v any, out map[string]struct{})

CollectEnvKeys walks JSON-decoded values and records env: variable names.

func DecryptSecretsFile added in v0.3.4

func DecryptSecretsFile(data []byte, key []byte) (map[string]string, error)

DecryptSecretsFile parses and decrypts all entries in data.

func EncryptSecretsFile added in v0.3.4

func EncryptSecretsFile(entries map[string]string, key []byte) ([]byte, error)

EncryptSecretsFile serializes entries to encrypted JSON.

func EnvKey

func EnvKey(ref string) string

EnvKey normalizes refs like "env:OPENAI_API_KEY" to "OPENAI_API_KEY".

func FirstShellCommandToken added in v0.3.27

func FirstShellCommandToken(command string) string

FirstShellCommandToken returns the first token of a bash -lc command string (minimal parse).

func InjectScopedEnv added in v0.3.27

func InjectScopedEnv(ctx context.Context, base []string, scope string, keys []string, store capscredentials.Store) []string

InjectScopedEnv resolves env:KEY under scope for each key and appends KEY=value to base. Missing or empty secrets are skipped.

func IsIntegrationScope added in v0.3.24

func IsIntegrationScope(scope string) bool

IsIntegrationScope reports whether scope is mcp.*, openapi.*, or shell-bash.*.

func MCPCredentialScope added in v0.3.27

func MCPCredentialScope(serverName string) string

MCPCredentialScope maps an mcpServers key to integration credential scope.

func ManifestFromAPIIndex added in v0.3.11

func ManifestFromAPIIndex(data []byte) (map[string]map[string]struct{}, error)

ManifestFromAPIIndex maps each apis key (scope) to allowed env keys.

func ManifestFromMCPFile added in v0.3.11

func ManifestFromMCPFile(data []byte) (map[string]map[string]struct{}, error)

ManifestFromMCPFile maps each mcpServers key to allowed env keys under scope mcp.<name>.

func ManifestFromShellBashFile added in v0.3.27

func ManifestFromShellBashFile(data []byte) (map[string]map[string]struct{}, error)

ManifestFromShellBashFile maps each commands key to allowed env keys under scope shell-bash.<name>.

func MergeEncryptedSecretsFile added in v0.3.4

func MergeEncryptedSecretsFile(existing []byte, key []byte, updates map[string]string) ([]byte, error)

MergeEncryptedSecretsFile decrypts existing (if any), applies updates, and re-encrypts.

func MergeManifests added in v0.3.11

func MergeManifests(parts ...map[string]map[string]struct{}) map[string]map[string]struct{}

MergeManifests unions scope maps; later maps overwrite key sets for the same scope.

func OpenAPICredentialScope added in v0.3.27

func OpenAPICredentialScope(apiName string) string

OpenAPICredentialScope maps an api.json apis entry name to integration credential scope.

func ParseSecretsMasterKey added in v0.3.4

func ParseSecretsMasterKey(raw string) ([]byte, error)

ParseSecretsMasterKey derives a 32-byte AES key via SHA-256(passphrase).

func ScopedStorageKey added in v0.3.12

func ScopedStorageKey(scope, storageKey string) string

ScopedStorageKey names an integration secret entry in secrets.enc.json or dotenv.

func SecretFromContext

func SecretFromContext(ctx context.Context, ref string) (capscredentials.Secret, bool)

SecretFromContext returns a secret when ctx carries an override for ref.

func ShellBashCredentialScope added in v0.3.27

func ShellBashCredentialScope(cmd string) string

ShellBashCredentialScope maps a shell command basename to integration credential scope.

func ShellBashScopeForCommand added in v0.3.27

func ShellBashScopeForCommand(command string) (cmd string, scope string)

ShellBashScopeForCommand derives command basename and scope shell-bash.<cmd>.

func ValidateIntegrationScope added in v0.3.12

func ValidateIntegrationScope(scope string) error

ValidateIntegrationScope reports whether scope is a non-empty integration credential scope.

func WithSecrets

func WithSecrets(ctx context.Context, secrets map[string]string) context.Context

WithSecrets returns a ctx whose refs resolve from secrets before a Store's default backend (for example environment variables).

Types

This section is empty.

Jump to

Keyboard shortcuts

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