allow encrypting watch-only wallets. initial support for hw wallet storage encryption.
This commit is contained in:
@@ -45,6 +45,10 @@ class KeyStore(PrintError):
|
||||
def can_import(self):
|
||||
return False
|
||||
|
||||
def may_have_password(self):
|
||||
"""Returns whether the keystore can be encrypted with a password."""
|
||||
raise NotImplementedError()
|
||||
|
||||
def get_tx_derivations(self, tx):
|
||||
keypairs = {}
|
||||
for txin in tx.inputs():
|
||||
@@ -116,9 +120,6 @@ class Imported_KeyStore(Software_KeyStore):
|
||||
def is_deterministic(self):
|
||||
return False
|
||||
|
||||
def can_change_password(self):
|
||||
return True
|
||||
|
||||
def get_master_public_key(self):
|
||||
return None
|
||||
|
||||
@@ -196,9 +197,6 @@ class Deterministic_KeyStore(Software_KeyStore):
|
||||
def is_watching_only(self):
|
||||
return not self.has_seed()
|
||||
|
||||
def can_change_password(self):
|
||||
return not self.is_watching_only()
|
||||
|
||||
def add_seed(self, seed):
|
||||
if self.seed:
|
||||
raise Exception("a seed exists")
|
||||
@@ -522,9 +520,13 @@ class Hardware_KeyStore(KeyStore, Xpub):
|
||||
assert not self.has_seed()
|
||||
return False
|
||||
|
||||
def can_change_password(self):
|
||||
return False
|
||||
|
||||
def get_password_for_storage_encryption(self):
|
||||
from .storage import get_derivation_used_for_hw_device_encryption
|
||||
client = self.plugin.get_client(self)
|
||||
derivation = get_derivation_used_for_hw_device_encryption()
|
||||
xpub = client.get_xpub(derivation, "standard")
|
||||
password = self.get_pubkey_from_xpub(xpub, ())
|
||||
return password
|
||||
|
||||
|
||||
def bip39_normalize_passphrase(passphrase):
|
||||
|
||||
Reference in New Issue
Block a user