mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-09-01 09:45:18 +00:00
Add missing encryption in private key import (issue #1966). Allow key overwrite in order to fix affected wallets
This commit is contained in:
parent
c4c2203caa
commit
f4d5efbf3b
1 changed files with 2 additions and 5 deletions
|
@ -141,15 +141,12 @@ class Imported_KeyStore(Software_KeyStore):
|
||||||
self.get_private_key((0,0), password)
|
self.get_private_key((0,0), password)
|
||||||
|
|
||||||
def import_key(self, sec, password):
|
def import_key(self, sec, password):
|
||||||
if not self.can_import():
|
|
||||||
raise BaseException('This wallet cannot import private keys')
|
|
||||||
try:
|
try:
|
||||||
pubkey = public_key_from_private_key(sec)
|
pubkey = public_key_from_private_key(sec)
|
||||||
except Exception:
|
except Exception:
|
||||||
raise BaseException('Invalid private key')
|
raise BaseException('Invalid private key')
|
||||||
if pubkey in self.keypairs:
|
# allow overwrite
|
||||||
raise BaseException('Private key already in keystore')
|
self.keypairs[pubkey] = pw_encode(sec, password)
|
||||||
self.keypairs[pubkey] = sec
|
|
||||||
self.receiving_pubkeys = self.keypairs.keys()
|
self.receiving_pubkeys = self.keypairs.keys()
|
||||||
return pubkey
|
return pubkey
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue