aboutsummaryrefslogtreecommitdiff
path: root/internal/utils/utils.go
blob: 516f55c1578985aa589101d3283866b27c8d39b2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
package utils

import (
	"fmt"

	"github.com/charmbracelet/x/term"
)

func TakeSecureUserInput() ([]byte, error) {
	sensInfo, err := term.ReadPassword(0)
	fmt.Println()
	if err != nil {
		return nil, err
	}
	if len(sensInfo) == 0 {
		return nil, fmt.Errorf("passphrase cannot be empty")
	}

	return sensInfo, nil
}