Documentation
¶
Overview ¶
Package secrets provides generic secret management utilities for authentication. This package contains functions that can be used by any authentication method (OAuth, bearer tokens, etc.) to process secrets and store them in a secrets manager.
Index ¶
- func GenerateUniqueSecretNameWithPrefix(workloadName, prefix string, secretManager secrets.Provider) (string, error)
- func GetSecretsManager() (secrets.Provider, error)
- func ProcessSecret(workloadName, secretValue string, tokenType TokenType) (string, error)
- func ProcessSecretWithProvider(workloadName, secretValue string, secretManager secrets.Provider, ...) (string, error)
- func StoreSecretInManagerWithProvider(ctx context.Context, secretName, secretValue string, ...) error
- type TokenType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateUniqueSecretNameWithPrefix ¶
func GenerateUniqueSecretNameWithPrefix(workloadName, prefix string, secretManager secrets.Provider) (string, error)
GenerateUniqueSecretNameWithPrefix generates a unique secret name with a custom prefix This is a generic function that can be used for any secret type
func GetSecretsManager ¶
GetSecretsManager returns the secrets manager instance This is exported so it can be reused by other packages
func ProcessSecret ¶
ProcessSecret processes a secret, converting plain text to CLI format if needed. This is a generic function that can be used for any secret type. Parameters:
- workloadName: Name of the workload (used for secret naming)
- secretValue: The secret value (plain text or already in CLI format)
- tokenType: The type of token/secret (determines prefix, target, and error context)
Returns the secret in CLI format: "secret-name,target=target_value"
func ProcessSecretWithProvider ¶
func ProcessSecretWithProvider( workloadName, secretValue string, secretManager secrets.Provider, tokenType TokenType, ) (string, error)
ProcessSecretWithProvider processes a secret using the provided secret manager This version is testable with dependency injection and is used for testing
func StoreSecretInManagerWithProvider ¶
func StoreSecretInManagerWithProvider(ctx context.Context, secretName, secretValue string, secretManager secrets.Provider) error
StoreSecretInManagerWithProvider stores a secret using the provided secret manager This version is testable with dependency injection