Generate tls secrets

This commit is contained in:
9seconds
2019-11-05 11:01:29 +03:00
parent 4c5f1a5636
commit 559a1a666b
3 changed files with 14 additions and 9 deletions
+2 -2
View File
@@ -7,7 +7,7 @@ import (
"github.com/9seconds/mtg/config"
)
func Generate(secretType string) {
func Generate(secretType, hostname string) {
data := make([]byte, config.SimpleSecretLength)
if _, err := rand.Read(data); err != nil {
panic(err)
@@ -21,6 +21,6 @@ func Generate(secretType string) {
case "secured":
PrintStdout("dd" + secret)
default:
Fatal("Unknown secret type " + secret)
PrintStdout("ee" + secret + hex.EncodeToString([]byte(hostname)))
}
}