diff --git a/cli/auth.go b/cli/auth.go index 46792c5..22739db 100644 --- a/cli/auth.go +++ b/cli/auth.go @@ -4,68 +4,21 @@ import ( "errors" "fmt" + "github.com/urfave/cli/v2" + "github.com/filecoin-project/venus-wallet/cli/helper" + "github.com/filecoin-project/venus/venus-shared/api/permission" - "github.com/urfave/cli/v2" ) var authCmd = &cli.Command{ Name: "auth", Usage: "Manage RPC permissions", Subcommands: []*cli.Command{ - authCreateAdminToken, authApiInfoToken, }, } -var authCreateAdminToken = &cli.Command{ - Name: "create-token", - Usage: "Create token", - Flags: []cli.Flag{ - &cli.StringFlag{ - Name: "perm", - Usage: "permission to assign to the token, one of: read, write, sign, admin", - }, - }, - - Action: func(cctx *cli.Context) error { - napi, closer, err := helper.GetAPI(cctx) - if err != nil { - return err - } - defer closer() - - ctx := helper.ReqContext(cctx) - - if !cctx.IsSet("perm") { - return errors.New("--perm flag not set") - } - - perm := cctx.String("perm") - idx := 0 - for i, p := range permission.AllPermissions { - if perm == p { - idx = i + 1 - } - } - - if idx == 0 { - return fmt.Errorf("--perm flag has to be one of: %s", permission.AllPermissions) - } - - // slice on [:idx] so for example: 'sign' gives you [read, write, sign] - token, err := napi.AuthNew(ctx, permission.AllPermissions[:idx]) - if err != nil { - return err - } - - // TODO: Log in audit log when it is implemented - - fmt.Println(string(token)) - return nil - }, -} - var authApiInfoToken = &cli.Command{ Name: "api-info", Usage: "Get token with API info required to connect to this node", @@ -77,7 +30,7 @@ var authApiInfoToken = &cli.Command{ }, Action: func(cctx *cli.Context) error { - napi, closer, err := helper.GetAPI(cctx) + api, closer, err := helper.GetAPI(cctx) if err != nil { return err } @@ -102,16 +55,16 @@ var authApiInfoToken = &cli.Command{ } // slice on [:idx] so for example: 'sign' gives you [read, write, sign] - token, err := napi.AuthNew(ctx, permission.AllPermissions[:idx]) + token, err := api.AuthNew(ctx, permission.AllPermissions[:idx]) if err != nil { return err } - ainfo, err := helper.GetAPIInfo(cctx) + apiInfo, err := helper.GetAPIInfo(cctx) if err != nil { return fmt.Errorf("could not get API info: %w", err) } - fmt.Printf("%s:%s\n", string(token), ainfo.Addr) + fmt.Printf("%s:%s\n", string(token), apiInfo.Addr) return nil }, } diff --git a/cli/cli_strategy/cmds.go b/cli/cli_strategy/cmds.go index 44c1910..7e157ef 100644 --- a/cli/cli_strategy/cmds.go +++ b/cli/cli_strategy/cmds.go @@ -6,7 +6,7 @@ import ( var StrategyCmd = &cli.Command{ Name: "strategy", - Usage: "Manage logging", + Usage: "Manage the signing strategy", Aliases: []string{"st"}, Subcommands: []*cli.Command{ //read diff --git a/cli/wallet.go b/cli/wallet.go index 279b570..73c6a57 100644 --- a/cli/wallet.go +++ b/cli/wallet.go @@ -54,7 +54,7 @@ var walletSetPassword = &cli.Command{ var walletUnlock = &cli.Command{ Name: "unlock", - Usage: "unlock the wallet and release private key", + Usage: "Unlock the wallet private key, so that it can be used for signing", Action: func(cctx *cli.Context) error { api, closer, err := helper.GetFullAPI(cctx) if err != nil { @@ -104,7 +104,7 @@ var walletLock = &cli.Command{ var walletLockState = &cli.Command{ Name: "lock-state", - Usage: "unlock the wallet and release private key", + Usage: "View the status of the key lock", Action: func(cctx *cli.Context) error { api, closer, err := helper.GetFullAPI(cctx) if err != nil { @@ -301,7 +301,7 @@ var walletImport = &cli.Command{ var walletSign = &cli.Command{ Name: "sign", - Usage: "sign a message", + Usage: "sign a hex-encoded message", Flags: []cli.Flag{ &cli.StringFlag{ Name: "msg-type", @@ -360,7 +360,7 @@ var walletSign = &cli.Command{ var walletDel = &cli.Command{ Name: "del", - Usage: "del a wallet and message", + Usage: "Del a wallet private key", ArgsUsage: "
", Action: func(cctx *cli.Context) error { if !cctx.Args().Present() || cctx.NArg() != 1 { diff --git a/cli/wallet_event.go b/cli/wallet_event.go index 150c5e5..57ccb10 100644 --- a/cli/wallet_event.go +++ b/cli/wallet_event.go @@ -3,15 +3,15 @@ package cli import ( "fmt" - "github.com/filecoin-project/venus-wallet/cli/helper" "github.com/urfave/cli/v2" + + "github.com/filecoin-project/venus-wallet/cli/helper" ) var supportCmds = &cli.Command{ Name: "support", - Aliases: []string{"support"}, - Usage: "tell upstream which account to support", - ArgsUsage: "account", + Usage: "Add an account that can be signed with the private key", + ArgsUsage: "