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.