tui

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2026 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Model

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

Model is the top-level bubbletea model for the init TUI.

func New

func New(ctx context.Context, profileName string, threshold int) Model

New creates a new TUI model for profile initialization.

func (Model) Completed

func (m Model) Completed() bool

Completed returns true if the profile was successfully written.

func (Model) Enrollments

func (m Model) Enrollments() []enrollment.Enrollment

Enrollments returns the completed enrollments.

func (Model) Err

func (m Model) Err() error

Err returns the error if the model is in error state.

func (Model) Init

func (m Model) Init() tea.Cmd

func (Model) Update

func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (Model) View

func (m Model) View() tea.View

type RekeyAppExit

type RekeyAppExit int

RekeyAppExit is what the parent command needs after RekeyAppModel finishes.

const (
	RekeyAppExitSuccess     RekeyAppExit = iota // new profile written
	RekeyAppExitCanceled                        // user dismissed without writing
	RekeyAppExitFallbackCLI                     // unsupported provider for TUI unlock; run CLI flow with Plan
	RekeyAppExitError                           // something blew up; see Err()
)

type RekeyAppModel

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

RekeyAppModel is the top-level bubbletea model for rekey. It owns the full lifecycle: plan → unlock → fill-in → enroll → write. Provider interactions compose the enroll*/unlock* sub-models. Unsupported providers (for example, FIDO2 in the unlock phase — its sub-model isn't written yet) cause the model to exit with RekeyAppExitFallbackCLI so the rekey command can run the tested line-based flow instead.

func NewRekeyApp

func NewRekeyApp(ctx context.Context, profileName string, profile *config.Profile) RekeyAppModel

NewRekeyApp constructs the top-level rekey TUI model.

func (RekeyAppModel) Err

func (m RekeyAppModel) Err() error

Err returns any fatal error. Valid when Exit() == RekeyAppExitError.

func (RekeyAppModel) Exit

func (m RekeyAppModel) Exit() RekeyAppExit

Exit is the post-run signal the command should branch on.

func (RekeyAppModel) Init

func (m RekeyAppModel) Init() tea.Cmd

func (RekeyAppModel) Plan

func (m RekeyAppModel) Plan() RekeyPlan

Plan returns the resolved plan from the planning phase. Useful when Exit() == RekeyAppExitFallbackCLI so the command can run the CLI flow with the same plan the user confirmed.

func (RekeyAppModel) Update

func (m RekeyAppModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (RekeyAppModel) View

func (m RekeyAppModel) View() tea.View

type RekeyModel

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

RekeyModel is the bubbletea model for the planning step of `cryptkey rekey`.

The model is intentionally limited to the *planning* phase: review the existing provider set, toggle keep/remove, choose a new threshold, and queue type-only adds. After the user confirms, the rekey command exits the TUI and runs the actual unlock + enroll + write phases through the regular terminal so the polished masked-prompt UX from `derive` carries over without being re-implemented inside bubbletea.

func NewRekey

func NewRekey(profileName string, p *config.Profile) RekeyModel

NewRekey builds a rekey TUI model seeded from an existing profile.

func (RekeyModel) Canceled

func (m RekeyModel) Canceled() bool

Canceled reports true if the user dismissed the TUI without confirming.

func (RekeyModel) Init

func (m RekeyModel) Init() tea.Cmd

Init satisfies the tea.Model interface.

func (RekeyModel) Plan

func (m RekeyModel) Plan() RekeyPlan

Plan returns the resolved rekey plan after Update has reached the done state. Calling Plan in any other state returns a zero value.

func (RekeyModel) Update

func (m RekeyModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

Update routes key messages based on the active sub-screen.

func (RekeyModel) View

func (m RekeyModel) View() tea.View

View renders the active screen.

type RekeyPlan

type RekeyPlan struct {
	Threshold int      // new threshold; always populated
	Keep      []string // providers (type:id) explicitly kept
	Remove    []string // providers (type:id) the user toggled off
	Add       []string // provider type names to enroll fresh
}

RekeyPlan is the planning result returned by the rekey TUI.

Jump to

Keyboard shortcuts

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