pwinput

package module
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: May 6, 2024 License: LGPL-3.0 Imports: 8 Imported by: 1

README

Package

github.com/tappoy/pwinput

See Document.txt

License

LGPL-3.0

Author

tappoy

Documentation

Overview

This package provides a robust way to read password from the terminal.

Features:

  • Read password from the terminal.
  • Mute the terminal while inputting the password.
  • If interrupted while inputting the password, the terminal will be turned back to normal.
  • If the input is not from the terminal, it will read from the Env.In.

Dependencies:

  • github.com/tappoy/env (Env.In)
  • golang.org/x/crypto/ssh/terminal

Index

Constants

This section is empty.

Variables

View Source
var (
	// The input process is interrupted.
	ErrInterrupted = errors.New("ErrInterrupted")
)
View Source
var (
	// The dummy password to generate ErrInterrupted.
	Interrupt = "Interrupt"
)

Functions

This section is empty.

Types

type PasswordInput added in v1.1.0

type PasswordInput interface {
	// InputPassword reads a password from the terminal.
	// If DummyPasswordInput is used, it will return the dummy password.
	// Errors:
	//	- ErrInterrupted
	InputPassword() (string, error)
}

func NewDummyPasswordInput added in v1.1.0

func NewDummyPasswordInput(dummyPassword string) PasswordInput

Create a dummy password reader for testing or some other purposes. It will return the dummy password when calling `Inputssword()`.

If dummyPassword is "Interrupt" or pwinput.Interrupt, it will return ErrInterrupted when calling `InputPassword()`

func NewPasswordInput added in v1.1.0

func NewPasswordInput() PasswordInput

Create a new password reader.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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