Documentation ¶
Overview ¶
Package app common objects
Package app common objects ¶
Package app handles informational requests ¶
Package app can insert ¶
Package app can get stats ¶
Package app can remove an entry ¶
Package app can show/clip an entry
Package app handles TOTP tokens.
Index ¶
- Constants
- Variables
- func Conv(cmd CommandOptions) error
- func Die(msg string)
- func GenerateCompletions(isBash, isHelp bool, exe string) ([]string, error)
- func Info(w io.Writer, command string, args []string) (bool, error)
- func Insert(cmd InsertOptions, mode InsertMode) error
- func JSON(cmd CommandOptions) error
- func List(cmd CommandOptions) error
- func Move(cmd CommandOptions) error
- func ReKey(cmd CommandOptions, r Keyer) error
- func Remove(cmd CommandOptions) error
- func ShowClip(cmd CommandOptions, isShow bool) error
- func Usage(verbose bool, exe string) ([]string, error)
- type CommandOptions
- type Completions
- type DefaultCommand
- func (a *DefaultCommand) Args() []string
- func (a *DefaultCommand) Confirm(prompt string) bool
- func (a *DefaultCommand) Input(pipe, multi bool) ([]byte, error)
- func (a *DefaultCommand) IsPipe() bool
- func (a *DefaultCommand) SetArgs(args ...string)
- func (a *DefaultCommand) Transaction() *backend.Transaction
- func (a *DefaultCommand) Writer() io.Writer
- type DefaultKeyer
- type Documentation
- type InsertMode
- type InsertOptions
- type Keyer
- type Mode
- type Profile
- type ReKeyEntry
- type TOTPArguments
- type TOTPOptions
Constants ¶
const ( // TOTPCommand is the parent of totp and by defaults generates a rotating token TOTPCommand = "totp" // ConvCommand handles text conversion of the data store ConvCommand = "conv" // ClearCommand is a callback to manage clipboard clearing ClearCommand = "clear" // ClipCommand will copy values to the clipboard ClipCommand = "clip" // FindCommand is for simplistic searching of entries FindCommand = "find" // InsertCommand adds a value InsertCommand = "insert" // ListCommand lists all entries ListCommand = "ls" // MoveCommand will move source to destination MoveCommand = "mv" // ShowCommand will show the value in an entry ShowCommand = "show" // VersionCommand displays version information VersionCommand = "version" // HelpCommand shows usage HelpCommand = "help" // HelpAdvancedCommand shows advanced help HelpAdvancedCommand = "verbose" // RemoveCommand removes an entry RemoveCommand = "rm" // EnvCommand shows environment information used by lockbox EnvCommand = "env" // TOTPClipCommand is the argument for copying totp codes to clipboard TOTPClipCommand = ClipCommand // TOTPMinimalCommand is the argument for getting the short version of a code TOTPMinimalCommand = "minimal" // TOTPListCommand will list the totp-enabled entries TOTPListCommand = ListCommand // TOTPOnceCommand will perform like a normal totp request but not refresh TOTPOnceCommand = "once" // BashCommand is the command to generate bash completions BashCommand = "bash" // CompletionHelpCommand outputs completion help information CompletionHelpCommand = "help" // ReKeyCommand will rekey the underlying database ReKeyCommand = "rekey" // MultiLineCommand handles multi-line inserts (when not piped) MultiLineCommand = "multiline" // TOTPShowCommand is for showing the TOTP token TOTPShowCommand = ShowCommand // TOTPInsertCommand is for inserting totp tokens TOTPInsertCommand = InsertCommand // JSONCommand handles JSON outputs JSONCommand = "json" // ZshCommand is the command to generate zsh completions ZshCommand = "zsh" )
Variables ¶
var ( // ErrNoTOTP is used when TOTP is requested BUT is disabled ErrNoTOTP = errors.New("totp is disabled") // ErrUnknownTOTPMode indicates an unknown totp argument type ErrUnknownTOTPMode = errors.New("unknown totp mode") )
Functions ¶
func GenerateCompletions ¶ added in v1.1.0
GenerateCompletions handles creating shell completion outputs
func Insert ¶ added in v1.1.0
func Insert(cmd InsertOptions, mode InsertMode) error
Insert will execute an insert
func JSON ¶ added in v1.1.0
func JSON(cmd CommandOptions) error
JSON will get entries (1 or ALL) in JSON format
func ReKey ¶ added in v1.1.0
func ReKey(cmd CommandOptions, r Keyer) error
ReKey handles entry rekeying
func ShowClip ¶
func ShowClip(cmd CommandOptions, isShow bool) error
ShowClip will handle showing/clipping an entry
Types ¶
type CommandOptions ¶
type CommandOptions interface { Confirm(string) bool Args() []string Transaction() *backend.Transaction Writer() io.Writer }
CommandOptions define how commands operate as an application
type Completions ¶ added in v1.1.0
type Completions struct { InsertCommand string TOTPListCommand string RemoveCommand string ClipCommand string ShowCommand string MultiLineCommand string MoveCommand string TOTPCommand string DoTOTPList string DoList string Executable string JSONCommand string HelpCommand string HelpAdvancedCommand string Profiles []Profile DefaultProfile Profile Shell string CompletionEnv string }
Completions handles the inputs to completions for templating
type DefaultCommand ¶
type DefaultCommand struct {
// contains filtered or unexported fields
}
DefaultCommand is the default CLI app type for actual execution
func NewDefaultCommand ¶
func NewDefaultCommand(args []string) (*DefaultCommand, error)
NewDefaultCommand creates a new app command
func (*DefaultCommand) Args ¶
func (a *DefaultCommand) Args() []string
Args will get the args passed to the application
func (*DefaultCommand) Confirm ¶
func (a *DefaultCommand) Confirm(prompt string) bool
Confirm will confirm with the user (dying if something abnormal happens)
func (*DefaultCommand) Input ¶
func (a *DefaultCommand) Input(pipe, multi bool) ([]byte, error)
Input will read user input
func (*DefaultCommand) IsPipe ¶
func (a *DefaultCommand) IsPipe() bool
IsPipe will indicate if we're receiving pipe input
func (*DefaultCommand) SetArgs ¶ added in v1.1.0
func (a *DefaultCommand) SetArgs(args ...string)
SetArgs allow updating the command args
func (*DefaultCommand) Transaction ¶
func (a *DefaultCommand) Transaction() *backend.Transaction
Transaction will return the backend transaction
type DefaultKeyer ¶ added in v1.1.0
type DefaultKeyer struct {
// contains filtered or unexported fields
}
DefaultKeyer is the default keyer for the application
func NewDefaultKeyer ¶ added in v1.1.0
func NewDefaultKeyer() (DefaultKeyer, error)
NewDefaultKeyer initializes the default keyer
func (DefaultKeyer) Insert ¶ added in v1.1.0
func (r DefaultKeyer) Insert(entry ReKeyEntry) error
Insert will insert the rekeying entry
type Documentation ¶ added in v1.1.0
type Documentation struct { Executable string MoveCommand string RemoveCommand string ReKeyCommand string ShellHelpCommand string ReKey struct { Store string KeyFile string Key string KeyMode string } }
Documentation is how documentation segments are templated
type InsertMode ¶ added in v1.1.0
type InsertMode uint
InsertMode changes how inserts are handled
const ( // SingleLineInsert is a single line entry SingleLineInsert InsertMode = iota // MultiLineInsert is a multiline insert MultiLineInsert // TOTPInsert is a singleline but from TOTP subcommands TOTPInsert )
type InsertOptions ¶
InsertOptions are functions required for insert
type Mode ¶ added in v1.1.0
type Mode int
Mode is the operating mode for TOTP operations
const ( // UnknownTOTPMode is an unknown command UnknownTOTPMode Mode = iota // InsertTOTPMode is inserting a new totp token InsertTOTPMode // ShowTOTPMode will show the token ShowTOTPMode // ClipTOTPMode will copy to clipboard ClipTOTPMode // MinimalTOTPMode will display minimal information to display the token MinimalTOTPMode // ListTOTPMode lists the available tokens ListTOTPMode // OnceTOTPMode will only show the token once and exit OnceTOTPMode )
type Profile ¶ added in v1.1.0
type Profile struct { Name string CanClip bool CanTOTP bool CanList bool ReadOnly bool IsDefault bool // contains filtered or unexported fields }
Profile is a completion profile
func (Profile) Env ¶ added in v1.1.0
Env will get the environment settable value to use this profile
func (Profile) TOTPSubCommands ¶ added in v1.1.0
TOTPSubCommands are the list of sub commands for TOTP within the profile
type ReKeyEntry ¶ added in v1.1.0
ReKeyEntry is an entry that is being rekeyed
type TOTPArguments ¶ added in v1.1.0
TOTPArguments are the parsed TOTP call arguments
func NewTOTPArguments ¶ added in v1.1.0
func NewTOTPArguments(args []string, tokenType string) (*TOTPArguments, error)
NewTOTPArguments will parse the input arguments
func (*TOTPArguments) Do ¶ added in v1.1.0
func (args *TOTPArguments) Do(opts TOTPOptions) error
Do will perform the TOTP operation
type TOTPOptions ¶ added in v1.1.0
type TOTPOptions struct { Clear func() IsNoTOTP func() (bool, error) IsInteractive func() (bool, error) // contains filtered or unexported fields }
TOTPOptions are TOTP call options
func NewDefaultTOTPOptions ¶ added in v1.1.0
func NewDefaultTOTPOptions(app CommandOptions) TOTPOptions
NewDefaultTOTPOptions gets the default option set