Watch
1
0
Fork
You've already forked golang-github-twpayne-go-pinentry
0
No description
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Daniel Baumann 61b613e0e2
Releasing fastforward version 4.0.1-2~ffwd13+u1.
Signed-off-by: Daniel Baumann <daniel@debian.org>
2026-07-14 16:29:54 +02:00
.github/workflows Adding upstream version 4.0.1. 2026-07-14 16:29:01 +02:00
cmd/pinentry-test Adding upstream version 4.0.1. 2026-07-14 16:29:01 +02:00
debian Releasing fastforward version 4.0.1-2~ffwd13+u1. 2026-07-14 16:29:54 +02:00
.golangci.yml Adding upstream version 4.0.1. 2026-07-14 16:29:01 +02:00
client_test.go Adding upstream version 4.0.1. 2026-07-14 16:29:01 +02:00
errors.go Adding upstream version 4.0.1. 2026-07-14 16:29:01 +02:00
gnupg.go Adding upstream version 4.0.1. 2026-07-14 16:29:01 +02:00
go.mod Adding upstream version 4.0.1. 2026-07-14 16:29:01 +02:00
go.sum Adding upstream version 4.0.1. 2026-07-14 16:29:01 +02:00
LICENSE Adding upstream version 4.0.1. 2026-07-14 16:29:01 +02:00
mockprocess_test.go Adding upstream version 4.0.1. 2026-07-14 16:29:01 +02:00
pinentry.go Adding upstream version 4.0.1. 2026-07-14 16:29:01 +02:00
pinentry_test.go Adding upstream version 4.0.1. 2026-07-14 16:29:01 +02:00
process.go Adding upstream version 4.0.1. 2026-07-14 16:29:01 +02:00
README.md Adding upstream version 4.0.1. 2026-07-14 16:29:01 +02:00

go-pinentry

PkgGoDev

Package pinentry provides a client to GnuPG's pinentry.

Key Features

  • Support for all pinentry features.
  • 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