checklist

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2026 License: MIT Imports: 20 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package checklist answers, for anything authama can revoke (an SSH key, an auth token), where it is used and what is left to do to rotate or revoke it completely. Steps authama can see for itself (a key file on disk, a target it was removed from, a token still in a tool's file) are worked out each time; the ones it cannot see (the token's issuer, a copy in Termius, a CI secret) are ticked by hand, and those ticks are kept in the state directory.

An item is a key or a token. A key's checklist follows its life: while in use it lists where the key is, and once revoked or replaced by a rotation it lists what still has to go. A token has no revoked state of its own, so its revocation checklist starts when you say you are revoking it.

Index

Constants

View Source
const (
	// InUse lists where an item is, and that each place is sound.
	InUse = "in-use"
	// Revoking is a token whose revocation has been started.
	Revoking = "revoking"
	// Revoked is a key revoked with `authama ssh key revoke`.
	Revoked = "revoked"
	// Retired is a key a rotation replaced, kept in old/ for rollback.
	Retired = "retired"
)

Modes an item's checklist is in.

View Source
const (
	KindKey   = "key"
	KindToken = "token"
)

Kinds of item.

Variables

View Source
var ErrNotFound = errors.New("no key or token by that name")

ErrNotFound is an item id that names nothing authama knows.

Functions

func Format

func Format(c Checklist) string

Format renders one checklist for the terminal.

func StorePath

func StorePath(p paths.Paths) string

StorePath is checklists.json in the state directory: what the person ticked is about this machine's work, not the manifest's, so it does not travel with a bundle.

func Summary

func Summary(all []Checklist) string

Summary is one line per item: what it is, its mode and its progress.

Types

type Checklist

type Checklist struct {
	Kind        string `json:"kind"`
	ID          string `json:"id"`   // key:<fingerprint or profile/key>, token:<target>/<host>
	Name        string `json:"name"` // profile/key, or "<target> <host>"
	Mode        string `json:"mode"`
	Fingerprint string `json:"fingerprint,omitempty"`
	Since       string `json:"since,omitempty"` // when it was revoked, retired or its revocation started
	Steps       []Step `json:"steps"`
}

Checklist is one item's steps.

func (Checklist) Complete

func (c Checklist) Complete() bool

Complete reports whether every step is done.

func (Checklist) Counts

func (c Checklist) Counts() (done, total int)

Counts is how many steps are done, and how many there are.

func (Checklist) Groups

func (c Checklist) Groups() []Group

Groups returns the steps by group, in the order groups first appear.

func (Checklist) Open

func (c Checklist) Open() int

Open is how many steps still need something.

type Group

type Group struct {
	Name  string
	Steps []Step
}

Group is the steps under one heading.

type Service

type Service struct {
	P paths.Paths
	// Now is the clock, for expiry and for the date a step is ticked.
	Now func() time.Time
	// AgentFingerprints lists the fingerprints ssh-agent holds; ok is false
	// when there is no agent to ask. Replaced in tests.
	AgentFingerprints func() (fps map[string]bool, ok bool)
	// Getenv reads the environment, for whether a token's variable is set.
	Getenv func(string) string
}

Service builds checklists for one authama home.

func New

func New(p paths.Paths) *Service

New returns the service for the home at p.

func (*Service) All

func (s *Service) All() ([]Checklist, error)

All is every key's and token's checklist: keys in manifest order, then retired and revoked keys, then tokens by target and host.

func (*Service) Get

func (s *Service) Get(id string) (Checklist, error)

Get is one item's checklist by id, or by a key's profile/key reference.

func (*Service) SetRevoking

func (s *Service) SetRevoking(id string, on bool) (Checklist, error)

SetRevoking starts (on) or stops a token's revocation checklist. A key's follows its own state, so this is for tokens only.

func (*Service) Tick

func (s *Service) Tick(id, step string, on bool) (Checklist, error)

Tick marks a manual step done (on) or not done.

type State

type State string

State is how far one step is.

const (
	// Done needs nothing more.
	Done State = "done"
	// Todo is still to do.
	Todo State = "todo"
	// Unknown is a step authama could not check this time (no ssh-agent, a file
	// it could not read).
	Unknown State = "unknown"
)

type Step

type Step struct {
	ID     string `json:"id"`
	Group  string `json:"group"` // the heading it is shown under
	Title  string `json:"title"`
	Detail string `json:"detail,omitempty"`
	State  State  `json:"state"`
	// Manual steps are ones authama cannot see: the person ticks them.
	Manual bool `json:"manual,omitempty"`
	// Ticked is when a manual step was ticked, "" when it was not.
	Ticked string `json:"ticked,omitempty"`
	// Fix is the authama (or other) command that does the step.
	Fix string `json:"fix,omitempty"`
	// Link is where the step is done by hand.
	Link string `json:"link,omitempty"`
}

Step is one thing to check or do.

Jump to

Keyboard shortcuts

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