credentials

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package credentials is the framework-owned boundary shared by S3, R2 and SES. Applications can use static settings, the AWS chain or a rotating Provider without importing an SDK. Credentials are never logged or stored in reports.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SettingsConfigSchema

func SettingsConfigSchema() (*config.Schema[Settings], error)

SettingsConfigSchema reuses the shared file/environment/override loader.

Types

type Mode

type Mode string
const (
	Chain  Mode = "chain"
	Static Mode = "static"
)

type Name

type Name string

func (Name) Validate

func (n Name) Validate() error

type Provider

type Provider interface {
	Retrieve(context.Context) (Value, error)
}

Provider implementations own refresh and must honor cancellation. Retrieve returns an immutable snapshot; callers never retry ambiguous delivery.

type ProviderFunc

type ProviderFunc func(context.Context) (Value, error)

func (ProviderFunc) Retrieve

func (f ProviderFunc) Retrieve(ctx context.Context) (Value, error)

type Settings

type Settings struct {
	Mode                               Mode
	Profile                            string
	AccessKey, SecretKey, SessionToken secret.String
}

Settings selects a reusable source. Chain preserves standard AWS discovery; R2 configuration requires an explicitly selected non-chain source.

func DefaultSettings

func DefaultSettings() Settings

func (Settings) Format

func (Settings) Format(s fmt.State, _ rune)

func (Settings) Validate

func (s Settings) Validate() error

type SettingsConfigKeySet

type SettingsConfigKeySet struct {
	// Mode selects mode. Set accepts Mode.
	Mode config.Key[Settings, Mode]
	// Profile selects profile. Set accepts string.
	Profile config.Key[Settings, string]
	// AccessKey selects access_key. Set accepts secret.String.
	AccessKey config.Key[Settings, secret.String]
	// SecretKey selects secret_key. Set accepts secret.String.
	SecretKey config.Key[Settings, secret.String]
	// SessionToken selects session_token. Set accepts secret.String.
	SessionToken config.Key[Settings, secret.String]
}

SettingsConfigKeySet exposes compiler-checked configuration overrides.

func SettingsConfigKeys

func SettingsConfigKeys() SettingsConfigKeySet

SettingsConfigKeys derives keys from the handwritten settings declaration.

type Source

type Source struct {
	// contains filtered or unexported fields
}

Source owns the chain's transport. Prepare is pure; Start loads chain settings at boot. Retrieval/refresh occurs on demand through the existing AWS SDK.

func Prepare

func Prepare(settings Settings) (*Source, error)

func (*Source) Close

func (s *Source) Close() error

func (Source) Format

func (Source) Format(s fmt.State, _ rune)

Format and LogValue keep private chain/static state out of diagnostics.

func (Source) LogValue

func (Source) LogValue() slog.Value

func (*Source) Retrieve

func (s *Source) Retrieve(ctx context.Context) (Value, error)

func (*Source) Start

func (s *Source) Start(ctx context.Context) error

type Value

type Value struct {
	AccessKey, SecretKey, SessionToken secret.String
	Expires                            time.Time
}

Value supports temporary, rotating credentials and explicit expiration.

func (Value) Format

func (Value) Format(s fmt.State, _ rune)

func (Value) Validate

func (v Value) Validate() error

Jump to

Keyboard shortcuts

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