Documentation
¶
Overview ¶
Package secrets fetches API keys and other sensitive configuration.
Index ¶
- Constants
- func ClaudeAPIKey(ctx context.Context, client SSMAPI) (string, error)
- func GetSSMParameter(ctx context.Context, client SSMAPI, name string) (string, error)
- func GetSSMParameterCached(ctx context.Context, client SSMAPI, name string, ttl time.Duration) (string, error)
- func IsSSMParameterAlreadyExists(err error) bool
- func MigaduAPIToken(ctx context.Context, client SSMAPI) (string, error)
- func OpenAIServiceKey(ctx context.Context, client SSMAPI) (string, error)
- func PutSSMSecureString(ctx context.Context, client SSMWriteAPI, name string, value string, ...) error
- func StripeSecretKey(ctx context.Context, client SSMAPI) (string, error)
- func StripeWebhookSecret(ctx context.Context, client SSMAPI) (string, error)
- type MigaduCredentials
- type SSMAPI
- type SSMWriteAPI
- type TelnyxCredentials
Constants ¶
const ( OpenAIServiceSSMParameterName = "/lesser-host/api/openai/service" ClaudeSSMParameterName = "/lesser-host/api/claude" // #nosec G101 -- SSM parameter path, not a hardcoded credential. StripeSecretKeySSMParameterName = "/lesser-host/api/stripe/secret" // #nosec G101 -- SSM parameter path, not a hardcoded credential. StripeWebhookSecretSSMParameterName = "/lesser-host/api/stripe/webhook" // #nosec G101 -- SSM parameter path, not a hardcoded credential. MigaduAPITokenSSMParameterName = "/lesser-host/migadu" // #nosec G101 -- SSM parameter path, not a hardcoded credential. TelnyxAPITokenSSMParameterName = "/lesser-host/telnyx" )
OpenAIServiceSSMParameterName and ClaudeSSMParameterName are SSM parameter paths for provider API keys.
Variables ¶
This section is empty.
Functions ¶
func ClaudeAPIKey ¶
ClaudeAPIKey loads the Claude API key from SSM.
func GetSSMParameter ¶
GetSSMParameter loads and returns a decrypted parameter value from SSM.
func GetSSMParameterCached ¶
func GetSSMParameterCached(ctx context.Context, client SSMAPI, name string, ttl time.Duration) (string, error)
GetSSMParameterCached loads a parameter from SSM and caches it for a TTL.
func IsSSMParameterAlreadyExists ¶
IsSSMParameterAlreadyExists reports whether an SSM PutParameter failed because the parameter already exists.
func MigaduAPIToken ¶
MigaduAPIToken loads the Migadu API token from SSM.
func OpenAIServiceKey ¶
OpenAIServiceKey loads the OpenAI service API key from SSM.
func PutSSMSecureString ¶
func PutSSMSecureString(ctx context.Context, client SSMWriteAPI, name string, value string, overwrite bool) error
PutSSMSecureString writes a SecureString parameter to SSM.
func StripeSecretKey ¶
StripeSecretKey loads the Stripe secret key from SSM.
Types ¶
type MigaduCredentials ¶ added in v0.1.6
type MigaduCredentials struct {
// #nosec G101,G117 -- runtime-loaded credential value; the field name is part of the stable internal API.
Username string
// #nosec G101,G117 -- runtime-loaded credential value; the field name is part of the stable internal API.
APIToken string
}
func MigaduCreds ¶ added in v0.1.6
func MigaduCreds(ctx context.Context, client SSMAPI) (MigaduCredentials, error)
MigaduCreds loads the Migadu API credentials from SSM. The parameter may be either: - a raw API key string (legacy; username must come from env), or - a JSON object including:
- username/email/user (required unless MIGADU_USERNAME is set)
- token/api_key/apiKey/key/value (required)
type SSMAPI ¶
type SSMAPI interface {
GetParameter(ctx context.Context, params *ssm.GetParameterInput, optFns ...func(*ssm.Options)) (*ssm.GetParameterOutput, error)
}
SSMAPI is the subset of the AWS SSM client used by this package.
type SSMWriteAPI ¶
type SSMWriteAPI interface {
PutParameter(ctx context.Context, params *ssm.PutParameterInput, optFns ...func(*ssm.Options)) (*ssm.PutParameterOutput, error)
}
SSMWriteAPI is the subset of the AWS SSM client used for writing parameters.
type TelnyxCredentials ¶
type TelnyxCredentials struct {
// #nosec G101,G117 -- runtime-loaded credential value; the field name is part of the stable internal API.
APIKey string
MessagingProfileID string
ConnectionID string
}
func TelnyxCreds ¶
func TelnyxCreds(ctx context.Context, client SSMAPI) (TelnyxCredentials, error)
TelnyxCreds loads the Telnyx platform credentials from SSM. The parameter may be either a raw API key string or a JSON object including: - api_key (required) - messaging_profile_id (optional) - connection_id (optional)