feat: use RandomString function for wallet's salt

This commit is contained in:
Adrien Waksberg 2019-07-25 07:46:04 +02:00
parent be8d5dfe60
commit 27ce2d499d
2 changed files with 2 additions and 6 deletions

View file

@ -15,6 +15,7 @@ Which is based on [Keep A Changelog](http://keepachangelog.com/)
### Changed
- Export in a file
- Use RandomString function for wallet's salt
## v1.1.0 - 2019-07-23

View file

@ -18,7 +18,6 @@ import (
"encoding/json"
"fmt"
"io/ioutil"
"math/rand"
"os"
"regexp"
"time"
@ -78,11 +77,7 @@ func (w *Wallet) Load() error {
// Save the wallet on the disk
func (w *Wallet) Save() error {
if w.Salt == "" {
salt := make([]byte, 8)
for i := 0; i < 8; i++ {
salt[i] = byte(65 + rand.Intn(25))
}
w.Salt = string(salt)
w.Salt = RandomString(12, true, true, false)
}
data, err := json.Marshal(&w.Entries)