secrets

package
v0.4.5 Latest Latest
Warning

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

Go to latest
Published: May 24, 2026 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Overview

Package secrets fetches API keys and other sensitive configuration.

Index

Constants

View Source
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

func ClaudeAPIKey(ctx context.Context, client SSMAPI) (string, error)

ClaudeAPIKey loads the Claude API key from SSM.

func GetSSMParameter

func GetSSMParameter(ctx context.Context, client SSMAPI, name string) (string, error)

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

func IsSSMParameterAlreadyExists(err error) bool

IsSSMParameterAlreadyExists reports whether an SSM PutParameter failed because the parameter already exists.

func MigaduAPIToken

func MigaduAPIToken(ctx context.Context, client SSMAPI) (string, error)

MigaduAPIToken loads the Migadu API token from SSM.

func OpenAIServiceKey

func OpenAIServiceKey(ctx context.Context, client SSMAPI) (string, error)

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

func StripeSecretKey(ctx context.Context, client SSMAPI) (string, error)

StripeSecretKey loads the Stripe secret key from SSM.

func StripeWebhookSecret

func StripeWebhookSecret(ctx context.Context, client SSMAPI) (string, error)

StripeWebhookSecret loads the Stripe webhook signing secret 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)

Jump to

Keyboard shortcuts

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