feat: move remaining go scripts to main executable

This commit is contained in:
Sam 2023-05-11 01:13:32 +02:00
parent 4e056632c8
commit 7c7f948ad6
Signed by: sam
GPG key ID: B4EF20DDE721CAA1
3 changed files with 59 additions and 5 deletions

View file

@ -1,12 +1,20 @@
package main
package genkey
import (
"crypto/rand"
"encoding/base64"
"fmt"
"github.com/urfave/cli/v2"
)
func main() {
var Command = &cli.Command{
Name: "key",
Usage: "Generate a secure 64-byte base 64 key",
Action: run,
}
func run(c *cli.Context) error {
b := make([]byte, 64)
_, err := rand.Read(b)
@ -17,4 +25,5 @@ func main() {
s := base64.URLEncoding.EncodeToString(b)
fmt.Println(s)
return nil
}