pwd

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2018 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PromptNewPassword

func PromptNewPassword(minEntropy float64) ([]byte, error)

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

func PromptPassword() (string, error)

PromptPassword just opens an uncolored password prompt.

The password is not echo'd to stdout for safety reasons.

func PromptPasswordMaxTries

func PromptPasswordMaxTries(maxTries int, passfn func(string) bool) (string, error)

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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