Documentation
¶
Index ¶
- func Choose(pr string, options []string) int
- func ChooseWithDefault(pr string, defaultValue string, options []string) (string, error)
- func ParseResults(pinEntryOutput io.Reader) (output string, err error)
- func Password(pr string) string
- func RequestSecurityCode(pattern string) string
- func SetPrompter(prmpt Prompter)
- func String(pr string, defaultValue string) string
- func StringRequired(pr string) string
- func ValidateAndSetPrompter(prmptCfg string) error
- type CliPrompter
- func (cli *CliPrompter) Choose(pr string, options []string) int
- func (cli *CliPrompter) ChooseWithDefault(pr string, defaultValue string, options []string) (string, error)
- func (cli *CliPrompter) Password(pr string) string
- func (cli *CliPrompter) RequestSecurityCode(pattern string) string
- func (cli *CliPrompter) String(pr string, defaultValue string) string
- func (cli *CliPrompter) StringRequired(pr string) string
- type PinentryPrompter
- func (p *PinentryPrompter) Choose(pr string, options []string) int
- func (p *PinentryPrompter) ChooseWithDefault(prompt string, def string, choices []string) (string, error)
- func (p *PinentryPrompter) Password(pr string) string
- func (p *PinentryPrompter) RequestSecurityCode(pattern string) (output string)
- func (p *PinentryPrompter) String(pr string, defaultValue string) string
- func (p *PinentryPrompter) StringRequired(pr string) string
- type PinentryRunner
- type Prompter
- type RealPinentryRunner
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ChooseWithDefault ¶
ChooseWithDefault given the choice return the option selected with a default
func ParseResults ¶
ParseResults parses the standard output of the pinentry command and determine the user input, or wheter the program yielded any error
func RequestSecurityCode ¶
RequestSecurityCode request a security code to be entered by the user
func SetPrompter ¶
func SetPrompter(prmpt Prompter)
SetPrompter configure an aternate prompter to the default one
func StringRequired ¶
StringRequired prompt for string which is required
func ValidateAndSetPrompter ¶
ValidateAndSetPrompter validates the user configuration and will create a concrete prompter based on this configuration
Types ¶
type CliPrompter ¶
type CliPrompter struct { }
CliPrompter used to prompt for cli input
func (*CliPrompter) Choose ¶
func (cli *CliPrompter) Choose(pr string, options []string) int
Choose given the choice return the option selected
func (*CliPrompter) ChooseWithDefault ¶
func (cli *CliPrompter) ChooseWithDefault(pr string, defaultValue string, options []string) (string, error)
ChooseWithDefault given the choice return the option selected with a default
func (*CliPrompter) Password ¶
func (cli *CliPrompter) Password(pr string) string
Password prompt for password which is required
func (*CliPrompter) RequestSecurityCode ¶
func (cli *CliPrompter) RequestSecurityCode(pattern string) string
RequestSecurityCode request a security code to be entered by the user
func (*CliPrompter) String ¶
func (cli *CliPrompter) String(pr string, defaultValue string) string
StringRequired prompt for string which is required
func (*CliPrompter) StringRequired ¶
func (cli *CliPrompter) StringRequired(pr string) string
StringRequired prompt for string which is required
type PinentryPrompter ¶
type PinentryPrompter struct { Runner PinentryRunner DefaultPrompter Prompter }
PinentryPrompter is a concrete implementation of the Prompter interface. It uses the default Cli under the hood, except for RequestSecurityCode, where it uses any _pinentry_ binary to capture the security code. Its purpose is mainly to capture the TOTP code outside of the TTY, and thus making it possible to use TOTP with the credential process. https://github.com/Versent/saml2aws#using-saml2aws-as-credential-process
func NewPinentryPrompter ¶
func NewPinentryPrompter(bin string) *PinentryPrompter
NewPinentryPrompter is a factory for PinentryPrompter
func (*PinentryPrompter) Choose ¶
func (p *PinentryPrompter) Choose(pr string, options []string) int
Choose is running the default CLI Choose
func (*PinentryPrompter) ChooseWithDefault ¶
func (p *PinentryPrompter) ChooseWithDefault(prompt string, def string, choices []string) (string, error)
ChooseWithDefault is running the default CLI ChooseWithDefault
func (*PinentryPrompter) Password ¶
func (p *PinentryPrompter) Password(pr string) string
Password is runniner the default Cli Password
func (*PinentryPrompter) RequestSecurityCode ¶
func (p *PinentryPrompter) RequestSecurityCode(pattern string) (output string)
RequestSecurityCode for PinentryPrompter is creating a query for pinentry and sends it to the pinentry bin.
func (*PinentryPrompter) String ¶
func (p *PinentryPrompter) String(pr string, defaultValue string) string
String is runniner the default Cli String
func (*PinentryPrompter) StringRequired ¶
func (p *PinentryPrompter) StringRequired(pr string) string
StringRequired is runniner the default Cli StringRequired
type PinentryRunner ¶
PinentryRunner is the interface for pinentry to run itself
type Prompter ¶
type Prompter interface { RequestSecurityCode(string) string ChooseWithDefault(string, string, []string) (string, error) Choose(string, []string) int StringRequired(string) string String(string, string) string Password(string) string }
Prompter handles prompting user for input
type RealPinentryRunner ¶
type RealPinentryRunner struct {
PinentryBin string
}
RealPinentryRunner is the concrete implementation of PinentryRunner
func NewRealPinentryRunner ¶
func NewRealPinentryRunner(bin string) *RealPinentryRunner
NewRealPinentryRunner is a factory for RealPinentryRunner