Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Basic single node UI #208

Merged
merged 3 commits into from
Sep 19, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions cli/auth.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package cli

import (
"fmt"

"gopkg.in/urfave/cli.v2"

"github.com/filecoin-project/go-lotus/api"
)

var authCmd = &cli.Command{
Name: "auth",
Usage: "Manage RPC permissions",
Subcommands: []*cli.Command{
authCreateAdminToken,
},
}

var authCreateAdminToken = &cli.Command{
Name: "create-admin-token",
Usage: "Create admin token",
Action: func(cctx *cli.Context) error {
napi, err := GetFullNodeAPI(cctx)
if err != nil {
return err
}
ctx := ReqContext(cctx)

// TODO: Probably tell the user how powerful this token is
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yolo, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So the correct approach is probably to not relay on tokens like that, and instead have a more 'two-factor' approach:

  • User initializes some transaction
  • UI calls node, gets a random challenge string (think UUID), shows that to the user
  • User calls lotus auth approve [uuid]
    • Lotus shows some transaction details to the user
  • If user agrees, the transaction proceeds
$ lotus auth approve 73050e44-17fd-4425-b447-a615cfaf899b
Approving transaction:

From:      t3-5ou1i8e1-h850b-id6h5t-... # added '-'s for readability 
To:        t2-uideuid3-itohb-ue4odi-...
Amount:    12.000 000 001 FIL

Method:    multisig.Approve(123)
Gas:       1235
Gas price: 0.000 02
Gas cost:  0.000 024 70 FIL

Approve [y/N]:

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

parity solves this by having separate webui just for it, when it wants you to approve something it opens a new tab to it.


token, err := napi.AuthNew(ctx, api.AllPermissions)
if err != nil {
return err
}

// TODO: Log in audit log when it is implemented

fmt.Println(string(token))
return nil
},
}
1 change: 1 addition & 0 deletions cli/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ func ReqContext(cctx *cli.Context) context.Context {
}

var Commands = []*cli.Command{
authCmd,
chainCmd,
clientCmd,
createMinerCmd,
Expand Down
102 changes: 102 additions & 0 deletions lotuspond/front/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions lotuspond/front/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"react": "^16.8.6",
"react-cristal": "^0.0.12",
"react-dom": "^16.8.6",
"react-router-dom": "^5.0.1",
"react-scripts": "3.0.1",
"rpc-websockets": "^4.5.1",
"styled-components": "^3.3.3",
Expand Down
2 changes: 1 addition & 1 deletion lotuspond/front/src/Address.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ class Address extends React.Component {
}

addr = <span className={`pondaddr-${this.props.addr}`}
onMouseEnter={() => sheet.sheet.insertRule(`.pondaddr-${this.props.addr}, .pondaddr-${this.props.addr} * { color: #11ee11; }`, 0)}
onMouseEnter={() => sheet.sheet.insertRule(`.pondaddr-${this.props.addr}, .pondaddr-${this.props.addr} * { color: #11ee11 !important; }`, 0)}
onMouseLeave={() => sheet.sheet.deleteRule(0)}
>{addr}</span>

Expand Down
Loading