gopass

package
v1.5.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 12, 2017 License: Apache-2.0, Apache-2.0, ISC Imports: 5 Imported by: 0

README

getpasswd in Go GoDoc Build Status

Retrieve password from user terminal or piped input without echo.

Verified on BSD, Linux, and Windows.

Example:

package main

import "fmt"
import "github.com/howeyc/gopass"

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!

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInterrupted       = errors.New("interrupted")
	ErrMaxLengthExceeded = fmt.Errorf("maximum byte limit (%v) exceeded", maxLength)
)

Functions

func GetPasswd

func GetPasswd() ([]byte, error)

GetPasswd returns the password read from the terminal without echoing input. The returned byte array does not include end-of-line characters.

func GetPasswdMasked

func GetPasswdMasked() ([]byte, error)

GetPasswdMasked returns the password read from the terminal, echoing asterisks. The returned byte array does not include end-of-line characters.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL