Merge pull request #300 from Oisann/oisann/macos-ssh-agent-pinentry-fix

Fix: Use pinentry-mac as pinentry binary on macOS for approvals
This commit is contained in:
Bernd Schoolmann 2024-10-30 23:23:44 +01:00 committed by GitHub
commit b62ffb2cb4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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),