summaryrefslogtreecommitdiff
path: root/internal/readpassword
diff options
context:
space:
mode:
authorJakob Unterwurzacher2022-08-28 12:03:34 +0200
committerJakob Unterwurzacher2022-08-28 12:03:34 +0200
commit6677d8f1d50a2e51947dac137d126d37614a6255 (patch)
tree6a206fed1305784d3db4a706b8359e4b1b2ba65b /internal/readpassword
parent003a7fa2e53ac15d2c94a34102ae12b69b23c586 (diff)
Replace remaining golang.org/x/crypto/ssh/terminal ref with golang.org/x/term
Fixes https://github.com/rfjakob/gocryptfs/issues/681 Fixes 2a25c3a8fda1f0918fd76687561b1a9c615298b9
Diffstat (limited to 'internal/readpassword')
-rw-r--r--internal/readpassword/read.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/internal/readpassword/read.go b/internal/readpassword/read.go
index 498d09b..3ad3bb4 100644
--- a/internal/readpassword/read.go
+++ b/internal/readpassword/read.go
@@ -9,7 +9,7 @@ import (
"os/exec"
"strings"
- "golang.org/x/crypto/ssh/terminal"
+ "golang.org/x/term"
"github.com/rfjakob/gocryptfs/v2/internal/tlog"
)
@@ -31,7 +31,7 @@ func Once(extpass []string, passfile []string, prompt string) ([]byte, error) {
if prompt == "" {
prompt = "Password"
}
- if !terminal.IsTerminal(int(os.Stdin.Fd())) {
+ if !term.IsTerminal(int(os.Stdin.Fd())) {
return readPasswordStdin(prompt)
}
return readPasswordTerminal(prompt + ": ")
@@ -46,7 +46,7 @@ func Twice(extpass []string, passfile []string) ([]byte, error) {
if len(extpass) != 0 {
return readPasswordExtpass(extpass)
}
- if !terminal.IsTerminal(int(os.Stdin.Fd())) {
+ if !term.IsTerminal(int(os.Stdin.Fd())) {
return readPasswordStdin("Password")
}
p1, err := readPasswordTerminal("Password: ")
@@ -72,8 +72,8 @@ func Twice(extpass []string, passfile []string) ([]byte, error) {
func readPasswordTerminal(prompt string) ([]byte, error) {
fd := int(os.Stdin.Fd())
fmt.Fprintf(os.Stderr, prompt)
- // terminal.ReadPassword removes the trailing newline
- p, err := terminal.ReadPassword(fd)
+ // term.ReadPassword removes the trailing newline
+ p, err := term.ReadPassword(fd)
if err != nil {
return nil, fmt.Errorf("Could not read password from terminal: %v\n", err)
}