No description
- Go 100%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
|
|
||
| .github/workflows | ||
| cmd/pinentry-test | ||
| debian | ||
| .golangci.yml | ||
| client_test.go | ||
| errors.go | ||
| gnupg.go | ||
| go.mod | ||
| go.sum | ||
| LICENSE | ||
| mockprocess_test.go | ||
| pinentry.go | ||
| pinentry_test.go | ||
| process.go | ||
| README.md | ||
go-pinentry
Package pinentry provides a client to GnuPG's
pinentry.
Key Features
- Support for all
pinentryfeatures. - Idiomatic Go API.
- Well tested.
Example
client, err := pinentry.NewClient(
pinentry.WithBinaryNameFromGnuPGAgentConf(),
pinentry.WithDesc("My description"),
pinentry.WithGPGTTY(),
pinentry.WithPrompt("My prompt:"),
pinentry.WithTitle("My title"),
)
if err != nil {
return err
}
defer client.Close()
switch result, err := client.GetPIN(); {
case pinentry.IsCancelled(err):
fmt.Println("Cancelled")
case err != nil:
return err
case result.PasswordFromCache:
fmt.Printf("PIN: %s (from cache)\n", result.PIN)
default:
fmt.Printf("PIN: %s\n", result.PIN)
}
License
MIT