Skip to content

Instantly share code, notes, and snippets.

@sle-c
Created April 16, 2019 02:55
Show Gist options
  • Save sle-c/e53fab6c788cfcb04db8f13c00917049 to your computer and use it in GitHub Desktop.
Save sle-c/e53fab6c788cfcb04db8f13c00917049 to your computer and use it in GitHub Desktop.
Command to generate a random 32 bits key and print to the screen
package cmd
import (
"fmt"
"github.com/omnisyle/goliauth"
"github.com/spf13/cobra"
)
func keyCmd() *cobra.Command {
command := &cobra.Command{
Use: "key",
Short: "Generate a 32 bit random key",
Run: func(cmd *cobra.Command, args []string) {
fmt.Printf("%x\n", goliauth.NewRandomKey())
},
}
return command
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment