Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PromptNewPassword ¶
PromptNewPassword asks the user to input a password.
While typing, the user gets feedback by the prompt color, which changes with the security of the password to green. Additionally the entrtopy of the password is shown. If minEntropy was not reached after hitting enter, this function will log a message and ask the user again.
func PromptPassword ¶
PromptPassword just opens an uncolored password prompt.
The password is not echo'd to stdout for safety reasons.
func PromptPasswordMaxTries ¶
PromptPasswordMaxTries tries to read a password maxTries times.
The typed password can be validated by the caller via the passfn function. If the user failed to pass the correct password, ErrTooManyTries is returned. For visual guidance the prompt color will gradually change from green to red with each failed try.
Types ¶
type ErrTooManyTries ¶
type ErrTooManyTries struct {
Tries int
}
ErrTooManyTries happens when the user failed the password check too often
func (ErrTooManyTries) Error ¶
func (e ErrTooManyTries) Error() string