Пример #1
0
func readPassword(prompt string) (password string, err error) {
	if acceptPasswordFromStdin && !isTerminalIn {
		_, err = fmt.Scanln(&password)
		return
	}
	// NOTE: speakeasy may not support multi-byte chars on Windows
	return speakeasy.Ask("Enter password: ")
}
Пример #2
0
func main() {
	password, err := speakeasy.Ask("Please enter a password: "******"Password result: %q\n", password)
	fmt.Printf("Password len: %d\n", len(password))
}