Skip to content

Commit

Permalink
one-time use private key
Browse files Browse the repository at this point in the history
Close steemit#280

Instead of MissingKeyError when the key can't be found in the wallet, users have the second chance to enter the private key for a one-time use.
  • Loading branch information
economicstudio committed Mar 10, 2019
1 parent 57fb0f1 commit 026a092
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion steem/transactionbuilder.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

from .account import Account
from .instance import shared_steemd_instance
import getpass

log = logging.getLogger(__name__)

Expand Down Expand Up @@ -118,7 +119,13 @@ def sign(self):
raise e

if not any(self.wifs):
raise MissingKeyError
# if no key found in the wallet, give a chance to enter it manually for a one-time use
print("The required private key can't be found in the wallet.")
wif = getpass.getpass("Private key to sign: ")
if wif == '':
raise MissingKeyError
else:
self.wifs.add(wif)

signedtx.sign(self.wifs, chain=self.steemd.chain_params)
self["signatures"].extend(signedtx.json().get("signatures"))
Expand Down

0 comments on commit 026a092

Please sign in to comment.