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:
commit
b62ffb2cb4
|
@ -9,11 +9,16 @@ import (
|
||||||
"github.com/twpayne/go-pinentry"
|
"github.com/twpayne/go-pinentry"
|
||||||
)
|
)
|
||||||
|
|
||||||
func getPassword(title string, description string) (string, error) {
|
func getBinaryClientOption() (clientOption pinentry.ClientOption) {
|
||||||
binaryClientOption := pinentry.WithBinaryNameFromGnuPGAgentConf()
|
binaryClientOption := pinentry.WithBinaryNameFromGnuPGAgentConf()
|
||||||
if runtime.GOOS == "darwin" {
|
if runtime.GOOS == "darwin" {
|
||||||
binaryClientOption = pinentry.WithBinaryName("pinentry-mac")
|
binaryClientOption = pinentry.WithBinaryName("pinentry-mac")
|
||||||
}
|
}
|
||||||
|
return binaryClientOption
|
||||||
|
}
|
||||||
|
|
||||||
|
func getPassword(title string, description string) (string, error) {
|
||||||
|
binaryClientOption := getBinaryClientOption()
|
||||||
|
|
||||||
client, err := pinentry.NewClient(
|
client, err := pinentry.NewClient(
|
||||||
binaryClientOption,
|
binaryClientOption,
|
||||||
|
@ -49,8 +54,10 @@ func getApproval(title string, description string) (bool, error) {
|
||||||
return true, nil
|
return true, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
binaryClientOption := getBinaryClientOption()
|
||||||
|
|
||||||
client, err := pinentry.NewClient(
|
client, err := pinentry.NewClient(
|
||||||
pinentry.WithBinaryNameFromGnuPGAgentConf(),
|
binaryClientOption,
|
||||||
pinentry.WithGPGTTY(),
|
pinentry.WithGPGTTY(),
|
||||||
pinentry.WithTitle(title),
|
pinentry.WithTitle(title),
|
||||||
pinentry.WithDesc(description),
|
pinentry.WithDesc(description),
|
||||||
|
|
Loading…
Reference in New Issue