[fix] key length
- uuid is too long for encryption key
This commit is contained in:
parent
0ff7d25802
commit
852ca3ab1a
@ -4,7 +4,7 @@ mctl is a terminal-friendly remote connection client
|
|||||||
## Installation
|
## Installation
|
||||||
Install mctl using golang
|
Install mctl using golang
|
||||||
```bash
|
```bash
|
||||||
go install code.jakeyoungdev.com/jake/mctl@master #it is recommended to use a tagged version to prevent pulling unwanted changes
|
go install code.jakeyoungdev.com/jake/mctl@main #it is recommended to use a tagged version to prevent pulling unwanted changes
|
||||||
```
|
```
|
||||||
|
|
||||||
## Setup
|
## Setup
|
||||||
|
@ -11,7 +11,6 @@ import (
|
|||||||
"io"
|
"io"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/google/uuid"
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
"github.com/spf13/viper"
|
"github.com/spf13/viper"
|
||||||
"golang.org/x/term"
|
"golang.org/x/term"
|
||||||
@ -87,9 +86,11 @@ func initConfig() {
|
|||||||
viper.Set("nonce", "")
|
viper.Set("nonce", "")
|
||||||
|
|
||||||
//generate a uuid to be used as encryption key
|
//generate a uuid to be used as encryption key
|
||||||
uu := uuid.New()
|
uu := make([]byte, 32)
|
||||||
viper.Set("device", uu.String())
|
_, err := rand.Read(uu)
|
||||||
|
cobra.CheckErr(err)
|
||||||
|
|
||||||
|
viper.Set("device", string(uu))
|
||||||
viper.SafeWriteConfig()
|
viper.SafeWriteConfig()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user