diff options
author | Dan J Miller <danjm.com@gmail.com> | 2019-08-02 11:57:26 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-08-02 11:57:26 +0800 |
commit | 3eff4787757ac22d0a469c91599cdcfd97a2a98c (patch) | |
tree | d0ba3b8b5fbbb9f6d68ba227fa3fd8410b766912 /app | |
parent | 189e126f6184b4351a9f11d8dc063d7abd5e9bbe (diff) | |
download | tangerine-wallet-browser-3eff4787757ac22d0a469c91599cdcfd97a2a98c.tar.gz tangerine-wallet-browser-3eff4787757ac22d0a469c91599cdcfd97a2a98c.tar.zst tangerine-wallet-browser-3eff4787757ac22d0a469c91599cdcfd97a2a98c.zip |
I5849 incremental account security (#6874)
* Implements ability to defer seed phrase backup to later
* Adds incremental-security.spec.js, including test dapp that sends signed tx with stand alone localhost provider
* Update metamask-responsive-ui for incremental account security changes
* Update backup-notification style and fix responsiveness of seed phrase screen
* Remove uneeded files from send-eth-with-private-key-test/
* Apply linguist flags in .gitattributes for send-eth-with-private-key-test/ethereumjs-tx.js
* Improve docs in controllers/onboarding.js
* Clean up metamask-extension/test/e2e/send-eth-with-private-key-test/index.html
* Remove unnecessary newlines in a couple first-time-flow/ files
* Fix import of backup-notification in home.component
* Fix git attrs file
Diffstat (limited to 'app')
-rw-r--r-- | app/_locales/en/messages.json | 6 | ||||
-rw-r--r-- | app/images/meta-shield.svg | 3 | ||||
-rw-r--r-- | app/scripts/controllers/onboarding.js | 43 | ||||
-rw-r--r-- | app/scripts/metamask-controller.js | 11 |
4 files changed, 63 insertions, 0 deletions
diff --git a/app/_locales/en/messages.json b/app/_locales/en/messages.json index f15dff386..4f9dff0c8 100644 --- a/app/_locales/en/messages.json +++ b/app/_locales/en/messages.json @@ -208,6 +208,9 @@ "backToAll": { "message": "Back to All" }, + "backupNow": { + "message": "Backup now" + }, "balance": { "message": "Balance" }, @@ -1310,6 +1313,9 @@ "deleteNetworkDescription": { "message": "Are you sure you want to delete this network?" }, + "remindMeLater": { + "message": "Remind me later" + }, "restoreFromSeed": { "message": "Restore account?" }, diff --git a/app/images/meta-shield.svg b/app/images/meta-shield.svg new file mode 100644 index 000000000..346934dbc --- /dev/null +++ b/app/images/meta-shield.svg @@ -0,0 +1,3 @@ +<svg width="20" height="24" viewBox="0 0 20 24" fill="none" xmlns="http://www.w3.org/2000/svg"> +<path fill-rule="evenodd" clip-rule="evenodd" d="M0 9.71495V3.57158L10 0.872803L20 3.57158V9.71495C20 16.0442 15.7999 21.4041 10 23.2357C4.19995 21.4041 0 16.0442 0 9.71495ZM15.3879 10.7277L15.6232 10.898L15.0819 11.5366L15.9057 14.1001L15.1431 16.7158L12.4738 15.9779L11.956 16.4036L10.9014 17.1367H9.09833L8.04379 16.4036L7.52596 15.9779L4.85671 16.7158L4.09874 14.1001L4.91784 11.5366L4.37644 10.898L4.61188 10.7277L4.23524 10.3825L4.52242 10.1553L4.14578 9.8669L4.4 9.6777L3.99989 7.74783L4.59302 5.95527L8.41104 7.38838H11.5887L15.4067 5.95527L15.9999 7.74783L15.6045 9.6777L15.854 9.8669L15.4773 10.1553L15.7644 10.3825L15.3879 10.7277ZM7.38499 13.1652L8.47065 12.6641L8.92346 13.6225L7.38499 13.1652ZM10.7685 13.6225L11.2197 12.6641L12.307 13.1652L10.7685 13.6225ZM9.24343 14.9001H10.4439L10.6519 15.0662L10.7689 16.178L10.6607 16.0674H9.02677L8.92279 16.178L9.03541 15.0662L9.24343 14.9001Z" fill="white"/> +</svg> diff --git a/app/scripts/controllers/onboarding.js b/app/scripts/controllers/onboarding.js new file mode 100644 index 000000000..18fec4993 --- /dev/null +++ b/app/scripts/controllers/onboarding.js @@ -0,0 +1,43 @@ +const ObservableStore = require('obs-store') +const extend = require('xtend') + +/** + * @typedef {Object} InitState + * @property {Boolean} seedPhraseBackedUp Indicates whether the user has completed the seed phrase backup challenge + */ + +/** + * @typedef {Object} OnboardingOptions + * @property {InitState} initState The initial controller state + */ + +/** + * Controller responsible for maintaining + * a cache of account balances in local storage + */ +class OnboardingController { + /** + * Creates a new controller instance + * + * @param {OnboardingOptions} [opts] Controller configuration parameters + */ + constructor (opts = {}) { + const initState = extend({ + seedPhraseBackedUp: null, + }, opts.initState) + this.store = new ObservableStore(initState) + } + + setSeedPhraseBackedUp (newSeedPhraseBackUpState) { + this.store.updateState({ + seedPhraseBackedUp: newSeedPhraseBackUpState, + }) + } + + getSeedPhraseBackedUp () { + return this.store.getState().seedPhraseBackedUp + } + +} + +module.exports = OnboardingController diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js index 158fb3079..d999bb790 100644 --- a/app/scripts/metamask-controller.js +++ b/app/scripts/metamask-controller.js @@ -28,6 +28,7 @@ const PreferencesController = require('./controllers/preferences') const AppStateController = require('./controllers/app-state') const InfuraController = require('./controllers/infura') const CachedBalancesController = require('./controllers/cached-balances') +const OnboardingController = require('./controllers/onboarding') const RecentBlocksController = require('./controllers/recent-blocks') const MessageManager = require('./lib/message-manager') const PersonalMessageManager = require('./lib/personal-message-manager') @@ -158,6 +159,10 @@ module.exports = class MetamaskController extends EventEmitter { initState: initState.CachedBalancesController, }) + this.onboardingController = new OnboardingController({ + initState: initState.OnboardingController, + }) + // ensure accountTracker updates balances after network change this.networkController.on('networkDidChange', () => { this.accountTracker._updateAccounts() @@ -262,6 +267,7 @@ module.exports = class MetamaskController extends EventEmitter { NetworkController: this.networkController.store, InfuraController: this.infuraController.store, CachedBalancesController: this.cachedBalancesController.store, + OnboardingController: this.onboardingController.store, }) this.memStore = new ComposableObservableStore(null, { @@ -283,6 +289,7 @@ module.exports = class MetamaskController extends EventEmitter { ShapeshiftController: this.shapeshiftController, InfuraController: this.infuraController.store, ProviderApprovalController: this.providerApprovalController.store, + OnboardingController: this.onboardingController.store, }) this.memStore.subscribe(this.sendUpdate.bind(this)) } @@ -398,6 +405,7 @@ module.exports = class MetamaskController extends EventEmitter { const txController = this.txController const networkController = this.networkController const providerApprovalController = this.providerApprovalController + const onboardingController = this.onboardingController return { // etc @@ -501,6 +509,9 @@ module.exports = class MetamaskController extends EventEmitter { rejectProviderRequestByOrigin: providerApprovalController.rejectProviderRequestByOrigin.bind(providerApprovalController), forceApproveProviderRequestByOrigin: providerApprovalController.forceApproveProviderRequestByOrigin.bind(providerApprovalController), clearApprovedOrigins: providerApprovalController.clearApprovedOrigins.bind(providerApprovalController), + + // onboarding controller + setSeedPhraseBackedUp: nodeify(onboardingController.setSeedPhraseBackedUp, onboardingController), } } |