auth

package
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2026 License: MPL-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IAMUserAuth

type IAMUserAuth struct {
	RootEmail string
	Username  string
	Password  string
	TOTP      TOTPProvider // optional, for accounts with 2FA
	// contains filtered or unexported fields
}

IAMUserAuth holds credentials for IAM user authentication. Token is cached so multiple SDK clients sharing the same instance do not trigger redundant logins.

func (*IAMUserAuth) Authenticate

func (a *IAMUserAuth) Authenticate(ctx context.Context) (accessToken string, expiresAt int64, err error)

Authenticate returns a valid access token. If a cached token exists and has not expired, it is returned immediately without a network call.

type SecretTOTP

type SecretTOTP struct {
	Secret string // base32-encoded TOTP secret
}

SecretTOTP computes TOTP codes from a base32-encoded shared secret (RFC 6238).

func (*SecretTOTP) GetCode

func (s *SecretTOTP) GetCode(_ context.Context) (string, error)

GetCode generates a 6-digit TOTP code for the current 30-second interval.

type TOTPFunc

type TOTPFunc func(ctx context.Context) (string, error)

TOTPFunc adapts a plain function into a TOTPProvider. Use this to integrate any external TOTP source (Vault, env vars, prompts, etc).

func (TOTPFunc) GetCode

func (f TOTPFunc) GetCode(ctx context.Context) (string, error)

GetCode delegates to the wrapped function.

type TOTPProvider

type TOTPProvider interface {
	GetCode(ctx context.Context) (string, error)
}

TOTPProvider returns a TOTP code for 2FA.

Jump to

Keyboard shortcuts

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