This commit is contained in:
Greg 2019-09-10 11:36:03 -04:00
parent 2c4c708b3a
commit 12b57d263f
5 changed files with 51 additions and 53 deletions

View File

@ -223,7 +223,7 @@ func eventLoop() {
log(Info, err) log(Info, err)
return return
} }
for i,n := range ids { for i, n := range ids {
if i >= len(idBtns) { if i >= len(idBtns) {
idBtns = append(idBtns, &Button{ idBtns = append(idBtns, &Button{
Face: face, Face: face,
@ -496,7 +496,7 @@ func eventLoop() {
insValue = passvalEd.Text() insValue = passvalEd.Text()
for _, n := range pathnames { for _, n := range pathnames {
if insName == n { if insName == n {
log(Info,"Password exists") log(Info, "Password exists")
page = confirmPage page = confirmPage
w.Invalidate() w.Invalidate()
return return

View File

@ -69,7 +69,7 @@ func main() {
if opts.clip { if opts.clip {
passgo.Clip(p) passgo.Clip(p)
} else { } else {
fmt.Print(p) fmt.Println(p)
} }
default: default:
usage() usage()

View File

@ -22,4 +22,3 @@ func (s *Store) nativeEncrypt(pw string) ([]byte, error) {
func nativeIdentities() ([]string, error) { func nativeIdentities() ([]string, error) {
return nil, fmt.Errorf("NOT IMPLEMENTED") return nil, fmt.Errorf("NOT IMPLEMENTED")
} }

View File

@ -11,14 +11,14 @@ import (
"os/exec" "os/exec"
"os/user" "os/user"
"path" "path"
"strings"
"strconv" "strconv"
"strings"
"sync" "sync"
"golang.org/x/crypto/openpgp" "golang.org/x/crypto/openpgp"
"github.com/jcmdev0/gpgagent"
"github.com/fsnotify/fsnotify" "github.com/fsnotify/fsnotify"
"github.com/jcmdev0/gpgagent"
) )
func (s *Store) nativeDecrypt(name string) (string, error) { func (s *Store) nativeDecrypt(name string) (string, error) {
@ -59,11 +59,11 @@ func nativeIdentities() ([]string, error) {
idMux.Lock() idMux.Lock()
defer idMux.Unlock() defer idMux.Unlock()
if cachedIdentities != nil { if cachedIdentities != nil {
ret := make([]string,len(cachedIdentities)) ret := make([]string, len(cachedIdentities))
copy(ret, cachedIdentities) copy(ret, cachedIdentities)
return ret, nil return ret, nil
} }
ret := make([]string,0) ret := make([]string, 0)
fmt.Println("calling gpg") fmt.Println("calling gpg")
output, err := exec.Command("gpg", "--list-secret-keys", "--with-colons").Output() output, err := exec.Command("gpg", "--list-secret-keys", "--with-colons").Output()
if err != nil { if err != nil {
@ -71,9 +71,9 @@ func nativeIdentities() ([]string, error) {
} }
scanner := bufio.NewScanner(bytes.NewBuffer(output)) scanner := bufio.NewScanner(bytes.NewBuffer(output))
for scanner.Scan() { for scanner.Scan() {
fs := strings.Split(scanner.Text(),":") fs := strings.Split(scanner.Text(), ":")
if fs[0] == "uid" { if fs[0] == "uid" {
fmt.Printf("%s: %s\n",fs[0], fs[9]) fmt.Printf("%s: %s\n", fs[0], fs[9])
ret = append(ret, fs[9]) ret = append(ret, fs[9])
} }
} }
@ -211,4 +211,3 @@ func Clip(x string) {
cmd.Stdin = b cmd.Stdin = b
cmd.Run() cmd.Run()
} }

View File

@ -107,7 +107,7 @@ func (s *Store) SetID(id string) error {
return err return err
} }
} }
return ioutil.WriteFile(path.Join(s.Dir, ".gpg-id"), []byte(id + "\n"), 0644) return ioutil.WriteFile(path.Join(s.Dir, ".gpg-id"), []byte(id+"\n"), 0644)
} }
type caseInsensitive []os.FileInfo type caseInsensitive []os.FileInfo
@ -285,5 +285,5 @@ func (s *Store) Insert(name, value string) error {
return err return err
} }
//} //}
return ioutil.WriteFile(path.Join(s.Dir, name + ".gpg"), enc, 0644) return ioutil.WriteFile(path.Join(s.Dir, name+".gpg"), enc, 0644)
} }