passphrase

package
v0.7.6 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package passphrase provides passphrase input handling for encryption.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrPassphraseMismatch is returned when confirmation doesn't match.
	ErrPassphraseMismatch = errors.New("passphrases do not match")
	// ErrCancelled is returned when user cancels the operation.
	ErrCancelled = errors.New("operation cancelled")
)

Functions

This section is empty.

Types

type Prompter

type Prompter struct {
	Stdin  io.Reader
	Stdout io.Writer
	Stderr io.Writer
	// contains filtered or unexported fields
}

Prompter handles passphrase input prompts.

func (*Prompter) PromptForDecrypt

func (p *Prompter) PromptForDecrypt() (string, error)

PromptForDecrypt prompts for passphrase for decryption (no confirmation).

func (*Prompter) PromptForEncrypt

func (p *Prompter) PromptForEncrypt() (string, error)

PromptForEncrypt prompts for passphrase with confirmation for encryption. Returns empty string if user chooses to continue without encryption after warning. Returns ErrCancelled if user declines to continue without encryption.

func (*Prompter) ReadFromStdin

func (p *Prompter) ReadFromStdin() (string, error)

ReadFromStdin reads a single line from stdin without prompting. Used with --passphrase-stdin flag for non-interactive input.

func (*Prompter) WarnNonTTY

func (p *Prompter) WarnNonTTY()

WarnNonTTY prints warning for non-TTY environment.

Jump to

Keyboard shortcuts

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