效果
包
github.com/howeyc/gopass
方法
GetPasswd
// GetPasswd returns the password read from the terminal without echoing input.
// The returned byte array does not include end-of-line characters.
// 返回从终端读取的密码,不在命令行输出
func GetPasswd() ([]byte, error) {
return getPasswd("", false, os.Stdin, os.Stdout)
}
GetPasswdMasked
// GetPasswdMasked returns the password read from the terminal, echoing asterisks.
// The returned byte array does not include end-of-line characters.
//返回从终端读取的密码,返回星号。
func GetPasswdMasked() ([]byte, error) {
return getPasswd("", true, os.Stdin, os.Stdout)
}
GetPasswdPrompt
// GetPasswdPrompt prompts the user and returns the password read from the terminal.
// If mask is true, then asterisks are echoed.
// The returned byte array does not include end-of-line characters.