steemit / steem-python

The official Python (3) library for the Steem Blockchain.
https://steem.io
MIT License
153 stars 99 forks source link

Refactored MasterPassword #232

Closed cyon1c closed 6 years ago

cyon1c commented 6 years ago

Closes #222 .

MasterPassword, as used in wallet.py and storage.py is in fact a randomly generated key encryption key stored in SQLiteConfig. It has been refactored to KeyEncryptionKey.

password within the MasterPassword class was in fact a user supplied pass phrase for unlocking the KEK, so was refactored to userPassphrase.

I didn't muck around much in cli.py as I know we are intending to rewrite that with click.

roadscape commented 6 years ago

Nice.. much more clear.

1) Does WalletPassword make sense in place of any of these variables? 2) Any changed methods used publicly, i.e. any we should add old alias to for compatibility?

cyon1c commented 6 years ago

WalletPassword I feel is still too ambiguous, userPassphrase and KEK are very clearly separate concepts.

With regards to 2 -

WrongMasterPasswordException - renamed WrongKEKException MasterPassword - renamed KeyEncryptionKey

Wallet.unlock - pwd in signature changed to user_passphrase Wallet.getPassword - changed to Wallet.getUserPassphrase Wallet.changePassword - changed to Wallet.changeUserPassphrase

Storage.saveEncryptedMaster - changed to Storage.saveEncryptedKEK Storage.getEncryptedMaster - changed to Storage.getEncryptedKEK Storage.decryptEncryptedMaster - changed to Storage.decryptEncryptedKEK Storage.newMaster - changed to Storage.newKEK Storage.changePassword - changed to Storage.changePassphrase

as long as this is documented somewhere in release notes, I believe we'll be okay.

roadscape commented 6 years ago

Sounds good, most of those look internal, and unlock is compatible unless dev uses named param.