mirror of
https://github.com/shazow/ssh-chat.git
synced 2025-04-12 15:17:16 +03:00
cmd/ssh-chat: Use x/term instead of howeyc/gopass, update prompt
Fixes #380
This commit is contained in:
parent
4840634434
commit
3f81d84cf1
@ -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)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user