input

package
v1.0.4 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	Encrypt cryptoOperation = "encrypt"
	Decrypt cryptoOperation = "decrypt"
)

Variables

View Source
var ErrSecretTooShort = encryptor.ErrKeyTooShort

ErrSecretTooShort is returned when the secret key is less than 11 characters long.

Functions

This section is empty.

Types

type InputReader

type InputReader interface {
	// ReadString reads a string from the input.
	ReadString(sep byte) (string, error)
}

InputReader defines the interface for reading user input.

type InputReaderCaller added in v1.0.1

type InputReaderCaller func() InputReader

InputReaderCaller is a function that returns an InputReader.

func StdReader

func StdReader() InputReaderCaller

StdReader is the standard input reader.

type ReadPSWDFn

type ReadPSWDFn func(fd int) ([]byte, error)

ReadPSWDFn defines the function type for reading a password.

var (
	// ErrInvalidOperation is returned when the user enters an invalid operation.
	ErrInvalidOperation = errors.New("invalid operation. Please choose 'encrypt' or 'decrypt'")

	// ReadPassword is the function for reading a password.
	ReadPassword ReadPSWDFn = PasswordReader()
)

func PasswordReader

func PasswordReader() ReadPSWDFn

type UserInput

type UserInput struct {
	Operation cryptoOperation
	Path,
	OutputPath,
	Secret string
}

UserInput defines the structure for user input.

func User

func User(irc InputReaderCaller, readPSWD ReadPSWDFn) (UserInput, error)

User prompts the user to enter the operation, input file path, output file path, and secret key.

Jump to

Keyboard shortcuts

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