From 852ca3ab1a036311a0e586d094519e34b3848698 Mon Sep 17 00:00:00 2001 From: jake Date: Wed, 16 Apr 2025 16:25:45 -0400 Subject: [PATCH] [fix] key length - uuid is too long for encryption key --- README.md | 2 +- cmd/config.go | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index cfb39f4..d189e44 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ mctl is a terminal-friendly remote connection client ## Installation Install mctl using golang ```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 diff --git a/cmd/config.go b/cmd/config.go index 4c3d7e9..dc1f8b3 100644 --- a/cmd/config.go +++ b/cmd/config.go @@ -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() } }