From ff1ae8316e5ebf4f59614ee60fc4e05649d0ce05 Mon Sep 17 00:00:00 2001 From: Jonas Myhr Refseth Date: Mon, 28 Oct 2024 13:29:43 +0100 Subject: [PATCH] Fix: Use pinentry-mac as pinentry binary on macOS for approvals --- cli/agent/systemauth/pinentry/go-pinentry.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/cli/agent/systemauth/pinentry/go-pinentry.go b/cli/agent/systemauth/pinentry/go-pinentry.go index 648a7e3..67b4d99 100644 --- a/cli/agent/systemauth/pinentry/go-pinentry.go +++ b/cli/agent/systemauth/pinentry/go-pinentry.go @@ -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, @@ -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),