[fix] key length
- uuid is too long for encryption key
This commit is contained in:
@@ -11,7 +11,6 @@ import (
|
||||
"io"
|
||||
"os"
|
||||
|
||||
"github.com/google/uuid"
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/viper"
|
||||
"golang.org/x/term"
|
||||
@@ -87,9 +86,11 @@ func initConfig() {
|
||||
viper.Set("nonce", "")
|
||||
|
||||
//generate a uuid to be used as encryption key
|
||||
uu := uuid.New()
|
||||
viper.Set("device", uu.String())
|
||||
uu := make([]byte, 32)
|
||||
_, err := rand.Read(uu)
|
||||
cobra.CheckErr(err)
|
||||
|
||||
viper.Set("device", string(uu))
|
||||
viper.SafeWriteConfig()
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user