Compare commits

...

3 commits

Author SHA1 Message Date
40d96c0776 doc: update changelog 2025-03-09 19:44:22 +01:00
586a612388 fix: remove deprecated ioutil lib 2025-03-09 19:36:01 +01:00
d72e124a47 chore: update libs 2024-10-12 10:17:51 +02:00
17 changed files with 75 additions and 40 deletions

View file

@ -1,5 +0,0 @@
---
language: go
script:
- go test ./...
- go get git.yaegashi.fr/nishiki/gpm/cmd/gpm

View file

@ -7,6 +7,16 @@ Which is based on [Keep A Changelog](http://keepachangelog.com/)
## Unreleased
### Changed
- Replace deprecated ioutil lib
## v2.0.1 - 2024-10-12
### Changed
- Update libs
### Fixed
- Choice box for generate new password was ignored
@ -52,7 +62,7 @@ Which is based on [Keep A Changelog](http://keepachangelog.com/)
### Changed
- Prefix error message with ERROR
- Prefix error message with ERROR
- Fix new line with clear input
- Replace sha1 to sha512 in pbkdf2.Key function
- Replace default config directory

View file

@ -1,9 +1,9 @@
# gpm: Go Passwords Manager
[![Version](https://img.shields.io/badge/latest_version-2.0.0-green.svg)](https://git.yaegashi.fr/nishiki/gpm/releases)
[![Version](https://img.shields.io/badge/latest_version-2.0.0-green.svg)](https://code.waks.be/nishiki/gpm/releases)
[![Build Status](https://travis-ci.org/nishiki/gpm.svg?branch=master)](https://travis-ci.org/nishiki/gpm)
[![GoReport](https://goreportcard.com/badge/git.yaegashi.fr/nishiki/gpm)](https://goreportcard.com/report/git.yaegashi.fr/nishiki/gpm)
[![License](https://img.shields.io/badge/license-Apache--2.0-blue.svg)](https://git.yaegashi.fr/nishiki/gpm/src/branch/master/LICENSE)
[![GoReport](https://goreportcard.com/badge/code.waks.be/nishiki/gpm)](https://goreportcard.com/report/code.waks.be/nishiki/gpm)
[![License](https://img.shields.io/badge/license-Apache--2.0-blue.svg)](https://code.waks.be/nishiki/gpm/src/branch/master/LICENSE)
gpm is passwords manager write in go and use AES-256 to encrypt the wallets
@ -21,7 +21,7 @@ gpm is passwords manager write in go and use AES-256 to encrypt the wallets
- Download and build
```text
go get git.yaegashi.fr/nishiki/gpm/cmd/gpm
go get code.waks.be/nishiki/gpm/cmd/gpm
```
## How to use

View file

@ -1,4 +0,0 @@
module git.yaegashi.fr/nishiki/gpm/cmd/gpm
require git.yaegashi.fr/nishiki/gpm/gpm v0.0.0
replace git.yaegashi.fr/nishiki/gpm/gpm => ../../gpm

17
go.mod Normal file
View file

@ -0,0 +1,17 @@
module code.waks.be/nishiki/gpm
go 1.23.1
require (
github.com/atotto/clipboard v0.1.4
github.com/gizak/termui/v3 v3.1.0
github.com/pquerna/otp v1.4.0
golang.org/x/crypto v0.28.0
)
require (
github.com/boombuler/barcode v1.0.1-0.20190219062509-6c824513bacc // indirect
github.com/mattn/go-runewidth v0.0.2 // indirect
github.com/mitchellh/go-wordwrap v0.0.0-20150314170334-ad45545899c7 // indirect
github.com/nsf/termbox-go v0.0.0-20190121233118-02980233997d // indirect
)

23
go.sum Normal file
View file

@ -0,0 +1,23 @@
github.com/atotto/clipboard v0.1.4 h1:EH0zSVneZPSuFR11BlR9YppQTVDbh5+16AmcJi4g1z4=
github.com/atotto/clipboard v0.1.4/go.mod h1:ZY9tmq7sm5xIbd9bOK4onWV4S6X0u6GY7Vn0Yu86PYI=
github.com/boombuler/barcode v1.0.1-0.20190219062509-6c824513bacc h1:biVzkmvwrH8WK8raXaxBx6fRVTlJILwEwQGL1I/ByEI=
github.com/boombuler/barcode v1.0.1-0.20190219062509-6c824513bacc/go.mod h1:paBWMcWSl3LHKBqUq+rly7CNSldXjb2rDl3JlRe0mD8=
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/gizak/termui/v3 v3.1.0 h1:ZZmVDgwHl7gR7elfKf1xc4IudXZ5qqfDh4wExk4Iajc=
github.com/gizak/termui/v3 v3.1.0/go.mod h1:bXQEBkJpzxUAKf0+xq9MSWAvWZlE7c+aidmyFlkYTrY=
github.com/mattn/go-runewidth v0.0.2 h1:UnlwIPBGaTZfPQ6T1IGzPI0EkYAQmT9fAEJ/poFC63o=
github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
github.com/mitchellh/go-wordwrap v0.0.0-20150314170334-ad45545899c7 h1:DpOJ2HYzCv8LZP15IdmG+YdwD2luVPHITV96TkirNBM=
github.com/mitchellh/go-wordwrap v0.0.0-20150314170334-ad45545899c7/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo=
github.com/nsf/termbox-go v0.0.0-20190121233118-02980233997d h1:x3S6kxmy49zXVVyhcnrFqxvNVCBPb2KZ9hV2RBdS840=
github.com/nsf/termbox-go v0.0.0-20190121233118-02980233997d/go.mod h1:IuKpRQcYE1Tfu+oAQqaLisqDeXgjyyltCfsaoYN18NQ=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/pquerna/otp v1.4.0 h1:wZvl1TIVxKRThZIBiwOOHOGP/1+nZyWBil9Y2XNEDzg=
github.com/pquerna/otp v1.4.0/go.mod h1:dkJfzwRKNiegxyNb54X/3fLwhCynbMspSyWKnvi1AEg=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
golang.org/x/crypto v0.28.0 h1:GBDwsMXVQi34v5CCYUm2jkJvu4cbtru2U4TN2PSyQnw=
golang.org/x/crypto v0.28.0/go.mod h1:rmgy+3RHxRZMyY0jjAJShp2zgEdOqj2AO7U0pYmeQ7U=

View file

@ -1 +0,0 @@
module git.yaegashi.fr/nishiki/gpm

View file

@ -1,15 +1,14 @@
package gpm
import (
"fmt"
"flag"
"io/ioutil"
"fmt"
"os"
"time"
"github.com/atotto/clipboard"
ui "github.com/gizak/termui/v3"
"github.com/gizak/termui/v3/widgets"
"github.com/atotto/clipboard"
)
// Options
@ -104,7 +103,7 @@ func (c *Cli) InputBox(title string, input string, hidden bool) string {
if hidden {
secret = ""
for i := 1; i <= int(float64(len(input)) * 1.75); i++ {
for i := 1; i <= int(float64(len(input))*1.75); i++ {
secret = secret + "*"
}
p.Text = secret
@ -472,7 +471,7 @@ func (c *Cli) ImportWallet() error {
return err
}
data, err := ioutil.ReadFile(*IMPORT)
data, err := os.ReadFile(*IMPORT)
if err != nil {
return err
}
@ -497,7 +496,7 @@ func (c *Cli) ExportWallet() error {
return err
}
err = ioutil.WriteFile(*EXPORT, data, 0600)
err = os.WriteFile(*EXPORT, data, 0600)
if err != nil {
return err
}
@ -553,12 +552,12 @@ func Run() {
for {
select {
case res := <-c1:
if res {
return
}
case <-time.After(300 * time.Second):
case res := <-c1:
if res {
return
}
case <-time.After(300 * time.Second):
return
}
}
}

View file

@ -17,7 +17,6 @@ package gpm
import (
"encoding/json"
"fmt"
"io/ioutil"
"os"
"os/user"
"runtime"
@ -69,7 +68,7 @@ func (c *Config) Load(path string) error {
}
data, err := ioutil.ReadFile(path)
data, err := os.ReadFile(path)
if err != nil {
return err
}
@ -95,7 +94,7 @@ func (c *Config) Save(path string) error {
return err
}
err = ioutil.WriteFile(path, []byte(data), 0644)
err = os.WriteFile(path, []byte(data), 0644)
if err != nil {
return err
}

View file

@ -1,7 +1,6 @@
package gpm
import (
"io/ioutil"
"os"
"testing"
)
@ -38,7 +37,7 @@ func TestInit(t *testing.T) {
func TestSave(t *testing.T) {
var config Config
tmpFile, _ := ioutil.TempFile(os.TempDir(), "gpm_test-")
tmpFile, _ := os.CreateTemp(os.TempDir(), "gpm_test-")
defer os.Remove(tmpFile.Name())
config.Init()
@ -51,7 +50,7 @@ func TestSave(t *testing.T) {
func TestLoadWithFile(t *testing.T) {
var config Config
tmpFile, _ := ioutil.TempFile(os.TempDir(), "gpm_test-")
tmpFile, _ := os.CreateTemp(os.TempDir(), "gpm_test-")
defer os.Remove(tmpFile.Name())
config.Init()

View file

@ -17,7 +17,6 @@ package gpm
import (
"encoding/json"
"fmt"
"io/ioutil"
"os"
"regexp"
"sort"
@ -49,7 +48,7 @@ func (w *Wallet) Load() error {
return nil
}
content, err := ioutil.ReadFile(w.Path)
content, err := os.ReadFile(w.Path)
if err != nil {
return err
}
@ -95,7 +94,7 @@ func (w *Wallet) Save() error {
return err
}
err = ioutil.WriteFile(w.Path, content, 0600)
err = os.WriteFile(w.Path, content, 0600)
if err != nil {
return err
}

View file

@ -2,7 +2,6 @@ package gpm
import (
"fmt"
"io/ioutil"
"os"
"testing"
)
@ -173,7 +172,7 @@ func TestExportAndImport(t *testing.T) {
}
func TestSaveWallet(t *testing.T) {
tmpFile, _ := ioutil.TempFile(os.TempDir(), "gpm_test-")
tmpFile, _ := os.CreateTemp(os.TempDir(), "gpm_test-")
defer os.Remove(tmpFile.Name())
wallet := generateWalletWithEntries()
@ -189,7 +188,7 @@ func TestSaveWallet(t *testing.T) {
func TestLoadWalletWithGoodPassword(t *testing.T) {
var loadWallet Wallet
tmpFile, _ := ioutil.TempFile(os.TempDir(), "gpm_test-")
tmpFile, _ := os.CreateTemp(os.TempDir(), "gpm_test-")
defer os.Remove(tmpFile.Name())
wallet := generateWalletWithEntries()
@ -213,7 +212,7 @@ func TestLoadWalletWithGoodPassword(t *testing.T) {
func TestLoadWalletWithBadPassword(t *testing.T) {
var loadWallet Wallet
tmpFile, _ := ioutil.TempFile(os.TempDir(), "gpm_test-")
tmpFile, _ := os.CreateTemp(os.TempDir(), "gpm_test-")
defer os.Remove(tmpFile.Name())
wallet := generateWalletWithEntries()

View file

@ -15,7 +15,7 @@
package main
import (
"git.yaegashi.fr/nishiki/gpm/gpm"
"code.waks.be/nishiki/gpm/internal/gpm"
)
func main() {