This is only a bug in dev, but was committed yesterday.
Sometimes the `encrypt` method was being passed values other than the password as the encryption key, leading to un-unlockable vaults.
To find this, and avoid it for all time hereafter, I added several more steps to our oft-neglected integration test suite, which now fully initializes a vault, locks it, and unlocks it again, to make sure all of those steps definitely work always.
Mostly Fixes#893
A couple methods cache callbacks, and will require a larger refactor to fully denodeify.
Specifically, our methods involving web3 requests to sign a tx, sign a message, and approve or cancel either of those.
I think we should postpone those until the TxManager refactor, since it will likely handle this response caching itself.
At least, the portion of it that we use.
Moved salting within the encryptor, so it does not need to be managed externally.
KeyringController now caches the password instead of a passwordDerivedKey, since it is ignorant of the salt.
Encryptor payload is now in a JSON format, so its portions are both base64 encoded *and* labeled appropriately. The format is `{ "data": "0x0", "iv": "0x0", "salt": "string" }`.
Fixes#843Fixes#859
Our gas price buffering logic had a bug, because bn.js has inconsistent behavior when using hex-prefixed output. The issue has been opened with them here:
https://github.com/indutny/bn.js/issues/151
We've corrected our usage in the mean time.
Now old vaults are recognized as an "Initialized" MetaMask instance.
Upon logging in, when fetching the initial password-derived key, if there is no new-style vault, but there is an old style vault, it is migrated to the new format before proceeding through the usual unlocking steps.