wallet: encrypt storage by default
notably, now also in kivy
This commit is contained in:
@@ -34,7 +34,7 @@ from . import bitcoin
|
|||||||
from . import keystore
|
from . import keystore
|
||||||
from . import mnemonic
|
from . import mnemonic
|
||||||
from .bip32 import is_bip32_derivation, xpub_type, normalize_bip32_derivation, BIP32Node
|
from .bip32 import is_bip32_derivation, xpub_type, normalize_bip32_derivation, BIP32Node
|
||||||
from .keystore import bip44_derivation, purpose48_derivation, Hardware_KeyStore
|
from .keystore import bip44_derivation, purpose48_derivation, Hardware_KeyStore, KeyStore
|
||||||
from .wallet import (Imported_Wallet, Standard_Wallet, Multisig_Wallet,
|
from .wallet import (Imported_Wallet, Standard_Wallet, Multisig_Wallet,
|
||||||
wallet_types, Wallet, Abstract_Wallet)
|
wallet_types, Wallet, Abstract_Wallet)
|
||||||
from .storage import (WalletStorage, StorageEncryptionVersion,
|
from .storage import (WalletStorage, StorageEncryptionVersion,
|
||||||
@@ -85,7 +85,7 @@ class BaseWizard(Logger):
|
|||||||
self.pw_args = None # type: Optional[WizardWalletPasswordSetting]
|
self.pw_args = None # type: Optional[WizardWalletPasswordSetting]
|
||||||
self._stack = [] # type: List[WizardStackItem]
|
self._stack = [] # type: List[WizardStackItem]
|
||||||
self.plugin = None # type: Optional[BasePlugin]
|
self.plugin = None # type: Optional[BasePlugin]
|
||||||
self.keystores = []
|
self.keystores = [] # type: List[KeyStore]
|
||||||
self.is_kivy = config.get('gui') == 'kivy'
|
self.is_kivy = config.get('gui') == 'kivy'
|
||||||
self.seed_type = None
|
self.seed_type = None
|
||||||
|
|
||||||
|
|||||||
@@ -252,7 +252,7 @@ class Commands:
|
|||||||
if wallet.storage.is_encrypted_with_hw_device() and new_password:
|
if wallet.storage.is_encrypted_with_hw_device() and new_password:
|
||||||
raise Exception("Can't change the password of a wallet encrypted with a hw device.")
|
raise Exception("Can't change the password of a wallet encrypted with a hw device.")
|
||||||
b = wallet.storage.is_encrypted()
|
b = wallet.storage.is_encrypted()
|
||||||
wallet.update_password(password, new_password, b)
|
wallet.update_password(password, new_password, encrypt_storage=b)
|
||||||
wallet.storage.write()
|
wallet.storage.write()
|
||||||
return {'password':wallet.has_password()}
|
return {'password':wallet.has_password()}
|
||||||
|
|
||||||
|
|||||||
@@ -1151,7 +1151,7 @@ class InstallWizard(BaseWizard, Widget):
|
|||||||
return
|
return
|
||||||
def on_success(old_pin, pin):
|
def on_success(old_pin, pin):
|
||||||
assert old_pin is None
|
assert old_pin is None
|
||||||
run_next(pin, False)
|
run_next(pin, True)
|
||||||
def on_failure():
|
def on_failure():
|
||||||
self.show_error(_('PIN mismatch'))
|
self.show_error(_('PIN mismatch'))
|
||||||
self.run('request_password', run_next)
|
self.run('request_password', run_next)
|
||||||
|
|||||||
@@ -2107,7 +2107,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger):
|
|||||||
if not ok:
|
if not ok:
|
||||||
return
|
return
|
||||||
try:
|
try:
|
||||||
self.wallet.update_password(old_password, new_password, encrypt_file)
|
self.wallet.update_password(old_password, new_password, encrypt_storage=encrypt_file)
|
||||||
except InvalidPassword as e:
|
except InvalidPassword as e:
|
||||||
self.show_error(str(e))
|
self.show_error(str(e))
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -1708,7 +1708,7 @@ class Abstract_Wallet(AddressSynchronizer, ABC):
|
|||||||
self.keystore.check_password(password)
|
self.keystore.check_password(password)
|
||||||
self.storage.check_password(password)
|
self.storage.check_password(password)
|
||||||
|
|
||||||
def update_password(self, old_pw, new_pw, encrypt_storage=False):
|
def update_password(self, old_pw, new_pw, *, encrypt_storage: bool = True):
|
||||||
if old_pw is None and self.has_password():
|
if old_pw is None and self.has_password():
|
||||||
raise InvalidPassword()
|
raise InvalidPassword()
|
||||||
self.check_password(old_pw)
|
self.check_password(old_pw)
|
||||||
|
|||||||
Reference in New Issue
Block a user