Reworked base

This commit is contained in:
9seconds
2019-08-29 13:16:08 +03:00
parent 09c7ce45d2
commit 07985cf418
26 changed files with 1481 additions and 271 deletions
+25
View File
@@ -0,0 +1,25 @@
package newcli
import (
"crypto/rand"
"encoding/hex"
"github.com/9seconds/mtg/newconfig"
)
func Generate(secretType string) {
data := make([]byte, newconfig.SimpleSecretLength)
if _, err := rand.Read(data); err != nil {
panic(err)
}
secret := hex.EncodeToString(data)
switch secretType {
case "simple":
PrintStdout(secret)
case "secured":
PrintStdout("dd" + secret)
default:
Fatal("Unknown secret type " + secret)
}
}