Add bit selection to config generation

This commit is contained in:
meshmayhem 2024-09-18 16:03:38 +00:00
parent 2795260d21
commit c3bb88bd79
No known key found for this signature in database
GPG key ID: 23B40B90A3841D68

View file

@ -40,6 +40,7 @@ type node struct {
// The main function is responsible for configuring and starting Yggdrasil.
func main() {
genconf := flag.Bool("genconf", false, "print a new config to stdout")
security := flag.Int("security", 0, "use in combination with either -genconf or -autoconf, generates a higher security address up to the security bits desired")
useconf := flag.Bool("useconf", false, "read HJSON/JSON config from stdin")
useconffile := flag.String("useconffile", "", "read HJSON/JSON config from specified file path")
normaliseconf := flag.Bool("normaliseconf", false, "use in combination with either -useconf or -useconffile, outputs your configuration normalised")
@ -87,6 +88,11 @@ func main() {
}
cfg := config.GenerateConfig()
if (*security > 0) {
// Checks if the security flag is set, and generates a key with that many security bits
newKey, _ := config.NewSecureKeyPair(*security)
cfg.PrivateKey = []byte(newKey)
}
var err error
switch {
case *ver: