Documentation ¶
Overview ¶
Package pinentry provides a client to GnuPG's pinentry.
See info pinentry. See https://www.gnupg.org/related_software/pinentry/index.html. See https://www.gnupg.org/documentation/manuals/assuan.pdf.
Index ¶
- Constants
- func IsCancelled(err error) bool
- type AssuanError
- type Client
- type ClientOption
- func WithArgs(args []string) ClientOption
- func WithBinaryName(binaryName string) ClientOption
- func WithBinaryNameFromGnuPGAgentConf() (clientOption ClientOption)
- func WithCancel(cancel string) ClientOption
- func WithCommand(command string) ClientOption
- func WithCommandf(format string, args ...interface{}) ClientOption
- func WithDebug() ClientOption
- func WithDesc(desc string) ClientOption
- func WithError(err string) ClientOption
- func WithGPGTTY() ClientOption
- func WithKeyInfo(keyInfo string) ClientOption
- func WithLogger(logger *zerolog.Logger) ClientOption
- func WithNoGlobalGrab() ClientOption
- func WithNotOK(notOK string) ClientOption
- func WithOK(ok string) ClientOption
- func WithOption(option string) ClientOption
- func WithOptions(options []string) ClientOption
- func WithProcess(process Process) ClientOption
- func WithPrompt(prompt string) ClientOption
- func WithQualityBar(qualityFunc QualityFunc) ClientOption
- func WithQualityBarToolTip(qualityBarTT string) ClientOption
- func WithTimeout(timeout time.Duration) ClientOption
- func WithTitle(title string) ClientOption
- type Process
- type QualityFunc
- type UnexpectedResponseError
Constants ¶
const ( OptionAllowExternalPasswordCache = "allow-external-password-cache" OptionDefaultOK = "default-ok" OptionDefaultCancel = "default-cancel" OptionDefaultPrompt = "default-prompt" OptionTTYName = "ttyname" OptionTTYType = "ttytype" OptionLCCType = "lc-ctype" )
Options.
const (
AssuanErrorCodeCancelled = 83886179
)
Error codes.
Variables ¶
This section is empty.
Functions ¶
func IsCancelled ¶ added in v0.0.2
IsCancelled returns if the error is operation cancelled.
Types ¶
type AssuanError ¶
An AssuanError is returned when an error is sent over the Assuan protocol.
func (*AssuanError) Error ¶
func (e *AssuanError) Error() string
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
A Client is a pinentry client.
func NewClient ¶
func NewClient(options ...ClientOption) (c *Client, err error)
NewClient returns a new Client with the given options.
type ClientOption ¶
type ClientOption func(*Client)
A ClientOption sets an option on a Client.
func WithArgs ¶
func WithArgs(args []string) ClientOption
WithArgs appends extra arguments to the pinentry command.
func WithBinaryName ¶ added in v0.0.2
func WithBinaryName(binaryName string) ClientOption
WithBinaryName sets the name of the pinentry binary name. The default is pinentry.
func WithBinaryNameFromGnuPGAgentConf ¶ added in v0.0.2
func WithBinaryNameFromGnuPGAgentConf() (clientOption ClientOption)
WithBinaryNameFromGnuPGAgentConf sets the name of the pinentry binary by reading ~/.gnupg/gpg-agent.conf, if it exists.
func WithCancel ¶
func WithCancel(cancel string) ClientOption
WithCancel sets the cancel button text.
func WithCommand ¶
func WithCommand(command string) ClientOption
WithCommand appends an Assuan command that is sent when the connection is established.
func WithCommandf ¶
func WithCommandf(format string, args ...interface{}) ClientOption
WithCommandf appends an Assuan command that is sent when the connection is established, using fmt.Sprintf to format the command.
func WithDebug ¶
func WithDebug() ClientOption
WithDebug tells the pinentry command to print debug messages.
func WithKeyInfo ¶
func WithKeyInfo(keyInfo string) ClientOption
WithKeyInfo sets a stable key identifier for use with password caching.
func WithNoGlobalGrab ¶
func WithNoGlobalGrab() ClientOption
WithNoGlobalGrab instructs pinentry to only grab the password when the window is focused.
func WithNotOK ¶
func WithNotOK(notOK string) ClientOption
WithNotOK sets the text of the non-affirmative response button.
func WithOptions ¶
func WithOptions(options []string) ClientOption
WithOptions sets multiple options.
func WithProcess ¶ added in v0.1.0
func WithProcess(process Process) ClientOption
WithProcess sets the process.
func WithQualityBar ¶
func WithQualityBar(qualityFunc QualityFunc) ClientOption
WithQualityBar enables the quality bar.
func WithQualityBarToolTip ¶ added in v0.0.2
func WithQualityBarToolTip(qualityBarTT string) ClientOption
WithQualityBarToolTip sets the quality bar tool tip.
func WithTimeout ¶
func WithTimeout(timeout time.Duration) ClientOption
WithTimeout sets the timeout.
type Process ¶ added in v0.1.0
type Process interface { io.WriteCloser ReadLine() ([]byte, bool, error) Start(string, []string) error }
A Process abstracts the interface to a pinentry Process.
type QualityFunc ¶
A QualityFunc evaluates the quality of a password. It should return a value between -100 and 100. The absolute value of the return value is used as the quality. Negative values turn the quality bar red. The boolean return value indicates whether the quality is valid.
type UnexpectedResponseError ¶
type UnexpectedResponseError struct {
Line string
}
An UnexpectedResponseError is returned when an unexpected response is received.
func (UnexpectedResponseError) Error ¶
func (e UnexpectedResponseError) Error() string