prompt

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrKeyboardInterrupt = errors.New("keyboard interrupt")

Functions

func Prompt

func Prompt(msg string, hidden bool) (string, error)

func PromptFileName

func PromptFileName() string

func Read

func Read(prompt string, hidden bool) ([]byte, error)

Read prints the given prompt to standard output and then reads a line of input from standard input with echoing of input disabled. This is commonly used for inputting passwords and other sensitive data. The byte slice returned does not include the terminating "\n".

func ReadWithTimings

func ReadWithTimings(prompt string, timings chan<- time.Time, hidden bool) ([]byte, error)

ReadWithTimings prints the given prompt to standard output and then reads a line of input from standard input with echoing of input disabled. This is commonly used for inputting passwords and other sensitive data. The byte slice returned does not include the terminating "\n".

The time of every keypress during password input is written into the channel 'timings'. This allows to use password input to gather entropy for a random number generator. Care must be taken to not disclose these timings to an attacker: there is correlation between keys pressed and the times between key presses.

Types

This section is empty.

Jump to

Keyboard shortcuts

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