getpasswd for Go
Switch branches/tags
Nothing to show
Clone or download
vyzo and howeyc GetPasswdPrompt: interface to specify output writer (#35)
* GetPasswdPrompt: generic interface, with password prompt

* narrow getCh reader interface, doesn't need Fd
Latest commit bf9dde6 Jan 9, 2017

getpasswd in Go GoDoc Build Status

Retrieve password from user terminal or piped input without echo.

Verified on BSD, Linux, and Windows.


package main

import "fmt"
import ""

func main() {
	fmt.Printf("Password: ")

	// Silent. For printing *'s use gopass.GetPasswdMasked()
	pass, err := gopass.GetPasswd()
	if err != nil {
		// Handle gopass.ErrInterrupted or getch() read error

	// Do something with pass

Caution: Multi-byte characters not supported!