improve interactive Password Entry

This commit is contained in:
Samuel Lorch 2021-09-13 09:22:10 +02:00
parent 5d1add84d1
commit 7b553fae9f

View file

@ -27,9 +27,11 @@ func GetClient(ctx context.Context) (*api.Client, error) {
fmt.Print("Enter Password:") fmt.Print("Enter Password:")
bytepw, err := term.ReadPassword(int(syscall.Stdin)) bytepw, err := term.ReadPassword(int(syscall.Stdin))
if err != nil { if err != nil {
fmt.Println("\n")
return nil, fmt.Errorf("Reading Password: %w", err) return nil, fmt.Errorf("Reading Password: %w", err)
} }
userPassword = string(bytepw) userPassword = string(bytepw)
fmt.Println("\n")
} }
client, err := api.NewClient(nil, "", serverAddress, userPrivateKey, userPassword) client, err := api.NewClient(nil, "", serverAddress, userPrivateKey, userPassword)