setup

package
v0.0.0-...-14162ad Latest Latest
Warning

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

Go to latest
Published: May 4, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package setup provides interactive setup flows for configuring TOTP and AWS MFA credentials.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AWSSetupHandler

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

AWSSetupHandler implements SetupHandler for AWS

func NewAWSSetupHandler

func NewAWSSetupHandler(provider keychain.Provider) *AWSSetupHandler

NewAWSSetupHandler creates a new AWS setup handler

func (*AWSSetupHandler) ServiceName

func (h *AWSSetupHandler) ServiceName() string

ServiceName returns the name of the service

func (*AWSSetupHandler) Setup

func (h *AWSSetupHandler) Setup() error

Setup performs the AWS MFA setup process through an interactive CLI flow. The method guides users through the following steps:

  1. Verifies AWS CLI is installed
  2. Collects the AWS profile name (or uses default)
  3. Verifies AWS credentials by checking caller identity
  4. Guides the user through setting up a virtual MFA device in AWS Console
  5. Captures the MFA secret (either manually or via QR code)
  6. Generates TOTP codes and helps with AWS Console MFA setup
  7. Helps identify and select the newly created MFA device, with retry and refresh options
  8. Stores the MFA secret and serial number securely in system keychain
  9. Provides instructions for using the setup with the sesh command

The flow includes multiple validation steps, error handling, and user guidance for common issues that might occur during setup, such as delayed MFA device registration in the AWS API.

Returns an error if any step in the setup process fails. If successful, the user will be able to generate temporary AWS credentials with MFA protection using the 'sesh' command.

type SetupHandler

type SetupHandler interface {
	ServiceName() string
	Setup() error
}

SetupHandler defines a handler for a specific service setup

type SetupService

type SetupService interface {
	// RegisterHandler registers a setup handler for a service
	RegisterHandler(handler SetupHandler)

	// SetupService initiates the setup process for a specific service
	SetupService(serviceName string) error

	// GetAvailableServices returns a list of services that can be set up
	GetAvailableServices() []string
}

SetupService is the main service for setting up credentials

func NewSetupService

func NewSetupService(provider keychain.Provider) SetupService

NewSetupService creates a new SetupService

type TOTPSetupHandler

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

TOTPSetupHandler implements SetupHandler for TOTP

func NewTOTPSetupHandler

func NewTOTPSetupHandler(provider keychain.Provider) *TOTPSetupHandler

NewTOTPSetupHandler creates a new TOTP setup handler

func (*TOTPSetupHandler) ServiceName

func (h *TOTPSetupHandler) ServiceName() string

ServiceName returns the name of the service

func (*TOTPSetupHandler) Setup

func (h *TOTPSetupHandler) Setup() error

Setup performs the TOTP setup

Jump to

Keyboard shortcuts

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