wizard

package
v0.13.5 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrAgeSetupCancelled is returned when the user aborts the AGE setup wizard.
	ErrAgeSetupCancelled = errors.New("encryption setup aborted by user")
)
View Source
var (
	// ErrInstallCancelled is returned when the user aborts the install wizard.
	ErrInstallCancelled = errors.New("installation aborted by user")
)

Functions

func ApplyInstallData

func ApplyInstallData(baseTemplate string, data *InstallWizardData) (string, error)

ApplyInstallData applies the collected data to the config template. If baseTemplate is empty, the embedded default template is used.

func ConfirmAddRecipient added in v0.12.5

func ConfirmAddRecipient(configPath, buildSig string, count int) (bool, error)

ConfirmAddRecipient asks whether to add another AGE recipient.

func ConfirmNewInstall

func ConfirmNewInstall(baseDir string, buildSig string) (bool, error)

ConfirmNewInstall shows a TUI confirmation before wiping baseDir for --new-install.

func ConfirmRecipientOverwrite

func ConfirmRecipientOverwrite(recipientPath, configPath, buildSig string) (bool, error)

ConfirmRecipientOverwrite shows a TUI modal to confirm overwriting an existing AGE recipient.

func SaveAgeRecipient

func SaveAgeRecipient(recipientPath, recipient string) error

SaveAgeRecipient saves the AGE recipient to the file

Types

type AgeSetupData

type AgeSetupData struct {
	SetupType    string // "existing", "passphrase", "privatekey"
	PublicKey    string // For "existing" type
	Passphrase   string // For "passphrase" type
	PrivateKey   string // For "privatekey" type
	RecipientKey string // The final recipient key to save
}

AgeSetupData holds the collected AGE encryption setup data

func RunAgeSetupWizard

func RunAgeSetupWizard(ctx context.Context, recipientPath, configPath, buildSig string) (*AgeSetupData, error)

RunAgeSetupWizard runs the TUI-based AGE encryption setup wizard

type ExistingConfigAction

type ExistingConfigAction int

ExistingConfigAction represents how to handle an already-present configuration file.

const (
	ExistingConfigOverwrite ExistingConfigAction = iota // Start from embedded template (overwrite)
	ExistingConfigEdit                                  // Keep existing file as base and edit
	ExistingConfigSkip                                  // Leave the file untouched and skip wizard
)

func CheckExistingConfig

func CheckExistingConfig(configPath string, buildSig string) (ExistingConfigAction, error)

CheckExistingConfig checks if config file exists and asks how to proceed

type InstallWizardData

type InstallWizardData struct {
	BaseDir                string
	ConfigPath             string
	EnableSecondaryStorage bool
	SecondaryPath          string
	SecondaryLogPath       string
	EnableCloudStorage     bool
	RcloneBackupRemote     string
	RcloneLogRemote        string
	BackupFirewallRules    *bool
	NotificationMode       string // "none", "telegram", "email", "both"
	CronTime               string // HH:MM
	EnableEncryption       bool
}

InstallWizardData holds the collected installation data

func RunInstallWizard

func RunInstallWizard(ctx context.Context, configPath string, baseDir string, buildSig string) (*InstallWizardData, error)

RunInstallWizard runs the TUI-based installation wizard

Jump to

Keyboard shortcuts

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