(ctx context.Context)
| 71 | } |
| 72 | |
| 73 | func askForPassword(ctx context.Context) (string, string, error) { |
| 74 | fmt.Printf("Password (Will be generated if left empty): ") |
| 75 | |
| 76 | password, err := term.ReadPassword(int(os.Stdin.Fd())) |
| 77 | if err != nil { |
| 78 | return "", "", errors.Wrap(ctx, err, "read password") |
| 79 | } |
| 80 | |
| 81 | fmt.Printf("\nPassword Confirmation: ") |
| 82 | confirmedPassword, err := term.ReadPassword(int(os.Stdin.Fd())) |
| 83 | if err != nil { |
| 84 | return "", "", errors.Wrap(ctx, err, "read password confirmation") |
| 85 | } |
| 86 | fmt.Println() |
| 87 | |
| 88 | return string(password), string(confirmedPassword), nil |
| 89 | } |
| 90 | |
| 91 | func isPasswordValid(password, confirmedPassword string) (string, bool) { |
| 92 | if password == "" && confirmedPassword == "" { |
no outgoing calls
no test coverage detected