Documentation ¶
Overview ¶
This package provides a robust way to read password from the terminal.
- Read password from the stdin.
- Mute the terminal while inputting the password.
- If interrupted while inputting the password, the terminal will be turned back to normal.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // The input process is interrupted. ErrInterrupted = errors.New("ErrInterrupted") )
Functions ¶
This section is empty.
Types ¶
type PasswordInput ¶ added in v1.1.0
type PasswordInput interface { // InputPassword reads a password from the terminal. // If DummyPasswordInput is used, it will return the dummy password. // Errors: // - ErrInterrupted InputPassword() (string, error) }
func NewDummyPasswordInput ¶ added in v1.1.0
func NewDummyPasswordInput(dummyPassword string) PasswordInput
Create a dummy password reader for testing or some other purposes. It will return the dummy password when calling `Inputssword()`.
func NewPasswordInput ¶ added in v1.1.0
func NewPasswordInput() PasswordInput
Create a new password reader.
Click to show internal directories.
Click to hide internal directories.