Ejemplo n.º 1
0
func createPassPhrase() ([]byte, error) {
	fmt.Fprint(os.Stderr, "Enter passphrase (empty for no passphrase): ")
	pass1 := gopass.GetPasswd()
	fmt.Fprint(os.Stderr, "\nEnter same passphrase again: ")
	pass2 := gopass.GetPasswd()
	fmt.Fprintln(os.Stderr)

	if bytes.Compare(pass1, pass2) != 0 {
		return nil, errors.New("Passphrases do not match.")
	}
	return pass1, nil
}
Ejemplo n.º 2
0
func askPassPhrase(name string) []byte {
	fmt.Fprintf(os.Stderr, "Enter passphrase for %v (empty for no passphrase): ", name)
	pass := gopass.GetPasswd()
	fmt.Fprintln(os.Stderr)
	return pass
}