aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2017-04-19 14:41:08 +0200
committerDimitri Sokolyuk <demon@dim13.org>2017-04-19 14:41:08 +0200
commit40e0295f4cce9e42a40384f7bc2eb6806171ff58 (patch)
tree99bae4206871eb26c2749fa4a5a05452368f6759
parente913ae859b4324fe11b0256b9520ff4f51e7498a (diff)
kiss
-rw-r--r--ask.go6
-rw-r--r--main.go4
2 files changed, 4 insertions, 6 deletions
diff --git a/ask.go b/ask.go
index df8f62e..c439bb5 100644
--- a/ask.go
+++ b/ask.go
@@ -12,10 +12,8 @@ var (
ErrNoMatch = errors.New("passwords don't match")
)
-func AskPassword(f *os.File, confirm bool) (string, error) {
- if f == nil {
- f = os.Stdin
- }
+func AskPassword(confirm bool) (string, error) {
+ f := os.Stdin
fd := f.Fd()
oldState, err := terminal.MakeRaw(int(fd))
diff --git a/main.go b/main.go
index 2321472..08e9cd9 100644
--- a/main.go
+++ b/main.go
@@ -70,7 +70,7 @@ func Generate(pubFile, secFile, comment string, rounds int) error {
}
if rounds > 0 {
- pass, err := AskPassword(nil, true)
+ pass, err := AskPassword(true)
if err != nil {
return err
}
@@ -115,7 +115,7 @@ func OpenSec(fname string) (*EncKey, error) {
return nil, err
}
if encKey.KDFRounds > 0 {
- pass, err := AskPassword(nil, false)
+ pass, err := AskPassword(false)
if err != nil {
return nil, err
}