comparison multipass-add.go @ 0:c18bc7b9d1d9

Basic binaries. checkpassword doesn't yet work.
author Paul Fisher <paul@pfish.zone>
date Sat, 24 Oct 2015 21:32:03 -0400
parents
children faf4aad86fc9
comparison
equal deleted inserted replaced
-1:000000000000 0:c18bc7b9d1d9
1 // multipass-add allows a user to add an entry to their multipass database.
2
3 package main
4
5 import (
6 "bufio"
7 "fmt"
8 "os"
9
10 "pfish.zone/go/multipass/auth"
11 "pfish.zone/go/multipass/file"
12 )
13
14 func main() {
15 passfile, err := file.ForMe()
16 reader := bufio.NewReader(os.Stdin)
17 fmt.Print("Describe password: ")
18 text, err := reader.ReadString('\n')
19 if err != nil {
20 fmt.Println(err.Error())
21 return
22 }
23 entry, password, err := auth.NewEntry(text)
24 if err != nil {
25 fmt.Println(err.Error())
26 return
27 }
28 passfile.Add(entry)
29 fmt.Printf("New password: %s\n", password)
30 }