diff options
author | Jeffrey Wilcke <jeffrey@ethereum.org> | 2015-10-23 00:27:05 +0800 |
---|---|---|
committer | Jeffrey Wilcke <jeffrey@ethereum.org> | 2015-10-23 00:27:05 +0800 |
commit | dce503779b2866d1d35b4582470604c0d7e156db (patch) | |
tree | 7d8817ec84be38b911f967f1ecd5618d02e4caa9 /rpc/useragent | |
parent | 58d0752fdd1c7363fb1a127cd7e0a86d7602be02 (diff) | |
parent | 8b81ad1fc40080af441c0c6df94f0b2ea46e320b (diff) | |
download | dexon-dce503779b2866d1d35b4582470604c0d7e156db.tar dexon-dce503779b2866d1d35b4582470604c0d7e156db.tar.gz dexon-dce503779b2866d1d35b4582470604c0d7e156db.tar.bz2 dexon-dce503779b2866d1d35b4582470604c0d7e156db.tar.lz dexon-dce503779b2866d1d35b4582470604c0d7e156db.tar.xz dexon-dce503779b2866d1d35b4582470604c0d7e156db.tar.zst dexon-dce503779b2866d1d35b4582470604c0d7e156db.zip |
Merge pull request #1840 from ethersphere/console
console, cli, api fixes
Diffstat (limited to 'rpc/useragent')
-rw-r--r-- | rpc/useragent/remote_frontend.go | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/rpc/useragent/remote_frontend.go b/rpc/useragent/remote_frontend.go index 0dd4a6049..944ab287a 100644 --- a/rpc/useragent/remote_frontend.go +++ b/rpc/useragent/remote_frontend.go @@ -49,6 +49,31 @@ func (fe *RemoteFrontend) Enable() { fe.enabled = true } +func (fe *RemoteFrontend) AskPassword() (string, bool) { + if !fe.enabled { + return "", false + } + + err := fe.send(AskPasswordMethod) + if err != nil { + glog.V(logger.Error).Infof("Unable to send password request to agent - %v\n", err) + return "", false + } + + passwdRes, err := fe.recv() + if err != nil { + glog.V(logger.Error).Infof("Unable to recv password response from agent - %v\n", err) + return "", false + } + + if passwd, ok := passwdRes.Result.(string); ok { + return passwd, true + } + + return "", false + +} + // UnlockAccount asks the user agent for the user password and tries to unlock the account. // It will try 3 attempts before giving up. func (fe *RemoteFrontend) UnlockAccount(address []byte) bool { |