File: README.md

package info (click to toggle)
golang-github-twpayne-go-pinentry 0.2.0-2
  • links: PTS, VCS
  • area: main
  • in suites: experimental, forky, sid, trixie
  • size: 132 kB
  • sloc: makefile: 4
file content (53 lines) | stat: -rw-r--r-- 1,229 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# go-pinentry

[![PkgGoDev](https://pkg.go.dev/badge/github.com/twpayne/go-pinentry)](https://pkg.go.dev/github.com/twpayne/go-pinentry)

Package `pinentry` provides a client to [GnuPG's
pinentry](https://www.gnupg.org/related_software/pinentry/index.html).

## Key Features

* Support for all `pinentry` features.
* Idiomatic Go API.
* Well tested.

## Example

```go
	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 pin, fromCache, err := client.GetPIN(); {
	case pinentry.IsCancelled(err):
		fmt.Println("Cancelled")
	case err != nil:
		return err
	case fromCache:
		fmt.Printf("PIN: %s (from cache)\n", pin)
	default:
		fmt.Printf("PIN: %s\n", pin)
	}
```

## Comparison with related packages

Compared to
[`github.com/gopasspw/pinentry`](https://github.com/gopasspw/pinentry), this
package:
* Implements all `pinentry` features.
* Includes tests.
* Implements a full parser of the underlying Assuan protocol for better
  compatibility with all `pinentry` implementations.

## License

MIT