aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/controllers
diff options
context:
space:
mode:
authorDan J Miller <danjm.com@gmail.com>2019-08-02 11:57:26 +0800
committerGitHub <noreply@github.com>2019-08-02 11:57:26 +0800
commit3eff4787757ac22d0a469c91599cdcfd97a2a98c (patch)
treed0ba3b8b5fbbb9f6d68ba227fa3fd8410b766912 /app/scripts/controllers
parent189e126f6184b4351a9f11d8dc063d7abd5e9bbe (diff)
downloadtangerine-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/scripts/controllers')
-rw-r--r--app/scripts/controllers/onboarding.js43
1 files changed, 43 insertions, 0 deletions
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