From 3f81d84cf172587bd3d45ce96f558d2645f015af Mon Sep 17 00:00:00 2001 From: Andrey Petrov Date: Fri, 26 Mar 2021 12:26:18 -0400 Subject: [PATCH] cmd/ssh-chat: Use x/term instead of howeyc/gopass, update prompt Fixes #380 --- cmd/ssh-chat/key.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/cmd/ssh-chat/key.go b/cmd/ssh-chat/key.go index 470efa4..534879e 100644 --- a/cmd/ssh-chat/key.go +++ b/cmd/ssh-chat/key.go @@ -4,9 +4,10 @@ import ( "fmt" "io/ioutil" "os" + "syscall" - "github.com/howeyc/gopass" "golang.org/x/crypto/ssh" + "golang.org/x/term" ) // ReadPrivateKey attempts to read your private key and possibly decrypt it if it @@ -24,8 +25,8 @@ func ReadPrivateKey(path string) (ssh.Signer, error) { } else if _, ok := err.(*ssh.PassphraseMissingError); ok { passphrase := []byte(os.Getenv("IDENTITY_PASSPHRASE")) if len(passphrase) == 0 { - fmt.Print("Enter passphrase: ") - passphrase, err = gopass.GetPasswd() + fmt.Println("Enter passphrase to unlock identity private key:", path) + passphrase, err = term.ReadPassword(int(syscall.Stdin)) if err != nil { return nil, fmt.Errorf("couldn't read passphrase: %v", err) }