feat: use RandomString function for wallet's salt
This commit is contained in:
parent
be8d5dfe60
commit
27ce2d499d
2 changed files with 2 additions and 6 deletions
|
@ -15,6 +15,7 @@ Which is based on [Keep A Changelog](http://keepachangelog.com/)
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
- Export in a file
|
- Export in a file
|
||||||
|
- Use RandomString function for wallet's salt
|
||||||
|
|
||||||
## v1.1.0 - 2019-07-23
|
## v1.1.0 - 2019-07-23
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,6 @@ import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"math/rand"
|
|
||||||
"os"
|
"os"
|
||||||
"regexp"
|
"regexp"
|
||||||
"time"
|
"time"
|
||||||
|
@ -78,11 +77,7 @@ func (w *Wallet) Load() error {
|
||||||
// Save the wallet on the disk
|
// Save the wallet on the disk
|
||||||
func (w *Wallet) Save() error {
|
func (w *Wallet) Save() error {
|
||||||
if w.Salt == "" {
|
if w.Salt == "" {
|
||||||
salt := make([]byte, 8)
|
w.Salt = RandomString(12, true, true, false)
|
||||||
for i := 0; i < 8; i++ {
|
|
||||||
salt[i] = byte(65 + rand.Intn(25))
|
|
||||||
}
|
|
||||||
w.Salt = string(salt)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
data, err := json.Marshal(&w.Entries)
|
data, err := json.Marshal(&w.Entries)
|
||||||
|
|
Loading…
Reference in a new issue