-
Notifications
You must be signed in to change notification settings - Fork 161
Conversation
rpc/personal_api.go
Outdated
} | ||
|
||
// LockAccount will lock the account associated with the given address when it's unlocked. | ||
func (e *PersonalEthAPI) LockAccount(addr common.Address) bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@alessio do you know if the keyring supports this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, it doesn't. Some backends (e.g. file, pass) require password to unlock the keystore every time it is accessed. The OS-backed backend normally unlocks the keyring once and keep it unlocked for the whole user session
Codecov Report
@@ Coverage Diff @@
## development #420 +/- ##
============================================
Coverage 70.93% 70.93%
============================================
Files 38 38
Lines 2467 2467
============================================
Hits 1750 1750
Misses 588 588
Partials 129 129 Continue to review full report at Codecov.
|
} | ||
|
||
// TODO: this only works on local keys | ||
privKey, err := e.cliCtx.Keybase.ExportPrivateKeyObject(name, password) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand why we are exporting the privkey in order to unlock it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's a bit of a workaround but the "unlocked" keys are stored in e.keys
, so to unlock the key we need to export it and save it in e.keys
, let me know if this isn't a good idea
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm I guess it's ok for now? We should document it on the comments and create an issue to track this work
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor comments. I'd be nice to add some docs too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor final comments
return false, fmt.Errorf("cannot find key with given address") | ||
} | ||
|
||
// TODO: this only works on local keys |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we wrap the code below on an if
that satisfies this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it'll return an error if it's not a local key, is that okay?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
from, err = getAddress() | ||
if err != nil { | ||
fmt.Printf("failed to get account: %s\n", err) | ||
os.Exit(1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use Fatal
or Fatalf
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you mean t.Fatal
? there's no testing.T
available in this func since it's the TestMain
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tested ACK. Pending error handling on keys ≠ local
related to: #414
Description
implements the personal ethereum JSON-RPC API
TODO:
For contributor use:
docs/
) or specification (x/<module>/spec/
)godoc
comments.Unreleased
section inCHANGELOG.md
Files changed
in the Github PR explorerFor admin use:
WIP
,R4R
,docs
, etc)