Commit graph

52 commits

Author SHA1 Message Date
SomberNight
a7199696d3
json_db: exempt keystore from StoredDict conversion
The keystore logic would need to be significantly changed to nicely
interoperate with StoredDict/json_db logic.
(just see KeyStore.__init__() and KeyStore.dump())
For now we exempt the keystore from the recursive StoredDict conversion, as
it is a smaller change that is also easier to review for correctness.

fixes #6066
fixes #6401

also reverts 2d3c2eeea9 (which was an even hackier workaround for #6066)
2020-09-04 16:11:01 +02:00
SomberNight
9d0bb295e6
hww: distinguish devices based on "soft device id" (not just labels)
fixes #5759
2020-04-08 14:44:42 +02:00
SomberNight
2d3c2eeea9
keystore: add workaround for StoredDict issue #6066
note: not a proper fix... but works for now
2020-04-01 13:33:38 +02:00
SomberNight
6760c3f252
hw wallets: introduce HardwareHandlerBase
previously, client.handler was sometimes
- an InstallWizard
- a QtHandlerBase where win was an ElectrumWindow
- a QtHandlerBase where win was an InstallWizard
- a CmdLineHandler

That's just too much dynamic untyped undocumented polymorphism...
Now it will never be an InstallWizard (replaced with QtHandlerBase where win is an InstallWizard),
and now in all cases client.handler is an instance of HardwareHandlerBase, yay.

related: #6063
2020-03-31 14:40:25 +02:00
SomberNight
a0b096dcb2
mnemonic: implement Wordlist class
Wordlist subclasses 'tuple' so it can be transparently used.
'in' and '.index()' are fast.
Use Wordlist in bip39_is_checksum_valid, which makes that faster.
2020-02-29 00:20:11 +01:00
SomberNight
f8ba660583
clean-up hw-wallet "get_password_for_storage_encryption"-related code 2020-02-28 19:47:56 +01:00
SomberNight
c744fc4e3d
follow-up prev: do all checks, and add tests 2020-02-27 05:13:31 +01:00
SomberNight
a987a2bbbe
keystore: make add_key_origin "API-user-friendly"
Power-users that know what they are doing can use this method
to populate key origin information for keystore (bip32 root fingerprint
and derivation path prefix).
Try to make method hard to misuse.

Qt console can now be used as e.g.:
```
wallet.get_keystores()[2].add_key_origin(derivation_prefix="m/48h/1h/0h/2h", root_fingerprint="deadbeef")
```

related #5715
related #5955
related #5969
2020-02-27 04:18:27 +01:00
SomberNight
ab4e2dd9f0
wallet: fix is_mine/can_sign. don't just rely on ks, also check script
Previously a standard (single-sig) wallet would consider a multisig txin as is_mine
(if the keystore found its pubkey in the txin).

fixes #5948
2020-02-12 18:14:07 +01:00
SomberNight
07f5d6b745
keystore: 'get_tx_derivations' no longer public 2020-02-12 18:14:00 +01:00
SomberNight
0a5ad9fda4
ecc: small API clean-up 2020-02-11 16:42:02 +01:00
SomberNight
2cf2135528
ecc: abstract away some usage of python-ecdsa: bytes<->int conversions 2020-02-11 16:41:49 +01:00
ThomasV
e1ce3aace7 Separate db from storage
- storage is content-agnostic
 - db and storage are passed to wallet contructor
2020-02-10 17:45:23 +01:00
SomberNight
fcd9752f19
keystore: change derive_pubkey API to return bytes 2019-12-10 20:41:47 +01:00
SomberNight
ea62027599
wallet: faster decrypt_message for Imported_Wallet 2019-12-10 20:08:41 +01:00
SomberNight
869a728317
wallet: use abstract base classes 2019-12-10 19:34:44 +01:00
SomberNight
0ab88b821c
keystore: use abstract base classes, introduce MPKMixin 2019-12-10 00:31:01 +01:00
SomberNight
d641dfe964
follow-up prev: add comment 2019-12-09 17:43:08 +01:00
SomberNight
59c5efb090
keystore: cache BIP32Node.from_xkey(self.xpub)
This results in significant performance improvements for
keystore.can_sign() and wallet._add_txinout_derivation_info()
2019-12-09 03:43:47 +01:00
SomberNight
f73b6b5d23
keystore: cache derive_pubkey 2019-12-09 03:35:20 +01:00
SomberNight
d3fd87ebd0
hardware wallets: wizard no longer requests xpub at path "m"
This was done to calculate the bip32 root fingerprint but it broke
the digitalbitbox. The keystore already had a different way to get
the root fingerprint for existing wallets, specifically handling this
case; the code in base_wizard used when creating new wallets was
duplicating that code originally and was then forgotten to be updated.
Now these codepaths are unified.

closes #5816
2019-12-02 19:31:17 +01:00
SomberNight
88307357ec
add some type hints
mostly related to hw wallets
2019-11-22 22:59:33 +01:00
SomberNight
cbd146ad15
hardware wallets: detect if label changed and update it in wallet file 2019-11-17 01:17:38 +01:00
SomberNight
6ebbaa60ef
old_mnemonic: speed up mn_decode
mn_decode is used by mnemonic.make_seed which now takes around 25% less time
2019-11-15 12:08:06 +01:00
SomberNight
f8c84fbb1e
hardware wallets: create base class for HW Clients. add some type hints 2019-11-11 17:04:12 +01:00
SomberNight
dd14a3fde5
psbt: follow-ups: fix digital bitbox 2019-11-05 22:06:46 +01:00
SomberNight
d872be7f6b
psbt: don't put xpubs and full paths into tx by def; only while signing 2019-11-04 22:25:02 +01:00
SomberNight
e6c841d05f
psbt: put fake xpubs into globals. keystores handle xfp/der_prefix missing 2019-11-04 22:24:59 +01:00
SomberNight
bafe8a2fff
integrate PSBT support natively. WIP 2019-11-04 22:24:36 +01:00
SomberNight
58681e4d07
follow-up prev (commands) 2019-09-05 18:30:04 +02:00
SomberNight
073a09f926
wallet/keystore: small inheritance clean-up 2019-09-03 16:24:05 +02:00
ThomasV
0552c61b66 lightning: add payment methods to lnworker 2019-08-20 09:03:09 +02:00
ThomasV
96544b8b58 lnbase: derive keys from wallet keystore 2019-08-20 09:03:09 +02:00
SomberNight
6ad24ea3b3
keystore/transactions: fix overflow of derivation path indices
fixes #5366
2019-05-21 02:14:22 +02:00
SomberNight
fd5b1acdc8
commands: fix encrypt/decrypt
based on Electron-Cash/Electron-Cash@62aa08a0ff
2019-05-03 03:10:31 +02:00
SomberNight
3385a94753
logging: basics 2019-05-02 15:19:03 +02:00
SomberNight
a1d98d4331
sweep/import key: show error in Qt GUI to user as tooltip 2019-04-19 00:15:45 +02:00
SomberNight
1b3f428e88
keystore: speedup for Old_KeyStore
from Electron-Cash/Electron-Cash@01177d7deb
2019-03-27 16:30:21 +01:00
SomberNight
8ae6ddcc00
keystore: rm dead code 2019-03-04 17:29:12 +01:00
SomberNight
85a7aa291e
bip32: refactor whole module. clean-up. 2019-02-22 18:50:24 +01:00
SomberNight
b39c51adf7
mv "electrum seed" stuff from bitcoin.py to mnemonic.py 2019-02-22 18:01:54 +01:00
SomberNight
e2eb051eed
keystore bip39: minor clean-up 2019-02-13 15:03:32 +01:00
SomberNight
3ad6f738bd
util: rm hfu, cleaner bh2u 2019-02-01 19:02:02 +01:00
SomberNight
8f5f0e46aa
keystore: fail sooner if unsupported version
follow-up #4937
2018-12-18 19:57:58 +01:00
SomberNight
48b0de7871
keystore: stronger pbkdf for encryption 2018-11-10 16:36:41 +01:00
SomberNight
082a83dd85
rename crypto.Hash to sha256d 2018-10-25 22:28:24 +02:00
SomberNight
a88a2dea82
split bip32 from bitcoin.py 2018-10-25 22:20:33 +02:00
SomberNight
b68729115a
qt wallet information: added keystore type 2018-10-23 02:54:54 +02:00
SomberNight
1233309ebd
cli/rpc: 'restore' and 'create' commands are now available via RPC 2018-10-11 20:57:15 +02:00
SomberNight
3842205b8a
keystore: add note regarding xpubkeys 2018-09-12 18:22:34 +02:00