mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-09-11 15:21:02 +00:00
update keygen subcommand
this updates the subcommand to output a single secret key instead of two reflecting changes made to AuthN/authZ
This commit is contained in:
parent
22a60a19f8
commit
950e62aae9
2 changed files with 6 additions and 7 deletions
|
|
@ -13,9 +13,9 @@ func newKeygenCommand(stdin io.Reader, stdout io.Writer, stderr io.Writer) *cobr
|
|||
cmd := ctl.NewKeygenCommand(stdin, stdout, stderr)
|
||||
ccmd := &cobra.Command{
|
||||
Use: "keygen",
|
||||
Short: "Generate keys for authentication.",
|
||||
Short: "Generate secret key for authentication.",
|
||||
Long: `
|
||||
Generate hash and block keys to configure FeatureBase for Authentication.
|
||||
Generate secret key to configure FeatureBase for Authentication.
|
||||
`,
|
||||
RunE: func(c *cobra.Command, args []string) error {
|
||||
return cmd.Run(context.Background())
|
||||
|
|
@ -23,6 +23,6 @@ Generate hash and block keys to configure FeatureBase for Authentication.
|
|||
}
|
||||
|
||||
flags := ccmd.Flags()
|
||||
flags.IntVarP(&cmd.KeyLength, "length", "l", 32, "length of keys to produce")
|
||||
flags.IntVarP(&cmd.KeyLength, "length", "l", 32, "length of the key to produce")
|
||||
return ccmd
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import (
|
|||
pilosa "github.com/molecula/featurebase/v2"
|
||||
)
|
||||
|
||||
// Keygen represents a command for generating crytographic keys.
|
||||
// Keygen represents a command for generating a crytographic key.
|
||||
type KeygenCommand struct {
|
||||
CmdIO *pilosa.CmdIO
|
||||
KeyLength int
|
||||
|
|
@ -23,9 +23,8 @@ func NewKeygenCommand(stdin io.Reader, stdout, stderr io.Writer) *KeygenCommand
|
|||
}
|
||||
}
|
||||
|
||||
// Run keys to use for authentication .
|
||||
// Run keygen to obtain key to use for authentication .
|
||||
func (kg *KeygenCommand) Run(_ context.Context) error {
|
||||
fmt.Printf("hash-key = \"%+x\"\n", securecookie.GenerateRandomKey(kg.KeyLength))
|
||||
fmt.Printf("block-key = \"%+x\"\n", securecookie.GenerateRandomKey(kg.KeyLength))
|
||||
fmt.Printf("secret-key = \"%+x\"\n", securecookie.GenerateRandomKey(kg.KeyLength))
|
||||
return nil
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue