mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-24 12:27:18 +00:00
eebcd52ee6
* slashutil * builds * interop * viz Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
23 lines
471 B
Go
23 lines
471 B
Go
package cmd
|
|
|
|
import (
|
|
"os"
|
|
|
|
"golang.org/x/crypto/ssh/terminal"
|
|
)
|
|
|
|
// PasswordReader reads a password from a mock or stdin.
|
|
type PasswordReader interface {
|
|
ReadPassword() (string, error)
|
|
}
|
|
|
|
// StdInPasswordReader reads a password from stdin.
|
|
type StdInPasswordReader struct {
|
|
}
|
|
|
|
// ReadPassword reads a password from stdin.
|
|
func (pr StdInPasswordReader) ReadPassword() (string, error) {
|
|
pwd, err := terminal.ReadPassword(int(os.Stdin.Fd()))
|
|
return string(pwd), err
|
|
}
|