diff options
| author | Joe Richey joerichey@google.com <joerichey@google.com> | 2017-10-17 02:39:07 -0700 |
|---|---|---|
| committer | Joseph Richey <joerichey94@gmail.com> | 2017-10-19 02:22:26 -0700 |
| commit | bab7dfdf68075b345e4de3ae79ea685ca884668f (patch) | |
| tree | eced4ecdfd37aae1a92f28ba0864837db1205eb0 /cmd/fscrypt/prompt.go | |
| parent | b5cc60b2b974645f0d09721c292cd243d049cbcf (diff) | |
Move around and fscrypt refactor
Diffstat (limited to 'cmd/fscrypt/prompt.go')
| -rw-r--r-- | cmd/fscrypt/prompt.go | 29 |
1 files changed, 0 insertions, 29 deletions
diff --git a/cmd/fscrypt/prompt.go b/cmd/fscrypt/prompt.go index bccf534..57d0fc7 100644 --- a/cmd/fscrypt/prompt.go +++ b/cmd/fscrypt/prompt.go @@ -23,22 +23,13 @@ import ( "fmt" "log" "os" - "os/user" "strconv" - "github.com/pkg/errors" - "github.com/google/fscrypt/actions" "github.com/google/fscrypt/metadata" "github.com/google/fscrypt/util" ) -const ( - // Suffixes for questions with a yes or no default - defaultYesSuffix = " [Y/n] " - defaultNoSuffix = " [y/N] " -) - // Descriptions for each of the protector sources var sourceDescriptions = map[metadata.SourceType]string{ metadata.SourceType_pam_passphrase: "Your login passphrase", @@ -46,26 +37,6 @@ var sourceDescriptions = map[metadata.SourceType]string{ metadata.SourceType_raw_key: "A raw 256-bit key", } -// usernameFromID returns the username for the provided UID. If the UID does not -// correspond to a user or the username is blank, an error is returned. -func usernameFromID(uid int64) (string, error) { - u, err := user.LookupId(strconv.Itoa(int(uid))) - if err != nil || u.Username == "" { - return "", errors.Wrapf(ErrUnknownUser, "uid %d", uid) - } - return u.Username, nil -} - -// formatUsername either returns the username for the provided UID, or a string -// containing the error for unknown UIDs. -func formatUsername(uid int64) string { - username, err := usernameFromID(uid) - if err != nil { - return fmt.Sprintf("[%v]", err) - } - return username -} - // formatInfo gives a string description of metadata.ProtectorData. func formatInfo(data actions.ProtectorInfo) string { switch data.Source() { |