1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

Merge branch 'i328-MultiVault' of github.com:MetaMask/metamask-plugin into origin/i328-MultiVault

This commit is contained in:
Kevin Serrano 2016-10-12 17:12:52 -07:00
commit 7cba71fc55
No known key found for this signature in database
GPG Key ID: 7CC862A58D2889B4
11 changed files with 467 additions and 144 deletions

View File

@ -0,0 +1,102 @@
const scrypt = require('scrypt-async')
const bitcore = require('bitcore-lib')
const configManager = require('./lib/config-manager')
const EventEmitter = require('events').EventEmitter
module.exports = class KeyringController extends EventEmitter {
constructor (opts) {
super()
this.configManager = opts.configManager
this.ethStore = opts.ethStore
this.keyChains = []
}
getKeyForPassword(password, callback) {
let salt = this.configManager.getSalt()
if (!salt) {
salt = generateSalt(32)
configManager.setSalt(salt)
}
var logN = 14
var r = 8
var dkLen = 32
var interruptStep = 200
var cb = function(derKey) {
try {
var ui8arr = (new Uint8Array(derKey))
this.pwDerivedKey = ui8arr
callback(null, ui8arr)
} catch (err) {
callback(err)
}
}
scrypt(password, salt, logN, r, dkLen, interruptStep, cb, null)
}
getState() {
return {}
}
setStore(ethStore) {
this.ethStore = ethStore
}
createNewVault(password, entropy, cb) {
cb()
}
submitPassword(password, cb) {
cb()
}
setSelectedAddress(address, cb) {
this.selectedAddress = address
cb(null, address)
}
approveTransaction(txId, cb) {
cb()
}
cancelTransaction(txId, cb) {
if (cb && typeof cb === 'function') {
cb()
}
}
signMessage(msgParams, cb) {
cb()
}
cancelMessage(msgId, cb) {
if (cb && typeof cb === 'function') {
cb()
}
}
setLocked(cb) {
cb()
}
exportAccount(address, cb) {
cb(null, '0xPrivateKey')
}
saveAccountLabel(account, label, cb) {
cb(/* null, label */)
}
tryPassword(password, cb) {
cb()
}
}
function generateSalt (byteCount) {
return bitcore.crypto.Random.getRandomBuffer(byteCount || 32).toString('base64')
}

View File

@ -1,7 +1,7 @@
const extend = require('xtend') const extend = require('xtend')
const EthStore = require('eth-store') const EthStore = require('eth-store')
const MetaMaskProvider = require('web3-provider-engine/zero.js') const MetaMaskProvider = require('web3-provider-engine/zero.js')
const IdentityStore = require('./lib/idStore') const IdentityStore = require('./keyring-controller')
const messageManager = require('./lib/message-manager') const messageManager = require('./lib/message-manager')
const HostStore = require('./lib/remote-store.js').HostStore const HostStore = require('./lib/remote-store.js').HostStore
const Web3 = require('web3') const Web3 = require('web3')
@ -11,6 +11,7 @@ const extension = require('./lib/extension')
module.exports = class MetamaskController { module.exports = class MetamaskController {
constructor (opts) { constructor (opts) {
this.state = { network: 'loading' }
this.opts = opts this.opts = opts
this.listeners = [] this.listeners = []
this.configManager = new ConfigManager(opts) this.configManager = new ConfigManager(opts)
@ -20,6 +21,7 @@ module.exports = class MetamaskController {
this.provider = this.initializeProvider(opts) this.provider = this.initializeProvider(opts)
this.ethStore = new EthStore(this.provider) this.ethStore = new EthStore(this.provider)
this.idStore.setStore(this.ethStore) this.idStore.setStore(this.ethStore)
this.getNetwork()
this.messageManager = messageManager this.messageManager = messageManager
this.publicConfigStore = this.initPublicConfigStore() this.publicConfigStore = this.initPublicConfigStore()
@ -30,11 +32,11 @@ module.exports = class MetamaskController {
this.checkTOSChange() this.checkTOSChange()
this.scheduleConversionInterval() this.scheduleConversionInterval()
} }
getState () { getState () {
return extend( return extend(
this.state,
this.ethStore.getState(), this.ethStore.getState(),
this.idStore.getState(), this.idStore.getState(),
this.configManager.getConfig() this.configManager.getConfig()
@ -58,7 +60,6 @@ module.exports = class MetamaskController {
// forward directly to idStore // forward directly to idStore
createNewVault: idStore.createNewVault.bind(idStore), createNewVault: idStore.createNewVault.bind(idStore),
recoverFromSeed: idStore.recoverFromSeed.bind(idStore),
submitPassword: idStore.submitPassword.bind(idStore), submitPassword: idStore.submitPassword.bind(idStore),
setSelectedAddress: idStore.setSelectedAddress.bind(idStore), setSelectedAddress: idStore.setSelectedAddress.bind(idStore),
approveTransaction: idStore.approveTransaction.bind(idStore), approveTransaction: idStore.approveTransaction.bind(idStore),
@ -66,12 +67,9 @@ module.exports = class MetamaskController {
signMessage: idStore.signMessage.bind(idStore), signMessage: idStore.signMessage.bind(idStore),
cancelMessage: idStore.cancelMessage.bind(idStore), cancelMessage: idStore.cancelMessage.bind(idStore),
setLocked: idStore.setLocked.bind(idStore), setLocked: idStore.setLocked.bind(idStore),
clearSeedWordCache: idStore.clearSeedWordCache.bind(idStore),
exportAccount: idStore.exportAccount.bind(idStore), exportAccount: idStore.exportAccount.bind(idStore),
revealAccount: idStore.revealAccount.bind(idStore),
saveAccountLabel: idStore.saveAccountLabel.bind(idStore), saveAccountLabel: idStore.saveAccountLabel.bind(idStore),
tryPassword: idStore.tryPassword.bind(idStore), tryPassword: idStore.tryPassword.bind(idStore),
recoverSeed: idStore.recoverSeed.bind(idStore),
// coinbase // coinbase
buyEth: this.buyEth.bind(this), buyEth: this.buyEth.bind(this),
// shapeshift // shapeshift
@ -160,11 +158,11 @@ module.exports = class MetamaskController {
var provider = MetaMaskProvider(providerOpts) var provider = MetaMaskProvider(providerOpts)
var web3 = new Web3(provider) var web3 = new Web3(provider)
this.web3 = web3
idStore.web3 = web3 idStore.web3 = web3
idStore.getNetwork()
provider.on('block', this.processBlock.bind(this)) provider.on('block', this.processBlock.bind(this))
provider.on('error', idStore.getNetwork.bind(idStore)) provider.on('error', this.getNetwork.bind(this))
return provider return provider
} }
@ -261,8 +259,8 @@ module.exports = class MetamaskController {
verifyNetwork () { verifyNetwork () {
// Check network when restoring connectivity: // Check network when restoring connectivity:
if (this.idStore._currentState.network === 'loading') { if (this.state.network === 'loading') {
this.idStore.getNetwork() this.getNetwork()
} }
} }
@ -345,13 +343,13 @@ module.exports = class MetamaskController {
setRpcTarget (rpcTarget) { setRpcTarget (rpcTarget) {
this.configManager.setRpcTarget(rpcTarget) this.configManager.setRpcTarget(rpcTarget)
extension.runtime.reload() extension.runtime.reload()
this.idStore.getNetwork() this.getNetwork()
} }
setProviderType (type) { setProviderType (type) {
this.configManager.setProviderType(type) this.configManager.setProviderType(type)
extension.runtime.reload() extension.runtime.reload()
this.idStore.getNetwork() this.getNetwork()
} }
useEtherscanProvider () { useEtherscanProvider () {
@ -362,7 +360,7 @@ module.exports = class MetamaskController {
buyEth (address, amount) { buyEth (address, amount) {
if (!amount) amount = '5' if (!amount) amount = '5'
var network = this.idStore._currentState.network var network = this.state.network
var url = `https://buy.coinbase.com/?code=9ec56d01-7e81-5017-930c-513daa27bb6a&amount=${amount}&address=${address}&crypto_currency=ETH` var url = `https://buy.coinbase.com/?code=9ec56d01-7e81-5017-930c-513daa27bb6a&amount=${amount}&address=${address}&crypto_currency=ETH`
if (network === '2') { if (network === '2') {
@ -377,4 +375,24 @@ module.exports = class MetamaskController {
createShapeShiftTx (depositAddress, depositType) { createShapeShiftTx (depositAddress, depositType) {
this.configManager.createShapeShiftTx(depositAddress, depositType) this.configManager.createShapeShiftTx(depositAddress, depositType)
} }
getNetwork(err) {
if (err) {
this.state.network = 'loading'
this.sendUpdate()
}
this.web3.version.getNetwork((err, network) => {
if (err) {
this.state.network = 'loading'
return this.sendUpdate()
}
if (global.METAMASK_DEBUG) {
console.log('web3.getNetwork returned ' + network)
}
this.state.network = network
this.sendUpdate()
})
}
} }

View File

@ -0,0 +1,188 @@
https://hackmd.io/JwIwDMDGKQZgtAFgKZjEgbARhPAhgKxZbwAcA7LAWOQCaKEgFA==?edit
Subscribablez(initState)
.subscribe()
.emitUpdate(newState)
//.getState()
var initState = fromDisk()
ReduxStore(reducer, initState)
.reduce(action) -> .emitUpdate()
ReduxStore.subscribe(toDisk)
### KeyChainManager / idStore 2.0 (maybe just in MetaMaskController)
keychains: []
getAllAccounts(cb)
getAllKeychainViewStates(cb) -> returns [ KeyChainViewState]
#### Old idStore external methods, for feature parity:
- init(configManager)
- setStore(ethStore)
- getState()
- getSelectedAddres()
- setSelectedAddress()
- createNewVault()
- recoverFromSeed()
- submitPassword()
- approveTransaction()
- cancelTransaction()
- addUnconfirmedMessage(msgParams, cb)
- signMessage()
- cancelMessage()
- setLocked()
- clearSeedWordCache()
- exportAccount()
- revealAccount()
- saveAccountLabel()
- tryPassword()
- recoverSeed()
- getNetwork()
##### Of those methods
Where they should end up:
##### MetaMaskController
- getNetwork()
##### KeyChainManager
- init(configManager)
- setStore(ethStore)
- getState() // Deprecate for unidirectional flow
- on('update', cb)
- createNewVault(password)
- getSelectedAddres()
- setSelectedAddress()
- submitPassword()
- tryPassword()
- approveTransaction()
- cancelTransaction()
- signMessage()
- cancelMessage()
- setLocked()
- exportAccount()
##### Bip44 KeyChain
- getState() // Deprecate for unidirectional flow
- on('update', cb)
If we adopt a ReactStore style unidirectional action dispatching data flow, these methods will be unified under a `dispatch` method, and rather than having a cb will emit an update to the UI:
- createNewKeyChain(entropy)
- recoverFromSeed()
- approveTransaction()
- signMessage()
- clearSeedWordCache()
- exportAccount()
- revealAccount()
- saveAccountLabel()
- recoverSeed()
Additional methods, new to this:
- serialize()
- Returns pojo with optional `secret` key whose contents will be encrypted with the users' password and salt when written to disk.
- The isolation of secrets is to preserve performance when decrypting user data.
- deserialize(pojo)
### KeyChain (ReduxStore?)
// attributes
@name
signTx(txParams, cb)
signMsg(msg, cb)
getAddressList(cb)
getViewState(cb) -> returns KeyChainViewState
serialize(cb) -> obj
deserialize(obj)
dispatch({ type: <str>, value: <pojo> })
### KeyChainViewState
// The serialized, renderable keychain data
accountList: [],
typeName: 'uPort',
iconAddress: 'uport.gif',
internal: {} // Subclass-defined metadata
### KeyChainReactComponent
// takes a KeyChainViewState
// Subclasses of this:
- KeyChainListItemComponent
- KeyChainInitComponent - Maybe part of the List Item
- KeyChainAccountHeaderComponent
- KeyChainConfirmationComponent
// Account list item, tx confirmation extra data (like a QR code),
// Maybe an options screen, init screen,
how to send actions?
emitAction(keychains.<id>.didInit)
gimmeRemoteKeychain((err, remoteKeychain)=>
)
KeyChainReactComponent({
keychain
})
Keychain:
methods:{},
cachedAccountList: [],
name: '',
CoinbaseKeychain
getAccountList
CoinbaseKeychainComponent
isLoading = true
keychain.getAccountList(()=>{
isLoading=false
accountList=accounts
})
KeyChainViewState {
attributes: {
//mandatory:
accountList: [],
typeName: 'uPort',
iconAddress: 'uport.gif',
internal: {
// keychain-specific metadata
proxyAddresses: {
0xReal: '0xProxy'
}
},
},
methods: {
// arbitrary, internal
}
}
## A note on the security of arbitrary action dispatchers
Since keychains will be dispatching actions that are then passed through the background process to be routed, we should not trust or require them to include their own keychain ID as a prefix to their action, but we should tack it on ourselves, so that no action dispatched by a KeyChainComponent ever reaches any KeyChain other than its own.

View File

@ -0,0 +1,141 @@
var assert = require('assert')
var KeyringController = require('../../app/scripts/keyring-controller')
var configManagerGen = require('../lib/mock-config-manager')
const ethUtil = require('ethereumjs-util')
const async = require('async')
describe('KeyringController', function() {
describe('#createNewVault', function () {
let keyringController
let password = 'password123'
let entropy = 'entripppppyy duuude'
let seedWords
let accounts = []
let originalKeystore
before(function(done) {
window.localStorage = {} // Hacking localStorage support into JSDom
keyringController = new KeyringController({
configManager: configManagerGen(),
ethStore: {
addAccount(acct) { accounts.push(ethUtil.addHexPrefix(acct)) },
},
})
keyringController.createNewVault(password, entropy, (err, seeds) => {
assert.ifError(err, 'createNewVault threw error')
seedWords = seeds
originalKeystore = keyringController._idmgmt.keyStore
done()
})
})
describe('#recoverFromSeed', function() {
let newAccounts = []
before(function() {
window.localStorage = {} // Hacking localStorage support into JSDom
keyringController = new KeyringController({
configManager: configManagerGen(),
ethStore: {
addAccount(acct) { newAccounts.push(ethUtil.addHexPrefix(acct)) },
},
})
})
it('should return the expected keystore', function (done) {
keyringController.recoverFromSeed(password, seedWords, (err) => {
assert.ifError(err)
let newKeystore = keyringController._idmgmt.keyStore
assert.equal(newAccounts[0], accounts[0])
done()
})
})
})
})
describe('#recoverFromSeed BIP44 compliance', function() {
const salt = 'lightwalletSalt'
let password = 'secret!'
let accounts = {}
let keyringController
var assertions = [
{
seed: 'picnic injury awful upper eagle junk alert toss flower renew silly vague',
account: '0x5d8de92c205279c10e5669f797b853ccef4f739a',
},
{
seed: 'radar blur cabbage chef fix engine embark joy scheme fiction master release',
account: '0xe15d894becb0354c501ae69429b05143679f39e0',
},
{
seed: 'phone coyote caught pattern found table wedding list tumble broccoli chief swing',
account: '0xb0e868f24bc7fec2bce2efc2b1c344d7569cd9d2',
},
{
seed: 'recycle tag bird palace blue village anxiety census cook soldier example music',
account: '0xab34a45920afe4af212b96ec51232aaa6a33f663',
},
{
seed: 'half glimpse tape cute harvest sweet bike voyage actual floor poet lazy',
account: '0x28e9044597b625ac4beda7250011670223de43b2',
},
{
seed: 'flavor tiger carpet motor angry hungry document inquiry large critic usage liar',
account: '0xb571be96558940c4e9292e1999461aa7499fb6cd',
},
]
before(function() {
window.localStorage = {} // Hacking localStorage support into JSDom
keyringController = new KeyringController({
configManager: configManagerGen(),
ethStore: {
addAccount(acct) { accounts[acct] = acct},
del(acct) { delete accounts[acct] },
},
})
})
it('should enforce seed compliance with TestRPC', function (done) {
this.timeout(10000)
const tests = assertions.map((assertion) => {
return function (cb) {
keyringController.recoverFromSeed(password, assertion.seed, (err) => {
assert.ifError(err)
var expected = assertion.account.toLowerCase()
var received = accounts[expected].toLowerCase()
assert.equal(received, expected)
keyringController.tryPassword(password, function (err) {
assert.ok(keyringController._isUnlocked(), 'should unlock the id store')
keyringController.submitPassword(password, function(err, account) {
assert.ifError(err)
assert.equal(account, expected)
assert.equal(Object.keys(keyringController._getAddresses()).length, 1, 'only one account on restore')
cb()
})
})
})
}
})
async.series(tests, function(err, results) {
assert.ifError(err)
done()
})
})
})
})

View File

@ -16,10 +16,6 @@ var actions = {
SHOW_INIT_MENU: 'SHOW_INIT_MENU', SHOW_INIT_MENU: 'SHOW_INIT_MENU',
SHOW_NEW_VAULT_SEED: 'SHOW_NEW_VAULT_SEED', SHOW_NEW_VAULT_SEED: 'SHOW_NEW_VAULT_SEED',
SHOW_INFO_PAGE: 'SHOW_INFO_PAGE', SHOW_INFO_PAGE: 'SHOW_INFO_PAGE',
RECOVER_FROM_SEED: 'RECOVER_FROM_SEED',
CLEAR_SEED_WORD_CACHE: 'CLEAR_SEED_WORD_CACHE',
clearSeedWordCache: clearSeedWordCache,
recoverFromSeed: recoverFromSeed,
unlockMetamask: unlockMetamask, unlockMetamask: unlockMetamask,
unlockFailed: unlockFailed, unlockFailed: unlockFailed,
showCreateVault: showCreateVault, showCreateVault: showCreateVault,
@ -29,10 +25,6 @@ var actions = {
createNewVaultInProgress: createNewVaultInProgress, createNewVaultInProgress: createNewVaultInProgress,
showNewVaultSeed: showNewVaultSeed, showNewVaultSeed: showNewVaultSeed,
showInfoPage: showInfoPage, showInfoPage: showInfoPage,
// seed recovery actions
REVEAL_SEED_CONFIRMATION: 'REVEAL_SEED_CONFIRMATION',
revealSeedConfirmation: revealSeedConfirmation,
requestRevealSeed: requestRevealSeed,
// unlock screen // unlock screen
UNLOCK_IN_PROGRESS: 'UNLOCK_IN_PROGRESS', UNLOCK_IN_PROGRESS: 'UNLOCK_IN_PROGRESS',
UNLOCK_FAILED: 'UNLOCK_FAILED', UNLOCK_FAILED: 'UNLOCK_FAILED',
@ -53,8 +45,6 @@ var actions = {
SHOW_ACCOUNTS_PAGE: 'SHOW_ACCOUNTS_PAGE', SHOW_ACCOUNTS_PAGE: 'SHOW_ACCOUNTS_PAGE',
SHOW_CONF_TX_PAGE: 'SHOW_CONF_TX_PAGE', SHOW_CONF_TX_PAGE: 'SHOW_CONF_TX_PAGE',
SHOW_CONF_MSG_PAGE: 'SHOW_CONF_MSG_PAGE', SHOW_CONF_MSG_PAGE: 'SHOW_CONF_MSG_PAGE',
REVEAL_ACCOUNT: 'REVEAL_ACCOUNT',
revealAccount: revealAccount,
SET_CURRENT_FIAT: 'SET_CURRENT_FIAT', SET_CURRENT_FIAT: 'SET_CURRENT_FIAT',
setCurrentFiat: setCurrentFiat, setCurrentFiat: setCurrentFiat,
// account detail screen // account detail screen
@ -95,7 +85,6 @@ var actions = {
backToAccountDetail: backToAccountDetail, backToAccountDetail: backToAccountDetail,
showAccountsPage: showAccountsPage, showAccountsPage: showAccountsPage,
showConfTxPage: showConfTxPage, showConfTxPage: showConfTxPage,
confirmSeedWords: confirmSeedWords,
// config screen // config screen
SHOW_CONFIG_PAGE: 'SHOW_CONFIG_PAGE', SHOW_CONFIG_PAGE: 'SHOW_CONFIG_PAGE',
SET_RPC_TARGET: 'SET_RPC_TARGET', SET_RPC_TARGET: 'SET_RPC_TARGET',
@ -182,41 +171,8 @@ function createNewVault (password, entropy) {
if (err) { if (err) {
return dispatch(actions.showWarning(err.message)) return dispatch(actions.showWarning(err.message))
} }
dispatch(actions.showNewVaultSeed(result)) dispatch(this.goHome())
}) dispatch(this.hideLoadingIndication())
}
}
function revealSeedConfirmation () {
return {
type: this.REVEAL_SEED_CONFIRMATION,
}
}
function requestRevealSeed (password) {
return (dispatch) => {
dispatch(actions.showLoadingIndication())
_accountManager.tryPassword(password, (err, seed) => {
dispatch(actions.hideLoadingIndication())
if (err) return dispatch(actions.displayWarning(err.message))
_accountManager.recoverSeed((err, seed) => {
if (err) return dispatch(actions.displayWarning(err.message))
dispatch(actions.showNewVaultSeed(seed))
})
})
}
}
function recoverFromSeed (password, seed) {
return (dispatch) => {
// dispatch(actions.createNewVaultInProgress())
dispatch(actions.showLoadingIndication())
_accountManager.recoverFromSeed(password, seed, (err, metamaskState) => {
dispatch(actions.hideLoadingIndication())
if (err) return dispatch(actions.displayWarning(err.message))
var account = Object.keys(metamaskState.identities)[0]
dispatch(actions.unlockMetamask(account))
}) })
} }
} }
@ -233,19 +189,6 @@ function setSelectedAddress (address) {
} }
} }
function revealAccount () {
return (dispatch) => {
dispatch(actions.showLoadingIndication())
_accountManager.revealAccount((err) => {
dispatch(actions.hideLoadingIndication())
if (err) return dispatch(actions.displayWarning(err.message))
dispatch({
type: actions.REVEAL_ACCOUNT,
})
})
}
}
function setCurrentFiat (fiat) { function setCurrentFiat (fiat) {
return (dispatch) => { return (dispatch) => {
dispatch(this.showLoadingIndication()) dispatch(this.showLoadingIndication())
@ -451,27 +394,6 @@ function backToAccountDetail (address) {
value: address, value: address,
} }
} }
function clearSeedWordCache (account) {
return {
type: actions.CLEAR_SEED_WORD_CACHE,
value: account,
}
}
function confirmSeedWords () {
return (dispatch) => {
dispatch(actions.showLoadingIndication())
_accountManager.clearSeedWordCache((err, account) => {
dispatch(actions.hideLoadingIndication())
if (err) {
return dispatch(actions.showWarning(err.message))
}
console.log('Seed word cache cleared. ' + account)
dispatch(actions.showAccountDetail(account))
})
}
}
function showAccountsPage () { function showAccountsPage () {
return { return {

View File

@ -8,8 +8,6 @@ const ReactCSSTransitionGroup = require('react-addons-css-transition-group')
const DisclaimerScreen = require('./first-time/disclaimer') const DisclaimerScreen = require('./first-time/disclaimer')
const InitializeMenuScreen = require('./first-time/init-menu') const InitializeMenuScreen = require('./first-time/init-menu')
const CreateVaultScreen = require('./first-time/create-vault') const CreateVaultScreen = require('./first-time/create-vault')
const CreateVaultCompleteScreen = require('./first-time/create-vault-complete')
const RestoreVaultScreen = require('./first-time/restore-vault')
// unlock // unlock
const UnlockScreen = require('./unlock') const UnlockScreen = require('./unlock')
// accounts // accounts
@ -19,7 +17,6 @@ const SendTransactionScreen = require('./send')
const ConfirmTxScreen = require('./conf-tx') const ConfirmTxScreen = require('./conf-tx')
// other views // other views
const ConfigScreen = require('./config') const ConfigScreen = require('./config')
const RevealSeedConfirmation = require('./recover-seed/confirmation')
const InfoScreen = require('./info') const InfoScreen = require('./info')
const LoadingIndicator = require('./components/loading') const LoadingIndicator = require('./components/loading')
const SandwichExpando = require('sandwich-expando') const SandwichExpando = require('sandwich-expando')
@ -402,10 +399,6 @@ App.prototype.renderPrimary = function () {
return h(DisclaimerScreen, {key: 'disclaimerScreen'}) return h(DisclaimerScreen, {key: 'disclaimerScreen'})
} }
if (props.seedWords) {
return h(CreateVaultCompleteScreen, {key: 'createVaultComplete'})
}
// show initialize screen // show initialize screen
if (!props.isInitialized || props.forgottenPassword) { if (!props.isInitialized || props.forgottenPassword) {
// show current view // show current view
@ -414,12 +407,6 @@ App.prototype.renderPrimary = function () {
case 'createVault': case 'createVault':
return h(CreateVaultScreen, {key: 'createVault'}) return h(CreateVaultScreen, {key: 'createVault'})
case 'restoreVault':
return h(RestoreVaultScreen, {key: 'restoreVault'})
case 'createVaultComplete':
return h(CreateVaultCompleteScreen, {key: 'createVaultComplete'})
default: default:
return h(InitializeMenuScreen, {key: 'menuScreenInit'}) return h(InitializeMenuScreen, {key: 'menuScreenInit'})
@ -451,16 +438,15 @@ App.prototype.renderPrimary = function () {
case 'config': case 'config':
return h(ConfigScreen, {key: 'config'}) return h(ConfigScreen, {key: 'config'})
case 'reveal-seed-conf':
return h(RevealSeedConfirmation, {key: 'reveal-seed-conf'})
case 'info': case 'info':
return h(InfoScreen, {key: 'info'}) return h(InfoScreen, {key: 'info'})
case 'createVault': case 'createVault':
return h(CreateVaultScreen, {key: 'createVault'}) return h(CreateVaultScreen, {key: 'createVault'})
case 'buyEth': case 'buyEth':
return h(BuyView, {key: 'buyEthView'}) return h(BuyView, {key: 'buyEthView'})
case 'qr': case 'qr':
return h('div', { return h('div', {
style: { style: {

View File

@ -77,22 +77,6 @@ ConfigScreen.prototype.render = function () {
currentConversionInformation(metamaskState, state), currentConversionInformation(metamaskState, state),
h('hr.horizontal-line'), h('hr.horizontal-line'),
h('div', {
style: {
marginTop: '20px',
},
}, [
h('button', {
style: {
alignSelf: 'center',
},
onClick (event) {
event.preventDefault()
state.dispatch(actions.revealSeedConfirmation())
},
}, 'Reveal Seed Words'),
]),
]), ]),
]), ]),
]) ])

View File

@ -63,33 +63,15 @@ InitializeMenuScreen.prototype.renderMenu = function () {
h('.flex-row.flex-center.flex-grow', [ h('.flex-row.flex-center.flex-grow', [
h('hr'), h('hr'),
h('div', 'OR'), h('div', 'Advanced (Eventually?)'),
h('hr'), h('hr'),
]), ]),
h('button.primary', {
onClick: this.showRestoreVault.bind(this),
style: {
margin: 12,
},
}, 'Restore Existing Vault'),
]) ])
) )
} }
// InitializeMenuScreen.prototype.splitWor = function() {
// this.props.dispatch(actions.showInitializeMenu())
// }
InitializeMenuScreen.prototype.showInitializeMenu = function () {
this.props.dispatch(actions.showInitializeMenu())
}
InitializeMenuScreen.prototype.showCreateVault = function () { InitializeMenuScreen.prototype.showCreateVault = function () {
this.props.dispatch(actions.showCreateVault()) this.props.dispatch(actions.showCreateVault())
} }
InitializeMenuScreen.prototype.showRestoreVault = function () {
this.props.dispatch(actions.showRestoreVault())
}