1
0
mirror of https://blitiri.com.ar/repos/chasquid synced 2025-12-17 14:37:02 +00:00

chasquid-util: Update ReadPassword dependency

Today, we use `golang.org/x/crypto/ssh/terminal` to read passwords. That
package is obsolete, replaced with `golang.org/x/term`.

We couldn't move them because term wasn't compatible with Go 1.11 which
was our oldest supported Go version.

Now that we moved to Go 1.15 as the oldest supported version, we can do
the update.
This commit is contained in:
Alberto Bertogli
2021-10-08 17:36:31 +01:00
parent 07c133fd15
commit fcdc49d742
2 changed files with 4 additions and 7 deletions

View File

@@ -21,11 +21,8 @@ import (
"blitiri.com.ar/go/chasquid/internal/envelope"
"blitiri.com.ar/go/chasquid/internal/normalize"
"blitiri.com.ar/go/chasquid/internal/userdb"
"golang.org/x/term"
"google.golang.org/protobuf/encoding/prototext"
// TODO: Move to golang.org/x/term once we don't support Go 1.11 anymore,
// since this one is deprecated (but still fully functional, so no rush).
"golang.org/x/crypto/ssh/terminal"
)
// Usage to show users on --help or invocation errors.
@@ -182,14 +179,14 @@ func getPassword() string {
}
fmt.Printf("Password: ")
p1, err := terminal.ReadPassword(syscall.Stdin)
p1, err := term.ReadPassword(syscall.Stdin)
fmt.Printf("\n")
if err != nil {
Fatalf("Error reading password: %v\n", err)
}
fmt.Printf("Confirm password: ")
p2, err := terminal.ReadPassword(syscall.Stdin)
p2, err := term.ReadPassword(syscall.Stdin)
fmt.Printf("\n")
if err != nil {
Fatalf("Error reading password: %v", err)