Skip to content

Commit

Permalink
feat: remove key run
Browse files Browse the repository at this point in the history
  • Loading branch information
mehditeymorian committed Aug 31, 2022
1 parent 4d90f46 commit 19565e3
Showing 1 changed file with 0 additions and 32 deletions.
32 changes: 0 additions & 32 deletions internal/cmd/key/key.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ package key
import (
"os"

"github.com/AlecAivazis/survey/v2"
"github.com/mehditeymorian/jwt/internal/cmd"
"github.com/mehditeymorian/jwt/internal/config"
"github.com/pterm/pterm"
"github.com/spf13/cobra"
)
Expand All @@ -14,7 +12,6 @@ func Command() *cobra.Command {
c := &cobra.Command{
Use: "key",
Short: "generate different jwt keys",
Run: key,
Example: "jwt key rsa|hmac|ecdsa",
}
cmd.SetKeyFlags(c)
Expand All @@ -28,35 +25,6 @@ func Command() *cobra.Command {
return c
}

func key(cmd *cobra.Command, args []string) {

prompt := &survey.Select{
Message: "select key type",
Options: []string{
string(config.RSA),
string(config.HMAC),
string(config.ECDSA),
},
}

var selected string

survey.AskOne(prompt, &selected)

switch config.SigningMethod(selected) {
case config.RSA:
rsa(cmd, args)
case config.HMAC:
hmac(cmd, args)
case config.ECDSA:
ecdsa(cmd, args)

default:
pterm.Warning.Println("this type of key is not provided")
}

}

func SaveKey(filename string, content []byte) {
dir, _ := os.Getwd()

Expand Down

0 comments on commit 19565e3

Please sign in to comment.