Skip to content

Commit

Permalink
Fix: Use pinentry-mac as pinentry binary on macOS for approvals
Browse files Browse the repository at this point in the history
  • Loading branch information
Oisann committed Oct 28, 2024
1 parent 1317e1e commit ff1ae83
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions cli/agent/systemauth/pinentry/go-pinentry.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,16 @@ import (
"github.com/twpayne/go-pinentry"
)

func getPassword(title string, description string) (string, error) {
func getBinaryClientOption() (clientOption pinentry.ClientOption) {
binaryClientOption := pinentry.WithBinaryNameFromGnuPGAgentConf()
if runtime.GOOS == "darwin" {
binaryClientOption = pinentry.WithBinaryName("pinentry-mac")
}
return binaryClientOption
}

func getPassword(title string, description string) (string, error) {
binaryClientOption := getBinaryClientOption()

client, err := pinentry.NewClient(
binaryClientOption,
Expand Down Expand Up @@ -49,8 +54,10 @@ func getApproval(title string, description string) (bool, error) {
return true, nil
}

binaryClientOption := getBinaryClientOption()

client, err := pinentry.NewClient(
pinentry.WithBinaryNameFromGnuPGAgentConf(),
binaryClientOption,
pinentry.WithGPGTTY(),
pinentry.WithTitle(title),
pinentry.WithDesc(description),
Expand Down

0 comments on commit ff1ae83

Please sign in to comment.